/* The Lost Post Office — styles. Minimum text 14px; reading text 17px. */
:root {
  --night: #141821;
  --night-2: #1d2330;
  --night-3: #283044;
  --ink: #2b1d14;
  --ink-soft: #5a4532;
  --paper: #f7eedb;
  --paper-2: #efe0c2;
  --paper-3: #e2cda4;
  --amber: #e7a94f;
  --amber-2: #f3c477;
  --gold: #c99a3e;
  --cream: #fbf4e4;
  --teal: #2a7180;
  --rose: #c97b6b;
  --sage: #6f8a55;
  --text: #f4ead6;
  --text-soft: #cdbf9f;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-title: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
  --top: 64px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #232b3b 0%, var(--night) 60%) fixed, var(--night);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
img.fadein { opacity: 0; transition: opacity .45s ease; }
img.fadein.ready { opacity: 1; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: .005em; }
h1 { font-size: clamp(34px, 6vw, 58px); }
h2 { font-size: clamp(26px, 4vw, 36px); }
h3 { font-size: 22px; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber-2); outline-offset: 3px; border-radius: 8px; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 90; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, rgba(20, 24, 33, .96), rgba(20, 24, 33, .82));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(231, 169, 79, .18);
}
.topbar .brand { flex: 1; min-width: 0; font-family: var(--font-title); color: var(--amber-2); background: none; border: 0; text-align: left; padding: 4px 2px; display: flex; flex-direction: column; line-height: 1.1; }
.topbar .brand .b1 { font-size: 19px; font-weight: 600; white-space: nowrap; }
.topbar .brand .b2 { font-size: 14px; font-style: italic; color: var(--text-soft); white-space: nowrap; }
@media (max-width: 380px) { .topbar .brand .b1 { font-size: 15px !important; } .topbar .iconbtn { width: 40px !important; height: 40px !important; } .topbar { gap: 4px !important; } }
@media (max-width: 600px) { .topbar { gap: 6px; padding: 0 8px; } .topbar .iconbtn { width: 42px; height: 42px; } .topbar .map-btn { display: none; } .topbar .brand .b1 { font-size: 17px; } }
.iconbtn {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: inline-grid; place-items: center;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(231, 169, 79, .22); color: var(--amber-2);
  transition: background .2s, transform .15s;
}
.iconbtn:hover { background: rgba(231, 169, 79, .14); }
.iconbtn:active { transform: scale(.94); }
.iconbtn .badge { position: absolute; transform: translate(14px, -14px); background: var(--rose); color: #fff; font-size: 14px; font-weight: 800; border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 5px; }
.ico { width: 22px; height: 22px; }
.ico-sm { width: 18px; height: 18px; }
.ico-lg { width: 30px; height: 30px; }

.stepper { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 10px 12px 0; }
.stepper i { width: 10px; height: 10px; border-radius: 99px; background: rgba(244, 234, 214, .2); transition: all .3s; }
.stepper i.on { width: 28px; background: var(--amber); }
.stepper i.done { background: var(--amber-2); opacity: .7; }
.stepper-label { text-align: center; color: var(--text-soft); font-size: 14px; margin-top: 6px; }

/* ---------- Screen ---------- */
#screen { flex: 1; display: flex; flex-direction: column; }
.screen { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 18px 16px 110px; animation: screenIn .45s ease both; }
.screen.narrow { max-width: 720px; }
.screen.full { max-width: none; padding: 0; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.screen-head { text-align: center; margin: 6px auto 18px; max-width: 640px; }
.screen-head p { color: var(--text-soft); margin-top: 8px; }
.hint { color: var(--text-soft); font-size: 16px; text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 24px; border-radius: 16px; border: 0;
  font-weight: 800; font-size: 17px; letter-spacing: .01em;
  background: linear-gradient(180deg, var(--amber-2), var(--amber)); color: #2a1a08;
  box-shadow: 0 6px 0 #a8702a, 0 10px 24px rgba(0, 0, 0, .3);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #a8702a, 0 6px 14px rgba(0, 0, 0, .3); }
.btn[disabled] { filter: grayscale(.8) brightness(.7); cursor: not-allowed; transform: none; box-shadow: 0 4px 0 #5a4a33; }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--text); border: 1px solid rgba(231, 169, 79, .35); box-shadow: none; }
.btn.ghost:active { transform: scale(.97); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 16px; }
.btn.paper { background: var(--paper); color: var(--ink); box-shadow: 0 5px 0 var(--paper-3), 0 10px 20px rgba(0, 0, 0, .25); }
.btn.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 0 #a8702a, 0 0 0 0 rgba(243, 196, 119, .55); } 50% { box-shadow: 0 6px 0 #a8702a, 0 0 0 14px rgba(243, 196, 119, 0); } }

/* ---------- Paper card ---------- */
.paper {
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, .55), transparent 60%),
    linear-gradient(180deg, var(--paper), var(--paper-2));
  color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(120, 85, 40, .25);
}
.paper .muted { color: var(--ink-soft); }
.panel { background: rgba(255, 255, 255, .045); border: 1px solid rgba(231, 169, 79, .16); border-radius: var(--radius); padding: 18px; }

/* ---------- Title ---------- */
.title-screen { position: relative; min-height: calc(100dvh - var(--top)); display: grid; place-items: end start; overflow: hidden; }
.title-screen .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: slowZoom 30s ease-in-out infinite alternate; }
@keyframes slowZoom { from { transform: scale(1.02); } to { transform: scale(1.1) translate(-1%, -1%); } }
.title-screen .veil { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14, 16, 24, .88) 0%, rgba(14, 16, 24, .55) 45%, rgba(14, 16, 24, 0) 75%), linear-gradient(0deg, rgba(14, 16, 24, .7), transparent 50%); }
.title-card { position: relative; z-index: 2; max-width: 560px; padding: 32px 22px 48px; }
.title-card h1 { color: var(--cream); text-shadow: 0 4px 24px rgba(0, 0, 0, .5); }
.title-card h1 small { display: block; font-size: .55em; color: var(--amber-2); font-style: italic; margin-top: 4px; }
.title-card .tagline { color: var(--text); margin: 16px 0 26px; font-size: 18px; max-width: 46ch; }
.title-card .menu { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.title-card .menu .row { gap: 10px; }
.progress-pill { display: inline-flex; gap: 8px; align-items: center; padding: 8px 14px; border-radius: 99px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(231, 169, 79, .3); color: var(--amber-2); font-size: 15px; font-weight: 700; margin-bottom: 14px; }

/* ---------- Intro ---------- */
.intro { position: fixed; inset: 0; z-index: 60; background: #0b0d13; display: grid; }
.intro img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; }
.intro img.show { opacity: 1; animation: kenburns 12s ease-out both; }
@keyframes kenburns { from { transform: scale(1.12); } to { transform: scale(1); } }
.intro .caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 22px calc(28px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(8, 9, 14, .95), rgba(8, 9, 14, .6) 70%, transparent); }
.intro .caption .inner { max-width: 720px; margin: 0 auto; }
.intro .caption h2 { color: var(--amber-2); margin-bottom: 10px; }
.intro .caption p { font-size: 18px; color: var(--text); }
.intro .skip { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 3; }
.doors { position: absolute; inset: 0; display: flex; pointer-events: none; z-index: 4; perspective: 1400px; }
.doors span { flex: 1; position: relative; overflow: hidden; transition: transform 1.4s cubic-bezier(.6, .05, .3, 1), filter 1.4s; }
.doors span i { position: absolute; top: 0; bottom: 0; width: 200%; }
.doors span i img { width: 100%; height: 100%; object-fit: cover; opacity: 1; transition: none; animation: none; }
.doors span:first-child { transform-origin: left center; }
.doors span:last-child { transform-origin: right center; }
.doors span:last-child i { left: -100%; }
.doors.open span:first-child { transform: rotateY(-105deg); filter: brightness(.6); }
.doors.open span:last-child { transform: rotateY(105deg); filter: brightness(.6); }
.door-glow { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: radial-gradient(60% 70% at 50% 55%, #fff6d8 0%, #f6c66a 35%, #8a4f1c 75%, #2a160a 100%); transition: opacity .3s; }
.door-glow.on { opacity: 1; }
.intro.to-light::after { content: ''; position: absolute; inset: 0; z-index: 9; background: #fff3d6; animation: fadeIn .6s ease forwards; }
.intro .caption { transition: opacity .3s; z-index: 5; }

/* ---------- Registry ---------- */
.field label { display: block; font-weight: 800; margin-bottom: 8px; }
.input, .textarea {
  width: 100%; min-height: 54px; padding: 12px 16px; border-radius: 14px;
  background: var(--cream); color: var(--ink); border: 2px solid var(--paper-3); font-size: 18px;
}
.input:focus, .textarea:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 4px rgba(231, 169, 79, .25); }
.companions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .companions { grid-template-columns: repeat(4, 1fr); } }
.companion-card { padding: 12px; border-radius: 16px; border: 2px solid var(--paper-3); background: var(--cream); color: var(--ink); text-align: center; transition: transform .15s, border-color .2s, box-shadow .2s; }
.companion-card img { width: 100%; aspect-ratio: 1; object-fit: contain; }
.companion-card strong { display: block; font-family: var(--font-title); font-size: 20px; }
.companion-card span { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.35; margin-top: 4px; }
.companion-card[aria-pressed="true"] { border-color: var(--amber); box-shadow: 0 0 0 4px rgba(231, 169, 79, .35); transform: translateY(-3px); }

/* ---------- Counter ---------- */
.counter-hero { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; min-height: 170px; display: grid; align-items: end; box-shadow: var(--shadow); }
.counter-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.counter-hero .veil { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(14, 16, 24, .9), rgba(14, 16, 24, .2)); }
.counter-hero .inner { position: relative; padding: 18px; }
.counter-hero p { color: var(--text-soft); }
.envelopes { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.env-card { position: relative; padding: 0; overflow: hidden; text-align: left; border: 0; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.env-card:hover { transform: translateY(-4px) rotate(-.4deg); }
.env-card .thumb { height: 120px; position: relative; overflow: hidden; }
.env-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.env-card .thumb .tag { position: absolute; top: 10px; left: 10px; display: inline-flex; gap: 6px; align-items: center; background: rgba(20, 16, 10, .72); color: var(--amber-2); border-radius: 99px; padding: 4px 10px; font-size: 14px; font-weight: 800; }
.env-card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.env-card h3 { font-size: 21px; }
.env-card .to { font-size: 15px; color: var(--ink-soft); }
.env-card .foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.status { font-size: 14px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: rgba(120, 85, 40, .12); color: var(--ink-soft); }
.status.done { background: rgba(85, 112, 58, .18); color: #3d5527; }
.status.going { background: rgba(231, 169, 79, .25); color: #7a4c10; }
.wax-dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 240, 220, .9); box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .35), inset 0 3px 6px rgba(255, 255, 255, .25), 0 3px 6px rgba(0, 0, 0, .3); }
.final-env { margin-bottom: 18px; display: flex; gap: 16px; align-items: center; padding: 18px; flex-wrap: wrap; border: 2px solid var(--gold); animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 34px rgba(243, 196, 119, .55); } }
.final-env img { width: 140px; }

/* ---------- Envelope inspection ---------- */
.inspect { position: relative; max-width: 720px; margin: 0 auto; aspect-ratio: 4 / 3; touch-action: none; user-select: none; cursor: none; border-radius: 12px; }
.inspect .env-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45)); }
.inspect .dust { position: absolute; inset: 0; width: 100%; height: 100%; }
.loupe {
  position: absolute; width: 150px; height: 150px; margin: -75px 0 0 -75px; border-radius: 50%;
  border: 10px solid #b8862b; box-shadow: 0 0 0 3px #6e4c16, 0 12px 26px rgba(0, 0, 0, .5), inset 0 0 22px rgba(255, 240, 200, .5);
  pointer-events: none; transition: opacity .2s; z-index: 3;
}
.loupe::after { content: ''; position: absolute; width: 22px; height: 70px; background: linear-gradient(90deg, #5a3a1a, #8a5a2a); border-radius: 10px; right: -34px; bottom: -58px; transform: rotate(-40deg); }
.clue-pin { position: absolute; width: 18%; aspect-ratio: 1; margin: -9% 0 0 -9%; border-radius: 50%; border: 3px dashed transparent; z-index: 2; transition: border-color .3s, background .3s; }
.clue-pin.found { border-color: var(--amber-2); background: rgba(243, 196, 119, .12); animation: foundPop .5s ease; }
@keyframes foundPop { 0% { transform: scale(.6); } 70% { transform: scale(1.12); } }
.clue-list { display: grid; gap: 10px; margin-top: 18px; }
@media (min-width: 760px) { .clue-list { grid-template-columns: repeat(3, 1fr); } }
.clue { padding: 14px 16px; border-radius: 14px; }
.clue strong { display: block; font-family: var(--font-title); font-size: 19px; }
.clue p { font-size: 16px; color: var(--ink-soft); }
.clue.locked { background: rgba(255, 255, 255, .04); border: 2px dashed rgba(231, 169, 79, .3); color: var(--text-soft); box-shadow: none; }

/* ---------- Journey ---------- */
.ticket { display: grid; grid-template-columns: 1fr auto; max-width: 720px; margin: 0 auto 18px; overflow: hidden; position: relative; }
.ticket .main { padding: 18px 20px; border-right: 3px dashed rgba(120, 85, 40, .35); }
.ticket .main small { display: block; font-size: 14px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 800; }
.ticket .main .big { font-family: var(--font-title); font-size: 24px; line-height: 1.2; margin-bottom: 8px; }
.ticket .stub { width: 150px; display: grid; place-items: center; padding: 14px; position: relative; }
.ticket .hole { width: 44px; height: 44px; border-radius: 50%; background: var(--night); box-shadow: inset 0 3px 6px rgba(0, 0, 0, .6); transform: scale(0); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.ticket.punched .hole { transform: scale(1); }
.chad { position: absolute; width: 44px; height: 44px; border-radius: 50%; background: var(--paper-2); pointer-events: none; animation: chadFall 1.1s ease-in forwards; }
@keyframes chadFall { to { transform: translate(40px, 260px) rotate(260deg); opacity: 0; } }
@media (max-width: 560px) { .ticket { grid-template-columns: 1fr; } .ticket .main { border-right: 0; border-bottom: 3px dashed rgba(120, 85, 40, .35); } .ticket .stub { width: auto; } }

.window.loading > * { opacity: 0; }
.window > * { transition: opacity .5s ease; }
.window.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(243, 196, 119, .25); border-top-color: var(--amber-2); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.window { position: relative; max-width: 980px; margin: 0 auto; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; background: #0b0d13; box-shadow: var(--shadow); touch-action: none; }
@media (max-width: 640px) { .window { aspect-ratio: 4 / 5; } }
.window .layer { position: absolute; left: 0; top: 0; height: 100%; display: flex; will-change: transform; }
.window .layer img { height: 100%; width: auto; max-width: none; flex: none; }
.window .layer img.flip { transform: scaleX(-1); }
.window .sky { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.window .frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; z-index: 6; }
.window .frame-css { position: absolute; inset: 0; z-index: 6; pointer-events: none; border: 18px solid #4a2f1a; border-radius: 22px; box-shadow: inset 0 0 0 4px #b8862b, inset 0 0 60px rgba(0, 0, 0, .55); }
.window .frame-css.boat { border-radius: 50%; border-width: 26px; margin: 3% 12%; }
.window canvas.fog { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; }
.window canvas.weather { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }
.sight { position: absolute; z-index: 5; width: 64px; height: 64px; margin: -32px 0 0 -32px; border: 0; background: none; padding: 0; font-size: 40px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); transition: transform .3s, opacity .4s; }
.sight.seen { transform: scale(1.4); opacity: 0; }
.livemap { position: relative; max-width: 560px; margin: 14px auto 0; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); border: 3px solid rgba(231, 169, 79, .35); }
.livemap > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); }
.livemap svg.route { position: absolute; inset: 0; width: 100%; height: 100%; }
.livemap .ghost { fill: none; stroke: rgba(255, 245, 220, .45); stroke-width: .5; stroke-dasharray: 1 1.2; }
.livemap .drawn { fill: none; stroke: #f3c477; stroke-width: .9; stroke-linecap: round; filter: drop-shadow(0 0 .6px rgba(0, 0, 0, .8)); }
.livemap .from { fill: #fbf4e4; stroke: #8a5a1c; stroke-width: .4; }
.livemap .to { fill: #c0392b; stroke: #fbf4e4; stroke-width: .5; animation: glow 2s ease-in-out infinite; }
.livemap .vehicle { position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 10px rgba(0, 0, 0, .45); border: 2px solid var(--amber); z-index: 2; }
.livemap .dest { position: absolute; background: rgba(20, 16, 10, .8); color: var(--cream); padding: 3px 10px; border-radius: 12px; font-size: 14px; font-weight: 800; line-height: 1.25; max-width: 62%; width: max-content; text-align: center; z-index: 1; }
.minimap { max-width: 980px; margin: 14px auto 0; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; color: var(--text-soft); font-size: 15px; font-weight: 700; }
.minimap .track { position: relative; height: 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.minimap .fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--amber), var(--amber-2)); }
.minimap .vehicle { position: absolute; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 10px rgba(0, 0, 0, .4); left: 0; }

/* ---------- Scene ---------- */
.scene-wrap { position: relative; width: 100%; max-width: 1280px; margin: 0 auto; }
.scene-view { position: relative; width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; border-radius: 0; -webkit-overflow-scrolling: touch; }
.scene-view::-webkit-scrollbar { display: none; }
.scene { position: relative; aspect-ratio: 16 / 9; width: 100%; }
@media (max-width: 720px) and (orientation: portrait) { .scene { width: 190%; } }
@media (min-width: 721px) { .scene-view { border-radius: var(--radius); box-shadow: var(--shadow); } }
.scene > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene .scene-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.scene .light { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 50% at 50% 40%, transparent, rgba(10, 8, 6, .35)); mix-blend-mode: multiply; }
.motes { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.motes i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 226, 160, .8); box-shadow: 0 0 8px rgba(255, 210, 130, .9); animation: mote linear infinite; }
@keyframes mote { from { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: .8; } to { transform: translate(30px, -120px); opacity: 0; } }
.hotspot {
  position: absolute; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; z-index: 3;
  border: 3px solid rgba(255, 245, 220, .95); background: radial-gradient(circle, rgba(255, 214, 140, .95), rgba(231, 169, 79, .75));
  color: #3a2408; display: grid; place-items: center; box-shadow: 0 0 0 0 rgba(255, 220, 150, .7), 0 6px 14px rgba(0, 0, 0, .4);
  animation: hotspotPulse 2.4s ease-in-out infinite;
}
.hotspot.visited { animation: none; background: rgba(40, 32, 22, .7); color: var(--amber-2); border-color: rgba(243, 196, 119, .6); }
@keyframes hotspotPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 220, 150, .65), 0 6px 14px rgba(0, 0, 0, .4); } 50% { box-shadow: 0 0 0 18px rgba(255, 220, 150, 0), 0 6px 14px rgba(0, 0, 0, .4); } }
.hidden-spot { position: absolute; border-radius: 50%; z-index: 2; background: transparent; border: 0; padding: 0; }
.hidden-spot.found { box-shadow: 0 0 0 3px rgba(255, 245, 220, .9), 0 0 24px rgba(255, 220, 150, .8); animation: foundPop .5s ease; pointer-events: none; }
.hidden-spot.found::after { content: '✦'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%); color: var(--amber-2); font-size: 20px; }
.edit-mode .hidden-spot { background: rgba(255, 0, 255, .25); border: 2px dashed #f0f; }
.edit-coords { position: fixed; left: 10px; bottom: 10px; z-index: 99; background: #000c; color: #0f0; font: 14px monospace; padding: 8px 10px; border-radius: 8px; max-width: 90vw; }
.scene-bar { max-width: 1280px; margin: 0 auto; display: flex; align-items: flex-end; gap: 12px; padding: 12px 16px 120px; flex-wrap: wrap; position: relative; z-index: 2; }
.scene-bar .counts { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; color: var(--text-soft); font-size: 15px; font-weight: 700; }
.scene-seek { max-width: 1280px; margin: 12px auto 0; padding: 0 16px; position: relative; z-index: 1; }
.seek { background: rgba(255, 255, 255, .05); border: 1px solid rgba(231, 169, 79, .22); border-radius: var(--radius); padding: 14px; }
.seek-title { font-family: var(--font-title); font-size: 19px; color: var(--amber-2); }
.seek-sub { color: var(--text-soft); font-size: 15px; margin: 2px 0 10px; }
.seek-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.seek-item { display: flex; gap: 10px; align-items: center; text-align: left; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(243, 196, 119, .45); background: rgba(0, 0, 0, .2); color: var(--text); font-weight: 700; font-size: 15px; }
.seek-item .tick { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(243, 196, 119, .18); color: var(--amber-2); font-weight: 900; }
.seek-item.got { border-style: solid; border-color: rgba(122, 160, 79, .6); background: rgba(85, 112, 58, .22); }
.seek-item.got .tick { background: var(--sage); color: #fff; }
.glint { position: absolute; z-index: 2; transform: translate(-50%, -50%); color: #fff6d8; font-size: 22px; pointer-events: none; text-shadow: 0 0 10px rgba(255, 220, 150, .95); animation: glint 1.6s ease-out forwards; }
@keyframes glint { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0); } 35% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(40deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(90deg); } }
.pan-hint { display: none; text-align: center; color: var(--text-soft); font-size: 14px; padding: 6px; }
@media (max-width: 720px) and (orientation: portrait) { .scene-seek { max-width: 1280px; margin: -96px auto 0; padding: 0 16px 120px; }
.seek { background: rgba(255, 255, 255, .05); border: 1px solid rgba(231, 169, 79, .22); border-radius: var(--radius); padding: 14px; }
.seek-title { font-family: var(--font-title); font-size: 19px; color: var(--amber-2); }
.seek-sub { color: var(--text-soft); font-size: 15px; margin: 2px 0 10px; }
.seek-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.seek-item { display: flex; gap: 10px; align-items: center; text-align: left; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1px dashed rgba(243, 196, 119, .45); background: rgba(0, 0, 0, .2); color: var(--text); font-weight: 700; font-size: 15px; }
.seek-item .tick { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(243, 196, 119, .18); color: var(--amber-2); font-weight: 900; }
.seek-item.got { border-style: solid; border-color: rgba(122, 160, 79, .6); background: rgba(85, 112, 58, .22); }
.seek-item.got .tick { background: var(--sage); color: #fff; }
.glint { position: absolute; z-index: 2; transform: translate(-50%, -50%); color: #fff6d8; font-size: 22px; pointer-events: none; text-shadow: 0 0 10px rgba(255, 220, 150, .95); animation: glint 1.6s ease-out forwards; }
@keyframes glint { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0); } 35% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(40deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(90deg); } }
.pan-hint { display: block; } }

.companion {
  position: fixed; z-index: 30; left: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); width: 80px; height: 80px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  border: 0; background: none; padding: 0; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .45));
  animation: bob 3.2s ease-in-out infinite; transform-origin: bottom center;
}
.companion img { width: 100%; height: 100%; object-fit: contain; }
.companion .pet-fig > img { height: auto; }
.companion.hop { animation: hop .6s ease; }
.companion:focus-visible { outline-offset: 6px; }
.window-pet { position: absolute; left: 4%; bottom: 3%; width: 17%; max-width: 120px; z-index: 7; pointer-events: none; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); transition: transform .4s; }
.window-pet .pet-fig { transform: rotate(-8deg); filter: brightness(.85); transition: transform .4s, filter .4s; }
.window-pet .zz { position: absolute; top: -8px; right: 0; font: 800 16px var(--font-body); color: var(--amber-2); animation: zz 2.6s ease-in-out infinite; }
.window-bubble { position: absolute; z-index: 8; left: 3%; bottom: calc(3% + min(17%, 120px) + 6px); max-width: min(70%, 320px); background: var(--cream); color: var(--ink); padding: 10px 14px; border-radius: 16px 16px 16px 4px; font-size: 16px; font-weight: 700; line-height: 1.35; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; pointer-events: none; }
.window-bubble.show { opacity: 1; transform: none; }
.wipe-hand { position: absolute; z-index: 8; top: 40%; left: 35%; font-size: 44px; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); animation: wipeHint 2.2s ease-in-out infinite; }
@keyframes wipeHint { 0% { transform: translate(0, 0) rotate(-10deg); opacity: 0; } 15% { opacity: 1; } 50% { transform: translate(120%, -20%) rotate(10deg); } 85% { opacity: 1; } 100% { transform: translate(0, 0) rotate(-10deg); opacity: 0; } }
.window-pet.awake { transform: translateY(-14px); }
.window-pet.awake .pet-fig { transform: rotate(0); filter: none; }
.window-pet.awake .zz { display: none; }
.pet-hint { position: absolute; z-index: 4; width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 240, 200, .75), rgba(255, 214, 140, 0) 70%); animation: hintPulse 1.8s ease-out forwards; }
@keyframes hintPulse { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1.6); } }
.companion.happy .pet-fig { animation: wiggle .35s ease-in-out 3; filter: drop-shadow(0 0 10px rgba(255, 214, 140, .8)); }
@keyframes wiggle { 25% { transform: rotate(-8deg) scale(1.06); } 75% { transform: rotate(8deg) scale(1.06); } }
.companion.sleep { animation: breathe 4s ease-in-out infinite; }
.companion.sleep .pet-fig { transform: rotate(-10deg) translateY(6px); filter: brightness(.82) saturate(.85); }
@keyframes breathe { 50% { transform: scale(1.03, .98); } }
.pet-fig { position: relative; width: 100%; }
.pet-fig > img { width: 100%; height: auto; display: block; }
.pet-acc { position: absolute; transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.pet-acc svg { width: 100%; height: auto; display: block; }
.companion .pet-fig, .window-pet .pet-fig { height: 100%; }
.wardrobe { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: start; margin-top: 18px; padding-top: 16px; border-top: 1px dashed rgba(120, 85, 40, .35); }
@media (max-width: 520px) { .wardrobe { grid-template-columns: 1fr; justify-items: center; } }
.wardrobe .preview { width: 150px; }
.acc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; width: 100%; }
.acc { min-height: 84px; border-radius: 14px; border: 2px solid var(--paper-3); background: var(--cream); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; font-size: 14px; font-weight: 700; text-align: center; }
.acc .ic { width: 46px; height: 32px; display: grid; place-items: center; }
.acc .ic svg { width: 100%; height: 100%; }
.acc[aria-pressed="true"] { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(231, 169, 79, .35); }
.acc[disabled] { opacity: .55; filter: grayscale(.7); }
.companion .zz { position: absolute; top: -6px; right: -4px; font: 800 16px var(--font-body); color: var(--amber-2); opacity: 0; letter-spacing: 2px; }
.companion.sleep .zz { animation: zz 2.6s ease-in-out infinite; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 6px); } 40% { opacity: .9; } 100% { opacity: 0; transform: translate(10px, -16px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes hop { 30% { transform: translateY(-26px) scale(1.05, .95); } 60% { transform: translateY(0) scale(.95, 1.05); } }
.bubble { position: fixed; z-index: 31; left: 84px; bottom: calc(64px + env(safe-area-inset-bottom)); max-width: min(260px, 60vw); background: var(--cream); color: var(--ink); padding: 10px 14px; border-radius: 16px 16px 16px 4px; pointer-events: none; font-size: 15px; font-weight: 700; box-shadow: var(--shadow); animation: screenIn .3s ease; }

/* ---------- Sheet (hotspot / dialogue) ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 50; background: rgba(8, 9, 14, .55); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet { width: 100%; max-width: 720px; max-height: 88dvh; overflow: auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; animation: sheetUp .35s cubic-bezier(.2, .9, .3, 1); }
@media (min-width: 760px) { .sheet-back { align-items: center; } .sheet { border-radius: 24px; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.sheet h3 { font-size: 26px; margin-bottom: 10px; }
.sheet p { font-size: 18px; }
.keepsake-reveal { display: flex; gap: 16px; align-items: center; margin-top: 14px; padding: 14px; border-radius: 16px; background: rgba(201, 154, 62, .14); border: 1px solid rgba(201, 154, 62, .4); }
.keepsake-reveal img { width: 96px; height: 96px; object-fit: contain; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-6px) rotate(2deg); } }
.dialogue { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; }
@media (max-width: 520px) { .dialogue { grid-template-columns: 84px 1fr; gap: 12px; } }
.dialogue .portrait { position: relative; overflow: hidden; background: #2a1d17; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 16px; box-shadow: 0 6px 14px rgba(0, 0, 0, .25); }
.dialogue .who { font-family: var(--font-title); font-size: 20px; margin-bottom: 6px; }
.dialogue .line { font-size: 18px; font-style: italic; }
.dialogue .reply { margin-top: 12px; padding: 12px 14px; background: rgba(120, 85, 40, .1); border-radius: 12px; font-size: 17px; animation: screenIn .4s ease; }
.choices { display: grid; gap: 10px; margin-top: 16px; }
.choice { text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--cream); border: 2px solid var(--paper-3); color: var(--ink); font-size: 17px; font-weight: 600; transition: border-color .2s, transform .12s; }
.choice:hover { border-color: var(--amber); }
.choice:active { transform: scale(.98); }

/* ---------- Ritual ---------- */
.ritual-stage { position: relative; max-width: 720px; margin: 0 auto; aspect-ratio: 4 / 3; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); touch-action: none; user-select: none; background: #1b140e; }
.ritual-stage.wide { max-width: 960px; aspect-ratio: 16 / 9; }
.ritual-stage > img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ritual-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ritual-meter { max-width: 720px; margin: 14px auto 0; height: 14px; border-radius: 99px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.ritual-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--amber), var(--amber-2)); transition: width .2s; }
.ritual-done { text-align: center; margin-top: 16px; font-family: var(--font-title); font-size: 22px; color: var(--amber-2); animation: screenIn .5s ease; }
.token { position: absolute; z-index: 3; border: 0; padding: 0; background: none; touch-action: none; display: grid; place-items: center; }
.token .chip-label { position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 14px; font-weight: 800; background: rgba(20, 16, 10, .75); color: var(--cream); padding: 2px 8px; border-radius: 99px; }

/* ---------- Letter ---------- */
.letter-env { position: relative; max-width: 520px; margin: 0 auto; aspect-ratio: 4 / 3; }
.letter-env img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .45)); }
.seal-drag { position: absolute; left: 50%; top: 52%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; touch-action: none; display: grid; place-items: center; color: rgba(255, 235, 210, .9);
  background: radial-gradient(circle at 35% 30%, #c84a3a, #8e1b1b 60%, #5e0f10); box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .45), inset 0 4px 8px rgba(255, 255, 255, .25), 0 8px 18px rgba(0, 0, 0, .45); }
.seal-drag svg.crack { position: absolute; inset: 0; width: 100%; height: 100%; }
.letter-paper { max-width: 640px; margin: 0 auto; padding: 32px 28px; font-family: var(--font-title); font-size: 20px; line-height: 1.7; white-space: pre-line; position: relative; }
.letter-paper .ink span { opacity: 0; animation: ink .6s ease forwards; }
@keyframes ink { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }
.letter-paper .stamp-corner { position: absolute; top: 18px; right: 18px; width: 64px; height: 76px; border: 3px dashed rgba(120, 85, 40, .4); border-radius: 6px; display: grid; place-items: center; color: rgba(120, 85, 40, .6); }

/* ---------- Logbook ---------- */
.logbook { max-width: 720px; margin: 0 auto; padding: 24px 22px; }
.logbook .prompt { font-family: var(--font-title); font-size: 23px; line-height: 1.35; margin-bottom: 18px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { min-height: 46px; padding: 8px 16px; border-radius: 99px; border: 2px solid var(--paper-3); background: var(--cream); color: var(--ink); font-weight: 700; font-size: 16px; }
.chip[aria-pressed="true"] { background: var(--amber); border-color: var(--amber); color: #2a1a08; }
.textarea { min-height: 200px; resize: vertical; line-height: 1.6; font-size: 18px; background:
  repeating-linear-gradient(180deg, transparent 0 31px, rgba(120, 85, 40, .15) 31px 32px), var(--cream); background-attachment: local; }
.die-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 18px 14px; border-radius: 18px; background: linear-gradient(160deg, rgba(201, 154, 62, .16), rgba(201, 123, 107, .14)); border: 1px dashed rgba(120, 85, 40, .3); margin: 16px 0; }
.die-title { font-family: var(--font-title); font-size: 19px; font-weight: 600; }
.die { width: 92px; height: 92px; border-radius: 20px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14px; gap: 4px; place-items: center; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .18), inset 0 4px 6px rgba(255, 255, 255, .35), 0 8px 16px rgba(0, 0, 0, .25); transition: background .2s; }
.die i { width: 15px; height: 15px; border-radius: 50%; }
.die i.on { background: #fff8e8; box-shadow: inset 0 2px 2px rgba(0, 0, 0, .25); }
.die-crimson { background: linear-gradient(145deg, #e0675a, #9b2226); }
.die-sea { background: linear-gradient(145deg, #4fb3c8, #145566); }
.die-gold { background: linear-gradient(145deg, #f6cf72, #b8862b); }
.die-sage { background: linear-gradient(145deg, #a6c47e, #55703a); }
.die.rolling { animation: tumble .7s ease; }
.die-prompt { font-style: italic; font-size: 18px; max-width: 44ch; min-height: 1em; }

/* ---------- Seal ---------- */
.seal-grid { display: grid; gap: 18px; max-width: 760px; margin: 0 auto; }
@media (min-width: 760px) { .seal-grid { grid-template-columns: 1fr 1fr; align-items: center; } }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.swatch { min-height: 88px; border-radius: 16px; border: 3px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px 4px; background: rgba(255, 255, 255, .05); font-size: 14px; font-weight: 800; color: var(--text); }
.swatch .blob { width: 38px; height: 38px; border-radius: 50%; box-shadow: inset 0 -4px 8px rgba(0, 0, 0, .35), inset 0 3px 6px rgba(255, 255, 255, .25); }
.swatch[aria-pressed="true"] { border-color: var(--amber-2); background: rgba(231, 169, 79, .14); }
.press-zone { display: grid; place-items: center; gap: 12px; }
.press { width: 190px; height: 190px; border-radius: 50%; border: 0; position: relative; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #3a3326, #1e1a13); box-shadow: 0 10px 0 #0e0c09, 0 18px 30px rgba(0, 0, 0, .5); touch-action: none; color: var(--amber-2); }
.press svg.ring { position: absolute; inset: -12px; width: calc(100% + 24px); height: calc(100% + 24px); transform: rotate(-90deg); }
.press svg.ring circle { fill: none; stroke-width: 8; }
.press .wax-big { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; color: rgba(255, 238, 215, .92); box-shadow: inset 0 -8px 16px rgba(0, 0, 0, .4), inset 0 6px 12px rgba(255, 255, 255, .22); animation: squish .45s ease; }
@keyframes squish { 0% { transform: scale(.4); } 60% { transform: scale(1.12, .9); } 100% { transform: scale(1); } }
.shelf { margin: 24px auto 0; max-width: 760px; padding: 16px; }
.shelf-row { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; align-items: end; padding-bottom: 10px; border-bottom: 10px solid #6b4a2b; box-shadow: 0 8px 0 #3d2a17; }
.shelf-row .slot { aspect-ratio: 1; display: grid; place-items: center; }
.shelf-row .slot img { width: 100%; height: 100%; object-fit: contain; }
.shelf-row .slot.empty::before { content: ''; width: 40%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.shelf-row .slot.new img { animation: dropIn .9s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes dropIn { from { transform: translateY(-160px) scale(1.6); opacity: 0; } }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(8, 9, 14, .7); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .2s ease; }
.modal { width: 100%; max-width: 760px; max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; border-radius: 22px; position: relative; animation: sheetUp .3s ease; }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { flex: 1; font-size: 28px; }
.modal-head p { font-size: 16px; }
.modal .x { width: 46px; height: 46px; border-radius: 14px; border: 0; background: rgba(120, 85, 40, .12); color: var(--ink); display: grid; place-items: center; flex: none; }
.case { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 16px; border-radius: 18px; background: linear-gradient(180deg, #5a3a20, #3d2614); box-shadow: inset 0 0 0 6px #2e1c0e, inset 0 10px 30px rgba(0, 0, 0, .5); }
.case .cell { aspect-ratio: 1; border-radius: 12px; background: radial-gradient(circle at 50% 40%, rgba(255, 240, 210, .12), rgba(0, 0, 0, .25)); display: grid; place-items: center; padding: 8px; border: 0; color: var(--text-soft); text-align: center; font-size: 14px; }
.case .cell img { width: 80%; height: 80%; object-fit: contain; }
.case .cell.locked img { filter: brightness(0) opacity(.35); }
.passport-page { padding: 16px; border-radius: 14px; background: var(--cream); border: 1px solid var(--paper-3); display: grid; grid-template-columns: auto 1fr; gap: 14px; margin-bottom: 12px; }
.passport-page .meta { font-size: 14px; color: var(--ink-soft); font-weight: 700; }
.passport-page blockquote { margin: 8px 0 0; font-family: var(--font-title); font-style: italic; font-size: 17px; white-space: pre-line; word-break: break-word; }
.settings-list { display: grid; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(120, 85, 40, .08); font-weight: 700; }
.toggle button { min-width: 120px; }
.how-list { display: grid; gap: 10px; counter-reset: how; padding: 0; margin: 0; list-style: none; }
.how-list li { counter-increment: how; display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start; font-size: 17px; }
.how-list li::before { content: counter(how); width: 36px; height: 36px; border-radius: 50%; background: var(--amber); color: #2a1a08; font-weight: 900; display: grid; place-items: center; }

/* ---------- Map ---------- */
.map-wrap { position: relative; max-width: 1100px; margin: 0 auto; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.map-wrap > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.map-wrap svg.routes { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-pin { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; z-index: 1; }
.map-pin .name { position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%); }
@media (max-width: 640px) { .map-pin .dot { width: 30px !important; height: 30px !important; } }
.map-pin .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); color: var(--ink); box-shadow: 0 4px 10px rgba(0, 0, 0, .45); border: 3px solid var(--amber); }
.map-pin.done .dot { background: var(--sage); color: #fff; border-color: #d8e6c4; }
.map-pin .name { font-size: 14px; font-weight: 800; background: rgba(20, 16, 10, .72); color: var(--cream); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
@media (max-width: 640px) { .map-pin .name { display: none; } }

/* ---------- Ending ---------- */
.ending-art { position: relative; max-width: 1000px; margin: 0 auto 18px; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.ending-art img { width: 100%; height: 100%; object-fit: cover; }
.ending-art .title { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; background: linear-gradient(0deg, rgba(10, 10, 14, .9), transparent); }
.certificate { max-width: 720px; margin: 22px auto 0; padding: 28px; text-align: center; border: 6px double var(--gold); }
.certificate h3 { font-size: 30px; }
.certificate .name { font-family: var(--font-title); font-size: 34px; color: #7a4c10; margin: 10px 0; }

/* ---------- Endless ---------- */
.postcard { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0; overflow: hidden; }
.postcard > div { padding: 20px; }
.postcard .left { border-right: 2px solid rgba(120, 85, 40, .25); }
@media (max-width: 600px) { .postcard { grid-template-columns: 1fr; } .postcard .left { border-right: 0; border-bottom: 2px solid rgba(120, 85, 40, .25); } }
.postcard dt { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin-top: 10px; }
.postcard dd { margin: 2px 0 0; font-family: var(--font-title); font-size: 19px; }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 95; background: var(--cream); color: var(--ink); padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: 16px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* ---------- Keepsake journal ---------- */
.jbook { max-width: 820px; margin: 0 auto; display: grid; gap: 22px; }
.jpage { background: linear-gradient(180deg, var(--paper), var(--paper-2)); color: var(--ink); border-radius: 18px; padding: 28px; box-shadow: var(--shadow); border: 1px solid rgba(120, 85, 40, .25); }
.jcover { text-align: center; padding: 48px 28px; border: 6px double var(--gold); }
.jcover h1 { font-size: clamp(30px, 5vw, 44px); color: #4a2f16; margin: 6px 0 18px; }
.jkicker { text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.jpet { width: 170px; margin: 0 auto 12px; }
.jname { font-family: var(--font-title); font-size: 34px; color: #7a4c10; }
.jmeta { color: var(--ink-soft); font-size: 15px; font-weight: 700; }
.jhead { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.jnum { width: 46px; height: 46px; border-radius: 50%; background: var(--amber); color: #2a1a08; display: grid; place-items: center; font-weight: 900; font-size: 20px; flex: none; }
.jhead h2 { font-size: 26px; }
.jscene { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; }
.jcols { display: grid; grid-template-columns: 1fr 200px; gap: 18px; margin-top: 16px; }
@media (max-width: 640px) { .jcols { grid-template-columns: 1fr; } }
.jlabel { font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: 6px; }
.jtext { font-family: var(--font-title); font-size: 17px; line-height: 1.65; white-space: pre-line; word-break: break-word; }
.jfinal { max-width: 60ch; margin: 14px auto 0; }
.jside { display: grid; gap: 12px; align-content: start; justify-items: center; text-align: center; font-size: 15px; font-weight: 700; }
.jseal { display: grid; justify-items: center; gap: 6px; }
.jkeep { display: grid; justify-items: center; gap: 4px; }
.jkeep img { width: 110px; height: 110px; object-fit: contain; }
.jfound { font-size: 14px; color: var(--ink-soft); font-weight: 600; }
.jlog { margin-top: 16px; padding-top: 14px; border-top: 1px dashed rgba(120, 85, 40, .35); }
@media print {
  @page { margin: 12mm; }
  :root { color-scheme: light; }
  html, body, #app, #screen { background: #fff !important; }
  #toast, .bubble, .sheet-back, .modal-back:not(:has(.passport-page)) { display: none !important; }
  .jcover { min-height: 265mm; display: flex; flex-direction: column; justify-content: center; align-items: center; }
  .jpet { width: 60mm; }
  .journal { padding: 0 !important; }
  .jbook { gap: 0; max-width: none; }
  .jpage { box-shadow: none; border-radius: 0; break-after: page; page-break-after: always; }
  .jpage:last-child { break-after: auto; page-break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media print {
  body { background: #fff; color: #000; }
  .topbar, .companion, .bubble, #fx, .no-print { display: none !important; }
  .modal-back { position: static; background: none; padding: 0; }
  .modal { max-height: none; box-shadow: none; }
}
