/* Oz · The Road Home — a living storybook.
   Type: TeX Gyre Schola (Century Schoolbook lineage, the face of 1900s children's books). */
@font-face { font-family: Schola; src: url(../fonts/texgyreschola-regular.otf) format('opentype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: Schola; src: url(../fonts/texgyreschola-italic.otf) format('opentype'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: Schola; src: url(../fonts/texgyreschola-bold.otf) format('opentype'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: Schola; src: url(../fonts/texgyreschola-bolditalic.otf) format('opentype'); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  --ink: #2a2118; --ink-soft: #5a4a38; --paper: #f4ead2; --paper-2: #ead9b4; --paper-edge: #c9b082;
  --gold: #c99a2e; --gold-hi: #f2d27a; --night: #15120d;
  --accent: #8a7d68; --accent-2: #c6b89a; --glow: 255, 236, 180;
  --text-scale: 1; --ui: clamp(13px, 1.05vw, 16px);
  --ease: cubic-bezier(.22, .8, .25, 1);
}
body[data-region="kansas"]   { --accent: #7d7466; --accent-2: #b9ad98; --glow: 236, 228, 208; }
body[data-region="storm"]    { --accent: #4f5561; --accent-2: #9aa3b1; --glow: 190, 205, 230; }
body[data-region="munchkin"] { --accent: #2f56a3; --accent-2: #9db7ea; --glow: 205, 225, 255; }
body[data-region="road"]     { --accent: #b48a1c; --accent-2: #f0d681; --glow: 255, 236, 160; }
body[data-region="forest"]   { --accent: #4e6b34; --accent-2: #b9cf8f; --glow: 230, 245, 190; }
body[data-region="poppy"]    { --accent: #b3352b; --accent-2: #f1a79b; --glow: 255, 210, 200; }
body[data-region="emerald"]  { --accent: #1f8a55; --accent-2: #8fe0b2; --glow: 180, 255, 210; }
body[data-region="winkie"]   { --accent: #b98f12; --accent-2: #f3dc7c; --glow: 255, 240, 170; }
body[data-region="china"]    { --accent: #4d6fb0; --accent-2: #c6d6f4; --glow: 240, 245, 255; }
body[data-region="quadling"] { --accent: #b3262f; --accent-2: #f2a4a8; --glow: 255, 215, 215; }
body[data-region="desert"]   { --accent: #a9844d; --accent-2: #ecd2a2; --glow: 255, 235, 200; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--ink);
  font-family: Schola, 'Century Schoolbook', 'New Century Schoolbook', Georgia, serif; font-size: var(--ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

/* ---------------- the living painting ---------------- */
#stage { position: fixed; inset: 0; overflow: clip; background: var(--night); }
.plates, .plate { position: absolute; inset: 0; overflow: clip; }
.plate { opacity: 0; transition: opacity 1.4s var(--ease); }
.plate.on { opacity: 1; z-index: 1; }
.world { position: absolute; left: 50%; top: 50%; transform-origin: 50% 50%; will-change: transform; }
.world img, .world video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.world video { opacity: 0; transition: opacity 1.2s; }
.world video.ready { opacity: 1; }
.plate.drift .world { animation: drift var(--drift-dur, 46s) ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(-50%, -50%) scale(var(--s0, 1.02)) translate(var(--x0, 0%), var(--y0, 0%)); }
  to   { transform: translate(-50%, -50%) scale(var(--s1, 1.08)) translate(var(--x1, -1%), var(--y1, -.6%)); }
}
.plate .world { transform: translate(-50%, -50%) scale(1.03); }
body.closeup .plate.on .world { animation-duration: 24s; }
#motes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; mix-blend-mode: screen; opacity: .9; }
.vignette { position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 120% 95% at 50% 45%, transparent 55%, rgba(15,10,5,.42) 100%),
              linear-gradient(to bottom, rgba(10,8,4,.38), transparent 14%, transparent 70%, rgba(10,8,4,.55)); }
.grain { position: absolute; inset: -50%; z-index: 3; pointer-events: none; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .3  0 0 0 0 .22  0 0 0 0 .1  0 0 0 1.4 -.2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
body[data-mode="page"] .vignette { background: radial-gradient(ellipse 120% 95% at 50% 45%, transparent 50%, rgba(15,10,5,.5) 100%), linear-gradient(to bottom, rgba(10,8,4,.25), transparent 18%, transparent 55%, rgba(10,8,4,.6)); }

/* ---------------- hotspots ---------------- */
.spots { position: absolute; inset: 0; z-index: 2; }
.plate:not(.on) .spots { display: none; }
.spot { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 0; background: none; padding: 0; border-radius: 50%; }
.spot::before { content: ''; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fffef6 0 30%, rgb(var(--glow)) 55%, #e2b04a 100%);
  box-shadow: 0 0 0 1.5px rgba(40,25,5,.55), 0 0 12px 4px rgba(255,226,150,.75), 0 2px 5px rgba(0,0,0,.6);
  animation: twinkle 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); transition: transform .2s; }
.spot::after { content: ''; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px; border-radius: 50%;
  border: 1.5px solid rgba(255,240,200,.9); box-shadow: 0 0 0 1px rgba(40,25,5,.25);
  animation: ripple 3.2s ease-out infinite; animation-delay: var(--d, 0s); opacity: 0; }
.spot.person::before { background: radial-gradient(circle at 40% 35%, #fff 0 30%, #ffd9b0 60%, #d98a4a 100%); }
.spot.portable::before { background: radial-gradient(circle at 40% 35%, #fffef0 0 28%, #ffe27a 55%, #c98a10 100%); }
.spot.seen::before { opacity: .55; animation: none; }
.spot.seen::after { animation: none; }
.spot:hover::before, .spot:focus-visible::before { transform: scale(1.5); opacity: 1; animation: none; }
.spot:hover::after, .spot:focus-visible::after { animation: ripple 1.4s ease-out infinite; }
body.spots-quiet .spot:not(:hover):not(:focus-visible)::before, body.spots-quiet .spot:not(:hover):not(:focus-visible)::after { opacity: 0; animation: none; }
body.spots-reveal .spot::before { opacity: 1 !important; transform: scale(1.4); }
body.carrying .spot { cursor: copy; }
body.carrying .spot::before { transform: scale(1.3); background: radial-gradient(circle, #fff 0 30%, #ffd060 60%, #c98a10 100%); }
@keyframes twinkle { 0%,100% { opacity: .75; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes ripple { 0% { opacity: .9; transform: scale(.35); } 70% { opacity: 0; transform: scale(1.5); } 100% { opacity: 0; } }
body[data-mode="page"] .spots, body[data-mode="title"] .spots, body.closeup .spots { visibility: hidden; }

/* exits */
#exits { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.exit { position: absolute; pointer-events: auto; display: flex; align-items: center; gap: .55em; padding: .5em .9em; border: 0;
  color: #fff8e6; background: linear-gradient(90deg, rgba(20,14,6,.55), rgba(20,14,6,.25)); border-radius: 99px; letter-spacing: .04em;
  font-size: .95em; text-shadow: 0 1px 2px rgba(0,0,0,.8); opacity: .82; transition: opacity .3s, transform .3s var(--ease), background .3s; backdrop-filter: blur(2px); }
.exit:hover, .exit:focus-visible { opacity: 1; background: linear-gradient(90deg, rgba(20,14,6,.75), rgba(20,14,6,.45)); }
.exit .arr { font-size: 1.25em; line-height: 1; color: var(--gold-hi); }
.exit.left { left: 1.2vw; } .exit.right { right: 1.2vw; flex-direction: row-reverse; }
.exit.left:hover { transform: translateX(-4px); } .exit.right:hover { transform: translateX(4px); }
.exit.up { top: 8.5vh; } .exit.down { bottom: 15vh; }
.exit.up, .exit.down { left: 50%; translate: -50% 0; }
body[data-mode="page"] #exits, body[data-mode="title"] #exits, body.closeup #exits { opacity: 0; pointer-events: none; }

/* ---------------- HUD ---------------- */
#hud-top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: flex-start; padding: 1.1em 1.4em; pointer-events: none; transition: opacity .6s; }
#hud-top > * { pointer-events: auto; }
#placard { color: #fdf6e3; text-shadow: 0 1px 3px rgba(0,0,0,.85), 0 0 18px rgba(0,0,0,.4); display: flex; flex-direction: column; gap: .15em; }
#chapter-label { font-size: .78em; letter-spacing: .22em; text-transform: uppercase; opacity: .85; }
#room-label { font-size: 1.45em; font-style: italic; max-width: 48vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tools { display: flex; gap: .45em; }
.tool { display: flex; align-items: center; gap: .3em; height: 2.6em; min-width: 2.6em; justify-content: center; padding: 0 .6em; border-radius: 99px; border: 1px solid rgba(255,240,200,.25);
  background: rgba(22,16,8,.45); color: #fdf3d8; backdrop-filter: blur(4px); transition: background .2s, transform .2s; }
.tool:hover { background: rgba(22,16,8,.7); transform: translateY(-1px); }
.tool svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#btn-wonders svg { fill: var(--gold-hi); stroke: none; }
#score { font-variant-numeric: tabular-nums; font-size: .95em; }
#btn-hint.pulse { animation: hintpulse 2.4s ease-in-out 3; }
@keyframes hintpulse { 50% { box-shadow: 0 0 0 6px rgba(255,220,140,.25); background: rgba(80,60,20,.7); } }
body[data-mode="title"] #hud-top, body[data-mode="title"] #hud-bottom, body[data-mode="title"] #ribbon { opacity: 0; pointer-events: none; }
body[data-mode="page"] #hud-bottom, body[data-mode="page"] #ribbon { opacity: 0; pointer-events: none; }
body[data-mode="page"] #hud-top .tools { opacity: .35; }
body.idle[data-mode="play"] #hud-top, body.idle[data-mode="play"] #hud-bottom { opacity: .25; }

#hud-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr minmax(260px, 560px) 1fr; align-items: end; gap: 1em; padding: 0 1.2em 1.1em; pointer-events: none; transition: opacity .6s; }
#hud-bottom > * { pointer-events: auto; }
#party { display: flex; gap: .55em; align-items: flex-end; }
#satchel { display: flex; gap: .45em; justify-content: flex-end; align-items: flex-end; flex-wrap: wrap-reverse; }
.medal { position: relative; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,236,190,.75); padding: 0; flex: none;
  background-color: #3a3020; background-repeat: no-repeat; box-shadow: 0 3px 10px rgba(0,0,0,.55), inset 0 0 0 2px rgba(0,0,0,.25);
  transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; }
.medal.small { width: 48px; height: 48px; }
.medal:hover, .medal:focus-visible { transform: translateY(-4px) scale(1.05); border-color: var(--gold-hi); box-shadow: 0 8px 18px rgba(0,0,0,.6), 0 0 0 3px rgba(242,210,122,.25); }
.medal.held { border-color: var(--gold-hi); box-shadow: 0 0 0 4px rgba(242,210,122,.55), 0 8px 18px rgba(0,0,0,.6); transform: translateY(-6px); }
.medal.away { filter: grayscale(1) brightness(.6); opacity: .6; }
.medal.glow { animation: medalglow 2s ease-out 2; }
.medal.new { animation: medalnew .9s var(--ease); }
@keyframes medalglow { 30% { box-shadow: 0 0 0 6px rgba(255,220,140,.6), 0 0 30px 10px rgba(255,220,140,.5); } }
@keyframes medalnew { from { transform: scale(.2) translateY(-60px); opacity: 0; } }
.medal .lbl { position: absolute; left: 50%; bottom: calc(100% + 6px); translate: -50% 0; white-space: nowrap; font-size: .8em; color: #fff8e6; text-shadow: 0 1px 2px #000; opacity: 0; transition: opacity .2s; pointer-events: none; }
.medal:hover .lbl, .medal:focus-visible .lbl { opacity: 1; }
.medal .glyph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.5em; color: #f6e8c8; text-shadow: 0 1px 2px #000; }

#cmd { position: relative; display: flex; align-items: center; gap: .5em; padding: .55em 1em; border-radius: 99px;
  background: rgba(244,234,210,.92); box-shadow: 0 6px 22px rgba(0,0,0,.45), inset 0 0 0 1px rgba(120,90,40,.35); }
#cmd .quill { color: var(--ink-soft); font-size: 1.1em; }
#cmd-input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.08em; color: var(--ink); min-width: 0; }
#cmd-input::placeholder { color: #8a7a62; font-style: italic; }
#suggest { position: absolute; left: 1em; right: 1em; bottom: calc(100% + 6px); display: flex; gap: .35em; flex-wrap: wrap; pointer-events: auto; }
#suggest button { border: 0; border-radius: 99px; padding: .25em .7em; background: rgba(244,234,210,.92); color: var(--ink); font-size: .9em; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
#suggest button:hover { background: #fff; }

/* ---------------- response ribbon ---------------- */
#ribbon { position: fixed; z-index: 15; left: 50%; bottom: 5.4em; translate: -50% 0; width: min(780px, 92vw); max-height: min(52vh, 30em); display: flex; flex-direction: column; gap: .4em; overflow-y: auto; scrollbar-width: none; pointer-events: none; transition: opacity .5s; }
#ribbon::-webkit-scrollbar { display: none; }
#ribbon > :first-child { margin-top: auto; }
.say-body { max-height: min(30vh, 11.5em); overflow-y: auto; scrollbar-width: thin; }
.say.overflowing .say-body { -webkit-mask: linear-gradient(#000 78%, transparent); mask: linear-gradient(#000 78%, transparent); }
.say-more { position: absolute; right: .7em; bottom: .35em; border: 0; border-radius: 99px; padding: .1em .8em; background: rgba(60,40,15,.85); color: #fff3d6; font-size: .82em; }
.say .gap { display: block; height: .5em; }
.say { pointer-events: auto; position: relative; cursor: default; padding: .85em 1.25em 1.1em; flex: none; border-radius: 6px; color: var(--ink); font-size: calc(1.08em * var(--text-scale)); line-height: 1.55;
  background: linear-gradient(180deg, rgba(248,240,220,.95), rgba(240,228,200,.95)); box-shadow: 0 8px 26px rgba(0,0,0,.4), inset 0 0 0 1px rgba(150,115,60,.35), inset 0 0 40px rgba(180,140,80,.18);
  animation: sayin .55s var(--ease) both; }
.say.faded { opacity: 0; transition: opacity 2.5s; pointer-events: none; }
.say.old { opacity: .0; transform: translateY(-6px); transition: opacity .6s, transform .6s; pointer-events: none; }
.say.room { font-style: italic; }
.say.hint { background: linear-gradient(180deg, rgba(255,247,215,.97), rgba(250,232,178,.97)); }
.say.hint::before { content: '✦ '; color: var(--gold); }
.say .who { display: block; font-size: .78em; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: .2em; font-style: normal; }
.say .s { opacity: 0; transition: opacity .5s; }
.say .gap { display: block; height: .45em; }
.say .s.on { opacity: 1; }
.say .s.speaking { background: linear-gradient(transparent 60%, rgba(242,210,122,.45) 60%); }
.say.collapsed { max-height: 2.9em; overflow: hidden; -webkit-mask: linear-gradient(#000 40%, transparent); mask: linear-gradient(#000 40%, transparent); }
@keyframes sayin { from { opacity: 0; transform: translateY(10px); } }
#ribbon .more { align-self: center; pointer-events: auto; border: 0; background: rgba(20,14,6,.55); color: #fff3d6; border-radius: 99px; padding: .2em .9em; font-size: .85em; }

/* ---------------- story page (the book leaf) ---------------- */
#page { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: var(--page-side, flex-start); padding: 6vh 4vw 5vh; pointer-events: auto; cursor: pointer; }
.leaf { position: relative; width: min(600px, 44vw); max-height: 78vh; overflow: auto; padding: 2.1em 2.4em 1.5em; color: var(--ink);
  background: radial-gradient(ellipse at 30% 20%, #fbf4e1, #f1e3c0 70%, #e7d2a6); border-radius: 3px;
  box-shadow: 0 30px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(120,90,40,.35), inset 0 0 70px rgba(160,120,60,.28);
  animation: leafin .9s var(--ease) both; cursor: default; scrollbar-width: thin; }
.leaf::before { content: ''; position: absolute; inset: 8px; border: 1px solid rgba(140,100,50,.35); pointer-events: none; border-radius: 2px; }
@keyframes leafin { from { opacity: 0; transform: translateY(24px) rotate(-.4deg); } }
.leaf.out { animation: leafout .45s ease-in both; }
@keyframes leafout { to { opacity: 0; transform: translateY(14px); } }
.leaf-orn { height: 18px; margin: -0.6em auto .7em; width: 160px; opacity: .55;
  background: center/contain no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 18'><g fill='none' stroke='%235a4128' stroke-width='1.2'><path d='M2 9h56M102 9h56'/><path d='M80 2c-6 7-14 7-18 7 4 0 12 0 18 7 6-7 14-7 18-7-4 0-12 0-18-7z'/><circle cx='64' cy='9' r='1.6' fill='%235a4128'/><circle cx='96' cy='9' r='1.6' fill='%235a4128'/></g></svg>"); }
.leaf-text p { margin: 0 0 .85em; font-size: calc(clamp(15px, 2.05vh + .35vw, 21px) * var(--text-scale)); line-height: 1.62; hyphens: auto; text-wrap: pretty; }
.leaf-text p.first::first-letter { float: left; font-size: 3.6em; line-height: .82; padding: .06em .08em 0 0; color: var(--accent); font-weight: 700;
  text-shadow: 1px 1px 0 rgba(255,255,255,.6); }
.leaf-text .s { opacity: .0; transition: opacity .7s ease; }
.leaf-text .s.on { opacity: 1; }
.leaf-text .s.speaking { background: linear-gradient(transparent 62%, rgba(242,210,122,.5) 62%); }
.leaf-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .4em; padding-top: .6em; border-top: 1px solid rgba(140,100,50,.25); }
.leaf-count { font-size: .8em; letter-spacing: .2em; color: var(--ink-soft); }
.leaf-next { border: 0; background: none; color: var(--accent); font-style: italic; font-size: 1.05em; padding: .2em .4em; opacity: .4; transition: opacity .4s; }
.leaf-next.ready { opacity: 1; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }

/* ---------------- chapter card ---------------- */
#chapter { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(20,14,6,.55), rgba(10,7,3,.92)); color: #f7ecd2; animation: fadein 1.2s both; cursor: pointer; }
#chapter.out { animation: fadeout .9s both; }
.ch-inner { text-align: center; max-width: 80vw; }
.ch-num { font-size: 1em; letter-spacing: .5em; text-transform: uppercase; opacity: .8; animation: rise 1.6s .2s var(--ease) both; }
.ch-rule { width: 0; height: 1px; margin: 1.2em auto; background: linear-gradient(90deg, transparent, var(--gold-hi), transparent); animation: rule 1.6s .5s var(--ease) both; }
.ch-title { margin: 0; font-weight: 400; font-style: italic; font-size: clamp(2.2em, 5.2vw, 4.6em); line-height: 1.1; text-shadow: 0 2px 30px rgba(0,0,0,.6); animation: rise 1.8s .7s var(--ease) both; }
.ch-orn { margin-top: .6em; font-size: 2em; color: var(--gold-hi); opacity: .8; animation: rise 1.8s 1.1s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } }
@keyframes rule { to { width: 260px; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }

/* ---------------- verb coin ---------------- */
#coin { position: fixed; z-index: 50; width: 0; height: 0; }
#coin .coin-name { position: absolute; left: 0; top: -130px; translate: -50% 0; white-space: nowrap; padding: .2em .8em; border-radius: 99px; background: rgba(20,14,6,.78); color: #fff3d6; font-style: italic; font-size: 1.02em; animation: fadein .2s both; }
#coin button { position: absolute; width: 64px; height: 64px; margin: -32px; border-radius: 50%; border: 1.5px solid rgba(140,100,50,.6); display: grid; place-items: center; gap: 0; padding: 0;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #f0e0bb 70%, #dcc293); color: var(--ink); box-shadow: 0 6px 16px rgba(0,0,0,.45);
  font-size: .74em; line-height: 1.05; text-align: center; animation: coinin .28s var(--ease) both; transition: transform .15s, background .15s; }
#coin button svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; margin: 0 auto 2px; }
#coin button:hover, #coin button:focus-visible { transform: scale(1.12); background: radial-gradient(circle at 35% 30%, #fff, #fbeac0 70%, #e9c983); }
@keyframes coinin { from { opacity: 0; transform: scale(.3); } }
#tip { position: fixed; z-index: 45; pointer-events: none; padding: .25em .75em; border-radius: 99px; background: rgba(20,14,6,.78); color: #fff3d6; font-style: italic; white-space: nowrap; translate: -50% -150%; }
#carry { position: fixed; z-index: 60; pointer-events: none; width: 54px; height: 54px; margin: -27px; border-radius: 50%; border: 2px solid var(--gold-hi); background-repeat: no-repeat; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
#carry .glyph { display: grid; place-items: center; height: 100%; color: #fff; font-size: 1.4em; text-shadow: 0 1px 2px #000; }

/* ---------------- conversation ---------------- */
#talk { position: fixed; z-index: 25; left: 50%; bottom: 5.6em; translate: -50% 0; width: min(640px, 92vw); padding: .9em 1em .6em; border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,22,12,.9), rgba(22,16,8,.94)); color: #f6ead0; box-shadow: 0 16px 40px rgba(0,0,0,.55); animation: sayin .4s var(--ease) both; }
.talk-who { display: flex; align-items: center; gap: .7em; margin-bottom: .45em; }
.talk-face { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 2px solid rgba(255,236,190,.7); background-color: #3a3020; background-repeat: no-repeat; }
.talk-name { font-style: italic; font-size: 1.1em; color: var(--gold-hi); }
.talk-topics { list-style: none; margin: 0; padding: 0; display: grid; gap: .1em; max-height: min(38vh, 18em); overflow-y: auto; }
.talk-topics button { width: 100%; text-align: left; border: 0; background: none; color: #f6ead0; padding: .38em .6em; border-radius: 4px; font-size: 1.02em; display: flex; gap: .55em; align-items: baseline; }
.talk-topics button:hover, .talk-topics button:focus-visible { background: rgba(255,236,190,.12); color: #fff; }
.talk-topics button .dot { color: var(--gold-hi); width: .8em; flex: none; }
.talk-topics button.old { color: #b9a988; }
.talk-topics button.bye { color: #b9a988; font-style: italic; }

/* ---------------- toasts ---------------- */
#toasts { position: fixed; z-index: 70; top: 4.6em; right: 1.4em; display: flex; flex-direction: column; gap: .5em; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .7em; padding: .55em 1em .55em .55em; border-radius: 99px; background: rgba(22,16,8,.86); color: #fbefd2; box-shadow: 0 8px 22px rgba(0,0,0,.45); animation: toastin .6s var(--ease) both; max-width: 380px; }
.toast.out { animation: toastout .6s ease-in both; }
.toast .t-art { width: 44px; height: 44px; border-radius: 50%; flex: none; background-size: cover; background-position: center; border: 2px solid var(--gold-hi); }
.toast .t-k { font-size: .7em; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-hi); }
.toast .t-t { font-style: italic; }
.toast.wonder { background: linear-gradient(90deg, rgba(70,48,10,.94), rgba(30,20,6,.92)); }
.toast.wonder .t-pts { font-weight: 700; color: var(--gold-hi); margin-left: .3em; }
@keyframes toastin { from { opacity: 0; transform: translateX(40px); } }
@keyframes toastout { to { opacity: 0; transform: translateX(30px); } }
.sparkle { position: fixed; z-index: 69; pointer-events: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 8px 2px rgba(255,220,130,.8); animation: sparkle 1.3s ease-out forwards; }
@keyframes sparkle { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* ---------------- the book (modal) ---------------- */
#book { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; background: rgba(10,7,3,.72); backdrop-filter: blur(3px); animation: fadein .35s both; }
.book-inner { position: relative; width: min(1060px, 94vw); height: min(760px, 90vh); border-radius: 6px; overflow: hidden;
  background: radial-gradient(ellipse at 30% 10%, #fbf4e1, #f0e1bd 70%, #e3cc9c); box-shadow: 0 40px 80px rgba(0,0,0,.6), inset 0 0 90px rgba(160,120,60,.3); animation: leafin .5s var(--ease) both; }
.book-inner::before { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(140,100,50,.35); pointer-events: none; border-radius: 3px; z-index: 2; }
.book-close { position: absolute; z-index: 3; top: .5em; right: .7em; border: 0; background: none; font-size: 2em; color: var(--ink-soft); line-height: 1; }
.book-body { position: absolute; inset: 0; overflow: auto; padding: 2.2em 2.6em; }
.book-body h2 { margin: 0 0 .2em; font-weight: 400; font-style: italic; font-size: 2.1em; color: var(--ink); }
.book-body h3 { margin: 1.4em 0 .5em; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; font-size: .85em; color: var(--accent); }
.book-body .lede { color: var(--ink-soft); margin: 0 0 1.4em; font-style: italic; }
.tabs { display: flex; gap: .4em; margin-bottom: 1.2em; flex-wrap: wrap; }
.tabs button { border: 1px solid rgba(140,100,50,.4); background: rgba(255,255,255,.35); border-radius: 99px; padding: .3em 1em; }
.tabs button.on { background: var(--ink); color: var(--paper); }
.btn { border: 1px solid rgba(90,65,30,.55); background: linear-gradient(#fffaf0, #efdfba); border-radius: 99px; padding: .5em 1.3em; font-size: 1em; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.btn:hover { background: linear-gradient(#fff, #f6e6c2); }
.btn.primary { background: linear-gradient(#5b4426, #3a2a16); color: #fbefd2; border-color: #2a1d0e; }
.row { display: flex; gap: .6em; flex-wrap: wrap; align-items: center; }

.wonder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1em; }
.wcard { border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.4); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.wcard .w-art { aspect-ratio: 3/2; background-size: cover; background-position: center; }
.wcard .w-b { padding: .55em .75em .7em; }
.wcard .w-t { font-style: italic; font-size: 1.02em; }
.wcard .w-x { font-size: .85em; color: var(--ink-soft); margin-top: .2em; }
.wcard .w-p { float: right; color: var(--gold); font-weight: 700; font-size: .9em; }
.wcard.locked .w-art { filter: grayscale(1) blur(6px) brightness(1.3) sepia(.4); opacity: .45; }
.wcard.locked .w-t { color: #9a8a70; }
.progress { height: 8px; border-radius: 99px; background: rgba(90,65,30,.18); overflow: hidden; margin: .4em 0 1.2em; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); }

.journal-entry { margin: 0 0 .9em; line-height: 1.6; }
.journal-entry.page { font-size: 1.05em; }
.journal-entry.resp { color: var(--ink-soft); padding-left: 1em; border-left: 2px solid rgba(140,100,50,.25); }
.companion-sheet { display: grid; grid-template-columns: 90px 1fr; gap: 1em; align-items: start; margin-bottom: 1.4em; }
.companion-sheet .medal { width: 84px; height: 84px; }
.companion-sheet ul { margin: .3em 0 0; padding-left: 1.1em; }
.companion-sheet li { margin: .2em 0; font-style: italic; }

.endcard { text-align: center; }
.endcard .big { font-size: 3em; font-style: italic; margin: .2em 0; }
.endcard .found-row { display: flex; gap: .5em; justify-content: center; flex-wrap: wrap; margin: 1em 0; }
.endcard .found-row .wthumb { width: 96px; aspect-ratio: 3/2; border-radius: 3px; background-size: cover; background-position: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.endcard .found-row .wthumb.locked { filter: grayscale(1) blur(3px); opacity: .35; }

.slots { display: grid; gap: .6em; }
.slot { display: grid; grid-template-columns: 120px 1fr auto; gap: 1em; align-items: center; padding: .6em; border-radius: 4px; background: rgba(255,255,255,.35); }
.slot .s-art { aspect-ratio: 3/2; background-size: cover; background-position: center; border-radius: 3px; }
.setting { display: grid; grid-template-columns: 200px 1fr; gap: 1em; align-items: center; margin: .5em 0; }
.setting input[type=range] { width: 100%; accent-color: var(--accent); }
.keys td { padding: .15em .8em .15em 0; } .keys kbd { font-family: inherit; border: 1px solid rgba(90,65,30,.4); border-bottom-width: 2px; border-radius: 4px; padding: 0 .4em; background: #fffaf0; }

/* map */
.map-wrap { position: relative; width: 100%; max-width: 900px; margin: 0 auto; }
.map-wrap svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.18)); }
.map-legend { text-align: center; color: var(--ink-soft); font-style: italic; margin-top: .6em; }

/* ---------------- title ---------------- */
#title { position: fixed; inset: 0; z-index: 90; overflow: hidden; background: #0d0a06; }
.title-art { position: absolute; inset: 0; }
.title-art img { position: absolute; inset: -4%; width: 108%; height: 108%; object-fit: cover; animation: titledrift 60s ease-in-out infinite alternate; filter: saturate(.92); }
@keyframes titledrift { from { transform: scale(1.0) translate(0, 0); } to { transform: scale(1.08) translate(-2%, -1%); } }
#title::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 90% at 70% 40%, transparent 30%, rgba(10,7,3,.55) 100%), linear-gradient(90deg, rgba(10,7,3,.62), rgba(10,7,3,.15) 55%, transparent); pointer-events: none; }
.title-card { position: absolute; z-index: 2; left: 6vw; top: 50%; translate: 0 -50%; color: #f8eed6; max-width: 560px; text-shadow: 0 2px 18px rgba(0,0,0,.55); }
.title-kicker { letter-spacing: .3em; text-transform: uppercase; font-size: .78em; opacity: .85; margin: 0 0 1.2em; animation: rise 2s .3s var(--ease) both; }
.title-main { margin: 0; font-weight: 400; line-height: .95; animation: rise 2.4s .6s var(--ease) both; }
.title-main .t-the { display: block; font-style: italic; font-size: clamp(1.6em, 3vw, 2.5em); opacity: .9; }
.title-main .t-oz { display: block; font-size: clamp(3em, 7vw, 6.2em); letter-spacing: -.01em; background: linear-gradient(180deg, #fff7dc, #f2d27a 55%, #c99a2e); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 10px rgba(0,0,0,.45)); }
.title-sub { font-style: italic; font-size: 1.5em; margin: .4em 0 1.6em; opacity: .9; animation: rise 2.4s 1s var(--ease) both; }
.title-menu { display: flex; flex-direction: column; gap: .5em; align-items: flex-start; animation: rise 2.4s 1.3s var(--ease) both; }
.title-menu button { border: 0; background: none; color: #fbf1d8; font-size: 1.35em; padding: .15em 0; text-shadow: 0 2px 8px rgba(0,0,0,.6); display: flex; gap: .6em; align-items: center; transition: transform .25s var(--ease), color .2s; }
.title-menu button::before { content: '❧'; color: var(--gold-hi); opacity: 0; transform: translateX(-8px); transition: .25s; }
.title-menu button:hover, .title-menu button:focus-visible { color: #fff; transform: translateX(6px); }
.title-menu button:hover::before, .title-menu button:focus-visible::before { opacity: 1; transform: none; }
.title-menu button.primary { font-size: 1.7em; font-style: italic; }
.title-menu small { font-size: .62em; opacity: .7; font-style: italic; }
.title-foot { margin-top: 2.2em; font-style: italic; opacity: .7; animation: rise 2.4s 1.8s var(--ease) both; }

/* ---------------- small screens ---------------- */
@media (max-width: 820px) and (min-height: 521px) and (orientation: landscape) {
  :root { --ui: 14px; }
  #hud-bottom { grid-template-columns: 1fr; padding: 0 .6em .6em; gap: .5em; }
  #party, #satchel { justify-content: center; }
  #party { order: 1; } #satchel { order: 2; } #cmd { order: 3; }
  .medal { width: 46px; height: 46px; }
  #ribbon { bottom: 12.5em; max-height: 38vh; }
  #talk { bottom: 12.5em; }
  .leaf { width: 100%; max-height: 60vh; padding: 1.5em 1.5em 1em; }
  #page { padding: 3vh 3vw; align-items: flex-end; }
  .title-card { left: 6vw; right: 6vw; top: auto; bottom: 6vh; translate: none; }
  .exit .lbl { display: none; }
  .book-body { padding: 1.6em 1.2em; }
}
@media (prefers-reduced-motion: reduce) {
  .plate.drift .world { animation: none; }
  .spot::before, .spot::after { animation: none; }
  .title-art img { animation: none; }
}
body.reduce-motion .plate.drift .world, body.reduce-motion .title-art img { animation: none; }

/* ================= PHONE (held upright) ================= */
body.phone { --hud-h: 112px; background: #1a140c; }
body.phone #stage { height: var(--stage-h); bottom: auto; touch-action: pan-y; }
body.phone .plate .world, body.phone .plate.drift .world { top: 0; transform: none !important; animation: none !important; transition: left .3s ease-out; }
body.phone #stage::before, body.phone #stage::after { content: '\2039'; position: absolute; top: 0; bottom: 0; width: 34px; z-index: 5; display: grid; place-items: center; color: #fff6dc; font-size: 30px; text-shadow: 0 1px 6px #000; pointer-events: none; opacity: 0; transition: opacity .3s; }
body.phone #stage::before { left: 0; background: linear-gradient(90deg, rgba(20,12,4,.55), transparent); }
body.phone #stage::after { content: '\203a'; right: 0; background: linear-gradient(270deg, rgba(20,12,4,.55), transparent); }
body.phone #stage.more-left::before, body.phone #stage.more-right::after { opacity: 1; }
body.phone .vignette { background: linear-gradient(rgba(10,8,4,.45), transparent 22%, transparent 80%, rgba(10,8,4,.5)); }
body.phone .spot { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
body.phone #exits { position: fixed; inset: auto; top: var(--stage-h); left: 0; right: 0; height: 46px; z-index: 16; display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 0 8px; background: #241a0f; border-top: 1px solid #4a3a22; border-bottom: 1px solid #4a3a22; scrollbar-width: none; pointer-events: auto; }
body.phone .exit { position: static !important; translate: none !important; transform: none !important; flex: none; top: auto !important; font-size: 14px; opacity: 1; background: #3d2f1b; padding: .45em .9em; }
body.phone .exit .lbl { display: inline; }
body[data-mode="page"].phone #exits { opacity: .3; }
body.phone #hud-top { padding: 8px 10px; }
body.phone #placard { max-width: 52vw; } body.phone #room-label { font-size: 1.15em; max-width: 52vw; } body.phone #chapter-label { font-size: .68em; }
body.phone .tool { height: 2.3em; min-width: 2.3em; padding: 0 .45em; }
body.phone #ribbon { left: 0; right: 0; translate: none; width: auto; top: calc(var(--stage-h) + 46px); bottom: var(--hud-h); max-height: none; padding: 8px 10px; gap: 6px; pointer-events: auto; overflow-y: auto; }
body.phone .say { font-size: 16px; padding: .7em 1em .9em; box-shadow: 0 2px 10px rgba(0,0,0,.35), inset 0 0 0 1px rgba(150,115,60,.35); }
body.phone .say-body { max-height: none; overflow: visible; } body.phone .say-more { display: none; }
body.phone .say.faded { opacity: .55; pointer-events: auto; }
body.phone #hud-bottom { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: #241a0f; border-top: 1px solid #4a3a22; height: var(--hud-h); align-content: start; }
body.phone #party, body.phone #satchel { order: 0; }
body.phone #hud-bottom > #party { grid-row: 1; }
body.phone #hud-bottom { grid-template-areas: "medals" "cmd"; }
body.phone #party { display: flex; justify-content: flex-start; gap: 6px; overflow-x: auto; }
body.phone #satchel { position: absolute; top: 6px; right: 8px; left: auto; max-width: 52vw; justify-content: flex-end; flex-wrap: nowrap; overflow-x: auto; }
body.phone .medal { width: 46px; height: 46px; } body.phone .medal.small { width: 42px; height: 42px; }
body.phone .medal .lbl { display: none; }
body.phone #cmd { order: 3; padding: .4em .9em; } body.phone #cmd-input { font-size: 16px; }
body.phone #talk { left: 0; right: 0; translate: none; width: auto; bottom: var(--hud-h); border-radius: 12px 12px 0 0; max-height: 46vh; overflow: auto; }
body.phone #page { padding: 0; align-items: flex-end; justify-content: stretch; }
body.phone .leaf { width: 100%; max-height: calc(100vh - var(--stage-h) + 24px); border-radius: 14px 14px 0 0; padding: 1.3em 1.3em calc(1em + env(safe-area-inset-bottom)); }
body.phone #coin button { width: 60px; height: 60px; margin: -30px; }
body.phone #toasts { top: auto; bottom: calc(var(--hud-h) + 8px); right: 8px; left: 8px; align-items: center; }
body.phone .book-inner { width: 100vw; height: 100vh; border-radius: 0; } body.phone .book-body { padding: 1.4em 1.1em; }
body.phone .wonder-grid { grid-template-columns: repeat(2, 1fr); gap: .6em; }
body.phone .slot { grid-template-columns: 80px 1fr; } body.phone .slot > .row { grid-column: 1 / -1; }
body.phone .setting { grid-template-columns: 1fr; gap: .3em; }
body.phone .title-art { bottom: 45%; } body.phone .title-art img { inset: 0; width: 100%; height: 100%; }
body.phone .title-card { left: 6vw; right: 6vw; top: auto; bottom: 4vh; translate: none; }
body.phone .title-main .t-oz { font-size: 3.1em; } body.phone .title-menu button { font-size: 1.2em; } body.phone .title-menu button.primary { font-size: 1.45em; }
body.phone #title::after { background: linear-gradient(180deg, transparent 30%, rgba(10,7,3,.85) 58%, rgba(10,7,3,.95)); }

/* ================= PHONE (held sideways) / short screens ================= */
body.short { --ui: 13px; }
body.short #hud-top { padding: .5em .8em; } body.short .medal { width: 40px; height: 40px; } body.short .medal.small { width: 36px; height: 36px; }
body.short #hud-bottom { padding: 0 .7em .5em; grid-template-columns: 1fr minmax(220px, 40vw) 1fr; }
body.short #cmd { padding: .35em .8em; } body.short #cmd-input { font-size: 15px; }
body.short #talk { bottom: 3.9em; max-height: 60vh; overflow: auto; }
body.short #ribbon { bottom: 3.9em; max-height: 44vh; width: min(640px, 64vw); }
body.short .say-body { max-height: 24vh; }
body.short .leaf { max-height: 88vh; width: min(560px, 56vw); padding: 1.1em 1.4em .8em; }
body.short #page { padding: 3vh 3vw; }
body.short .exit .lbl { display: none; }
.ch-end { font-size: .78em; letter-spacing: .32em; text-transform: uppercase; opacity: .6; margin-bottom: 1.4em; animation: rise 1.2s var(--ease) both; }
.ch-end[hidden] { display: none; }

/* =====================================================================================================
   2026-11-07 · polish pass: epigraphs, friends' asides, Wonder clues, next-chapter glimpse, the finale,
   a living title. Everything respects "Living pictures" off and prefers-reduced-motion.
   ===================================================================================================== */

/* small capitals for command words in hints (TAKE the CARROTS → take the carrots in small caps) */
.sc { font-variant: small-caps; font-variant-caps: all-small-caps; letter-spacing: .06em; font-style: normal; color: var(--accent); font-weight: 700; }

/* chapter card: a line from Baum's chapter */
.ch-epi { margin: 1.5em auto 0; max-width: min(36em, 82vw); padding: 0; font-style: italic; font-size: clamp(1.02em, 1.5vw, 1.28em); line-height: 1.55; color: rgba(247,236,210,.88);
  text-shadow: 0 1px 16px rgba(0,0,0,.6); animation: rise 2s 1.7s var(--ease) both; text-wrap: balance; }
.ch-epi p { margin: 0; }
.ch-epi cite { display: block; margin-top: .7em; font-style: normal; font-size: .72em; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-hi); opacity: .75; }
.ch-epi cite::before { content: '—\00a0'; letter-spacing: 0; }
#chapter .ch-orn { animation-delay: 1.1s; }
body.phone .ch-epi { font-size: 1.02em; max-width: 88vw; }

/* friends' asides when you pause: lighter paper, a little set apart */
.say.aside { background: linear-gradient(180deg, rgba(250,244,228,.9), rgba(240,228,200,.9)); font-style: italic; color: var(--ink-soft); animation: asidein 1.4s var(--ease) both; }
.say.aside .who { font-style: normal; }
@keyframes asidein { from { opacity: 0; transform: translateY(8px); filter: blur(2px); } }

/* Book of Wonders: clues on locked cards */
.wcard .w-x.tease { font-style: italic; color: #7a6646; }
.wcard .w-x.tease::before { content: '✦ '; color: var(--gold); font-style: normal; }

/* first Wonder toast explains what Wonders are */
.toast .t-x { font-size: .84em; line-height: 1.4; margin-top: .3em; opacity: .9; max-width: 30em; }
.toast.first { border-radius: 18px; max-width: 440px; align-items: flex-start; padding-top: .7em; padding-bottom: .75em; }

/* act end: a glimpse of the next chapter */
.endcard .next-up { display: inline-flex; align-items: center; gap: 1em; margin: .6em auto 0; padding: .5em 1.2em .5em .5em; border-radius: 8px; background: rgba(255,255,255,.4); box-shadow: 0 2px 10px rgba(0,0,0,.12); text-align: left; }
.endcard .next-up .n-art { width: 132px; aspect-ratio: 3/2; border-radius: 5px; background-size: cover; background-position: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.endcard .next-up .n-t span { display: block; font-size: .72em; letter-spacing: .24em; text-transform: uppercase; color: var(--accent); }
.endcard .next-up .n-t em { font-size: 1.25em; }

/* ---------------- the finale ---------------- */
body[data-mode="finale"] #hud-top, body[data-mode="finale"] #hud-bottom, body[data-mode="finale"] #ribbon, body[data-mode="finale"] #exits { opacity: 0; pointer-events: none; }
#finale { position: fixed; inset: 0; z-index: 78; overflow: hidden; background: #0d0a06; color: #f8eed6; cursor: pointer; animation: fadein 2.4s both; }
#finale .fin-plate { position: absolute; inset: -3%; background-size: cover; background-position: center; opacity: 0; transition: opacity 2.2s var(--ease); }
#finale .fin-plate.on { opacity: 1; animation: finkb 9s ease-out both; }
@keyframes finkb { from { transform: scale(1.0); } to { transform: scale(1.07) translate(-1%, -.6%); } }
#finale .fin-veil { position: absolute; inset: 0; pointer-events: none; transition: background 2s;
  background: radial-gradient(ellipse 90% 80% at 50% 45%, rgba(10,7,3,.2), rgba(10,7,3,.75)), linear-gradient(to bottom, rgba(10,7,3,.15), transparent 40%, rgba(10,7,3,.7)); }
#finale .fin-title { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; transition: opacity 1.6s, transform 1.6s var(--ease); }
#finale .fin-and { margin: 0; font-style: italic; font-size: 1.3em; letter-spacing: .1em; opacity: .85; animation: rise 2.4s .8s var(--ease) both; }
#finale h1 { margin: .1em 0 0; font-weight: 400; font-style: italic; font-size: clamp(3.6em, 10vw, 8em); line-height: 1; animation: rise 3s 1.4s var(--ease) both;
  background: linear-gradient(100deg, #c99a2e 0%, #f2d27a 35%, #fff7dc 50%, #f2d27a 65%, #c99a2e 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 22px rgba(0,0,0,.55)); }
#finale h1 { animation: rise 3s 1.4s var(--ease) both, gilt 7s 3s ease-in-out infinite; }
#finale.rolling .fin-title, #finale.closing .fin-title { opacity: 0; transform: translateY(-20px); }
#finale .fin-cap { position: absolute; left: 6vw; bottom: 9vh; max-width: 70vw; opacity: 0; transform: translateY(12px); transition: opacity 1.1s, transform 1.1s var(--ease); text-shadow: 0 2px 16px rgba(0,0,0,.75); pointer-events: none; }
#finale .fin-cap.on { opacity: 1; transform: none; transition-delay: .5s; }
#finale .fin-ch { display: block; font-size: .8em; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-hi); }
#finale .fin-t { display: block; font-size: clamp(1.6em, 3.4vw, 2.8em); margin: .15em 0; }
#finale .fin-w { display: block; font-size: .9em; font-style: italic; opacity: .75; }
#finale .fin-skip { position: absolute; right: 1.4em; bottom: 1.2em; border: 0; border-radius: 99px; padding: .35em 1em; background: rgba(20,14,6,.55); color: #fbefd2; font-style: italic; opacity: .6; transition: opacity .3s; }
#finale .fin-skip:hover, #finale .fin-skip:focus-visible { opacity: 1; }
#finale.closing { cursor: default; }
#finale.closing .fin-veil { background: radial-gradient(ellipse 100% 90% at 50% 50%, rgba(10,7,3,.55), rgba(10,7,3,.88)); }
#finale .fin-card { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: min(760px, 92vw); max-height: 88vh; overflow: auto; padding: 2.2em 2.6em 1.8em; border-radius: 6px; text-align: center; color: var(--ink);
  background: radial-gradient(ellipse at 30% 10%, #fbf4e1, #f0e1bd 70%, #e3cc9c); box-shadow: 0 40px 90px rgba(0,0,0,.65), inset 0 0 90px rgba(160,120,60,.3); animation: leafin 1.4s .4s var(--ease) both; cursor: auto; }
#finale .fin-card::before { content: ''; position: absolute; inset: 10px; border: 1px solid rgba(140,100,50,.35); pointer-events: none; border-radius: 3px; }
#finale .fin-k { margin: 0; font-size: .78em; letter-spacing: .3em; text-transform: uppercase; color: var(--accent); }
#finale .fin-card h2 { margin: .1em 0 .4em; font-weight: 400; font-style: italic; font-size: 2.4em; }
#finale .fin-card h3 { margin: 1.5em 0 .5em; font-weight: 400; letter-spacing: .2em; text-transform: uppercase; font-size: .8em; color: var(--accent); }
#finale .fin-stats { margin: 0; } #finale .fin-verdict { font-style: italic; color: var(--ink-soft); margin: .5em 0 0; }
#finale .fin-note { font-style: italic; color: var(--ink-soft); margin: -.2em 0 1em; font-size: .92em; }
#finale .fin-friend { display: grid; grid-template-columns: 68px 1fr; gap: .9em; align-items: center; text-align: left; margin: .7em auto; max-width: 600px; }
#finale .fin-friend .medal { width: 64px; height: 64px; cursor: default; }
#finale .fin-friend p { margin: .15em 0 0; font-size: .92em; line-height: 1.5; color: var(--ink-soft); }
#finale .fin-credit { font-size: .92em; color: var(--ink-soft); }
#finale .fin-btns { justify-content: center; margin-top: 1.5em; }
body.phone #finale .fin-card { padding: 1.6em 1.2em 1.2em; } body.phone #finale .fin-cap { left: 5vw; right: 5vw; max-width: none; bottom: 7vh; }

/* ---------------- a living title ---------------- */
#title .title-art::after { content: ''; position: absolute; inset: -20%; pointer-events: none; mix-blend-mode: multiply; opacity: .55;
  background: radial-gradient(ellipse 38% 26% at 30% 40%, rgba(40,32,20,.55), transparent 70%), radial-gradient(ellipse 30% 20% at 75% 30%, rgba(40,32,20,.4), transparent 70%);
  animation: cloudshadow 48s linear infinite; }
@keyframes cloudshadow { from { transform: translateX(-18%); } to { transform: translateX(18%); } }
#title .title-art img { animation: titlein 3.2s ease-out both, titledrift 60s 3.2s ease-in-out infinite alternate; }
@keyframes titlein { from { opacity: 0; transform: scale(1.04); filter: brightness(.4) saturate(.6); } }
.title-main .t-oz { background: linear-gradient(100deg, #c99a2e 0%, #f2d27a 30%, #fff7dc 48%, #f2d27a 62%, #c99a2e 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text;
  animation: gilt 9s 3s ease-in-out infinite; }
@keyframes gilt { 0%, 55% { background-position: 100% 0; } 85%, 100% { background-position: 0% 0; } }
.title-menu button { opacity: 0; animation: menuin 1.1s var(--ease) both; }
.title-menu button:nth-child(1) { animation-delay: 1.9s; } .title-menu button:nth-child(2) { animation-delay: 2.05s; } .title-menu button:nth-child(3) { animation-delay: 2.2s; }
.title-menu button:nth-child(4) { animation-delay: 2.35s; } .title-menu button:nth-child(5) { animation-delay: 2.5s; } .title-menu button:nth-child(6) { animation-delay: 2.65s; } .title-menu button:nth-child(7) { animation-delay: 2.8s; }
@keyframes menuin { from { opacity: 0; translate: -10px 0; } to { opacity: 1; translate: 0 0; } }
.title-menu { animation: none; }
.title-finished { margin: -.6em 0 1.2em; font-style: italic; font-size: .95em; color: var(--gold-hi); opacity: .85; animation: rise 2.4s 1.6s var(--ease) both; }

/* nothing moves for people who asked for stillness */
body.reduce-motion #title .title-art::after, body.reduce-motion .title-main .t-oz, body.reduce-motion #finale h1, body.reduce-motion #finale .fin-plate.on { animation: none; }
@media (prefers-reduced-motion: reduce) {
  #title .title-art::after, .title-main .t-oz, #finale h1, #finale .fin-plate.on, .ch-epi, .say.aside { animation: none !important; }
  .title-menu button { animation: none; opacity: 1; }
}
/* a chapter-end card sits in the middle of its page, not at the top */
.book-body > .endcard:only-child { min-height: 100%; display: flex; flex-direction: column; justify-content: center; }
.book-body > .endcard:only-child > * { flex: none; }
/* continuing a journey: the last thing that happened */
.say.recap { background: linear-gradient(180deg, rgba(250,244,228,.86), rgba(238,226,198,.86)); font-style: italic; color: var(--ink-soft); }
.say.recap::before { content: 'Where the story left off'; display: block; font-style: normal; font-size: .72em; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); margin-bottom: .3em; }
/* the map: click or tap to look closer */
.map-wrap { overflow: hidden; border-radius: 4px; cursor: zoom-in; }
.map-wrap svg { transition: transform .6s var(--ease); }
.map-wrap.zoomed { cursor: zoom-out; }
.map-wrap.zoomed svg { transform: scale(2.4); }
.title-loading { margin: 0; font-style: italic; font-size: 1.15em; opacity: .75; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }
/* the way back to Oz Castle */
.title-castle { position: absolute; z-index: 3; top: 1.3em; left: 1.6em; color: #f8eed6; text-decoration: none; font-size: .8em; letter-spacing: .22em; text-transform: uppercase;
  opacity: .62; text-shadow: 0 1px 8px rgba(0,0,0,.6); transition: opacity .25s, translate .25s var(--ease); animation: rise 2s 2.4s var(--ease) backwards; }
.title-castle:hover, .title-castle:focus-visible { opacity: 1; translate: -3px 0; }
body.phone .title-castle { top: 1em; left: 1em; }
