/* ASHCOMBE: the look of the paper around the picture.
 * Ink, parchment, oxblood and old gold; Cormorant for reading, IM Fell for
 * anything that ought to look carved. */

:root {
  --ink: #0e0b09;
  --ink-2: #16110d;
  --ink-3: #221a13;
  --paper: #e9dcc0;
  --paper-2: #d7c6a2;
  --paper-dim: rgba(233, 220, 192, 0.62);
  --paper-faint: rgba(233, 220, 192, 0.28);
  --oxblood: #7a1a1e;
  --oxblood-2: #a4262c;
  --gold: #c9a24a;
  --gold-2: #e6c678;
  --forest: #2c4a33;
  --vigour: #a62a2a;
  --inkbar: #4a5ec8;
  --resolve: #b8923c;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --fell: 'IM Fell English SC', 'Cormorant Garamond', Georgia, serif;
  --fell-i: 'IM Fell English', 'Cormorant Garamond', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--ink); color: var(--paper); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
body { user-select: none; -webkit-user-select: none; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; }
button { font-family: inherit; cursor: pointer; }
kbd { font-family: var(--serif); font-size: 0.78em; border: 1px solid var(--paper-faint); border-bottom-width: 2px; border-radius: 3px; padding: 0 0.35em; margin: 0 0.15em; color: var(--paper-dim); }
[hidden] { display: none !important; }
.muted { color: var(--paper-dim); font-style: italic; }
.eyebrow { font-family: var(--fell); letter-spacing: 0.3em; font-size: 0.82rem; color: var(--gold); text-transform: uppercase; }

/* ── full-screen layers ───────────────────────────────────────────────── */
.screen { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.screen.modal { background: rgba(8, 6, 4, 0.72); backdrop-filter: blur(3px); z-index: 70; }

.title-word { font-family: var(--fell); font-weight: 400; letter-spacing: 0.22em; text-transform: uppercase; color: var(--paper); text-shadow: 0 2px 30px rgba(201, 162, 74, 0.25); }
.title-word.big { font-size: clamp(3rem, 9vw, 7.2rem); line-height: 1; margin: 0.35em 0 0.2em; }

.loading { background: radial-gradient(ellipse at 50% 40%, #1d150e 0%, #0b0806 70%); flex-direction: column; }
.loading { transition: opacity 0.9s ease; }
.loading.gone { opacity: 0; pointer-events: none; }
.load-inner { text-align: center; width: min(560px, 86vw); }
.crest { width: 64px; margin: 0 auto 1rem; color: var(--gold); opacity: 0.8; animation: breathe 3.5s ease-in-out infinite; }
.loading .title-word { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.load-bar { height: 2px; background: rgba(233, 220, 192, 0.12); margin: 2rem auto 0.8rem; width: 72%; overflow: hidden; }
.load-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--oxblood), var(--gold)); transition: width 0.4s ease; }
.load-note { font-style: italic; color: var(--paper-dim); font-size: 1.05rem; }
.load-quote { margin-top: 2.5rem; color: var(--paper-faint); font-size: 1.1rem; font-style: italic; min-height: 3em; line-height: 1.5; }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.04); } }

.title { background: linear-gradient(180deg, rgba(8, 6, 4, 0.2) 0%, rgba(8, 6, 4, 0.1) 40%, rgba(8, 6, 4, 0.85) 100%); z-index: 40; }
.title-inner { text-align: center; margin-top: 8vh; }
.subtitle { font-size: 1.5rem; color: var(--paper-dim); margin-bottom: 2.4rem; }
.title-menu { display: flex; flex-direction: column; gap: 0.4rem; align-items: center; }
.title-menu button, .title-menu .back-link { background: none; border: none; color: var(--paper); font-size: 1.45rem; font-family: var(--serif); padding: 0.3rem 1.4rem; letter-spacing: 0.04em; transition: color 0.2s, letter-spacing 0.3s; text-decoration: none; }
.title-menu button:hover, .title-menu button:focus-visible { color: var(--gold-2); letter-spacing: 0.1em; outline: none; }
.title-menu .back-link { font-size: 1rem; color: var(--paper-faint); margin-top: 1rem; font-style: italic; }
.title-menu .back-link:hover { color: var(--paper-dim); }
.title-foot { margin-top: 3rem; color: var(--paper-faint); font-style: italic; }

.boot-fail { background: var(--ink); flex-direction: column; text-align: center; padding: 2rem; gap: 1rem; }
.boot-fail h1 { font-family: var(--fell); letter-spacing: 0.2em; }
.boot-fail p { max-width: 520px; color: var(--paper-dim); font-size: 1.15rem; }
.boot-fail a { color: var(--gold); }

/* ── panels ───────────────────────────────────────────────────────────── */
.panel, .page {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 244, 214, 0.06), transparent 60%),
    linear-gradient(180deg, #1b140e, #120d09);
  border: 1px solid rgba(201, 162, 74, 0.35);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(0, 0, 0, 0.4);
  padding: 2rem 2.2rem;
  max-height: 88vh; overflow: auto;
}
.panel.narrow { width: min(460px, 92vw); }
.screen.create { z-index: 70; justify-content: flex-start; align-items: stretch; background: linear-gradient(90deg, rgba(8, 6, 4, 0.9) 0, rgba(8, 6, 4, 0.72) 32%, transparent 55%); }
.create-panel { width: min(430px, 92vw); margin: 0 0 0 4vw; align-self: center; max-height: 94vh; overflow-y: auto; padding: 1.4rem 1.8rem; }
.create-panel .field { margin: 0.55rem 0; }
.ng-h { font-family: var(--fell); letter-spacing: 0.25em; font-size: 0.8rem; text-transform: uppercase; color: var(--gold); margin: 1.1rem 0 0.2rem; border-bottom: 1px solid rgba(201, 162, 74, 0.25); padding-bottom: 0.2rem; }
.create-view { flex: 1; cursor: grab; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3vh; user-select: none; }
.create-view:active { cursor: grabbing; }
@media (max-width: 760px) { .screen.create { background: rgba(8, 6, 4, 0.55); } .create-view { display: none; } .create-panel { margin: 0 auto; } }
.panel h2, .page h2 { font-family: var(--fell); font-weight: 400; letter-spacing: 0.12em; font-size: 1.8rem; margin-bottom: 0.6rem; color: var(--paper); }
.field { display: grid; grid-template-columns: 7.5rem 1fr; align-items: center; gap: 0.8rem; margin: 0.9rem 0; font-size: 1.1rem; }
.field span { color: var(--paper-dim); }
.field.check { grid-template-columns: auto 1fr; }
.field input, .field select { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--paper-faint); color: var(--paper); font-family: var(--serif); font-size: 1.1rem; padding: 0.35rem 0.6rem; }
.field input[type=range] { accent-color: var(--gold); padding: 0; }
.field input[type=checkbox] { accent-color: var(--gold); width: 1.1rem; height: 1.1rem; }
.row { display: flex; gap: 0.8rem; margin-top: 1.4rem; }
.row.end { justify-content: flex-end; }
button.primary, button.ghost, .btn { font-family: var(--serif); font-size: 1.1rem; padding: 0.45rem 1.3rem; border: 1px solid var(--gold); background: linear-gradient(180deg, #3a1a14, #26100c); color: var(--paper); letter-spacing: 0.05em; transition: background 0.2s, border-color 0.2s; }
button.primary:hover, .btn:hover { background: linear-gradient(180deg, #5a2218, #3a140e); border-color: var(--gold-2); }
button.ghost { background: transparent; border-color: var(--paper-faint); color: var(--paper-dim); }
button.ghost:hover { border-color: var(--paper-dim); color: var(--paper); }
button:disabled { opacity: 0.4; cursor: default; }

/* the reader: pages of parchment */
.page {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.35), transparent 70%),
    radial-gradient(ellipse at 0% 100%, rgba(120, 80, 30, 0.35), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 80, 30, 0.35), transparent 50%),
    linear-gradient(180deg, #eadcbc, #d9c49a);
  color: #2a1c12; border: none; width: min(620px, 92vw); position: relative;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}
.page.wide { width: min(760px, 94vw); }
.page h2 { color: #2a1c12; }
.page .eyebrow { color: var(--oxblood); }
.reader-text { font-family: var(--fell-i); font-size: 1.22rem; line-height: 1.65; white-space: pre-wrap; margin: 1rem 0 1.5rem; }
.page .close { color: #5a4230; border-color: rgba(60, 40, 20, 0.4); }
.page button.primary { color: var(--paper); }

/* ── HUD ─────────────────────────────────────────────────────────────── */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 20; font-family: var(--serif); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.hud.photo > *:not(.floaters) { opacity: 0; }

.compass { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: min(560px, 70vw); height: 30px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  border-bottom: 1px solid rgba(233, 220, 192, 0.18); }
.compass-strip { position: absolute; top: 0; left: 0; height: 100%; width: 100%; }
.compass-strip .mk { position: absolute; top: 3px; transform: translateX(-50%); font-size: 0.95rem; color: var(--paper-dim); white-space: nowrap; }
.compass-strip .mk.card { font-family: var(--fell); color: var(--paper); font-size: 1.05rem; }
.compass-strip .mk.tick { top: 20px; width: 1px; height: 6px; background: var(--paper-faint); }
.compass-strip .mk.quest { color: var(--gold-2); font-size: 1.1rem; }
.compass-strip .mk.place { font-size: 0.75rem; color: var(--paper-faint); top: 16px; font-style: italic; }
.compass-strip .mk.foe { color: #d04a3a; font-size: 0.8rem; top: 2px; }
.compass-strip .mk.place.unknown { font-style: normal; font-size: 0.9rem; opacity: 0.55; top: 12px; }
.compass-strip .mk.pin { color: #c84a3a; font-size: 0.95rem; top: 4px; }
.compass-needle { position: absolute; left: 50%; bottom: -1px; width: 7px; height: 7px; border-left: 1px solid var(--gold); border-top: 1px solid var(--gold); transform: translateX(-50%) rotate(45deg); background: var(--ink); }

.boss { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); width: min(620px, 74vw); text-align: center; }
.boss-name { font-family: var(--fell); letter-spacing: 0.25em; font-size: 1.05rem; color: var(--paper); margin-bottom: 4px; }
.boss-bar { height: 6px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(201, 162, 74, 0.45); }
.boss-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #5a0e10, #b0302a); transition: width 0.25s; }

.where { position: absolute; top: 18px; left: 22px; font-size: 0.95rem; color: var(--paper-dim); font-style: italic; }
.place-title { position: absolute; top: 22vh; left: 0; right: 0; text-align: center; font-family: var(--fell); font-size: clamp(1.6rem, 3.4vw, 2.6rem); letter-spacing: 0.2em; color: var(--paper); opacity: 0; transition: opacity 1.4s; }
.place-title.show { opacity: 1; }
.place-title small { display: block; font-family: var(--serif); font-style: italic; font-size: 0.45em; letter-spacing: 0.1em; color: var(--paper-dim); margin-top: 0.3em; }

.tracker { position: absolute; top: 64px; right: 24px; width: min(340px, 34vw); text-align: right; }
.tracker .tq { font-family: var(--fell); letter-spacing: 0.1em; font-size: 1.02rem; color: var(--gold-2); }
.tracker .to { font-size: 1.02rem; color: var(--paper); margin-top: 2px; }
.tracker .to.done { color: var(--paper-faint); text-decoration: line-through; }
.tracker .to .pg { color: var(--paper-dim); font-size: 0.9em; margin-left: 0.3em; }

.vitals { position: absolute; left: 22px; bottom: 22px; display: flex; align-items: flex-end; gap: 12px; padding: 10px 14px 10px 10px; background: linear-gradient(90deg, rgba(8, 6, 4, 0.72), rgba(8, 6, 4, 0.35) 80%, transparent); border-left: 2px solid rgba(201, 162, 74, 0.45); }
.seal { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; font-family: var(--fell); font-size: 1.3rem; color: var(--paper);
  background: radial-gradient(circle at 35% 30%, #a02a2a, #5a0e10 70%); border: 2px solid rgba(201, 162, 74, 0.65); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.5); }
.seal.ready { animation: sealPulse 1.6s ease-in-out infinite; }
@keyframes sealPulse { 50% { box-shadow: 0 0 22px rgba(230, 198, 120, 0.8), inset 0 0 10px rgba(0, 0, 0, 0.5); } }
.bars { display: flex; flex-direction: column; gap: 4px; width: min(300px, 32vw); }
.who { display: flex; align-items: baseline; gap: 8px; font-size: 0.92rem; color: var(--paper-dim); margin-bottom: 1px; white-space: nowrap; }
.who b { font-family: var(--fell); font-weight: 400; letter-spacing: 0.08em; color: var(--paper); font-size: 1.05rem; }
.who span { font-style: italic; overflow: hidden; text-overflow: ellipsis; }
.who .purse { margin-left: auto; font-style: normal; color: var(--gold-2); }
.who .purse i { font-style: normal; }
.bar { position: relative; height: 14px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(233, 220, 192, 0.22); }
.bar .fill, .bar .ghost-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.bar .ghost-fill { background: rgba(233, 220, 192, 0.35); z-index: 0; transition: width 0.9s ease 0.35s; }
.bar .fill { z-index: 1; transition: width 0.12s; }
.bar.hp .fill { background: linear-gradient(90deg, #5a1010, var(--vigour)); }
.bar.ink .fill { background: linear-gradient(90deg, #1e2466, var(--inkbar)); }
.bar.st { height: 6px; }
.bar.st .fill { background: linear-gradient(90deg, #6a4e1a, var(--resolve)); }
.bar label, .bar em { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); font-size: 0.72rem; line-height: 1; letter-spacing: 0.08em; text-shadow: 0 1px 2px #000, 0 0 4px #000; pointer-events: none; }
.bar label { left: 6px; font-family: var(--fell); color: rgba(233, 220, 192, 0.85); text-transform: uppercase; }
.bar em { right: 6px; font-style: normal; color: var(--paper); }
.bar.st label { display: none; }
.xp { position: relative; height: 3px; background: rgba(233, 220, 192, 0.12); margin: 3px 0 14px; }
.xp span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.6s; }
.xp em { position: absolute; right: 0; top: 5px; font-size: 0.7rem; font-style: italic; color: var(--paper-faint); white-space: nowrap; }

.actionbar { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 18px; padding: 26px 46px 16px; background: radial-gradient(ellipse 60% 100% at 50% 100%, rgba(8, 6, 4, 0.78), rgba(8, 6, 4, 0.4) 60%, transparent 100%); }
.weapon { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; }
.weapon .ic, .belt .ic { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid rgba(201, 162, 74, 0.45); background: radial-gradient(circle at 50% 35%, rgba(60, 40, 25, 0.92), rgba(12, 9, 6, 0.94)); position: relative; }
.weapon .ic svg, .belt .ic svg { width: 36px; height: 36px; }
.weapon .nm, .belt .nm, .slot-nm { font-size: 0.7rem; color: var(--paper-dim); max-width: 78px; text-align: center; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; }
.weapon kbd, .belt kbd { position: absolute; left: -7px; top: -7px; background: rgba(8, 6, 4, 0.9); color: var(--gold-2); border-color: rgba(201, 162, 74, 0.6); font-size: 0.7rem; margin: 0; }
.belt { display: flex; gap: 10px; }
.belt .fl { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 70px; }
.belt .n { position: absolute; right: -6px; bottom: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: #2a1a10; border: 1px solid rgba(201, 162, 74, 0.6); color: var(--paper); font-size: 0.8rem; display: grid; place-items: center; }
.belt .fl.none .ic { opacity: 0.4; }
.belt .fl.none .n { background: #3a1010; color: #e0a090; }

.hotbar { display: flex; gap: 6px; }
.hotcell { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; }
.slot { width: 58px; height: 58px; position: relative; border: 1px solid rgba(201, 162, 74, 0.4); background: radial-gradient(circle at 50% 35%, rgba(60, 40, 25, 0.9), rgba(12, 9, 6, 0.92)); display: grid; place-items: center; transform: rotate(45deg) scale(0.78); }
.slot > * { transform: rotate(-45deg); }
.slot .g { font-size: 1.55rem; line-height: 1; }
.slot .k { position: absolute; bottom: -2px; right: 6px; font-size: 0.75rem; color: var(--paper-faint); }
.slot .cd { position: absolute; inset: 0; transform: none; background: conic-gradient(rgba(0, 0, 0, 0.72) var(--p, 0%), transparent 0); }
.slot.sel { border-color: var(--gold-2); box-shadow: 0 0 16px rgba(230, 198, 120, 0.45); }
.slot.poor .g { opacity: 0.35; }
.slot.empty { opacity: 0.35; }
.hotcell.empty .slot-nm { color: var(--paper-faint); font-style: italic; }
@media (max-width: 760px) { .weapon, .slot-nm, .belt .nm, .who span { display: none; } .actionbar { gap: 8px; } }

.crosshair { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2px 0 0 -2px; border-radius: 50%; background: rgba(233, 220, 192, 0.65); box-shadow: 0 0 3px #000; transition: transform 0.15s, background 0.15s; }
.crosshair.foe { background: #e0503a; transform: scale(1.5); }
.crosshair.lock { width: 22px; height: 22px; margin: -11px 0 0 -11px; background: none; border: 1px solid #e0503a; transform: rotate(45deg); }
.prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); font-size: 1.15rem; color: var(--paper); padding: 0.3rem 0.9rem; background: linear-gradient(90deg, transparent, rgba(8, 6, 4, 0.7), transparent); white-space: nowrap; }
.prompt kbd { color: var(--gold-2); border-color: rgba(201, 162, 74, 0.6); }

.toasts { position: absolute; right: 26px; bottom: 150px; display: flex; flex-direction: column-reverse; gap: 4px; align-items: flex-end; }
.toast { font-size: 1.05rem; color: var(--paper); padding: 0.2rem 0.8rem; background: linear-gradient(90deg, transparent, rgba(8, 6, 4, 0.75)); animation: toastIn 0.3s ease, toastOut 0.6s ease 3.4s forwards; }
.toast.coin { color: var(--gold-2); }
.toast.accent { color: var(--gold-2); font-style: italic; }
.toast.warn { color: #e07060; }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

.banner { position: absolute; top: 15vh; left: 0; right: 0; text-align: center; animation: bannerIn 0.8s ease, bannerOut 1s ease 3.6s forwards; }
.banner-kicker { font-family: var(--fell); letter-spacing: 0.35em; font-size: 0.95rem; color: var(--gold); text-transform: uppercase; }
.banner-title { font-family: var(--fell); font-size: clamp(2rem, 4vw, 3rem); letter-spacing: 0.12em; color: var(--paper); margin-top: 0.2em; }
.banner::after { content: ''; display: block; width: 180px; height: 1px; margin: 0.8rem auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
@keyframes bannerIn { from { opacity: 0; letter-spacing: 0.4em; } }
@keyframes bannerOut { to { opacity: 0; } }

.hint { position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); max-width: min(620px, 80vw); text-align: center; font-size: 1.12rem; color: var(--paper); padding: 0.55rem 1.2rem; background: rgba(8, 6, 4, 0.72); border-top: 1px solid rgba(201, 162, 74, 0.35); border-bottom: 1px solid rgba(201, 162, 74, 0.35); animation: toastIn 0.4s ease; }

.floaters { position: absolute; inset: 0; }
.dmg { position: absolute; font-family: var(--fell); font-size: 1.1rem; color: var(--paper); transform: translate(-50%, -50%); animation: dmgUp 0.9s ease-out forwards; white-space: nowrap; }
.dmg.crit { color: var(--gold-2); font-size: 1.5rem; }
.dmg.fire { color: #ff9a5a; } .dmg.frost { color: #9ad4ff; } .dmg.light { color: #fff0b0; } .dmg.lightning { color: #b8c8ff; } .dmg.shadow { color: #c090ff; } .dmg.ink { color: #9a8aba; }
.dmg.you { color: #e05a4a; }
.dmg.word { font-size: 1.05rem; letter-spacing: 0.08em; font-style: italic; text-shadow: 0 0 6px rgba(0,0,0,0.8), 0 1px 2px #000; animation-duration: 1.1s; }
.dmg.word.parry { color: #ffe6a0; font-size: 1.45rem; text-shadow: 0 0 10px rgba(255,210,120,0.7), 0 1px 2px #000; }
.dmg.word.block { color: #cfc6b4; } .dmg.word.broken { color: #e05a4a; }
@keyframes dmgUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -46px; } }
.ehp { position: absolute; width: 64px; height: 4px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(0, 0, 0, 0.8); transform: translate(-50%, -50%); }
.ehp span { display: block; height: 100%; background: #b0302a; }
.ehp small { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 0.78rem; color: var(--paper-dim); white-space: nowrap; font-style: italic; }
.fps { position: absolute; left: 22px; top: 42px; font-size: 0.8rem; color: var(--paper-faint); font-family: monospace; }

/* ── dialogue ───────────────────────────────────────────────────────────── */
.dialogue { position: fixed; left: 50%; bottom: 5vh; transform: translateX(-50%); width: min(820px, 92vw); z-index: 30; padding: 1.3rem 1.8rem 1.1rem;
  background: linear-gradient(180deg, rgba(14, 10, 7, 0.9), rgba(10, 7, 5, 0.96)); border-top: 1px solid rgba(201, 162, 74, 0.5); border-bottom: 1px solid rgba(201, 162, 74, 0.25);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); animation: toastIn 0.25s ease; }
.dlg-speaker { font-family: var(--fell); letter-spacing: 0.12em; font-size: 1.15rem; color: var(--gold-2); margin-bottom: 0.4rem; }
.dlg-speaker em { font-family: var(--serif); letter-spacing: 0.02em; font-size: 0.85em; color: var(--paper-faint); margin-left: 0.8rem; }
.dlg-text { font-size: 1.3rem; line-height: 1.5; color: var(--paper); min-height: 2.2em; }
.dlg-options { list-style: none; margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.15rem; }
.dlg-options li { font-size: 1.15rem; color: var(--paper-dim); cursor: pointer; padding: 0.2rem 0.4rem; counter-increment: opt; transition: color 0.15s, background 0.15s; }
.dlg-options li::before { content: counter(opt) '. '; color: var(--gold); }
.dlg-options li:hover, .dlg-options li.sel { color: var(--paper); background: linear-gradient(90deg, rgba(201, 162, 74, 0.12), transparent); }
.dlg-options li.special { color: #c8b8f0; }
.dlg-next { margin-top: 0.8rem; text-align: right; color: var(--paper-faint); font-style: italic; }

/* ── menus ─────────────────────────────────────────────────────────────── */
.menu { background: rgba(6, 4, 3, 0.8); backdrop-filter: blur(5px); z-index: 60; }
.menu-frame { position: relative; width: min(1180px, 96vw); height: min(760px, 92vh); display: flex; flex-direction: column;
  background: linear-gradient(180deg, #19120c, #0f0a07); border: 1px solid rgba(201, 162, 74, 0.35); box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7); }
.menu-tabs { display: flex; gap: 0.2rem; padding: 0.9rem 1.2rem 0; border-bottom: 1px solid rgba(201, 162, 74, 0.2); flex-wrap: wrap; }
.menu-tabs button { background: none; border: none; color: var(--paper-dim); font-family: var(--fell); letter-spacing: 0.12em; font-size: 1.1rem; padding: 0.5rem 1rem 0.7rem; border-bottom: 2px solid transparent; }
.menu-tabs button.on { color: var(--paper); border-bottom-color: var(--gold); }
.menu-tabs button:hover { color: var(--paper); }
.menu-body { flex: 1; overflow: hidden; display: flex; min-height: 0; }
.menu-close { position: absolute; top: 0.6rem; right: 0.9rem; background: none; border: none; color: var(--paper-dim); font-size: 2rem; line-height: 1; }
.menu-close:hover { color: var(--paper); }

.cols { display: flex; flex: 1; min-height: 0; }
.col-list { width: 36%; min-width: 240px; border-right: 1px solid rgba(201, 162, 74, 0.15); overflow: auto; padding: 1rem 0; }
.col-detail { flex: 1; overflow: auto; padding: 1.4rem 2rem; }
.list-h { font-family: var(--fell); letter-spacing: 0.2em; font-size: 0.85rem; color: var(--gold); padding: 0.8rem 1.4rem 0.3rem; text-transform: uppercase; }
.li { padding: 0.45rem 1.4rem; font-size: 1.12rem; color: var(--paper-dim); cursor: pointer; border-left: 2px solid transparent; }
.li:hover { color: var(--paper); background: rgba(201, 162, 74, 0.06); }
.li.on { color: var(--paper); border-left-color: var(--gold); background: rgba(201, 162, 74, 0.09); }
.li.done { color: var(--paper-faint); }
.li small { color: var(--paper-faint); font-style: italic; margin-left: 0.4rem; }
.detail-h { font-family: var(--fell); font-size: 1.7rem; letter-spacing: 0.08em; }
.detail-sub { color: var(--gold); font-style: italic; margin: 0.2rem 0 1rem; }
.detail-p { font-size: 1.18rem; line-height: 1.6; color: var(--paper); margin-bottom: 1rem; }
.obj { font-size: 1.12rem; margin: 0.25rem 0; padding-left: 1.4rem; position: relative; }
.obj::before { content: '\25C7'; position: absolute; left: 0; color: var(--gold); }
.obj.done { color: var(--paper-faint); text-decoration: line-through; }
.obj.done::before { content: '\25C6'; }
.obj.optional { font-style: italic; color: var(--paper-dim); }
.log-e { font-size: 1.05rem; color: var(--paper-dim); margin: 0.5rem 0; line-height: 1.45; }
.log-e b { color: var(--paper-faint); font-weight: 400; font-style: italic; margin-right: 0.5rem; }

/* map */
.map-wrap { flex: 1; position: relative; overflow: hidden; cursor: grab; }
.map-wrap canvas { position: absolute; left: 0; top: 0; }
.map-legend { position: absolute; left: 1rem; bottom: 1rem; font-size: 0.95rem; color: #3a2a1a; background: rgba(233, 220, 192, 0.75); padding: 0.4rem 0.8rem; border: 1px solid rgba(60, 40, 20, 0.3); }
.map-tip { position: absolute; pointer-events: none; font-family: var(--fell); color: #2a1c12; background: rgba(233, 220, 192, 0.92); padding: 0.2rem 0.6rem; border: 1px solid rgba(60, 40, 20, 0.4); font-size: 1rem; }

/* grimoire */
.grim { flex: 1; display: flex; min-height: 0; }
.grim-tree { flex: 1; position: relative; }
.grim-tree svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.grim-side { width: 330px; border-left: 1px solid rgba(201, 162, 74, 0.15); padding: 1.2rem 1.4rem; overflow: auto; }
.grim-points { font-size: 1.15rem; margin-bottom: 1rem; }
.grim-points b { color: var(--gold-2); font-weight: 500; }
.attr { display: flex; align-items: center; justify-content: space-between; font-size: 1.1rem; margin: 0.35rem 0; }
.attr button { width: 1.8rem; height: 1.8rem; border: 1px solid var(--gold); background: none; color: var(--gold-2); font-size: 1.1rem; }
.attr button:disabled { border-color: var(--paper-faint); color: var(--paper-faint); }
.stat-line { display: flex; justify-content: space-between; color: var(--paper-dim); font-size: 1rem; margin: 0.15rem 0; }
.stat-line b { color: var(--paper); font-weight: 400; }
.node-info h3 { font-family: var(--fell); font-weight: 400; font-size: 1.4rem; letter-spacing: 0.06em; }
.node-info p { font-size: 1.08rem; line-height: 1.5; margin: 0.5rem 0; }
.hotbar-edit { display: flex; gap: 0.5rem; margin: 0.6rem 0 1rem; }
.hotbar-edit button { width: 3rem; height: 3rem; border: 1px solid rgba(201, 162, 74, 0.4); background: rgba(0, 0, 0, 0.3); color: var(--paper); font-size: 1.3rem; }
.hotbar-edit button.on { border-color: var(--gold-2); box-shadow: 0 0 10px rgba(230, 198, 120, 0.4); }
svg .node { cursor: pointer; }
svg .node text { font-family: var(--serif); fill: var(--paper-dim); font-size: 13px; pointer-events: none; }
svg .node.have text { fill: var(--paper); }
svg .school-label { font-family: var(--fell); letter-spacing: 3px; font-size: 15px; }

/* satchel */
.sat { flex: 1; display: flex; min-height: 0; }
.equip { width: 290px; padding: 1.2rem 1.4rem; border-right: 1px solid rgba(201, 162, 74, 0.15); overflow: auto; }
.eq { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border: 1px solid rgba(201, 162, 74, 0.2); margin: 0.4rem 0; cursor: pointer; background: rgba(0, 0, 0, 0.25); }
.eq:hover { border-color: rgba(201, 162, 74, 0.5); }
.eq .g { font-size: 1.4rem; width: 1.6rem; text-align: center; color: var(--gold-2); }
.eq .n { font-size: 1.05rem; }
.eq .s { font-size: 0.85rem; color: var(--paper-faint); font-style: italic; display: block; }
.items { flex: 1; overflow: auto; padding: 1rem 1.2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.5rem; }
.it { display: flex; gap: 0.6rem; align-items: center; padding: 0.45rem 0.6rem; border: 1px solid rgba(233, 220, 192, 0.12); cursor: pointer; background: rgba(0, 0, 0, 0.25); font-size: 1.02rem; }
.it:hover, .it.on { border-color: rgba(201, 162, 74, 0.55); }
.it .g { font-size: 1.3rem; color: var(--gold-2); width: 1.5rem; text-align: center; }
.it .c { margin-left: auto; color: var(--paper-faint); }
.item-detail { width: 300px; padding: 1.2rem 1.4rem; border-left: 1px solid rgba(201, 162, 74, 0.15); overflow: auto; }
.item-detail h3 { font-family: var(--fell); font-weight: 400; font-size: 1.35rem; }
.item-detail p { font-size: 1.05rem; line-height: 1.5; margin: 0.6rem 0; color: var(--paper-dim); font-style: italic; }
.item-detail .st { font-size: 1rem; color: var(--paper); }
.item-detail .btns { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.8rem; }
.chips button { background: none; border: 1px solid rgba(233, 220, 192, 0.2); color: var(--paper-dim); padding: 0.2rem 0.7rem; font-size: 0.95rem; }
.chips button.on { border-color: var(--gold); color: var(--paper); }
.money { font-size: 1.1rem; color: var(--gold-2); margin-bottom: 0.6rem; }

/* settings */
.settings { padding: 1.4rem 2.4rem; overflow: auto; flex: 1; }
.settings .field { grid-template-columns: 14rem 1fr 4rem; max-width: 720px; }
.settings .field output { color: var(--paper-dim); }
.settings h3 { font-family: var(--fell); font-weight: 400; letter-spacing: 0.15em; color: var(--gold); margin: 1.4rem 0 0.2rem; font-size: 1.1rem; }
.sys { padding: 2rem 2.4rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; }
.controls-table { font-size: 1.08rem; border-collapse: collapse; }
.controls-table td { padding: 0.25rem 1.4rem 0.25rem 0; color: var(--paper-dim); }
.controls-table td:first-child { color: var(--paper); white-space: nowrap; }

.death { background: radial-gradient(ellipse at center, rgba(20, 0, 0, 0.55), rgba(0, 0, 0, 0.92)); z-index: 65; }
.death-inner { text-align: center; }
.death h1 { font-family: var(--fell); font-weight: 400; font-size: clamp(2rem, 5vw, 3.6rem); letter-spacing: 0.08em; color: #d8c8b0; margin-bottom: 0.8rem; }
.death p { margin-bottom: 2rem; font-size: 1.2rem; }

.rotate { background: var(--ink); z-index: 90; padding: 2rem; text-align: center; font-size: 1.3rem; color: var(--paper-dim); }

@media (max-width: 820px) {
  .tracker { display: none; }
  .bars { width: 42vw; }
  .bar label { display: none; }
  .slot { width: 46px; height: 46px; }
  .col-list { width: 42%; min-width: 0; }
  .grim-side, .item-detail, .equip { width: 240px; }
}

/* ── picking a lock ─────────────────────────────────────────────────────── */
#lockpick { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(14, 11, 9, 0.72), rgba(14, 11, 9, 0.94)); }
#lockpick[hidden] { display: none; }
.lp-card { text-align: center; max-width: 92vw; }
.lp-card canvas { width: min(420px, 80vw, 60vh); height: auto; aspect-ratio: 1; display: block; margin: 0.6rem auto; cursor: ew-resize; }
.lp-h { font-family: var(--fell); color: var(--gold-2); font-size: 1.5rem; letter-spacing: 0.06em; }
.lp-s { color: var(--paper); font-size: 1.1rem; }
.lp-hint { color: var(--paper-dim); font-style: italic; margin-top: 0.4rem; max-width: 34rem; margin-inline: auto; }
.warn-t { color: var(--oxblood-2); font-family: var(--serif); font-size: 0.8em; }

/* the sneaking eye */
#sneak-eye { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); width: 44px; height: 26px; opacity: 0.85; pointer-events: none; transition: opacity 0.3s; }
#sneak-eye svg { width: 100%; height: 100%; overflow: visible; }
#sneak-eye .lid { fill: rgba(20, 16, 12, 0.6); stroke: var(--paper-faint, #cbbd9c); stroke-width: 2.2; transform-origin: 20px 12px; transform: scaleY(calc(0.3 + var(--open, 0) * 0.7)); transition: transform 0.2s; }
#sneak-eye .pupil { fill: var(--paper-faint, #cbbd9c); opacity: calc(0.25 + var(--open, 0) * 0.75); }
#sneak-eye.noticed .lid { stroke: #d8b050; }
#sneak-eye.noticed .pupil { fill: #d8b050; }
#sneak-eye.seen .lid { stroke: #d04a3a; }
#sneak-eye.seen .pupil { fill: #d04a3a; }

/* ── cutscenes ──────────────────────────────────────────────────────────── */
.letterbox { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.letterbox span { position: absolute; left: 0; right: 0; height: 11vh; background: #050403; transition: transform 1.1s cubic-bezier(.6,0,.2,1); }
.letterbox span:first-child { top: 0; transform: translateY(-100%); }
.letterbox span:last-child { bottom: 0; transform: translateY(100%); }
.letterbox.on span { transform: none; }
.caption { position: fixed; left: 50%; bottom: 3.2vh; transform: translateX(-50%); z-index: 31; margin: 0;
  font-family: 'IM Fell English', 'Cormorant Garamond', serif; font-style: italic; font-size: clamp(15px, 2.1vh, 24px);
  color: #e9dcc0; letter-spacing: 0.02em; text-align: center; max-width: min(80vw, 900px);
  opacity: 0; transition: opacity 0.9s ease; text-shadow: 0 1px 3px #000; pointer-events: none; }
.caption.on { opacity: 1; }
.skip-hint { position: fixed; right: 2.2vw; bottom: 3.6vh; z-index: 31; margin: 0; font-family: 'Cormorant Garamond', serif;
  font-size: 14px; color: #a89a80; opacity: 0.75; pointer-events: none; }

/* games in the college */
.minigame { z-index: 80; }
.mg-panel { width: min(640px, 94vw); }
.mg-body { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; margin: 0.8rem 0; }
.mg-msg { min-height: 2.6em; text-align: center; color: var(--paper); font-style: italic; }
.chess { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: min(420px, 84vw); aspect-ratio: 1; border: 3px solid #3a2a1a; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6); }
.chess .sq { display: grid; place-items: center; background: #e8d8b4; font-size: clamp(1.4rem, 5vw, 2.4rem); cursor: pointer; user-select: none; line-height: 1; }
.chess .sq.dk { background: #8a6a44; }
.chess .sq.wp { color: #fffaf0; text-shadow: 0 0 2px #000, 0 1px 2px #000; }
.chess .sq.bp { color: #120c08; }
.chess .sq.pk { box-shadow: inset 0 0 0 3px var(--gold-2); }
.chess .sq.tg::after { content: ''; width: 26%; height: 26%; border-radius: 50%; background: rgba(40, 90, 40, 0.55); position: absolute; }
.chess .sq { position: relative; }
#mg-morris { width: min(400px, 84vw); background: #d8c49a; border: 3px solid #3a2a1a; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6); }
#mg-morris .lines line { stroke: #3a2a1a; stroke-width: 0.06; }
#mg-morris .pt { fill: #3a2a1a; cursor: pointer; }
#mg-morris .pt.w { fill: #f4ecd8; stroke: #3a2a1a; stroke-width: 0.05; }
#mg-morris .pt.b { fill: #1a120c; stroke: #c9a24a; stroke-width: 0.04; }
#mg-morris .pt.sel { stroke: #c93a2a; stroke-width: 0.1; }
.piano { display: flex; gap: 3px; }
.piano .pk { width: 3.2rem; height: 9rem; background: linear-gradient(180deg, #fffaf0, #e6dcc8); border: 1px solid #3a2a1a; border-radius: 0 0 5px 5px; color: #3a2a1a; font-family: var(--fell); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 0.5rem; cursor: pointer; }
.piano .pk:active { background: #d8ccb4; }
.mg-notes { font-family: var(--fell); letter-spacing: 0.3em; color: var(--gold-2); min-height: 1.4em; }

.perk-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.perk-list li { padding: 0.25rem 0 0.25rem 1.1rem; position: relative; color: var(--paper); }
.perk-list li::before { content: '◆'; position: absolute; left: 0; color: var(--gold-2); font-size: 0.7em; top: 0.45rem; }

/* title cards: the name of the thing, large, over the picture */
.titlecard { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; z-index: 32; opacity: 0; transition: opacity 1.4s ease; }
.titlecard.on { opacity: 1; }
.titlecard h1 { margin: 0; font-family: var(--fell); font-weight: 400; font-size: clamp(2.6rem, 9vw, 7.5rem); letter-spacing: 0.32em; color: #efe4c8; text-shadow: 0 0 30px rgba(0,0,0,0.75), 0 2px 3px rgba(0,0,0,0.8); padding-left: 0.32em; }
.titlecard p { margin: 0.6rem 0 0; font-family: var(--fell-i); font-style: italic; font-size: clamp(1rem, 2.2vw, 1.5rem); color: #d9c9a0; letter-spacing: 0.08em; text-shadow: 0 0 14px rgba(0,0,0,0.8); }
.titlecard.small h1 { font-size: clamp(1.8rem, 5vw, 3.8rem); letter-spacing: 0.2em; }
