/* =========================================================================
   THE ROAD FROM THE MARSHES — Victorian theme
   ========================================================================= */

:root {
  --sky1: #141b24;
  --sky2: #2f3c47;
  --glow: #9fb4c0;
  --accent: #d9b56a;
  --fogc: 210, 220, 228;
  --fog-op: .55;

  --parch1: #f3e8cf;
  --parch2: #e4d2ab;
  --ink: #2b1d12;
  --ink-soft: #5a4632;
  --gold: #a8833d;
  --gold-hi: #d9b56a;
  --wax: #7d1f1f;
  --good: #5d7a3a;
  --bad: #8a2f22;

  --serif: "Cormorant Garamond", "Georgia", serif;
  --fell: "IM Fell English", "Cormorant Garamond", Georgia, serif;
  --fellsc: "IM Fell English SC", "IM Fell English", Georgia, serif;
  color-scheme: dark;
}

/* per-scene palettes */
body[data-mood="marshes"] { --sky1:#10161e; --sky2:#33424d; --glow:#a9bcc8; --fogc:205,215,222; --fog-op:.7; }
body[data-mood="forge"]   { --sky1:#1a0b05; --sky2:#5a230d; --glow:#f08a3e; --fogc:120,70,45;  --fog-op:.35; }
body[data-mood="satis"]   { --sky1:#15110a; --sky2:#43361e; --glow:#e2bf73; --fogc:190,170,130; --fog-op:.4; }
body[data-mood="london"]  { --sky1:#0e130f; --sky2:#323c2d; --glow:#d6c98a; --fogc:160,165,130; --fog-op:.55; }
body[data-mood="storm"]   { --sky1:#07090d; --sky2:#1f2733; --glow:#9db0c8; --fogc:120,130,150; --fog-op:.5; }
body[data-mood="thames"]  { --sky1:#050a16; --sky2:#13284a; --glow:#8fb0d9; --fogc:150,170,200; --fog-op:.6; }
body[data-mood="dawn"]    { --sky1:#2a2535; --sky2:#b08a6e; --glow:#ffd9a0; --fogc:255,235,215; --fog-op:.6; }
body[data-mood="ashes"]   { --sky1:#080605; --sky2:#2a1d16; --glow:#b0805a; --fogc:110,95,85;  --fog-op:.45; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  color: #efe4cc;
  background: var(--sky1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- atmosphere */
.sky {
  position: fixed; inset: 0; z-index: -5;
  background:
    radial-gradient(120% 70% at 50% 110%, var(--sky2) 0%, transparent 70%),
    radial-gradient(80% 50% at 50% -10%, rgba(255,255,255,.05), transparent 70%),
    linear-gradient(180deg, var(--sky1), var(--sky1));
  transition: background 1.6s ease;
}
.fog { position: fixed; inset: 0; z-index: -4; pointer-events: none; overflow: hidden; opacity: var(--fog-op); transition: opacity 1.6s; }
.fog-layer {
  position: absolute; left: -50%; width: 200%; height: 60%;
  background:
    radial-gradient(40% 50% at 20% 50%, rgba(var(--fogc), .35), transparent 70%),
    radial-gradient(30% 40% at 55% 60%, rgba(var(--fogc), .28), transparent 70%),
    radial-gradient(35% 45% at 85% 45%, rgba(var(--fogc), .32), transparent 70%);
  filter: blur(18px);
  will-change: transform;
}
.f1 { bottom: -10%; animation: drift 70s linear infinite; }
.f2 { bottom: 15%; opacity: .6; animation: drift 110s linear infinite reverse; }
.f3 { top: -15%; opacity: .35; animation: drift 140s linear infinite; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.embers { position: fixed; inset: 0; z-index: -3; pointer-events: none; opacity: 0; transition: opacity 1.5s; }
body[data-mood="forge"] .embers, body[data-mood="ashes"] .embers { opacity: 1; }
.embers i {
  position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%;
  background: #ffb25a; box-shadow: 0 0 6px 2px rgba(255,140,50,.7);
  animation: rise linear infinite;
}
@keyframes rise {
  0% { transform: translate(0,0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(var(--dx, 30px), -105vh); opacity: 0; }
}
.vignette { position: fixed; inset: 0; z-index: -2; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.65) 100%); }

/* lightning for the storm */
body[data-mood="storm"] .sky { animation: lightning 9s infinite; }
@keyframes lightning { 0%,92%,100% { filter: brightness(1); } 93% { filter: brightness(2.2); } 94% { filter: brightness(1); } 96% { filter: brightness(1.8); } }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: rgba(10,9,8,.78);
  border-bottom: 1px solid rgba(217,181,106,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.brand {
  background: none; border: 0; cursor: pointer; padding: 0;
  font-family: var(--fellsc); font-size: 17px; letter-spacing: .04em; color: var(--gold-hi);
  white-space: nowrap;
}
.meters { display: flex; gap: 14px; margin-left: auto; }
.meter { display: flex; align-items: center; gap: 7px; font-size: 14px; color: #d8ccb2; position: relative; }
.meter .ico { color: var(--gold-hi); font-size: 15px; width: 16px; text-align: center; }
.meter .bar { width: 64px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.meter .bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.meter .val { font-variant-numeric: tabular-nums; min-width: 1.6em; text-align: right; }
.meter .pop {
  position: absolute; right: -4px; top: -14px; font-size: 14px; font-weight: 600;
  animation: pop 1.6s ease forwards; pointer-events: none;
}
.meter .pop.up { color: #b9d98a; } .meter .pop.down { color: #f0907a; }
@keyframes pop { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.tools { display: flex; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.06); border: 1px solid rgba(217,181,106,.35); color: var(--gold-hi); cursor: pointer;
  transition: background .2s, transform .2s;
}
.icon-btn:hover { background: rgba(217,181,106,.18); }
.icon-btn svg { width: 19px; height: 19px; }
#soundBtn .wave { display: none; }
#soundBtn[aria-pressed="true"] .wave { display: inline; }
#soundBtn[aria-pressed="true"] .mute { display: none; }

/* ---------------------------------------------------------------- layout */
main { min-height: 100vh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px 16px 56px; animation: screenIn .9s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.overline { font-family: var(--fellsc); letter-spacing: .14em; font-size: 14px; color: var(--gold-hi); opacity: .85; margin: 0 0 6px; text-transform: lowercase; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 28px; border-radius: 2px; cursor: pointer; text-decoration: none;
  font-family: var(--fellsc); font-size: 18px; letter-spacing: .06em;
  transition: transform .2s, box-shadow .3s, background .3s, color .3s;
}
.btn.primary {
  color: #1d140b; border: 1px solid #f3d995;
  background: linear-gradient(180deg, #f0d48c, #c79a48);
  box-shadow: 0 0 0 3px rgba(217,181,106,.18), 0 8px 30px -6px rgba(240,190,90,.55);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 4px rgba(217,181,106,.28), 0 12px 40px -6px rgba(240,190,90,.75); }
.btn.ghost { color: var(--gold-hi); border: 1px solid rgba(217,181,106,.5); background: rgba(0,0,0,.2); }
.btn.ghost:hover { background: rgba(217,181,106,.12); }
.card .btn.ghost { color: var(--ink); border-color: var(--gold); background: transparent; }
.btn:focus-visible, .opt:focus-visible, .choice:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* ---------------------------------------------------------------- title */
.title-wrap { max-width: 720px; text-align: center; }
.book { font-family: var(--fell); font-style: italic; font-size: 22px; color: #e6d6b4; margin: 0; }
.lantern-hero { width: 110px; margin: 18px auto 6px; }
.lantern-hero svg { width: 100%; overflow: visible; }
.flicker { animation: flicker 3.2s infinite ease-in-out; transform-origin: center; }
.flame { animation: flame 1.4s infinite ease-in-out; transform-origin: 60px 92px; }
@keyframes flicker { 0%,100% { opacity: .85; } 30% { opacity: 1; } 55% { opacity: .7; } 70% { opacity: .95; } }
@keyframes flame { 0%,100% { transform: scale(1,1); } 40% { transform: scale(.92,1.06); } 70% { transform: scale(1.05,.95); } }
h1 {
  font-family: var(--fell); font-weight: 400; margin: 0;
  font-size: clamp(46px, 10vw, 88px); line-height: .95; letter-spacing: .01em;
  color: #f6e7c4; text-shadow: 0 0 30px rgba(240,190,90,.35), 0 2px 0 rgba(0,0,0,.5);
}
h1 span { font-style: italic; font-size: .5em; color: var(--gold-hi); vertical-align: middle; }
.lede { font-size: 20px; max-width: 580px; margin: 22px auto 28px; color: #e2d6bd; }
.title-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 40px auto 26px; text-align: left; }
.how > div { display: flex; gap: 12px; align-items: flex-start; padding-top: 14px; border-top: 1px solid rgba(217,181,106,.3); }
.how-n { font-family: var(--fell); font-size: 24px; color: var(--gold-hi); line-height: 1; min-width: 26px; }
.how p { margin: 0; font-size: 16px; color: #d8ccb2; line-height: 1.45; }
.how b { color: #f3e3bf; font-weight: 600; }
.small-link { color: var(--gold-hi); font-size: 16px; text-decoration: none; border-bottom: 1px solid rgba(217,181,106,.4); }
.small-link:hover { border-color: var(--gold-hi); }

/* ---------------------------------------------------------------- map */
.map-wrap { width: 100%; max-width: 1000px; text-align: center; }
.map-title { font-family: var(--fell); font-weight: 400; font-size: clamp(36px, 7vw, 58px); margin: 0; color: #f6e7c4; text-shadow: 0 0 24px rgba(240,190,90,.3); }
.map-teaser { font-style: italic; font-size: 20px; color: #ddd0b5; margin: 4px 0 8px; }
.map-svg { margin: 6px auto 22px; }
.map-svg svg { width: 100%; height: auto; display: block; overflow: visible; }
.map-svg .road-bg { fill: none; stroke: rgba(217,181,106,.28); stroke-width: 3; stroke-dasharray: 2 10; stroke-linecap: round; }
.map-svg .road-done { fill: none; stroke: var(--gold-hi); stroke-width: 3.5; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(240,190,90,.6)); }
.map-svg .road-done.draw { animation: drawRoad 1.8s ease forwards; }
@keyframes drawRoad { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
.map-svg .lamp-glow { opacity: 0; }
.map-svg .lamp.done .lamp-glow { opacity: .35; }
.map-svg .lamp.current .lamp-glow { opacity: 1; animation: flicker 2.6s infinite; }
.map-svg .lamp-body { fill: #1c140c; stroke: #6d5a3c; stroke-width: 2; }
.map-svg .lamp.done .lamp-body, .map-svg .lamp.current .lamp-body { stroke: var(--gold-hi); }
.map-svg .lamp-flame { fill: #3a3128; }
.map-svg .lamp.done .lamp-flame { fill: #c99a4a; }
.map-svg .lamp.current .lamp-flame { fill: #ffd27a; }
.map-svg .lamp-label { font-family: var(--fellsc); font-size: 19px; fill: #8f8270; letter-spacing: .04em; }
.map-svg .lamp.done .lamp-label { fill: #cdbb95; }
.map-svg .lamp.current .lamp-label { fill: #fff1cc; }
.map-svg .lamp-num { font-family: var(--fell); font-size: 14px; fill: #8f8270; }
.map-svg .lamp.current .lamp-num, .map-svg .lamp.done .lamp-num { fill: var(--gold-hi); }
.map-svg .walker { fill: #fff4d6; filter: drop-shadow(0 0 6px #ffd27a); }

/* ---------------------------------------------------------------- parchment card */
.card {
  position: relative; width: 100%; max-width: 760px;
  padding: 44px 56px 46px;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(60% 40% at 0% 100%, rgba(120,80,30,.18), transparent 70%),
    radial-gradient(60% 40% at 100% 100%, rgba(120,80,30,.16), transparent 70%),
    linear-gradient(180deg, var(--parch1), var(--parch2));
  border-radius: 3px;
  box-shadow:
    0 0 0 1px rgba(80,55,25,.4),
    0 0 0 7px rgba(243,232,207,.06),
    0 30px 80px -20px rgba(0,0,0,.85),
    0 0 120px -30px var(--glow);
  transition: box-shadow 1.5s;
}
.card::before { /* paper grain */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35; mix-blend-mode: multiply; border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .32 0 0 0 0 .18 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.card-edge { position: absolute; inset: 12px; border: 1px solid rgba(140,105,55,.45); pointer-events: none; }
.card-edge::before, .card-edge::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid rgba(140,105,55,.55); transform: rotate(45deg); }
.card-edge::before { top: -8px; left: calc(50% - 7px); background: #f5ebd3; }
.card-edge::after { bottom: -8px; left: calc(50% - 7px); background: #e5d3ad; }
.card > *:not(.card-edge) { position: relative; }

.card-head { text-align: center; }
.station-tag { font-family: var(--fellsc); font-size: 15px; letter-spacing: .16em; color: var(--gold); margin: 0 0 4px; text-align: center; }
.card h2 { font-family: var(--fell); font-weight: 400; font-size: clamp(30px, 5vw, 42px); line-height: 1.1; margin: 0; text-align: center; color: #2a1a0e; }
.rule { display: flex; align-items: center; gap: 12px; margin: 14px auto 22px; max-width: 280px; color: var(--gold); }
.rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.rule i { font-style: normal; font-size: 18px; }

.phase { animation: phaseIn .7s ease both; }
@keyframes phaseIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* quiz */
.quiz-label { display: flex; align-items: center; gap: 10px; justify-content: center; font-style: italic; color: var(--ink-soft); font-size: 17px; margin: 0 0 8px; }
.seal {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: radial-gradient(circle at 35% 35%, #a83a32, var(--wax) 60%, #4d1010);
  color: #f6d9c8; font-family: var(--fell); font-style: normal; font-size: 17px;
  box-shadow: 0 2px 4px rgba(0,0,0,.35), inset 0 0 0 2px rgba(0,0,0,.15);
}
.quiz-q { font-family: var(--fell); font-size: 25px; text-align: center; margin: 6px 0 22px; line-height: 1.3; }
.options { display: grid; gap: 10px; }
.opt {
  text-align: left; cursor: pointer; padding: 13px 18px 13px 50px; position: relative;
  background: rgba(255,250,235,.5); border: 1px solid rgba(140,105,55,.45); border-radius: 2px;
  font-size: 19px; color: var(--ink); transition: background .2s, border-color .2s, transform .2s;
}
.opt::before {
  content: attr(data-letter); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center;
  font-family: var(--fell); font-size: 14px; color: var(--gold);
}
.opt:hover:not(:disabled) { background: rgba(255,250,235,.85); border-color: var(--gold); transform: translateX(3px); }
.opt.right { background: rgba(110,140,70,.22); border-color: var(--good); }
.opt.right::before { content: "✓"; background: var(--good); color: #fff; border-color: var(--good); }
.opt.wrong { background: rgba(140,50,35,.12); border-color: var(--bad); opacity: .7; animation: shake .4s; }
.opt.wrong::before { content: "✕"; color: var(--bad); border-color: var(--bad); }
.opt:disabled { cursor: default; }
@keyframes shake { 20%,60% { transform: translateX(-5px); } 40%,80% { transform: translateX(5px); } }
.hint { margin: 16px 0 0; padding: 12px 16px; border-left: 3px solid var(--wax); background: rgba(125,31,31,.07); font-style: italic; color: #4a2a1c; font-size: 17px; }

/* story */
.quote { margin: 0 0 22px; padding: 0 12px; text-align: center; }
.quote p { font-family: var(--fell); font-style: italic; font-size: 23px; line-height: 1.35; margin: 0; color: #3a2614; }
.quote p::before { content: "“"; color: var(--gold); font-size: 1.5em; line-height: 0; vertical-align: -.3em; margin-right: 2px; }
.quote p::after { content: "”"; color: var(--gold); font-size: 1.5em; line-height: 0; vertical-align: -.3em; margin-left: 2px; }
.quote cite { display: block; margin-top: 8px; font-style: normal; font-family: var(--fellsc); font-size: 14px; letter-spacing: .1em; color: var(--gold); }
.narration p { margin: 0 0 14px; font-size: 20px; }
.narration p:first-child::first-letter {
  font-family: var(--fell); float: left; font-size: 3.3em; line-height: .82; padding: 6px 8px 0 0; color: var(--wax);
}
.decide { font-family: var(--fellsc); letter-spacing: .14em; color: var(--gold); text-align: center; margin: 26px 0 12px; font-size: 16px; }
.choices { display: grid; gap: 12px; }
.choice {
  position: relative; text-align: left; cursor: pointer;
  padding: 16px 20px 16px 52px; font-size: 19px; line-height: 1.4; color: var(--ink);
  background: linear-gradient(90deg, rgba(255,250,235,.75), rgba(255,250,235,.35));
  border: 1px solid rgba(140,105,55,.5); border-radius: 2px;
  transition: transform .25s, box-shadow .25s, border-color .25s, background .25s;
}
.choice::before {
  content: ""; position: absolute; left: 18px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%) rotate(45deg);
  border: 1px solid var(--gold); background: rgba(217,181,106,.15); transition: background .25s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 8px 20px -10px rgba(60,35,10,.5); background: rgba(255,252,240,.95); }
.choice:hover::before { background: var(--gold); }

/* outcome */
.you-chose { font-style: italic; color: var(--ink-soft); text-align: center; margin: 0 0 14px; font-size: 17px; }
.outcome { font-size: 21px; line-height: 1.6; margin: 0 0 18px; }
.deltas { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0 0 26px; }
.delta { font-family: var(--fellsc); font-size: 15px; letter-spacing: .06em; padding: 5px 12px; border-radius: 20px; border: 1px solid; }
.delta.up { color: var(--good); border-color: rgba(93,122,58,.5); background: rgba(93,122,58,.08); }
.delta.down { color: var(--bad); border-color: rgba(138,47,34,.45); background: rgba(138,47,34,.07); }
#phase-outcome { text-align: center; }
#phase-outcome .outcome { text-align: left; }

/* ---------------------------------------------------------------- gate */
.gate-wrap { max-width: 620px; text-align: center; }
.gate-wrap h2 { font-family: var(--fell); font-weight: 400; font-size: clamp(34px, 6vw, 50px); margin: 0 0 10px; color: #f6e7c4; }
.scales { width: 200px; margin: 6px auto 10px; }
.scales .pan { transition: transform 1.6s cubic-bezier(.3,1.4,.5,1); transform-origin: 100px 40px; }
.scales.tilt-good .left { transform: translateY(10px); } .scales.tilt-good .right { transform: translateY(-10px); }
.scales.tilt-bad .left { transform: translateY(-10px); } .scales.tilt-bad .right { transform: translateY(10px); }
.gate-text { font-size: 19px; color: #ddd0b5; }
.gate-verdict { font-family: var(--fell); font-style: italic; font-size: 24px; color: var(--gold-hi); margin: 18px 0 26px; }

/* ---------------------------------------------------------------- ending */
.ending-card { max-width: 860px; }
.ending-card h2 { font-size: clamp(36px, 6vw, 54px); }
.theme-box { margin: 18px 0 26px; padding: 16px 20px; border: 1px solid rgba(140,105,55,.45); background: rgba(255,250,235,.4); }
.theme-label { font-family: var(--fellsc); letter-spacing: .12em; color: var(--gold); font-size: 14px; margin: 0 0 4px; }
.theme-box p:last-child { margin: 0; font-size: 19px; }
.end-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 30px; }
.end-grid h3 { font-family: var(--fellsc); font-weight: 400; letter-spacing: .08em; font-size: 19px; color: #3a2614; margin: 0 0 12px; border-bottom: 1px solid rgba(140,105,55,.4); padding-bottom: 6px; }
.final-meters .fm { margin-bottom: 12px; }
.fm-top { display: flex; justify-content: space-between; font-size: 17px; }
.fm-top b { font-variant-numeric: tabular-nums; }
.fm-bar { height: 7px; background: rgba(90,70,50,.18); border-radius: 4px; overflow: hidden; margin-top: 3px; }
.fm-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #7d5a1f); }
.fm-note { font-size: 14px; color: var(--ink-soft); font-style: italic; }
.quiz-score { font-size: 16px; color: var(--ink-soft); margin: 14px 0 0; }
.your-road { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.your-road li { position: relative; padding: 0 0 12px 30px; font-size: 16px; line-height: 1.4; counter-increment: r; }
.your-road li::before { content: counter(r, upper-roman); position: absolute; left: 0; top: 0; font-family: var(--fell); color: var(--gold); font-size: 15px; }
.your-road li b { display: block; font-family: var(--fellsc); font-weight: 400; letter-spacing: .05em; color: #3a2614; font-size: 15px; }
.endings-found { text-align: center; font-style: italic; color: var(--ink-soft); margin: 18px 0 14px; }
.end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ending-card.dark { --parch1: #e6dcc6; --parch2: #c9b998; }

/* ---------------------------------------------------------------- fade & toast */
.fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 50; transition: opacity .6s ease; }
.fade.on { opacity: 1; pointer-events: all; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); z-index: 60;
  padding: 10px 20px; background: rgba(20,14,8,.92); border: 1px solid var(--gold); color: #f3e3bf;
  font-size: 16px; opacity: 0; transition: .4s; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  body { font-size: 18px; }
  .topbar { padding: 8px 16px; gap: 10px; flex-wrap: wrap; }
  .brand { font-size: 15px; }
  .meters { order: 3; width: 100%; justify-content: space-between; margin: 0; gap: 8px; }
  .meter { font-size: 13px; gap: 5px; }
  .meter .bar { width: 44px; }
  .tools { margin-left: auto; }
  .card { padding: 34px 24px 34px; }
  .card-edge { inset: 8px; }
  .narration p, .outcome { font-size: 18px; }
  .quote p { font-size: 20px; }
  .quiz-q { font-size: 21px; }
  .choice, .opt { font-size: 17px; }
  .how { grid-template-columns: 1fr; margin-top: 30px; }
  .end-grid { grid-template-columns: 1fr; gap: 18px; }
  .lede { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================================
   3D WORLD LAYER
   ========================================================================= */
#world { position: fixed; inset: 0; z-index: 0; }
#world canvas { display: block; width: 100% !important; height: 100% !important; }
main { position: relative; z-index: 2; }
.vignette { z-index: 1; }
body.has3d .sky, body.has3d .fog, body.has3d .embers { display: none; }
body.has3d { background: #000; }
body.has3d .vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%); }

/* loader */
.loader { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; justify-items: center; gap: 18px; background: #07080a; transition: opacity 1.2s ease; }
.loader p { font-family: var(--fell); font-style: italic; color: var(--gold-hi); font-size: 20px; margin: 0; letter-spacing: .03em; }
.loader-lamp { width: 70px; height: 70px; border-radius: 50%; background: radial-gradient(circle, rgba(255,210,120,.9) 0 12%, rgba(240,170,70,.35) 30%, transparent 70%); animation: flicker 1.6s infinite; display: grid; place-items: center; }
.loader-lamp i { width: 10px; height: 18px; border-radius: 50% 50% 45% 45%; background: #fff1c8; box-shadow: 0 0 18px 6px rgba(255,200,110,.8); }
.loader.done { opacity: 0; pointer-events: none; }

/* title over the 3D scene */
body.has3d #screen-title { align-items: flex-start; }
body.has3d .title-wrap { padding: 26px 22px 30px; background: radial-gradient(ellipse at center, rgba(5,6,8,.62) 0%, rgba(5,6,8,.35) 55%, transparent 75%); }
body.has3d .lantern-hero { display: none; }
body.has3d h1 { margin-top: 14px; }

/* walk HUD */
.screen.walk { align-items: flex-end; padding-bottom: 26px; pointer-events: none; }
.walk-hud {
  pointer-events: auto; text-align: center; width: 100%; max-width: 520px;
  padding: 18px 26px 18px; border-radius: 4px;
  background: linear-gradient(180deg, rgba(14,11,8,.55), rgba(14,11,8,.82));
  border: 1px solid rgba(217,181,106,.35);
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.8), inset 0 0 0 1px rgba(255,230,180,.05);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: hudIn 1s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes hudIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }
.walk-hud h2 { font-family: var(--fell); font-weight: 400; font-size: clamp(30px, 6vw, 42px); line-height: 1; margin: 0; color: #f6e7c4; text-shadow: 0 0 20px rgba(240,190,90,.35); }
.walk-teaser { font-style: italic; color: #ddd0b5; margin: 6px 0 12px; font-size: 18px; }
.walk-progress { position: relative; height: 4px; margin: 4px 12px 16px; background: rgba(255,255,255,.12); border-radius: 2px; }
.walk-progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); border-radius: 2px; box-shadow: 0 0 10px rgba(240,190,90,.7); transition: width .2s linear; }
.walk-lamp { position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%) rotate(45deg); border: 1px solid var(--gold-hi); background: #1a130b; }
.walk-progress.near .walk-lamp { background: var(--gold-hi); box-shadow: 0 0 14px 4px rgba(255,200,110,.7); }
.walk-help { font-size: 14px; color: #b9ad94; margin: 12px 0 0; }
kbd { font-family: var(--serif); font-size: 13px; padding: 1px 6px; border: 1px solid rgba(217,181,106,.45); border-radius: 3px; color: #f0dfb8; background: rgba(255,255,255,.05); }
#walkBtn[disabled] { opacity: .75; cursor: default; transform: none; }
.pad { display: none; }
@media (pointer: coarse) {
  .walk-help { display: none; }
  .screen.walk { flex-direction: column; justify-content: flex-end; align-items: center; }
  .pad { pointer-events: auto; display: flex; gap: 14px; order: -1; margin: 0 0 12px; }
  .walk-hud { padding: 14px 18px; }
  .walk-teaser { font-size: 16px; margin-bottom: 10px; }
  .pad button { width: 54px; height: 54px; border-radius: 50%; border: 1px solid rgba(217,181,106,.5); background: rgba(14,11,8,.6); color: var(--gold-hi); font-size: 18px; touch-action: none; -webkit-user-select: none; user-select: none; }
  .pad button.on { background: rgba(217,181,106,.35); }
}

/* cards float over the world */
body.has3d .card { box-shadow: 0 0 0 1px rgba(80,55,25,.4), 0 0 0 7px rgba(243,232,207,.06), 0 40px 90px -20px rgba(0,0,0,.95), 0 0 140px -30px var(--glow); }
body.has3d #screen-scene, body.has3d #screen-ending { align-items: flex-start; padding-top: 40vh; }
body.has3d #screen-gate .gate-wrap { padding: 24px; background: radial-gradient(ellipse at center, rgba(5,6,8,.7), transparent 75%); }
@media (max-width: 760px) { body.has3d #screen-scene, body.has3d #screen-ending { padding-top: 34vh; } }

/* author credit on the title page */
.credit { margin: 26px auto 0; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 28px 10px; border-top: 1px solid rgba(217,181,106,.45); border-bottom: 1px solid rgba(217,181,106,.45); }
.credit-label { font-family: var(--fellsc); font-size: 13px; letter-spacing: .2em; color: var(--gold-hi); opacity: .85; text-transform: lowercase; }
.credit-name { font-family: var(--fell); font-size: 23px; color: #f6e7c4; text-shadow: 0 0 18px rgba(240,190,90,.3); }
.credit-id { font-family: var(--serif); font-variant-numeric: lining-nums; font-size: 16px; letter-spacing: .14em; color: #d8ccb2; }
