:root {
  color-scheme: dark;
  --bg: #111a20;
  --panel: #1b2930;
  --panel-soft: #24363e;
  --line: #41555a;
  --text: #f4ebd5;
  --muted: #b4c2b8;
  --gold: #edbd6a;
  --gold-deep: #c99043;
  --aqua: #a8d4c6;
  --danger: #e3a18d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 50% 0%, #263b3c 0, #111a20 42%);
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--aqua); outline-offset: 3px; }

.app-shell {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(22, 36, 42, .92), rgba(17, 26, 32, .98));
  border-inline: 1px solid rgba(237, 189, 106, .12);
}

.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; }
.brand-mark {
  display: grid; place-items: center; width: 39px; height: 39px; flex: none;
  border: 2px solid var(--gold); color: var(--gold); background: #26333a;
  font: 800 23px Georgia, serif; box-shadow: 4px 4px 0 #090f13;
}
.brand-copy { display: grid; gap: 2px; line-height: 1; }
.brand-copy span { color: var(--gold); font-size: 19px; font-weight: 900; letter-spacing: .09em; }
.brand-copy small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.case-tag {
  margin-left: auto; padding: 7px 8px; border: 1px solid var(--line);
  color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; letter-spacing: .06em;
}

.game { outline: none; }
.progress { margin: 26px 0 22px; }
.progress-label { color: var(--aqua); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.progress-track { height: 5px; margin-top: 10px; background: #34474c; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 25%; background: var(--gold); transition: width .24s ease; }
.campaign-status { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 14px; }
.campaign-status span { padding: 7px 9px; border: 1px solid var(--line); color: var(--aqua); background: #1d2a30; font-size: 11px; font-weight: 800; }
.campaign-map, .journal, .inventory { margin: 9px 0; border: 1px solid var(--line); background: #1b2930; }
.campaign-map summary, .journal summary, .inventory summary { display: flex; justify-content: space-between; gap: 8px; padding: 11px 13px; color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .04em; cursor: pointer; }
.campaign-map summary span, .journal summary span, .inventory summary span { color: var(--muted); white-space: nowrap; }
.campaign-map ol, .journal ol, .inventory ul { display: grid; gap: 7px; max-height: 230px; overflow: auto; margin: 0; padding: 0 15px 13px 34px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.campaign-map li.current { color: var(--gold); font-weight: 900; }
.campaign-map li.done { color: var(--aqua); }
.context-note { margin: 12px 0 19px; padding: 12px 14px; border-left: 3px solid var(--gold); color: var(--text); background: #2c3030; font-size: 13px; line-height: 1.45; }
.screen[hidden] { display: none; }
.screen { animation: enter .2s ease-out both; }
.eyebrow, .panel-label { color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.eyebrow { margin: 22px 0 10px; }
h1 {
  margin: 0 0 14px; max-width: 13ch; color: var(--text);
  font: 800 clamp(32px, 9vw, 46px)/1.05 Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}
.lede { margin: 0 0 20px; color: #d5ded2; font-size: 16px; line-height: 1.56; }

.scene-art {
  position: relative; height: clamp(214px, 62vw, 305px); overflow: hidden;
  isolation: isolate; border: 2px solid #9a4e37;
  background: #101c2b;
  box-shadow: 6px 6px 0 #0b1116, inset 0 0 0 5px rgba(14, 24, 27, .45);
}
.art-sky { position: absolute; inset: 0; background: radial-gradient(ellipse at 74% 41%, #b96541 0, #663b3b 23%, #233044 58%, #0b1523 100%); animation: sky-glow 8s ease-in-out infinite alternate; }
.art-moon { position: absolute; width: 35px; height: 35px; right: 15%; top: 11%; background: #f5cb8c; box-shadow: 0 0 0 7px rgba(245,203,140,.1), 0 0 34px #d98254; }
.art-horizon { position: absolute; inset: 39% 0 0; background: linear-gradient(154deg, transparent 0 22%, #1c2935 22% 31%, transparent 31%), linear-gradient(22deg, transparent 0 27%, #1b2632 27% 39%, transparent 39%), linear-gradient(180deg, transparent 0 42%, #0d1d24 42%); }
.art-flag { position: absolute; right: 22%; top: 22%; width: 6px; height: 48%; background: #352828; transform: rotate(7deg); transform-origin: bottom; }
.art-flag::after { content: ""; position: absolute; top: 2px; left: 4px; width: 58px; height: 28px; background: #c82926; clip-path: polygon(0 0, 100% 7%, 82% 52%, 100% 100%, 0 82%); filter: drop-shadow(1px 2px 0 #5d1b1e); animation: flag-wave 3.2s ease-in-out infinite alternate; transform-origin: left center; }
.art-house {
  position: absolute; left: 31%; bottom: 31%; width: 40%; height: 34%; background: #514d43;
  border: 7px solid #222b31; box-shadow: 0 -14px 0 -2px #3b3535, 0 9px 0 #101d20;
}
.art-house::before { content: ""; position: absolute; width: 16%; height: 27%; left: 10%; top: 19%; background: #e7a963; box-shadow: 0 0 18px #ed9854, 95px 0 0 #e7a963; }
.art-landmark { display: none; position: absolute; left: 31%; bottom: 29%; width: 40%; height: 38%; place-items: center; border: 7px solid #292f33; background: var(--landmark-bg, #74634d); box-shadow: 0 -12px 0 -2px #303439, 0 9px 0 #111b20; }
.art-landmark span { color: var(--landmark-ink, #f0d29c); font: 900 clamp(38px, 12vw, 67px)/1 Georgia, serif; text-shadow: 3px 4px #302b2b; }
.scene-art[data-scene]:not([data-scene="yard"]) .art-house, .scene-art[data-scene]:not([data-scene="yard"]) .art-door { display: none; }
.scene-art[data-scene]:not([data-scene="yard"]) .art-landmark { display: grid; }
.scene-art[data-scene="wardrobe"] { --landmark-bg: repeating-linear-gradient(90deg, #544334 0 18px, #6e5438 18px 22px); }
.scene-art[data-scene="office"] { --landmark-bg: #59656a; --landmark-ink: #e8caa0; }
.scene-art[data-scene="printshop"] { --landmark-bg: repeating-linear-gradient(0deg, #393844 0 11px, #545064 11px 15px); }
.scene-art[data-scene="fair"] { --landmark-bg: repeating-linear-gradient(90deg, #963e38 0 18px, #d6a45c 18px 35px); }
.scene-art[data-scene="post"] { --landmark-bg: #8b674e; }
.scene-art[data-scene="quay"] { --landmark-bg: #344e63; }
.scene-art[data-scene="theater"] { --landmark-bg: repeating-linear-gradient(90deg, #663945 0 13px, #8c4550 13px 17px); }
.scene-art[data-scene="archive"] { --landmark-bg: repeating-linear-gradient(90deg, #49372e 0 20px, #a58255 20px 22px); }
.scene-art[data-scene="square"] { --landmark-bg: #736249; }
.scene-art[data-scene="pavilion"] { --landmark-bg: #6a5045; --landmark-ink: #fff0bc; }
.scene-art[data-scene="wardrobe"] .art-map, .scene-art[data-scene="wardrobe"] .art-flag,
.scene-art[data-scene="office"] .art-map, .scene-art[data-scene="printshop"] .art-map,
.scene-art[data-scene="fair"] .art-map, .scene-art[data-scene="quay"] .art-map,
.scene-art[data-scene="theater"] .art-map, .scene-art[data-scene="archive"] .art-map,
.scene-art[data-scene="square"] .art-map { display: none; }
.scene-art[data-scene="wardrobe"] .art-landmark { height: 52%; bottom: 17%; border-color: #3c2d25; }
.scene-art[data-scene="office"] .art-landmark { width: 48%; left: 27%; border-color: #343c42; }
.scene-art[data-scene="printshop"] .art-landmark { height: 29%; bottom: 25%; box-shadow: 0 15px 0 #252835, 0 -17px 0 -6px #1d222b; }
.scene-art[data-scene="fair"] .art-landmark { border-color: #aa6b43; clip-path: polygon(50% 0, 100% 33%, 100% 100%, 0 100%, 0 33%); height: 51%; bottom: 20%; }
.scene-art[data-scene="post"] .art-landmark { width: 32%; left: 36%; background: #8b674e; }
.scene-art[data-scene="quay"] .art-horizon { background: linear-gradient(180deg, transparent 0 60%, #36566b 60% 71%, #203b51 71%); }
.scene-art[data-scene="quay"] .art-landmark { width: 55%; left: 24%; height: 25%; bottom: 23%; clip-path: polygon(0 0, 100% 0, 83% 100%, 17% 100%); }
.scene-art[data-scene="theater"] .art-sky { background: radial-gradient(circle at 50% 58%, #8a4b3b, #402b35 55%, #181c29); }
.scene-art[data-scene="theater"] .art-flag, .scene-art[data-scene="theater"] .art-moon { display: none; }
.scene-art[data-scene="theater"] .art-landmark { width: 56%; left: 22%; height: 45%; bottom: 22%; border-color: #783d4d; }
.scene-art[data-scene="archive"] .art-landmark { width: 50%; left: 26%; height: 47%; bottom: 20%; }
.scene-art[data-scene="square"] .art-landmark { width: 54%; left: 23%; height: 34%; bottom: 26%; border-color: #5e4d38; }
.scene-art[data-scene="pavilion"] .art-sky { background: radial-gradient(circle at 50% 52%, #ae774a, #513b39 48%, #172339); }
.scene-art[data-scene="pavilion"] .art-landmark { border-color: #c18a4d; border-radius: 50% 50% 0 0; }
.art-door { position: absolute; left: 48%; bottom: 31%; width: 11%; height: 27%; background: #17242b; border: 4px solid #7d5f47; }
.art-sign { position: absolute; left: 35%; bottom: 61%; padding: 5px 8px; background: #1d2b2e; color: #e8cb93; font: 800 10px monospace; letter-spacing: .08em; transform: rotate(-2deg); }
.art-ground { position: absolute; inset: 67% 0 0; background: linear-gradient(180deg, #25342f 0 12%, #171d20 12%); box-shadow: 0 -4px 0 #354236; }
.art-map { position: absolute; left: 29%; bottom: -2%; width: 53%; height: 27%; background: #b99a68; border: 3px solid #765a3f; clip-path: polygon(5% 4%, 97% 0, 100% 88%, 15% 100%, 0 76%); transform: rotate(-8deg); box-shadow: inset 0 0 0 4px #d6b580; }
.art-route { position: absolute; inset: 26% 29% 20% 13%; border-top: 3px dashed #554a3b; border-right: 3px dashed #554a3b; transform: skew(-19deg); }
.art-map-mark { position: absolute; right: 15%; top: 18%; color: #b62924; font: 900 32px/1 monospace; }
.art-lantern { position: absolute; left: 7%; bottom: 8%; width: 35px; height: 62px; border: 5px solid #4a3930; background: #e7963d; box-shadow: 0 0 27px 8px rgba(240,118,44,.55); animation: firelight 2.4s ease-in-out infinite alternate; }
.art-lantern::before { content: ""; position: absolute; left: 5px; right: 5px; top: -14px; height: 7px; background: #76604b; box-shadow: 0 70px 0 #76604b; }
.art-lantern span { position: absolute; inset: 12px 8px 8px; background: #fff0ab; clip-path: polygon(50% 0, 100% 65%, 75% 100%, 15% 100%, 0 55%); animation: flame 1s steps(2, end) infinite alternate; }
.art-person { position: absolute; bottom: 21%; width: 24px; height: 43px; background: #7c8b67; box-shadow: 0 11px 0 -2px #18282a; animation: scout-idle 3s ease-in-out infinite alternate; }
.art-person::before { content: ""; position: absolute; width: 21px; height: 19px; left: 2px; top: -17px; background: #c79770; box-shadow: 0 -6px 0 #272b2b; }
.art-person-left { left: 22%; }
.art-person-right { right: 12%; background: #816b56; transform: scale(.86); animation-delay: -1.3s; }
.art-ember { position: absolute; left: 14%; bottom: 28%; width: 3px; height: 3px; background: #ffc37d; box-shadow: 0 0 6px #ff8b42; animation: ember-rise 3s linear infinite; }
.art-ember-two { left: 21%; bottom: 31%; animation-delay: -1.1s; }
.art-ember-three { left: 10%; bottom: 20%; animation-delay: -2.2s; }

.dialogue {
  margin: 20px 0; padding: 16px 17px; border-left: 4px solid var(--aqua);
  background: var(--panel); box-shadow: 3px 3px 0 #0b1116;
}
.speaker { color: var(--aqua); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.dialogue p { margin: 7px 0 0; font-size: 15px; line-height: 1.47; }

.primary-button, .secondary-button {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px;
  padding: 14px 18px; border: 2px solid var(--gold); border-radius: 0;
  font-weight: 900; text-align: left; text-decoration: none;
}
.primary-button { color: #17242a; background: var(--gold); box-shadow: 5px 5px 0 #0a1114; }
.primary-button:hover { background: #ffd28a; }
.primary-button span { font-size: 23px; line-height: 1; }
.secondary-button { margin-top: 15px; color: var(--text); background: transparent; }
.secondary-button:hover { background: var(--panel); }
.hint { margin: 17px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.evidence-card, .clue-panel, .consequence-card {
  border: 1px solid var(--line); background: var(--panel); box-shadow: 4px 4px 0 #0b1116;
}
.evidence-card { display: flex; align-items: center; gap: 15px; margin: 21px 0; padding: 16px; }
.evidence-icon {
  display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  border: 2px dashed var(--gold); color: var(--gold); font: 900 18px monospace; transform: rotate(-8deg);
}
.evidence-card strong { font-size: 16px; }
.evidence-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.choice-list { display: grid; gap: 12px; margin: 18px 0 24px; }
.choice-button {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 72px;
  padding: 12px 14px; border: 1px solid #668077; border-radius: 0;
  color: var(--text); background: #25383d; text-align: left; box-shadow: 4px 4px 0 #0b1116;
}
.choice-button:hover { border-color: var(--gold); background: #304549; }
.choice-copy { display: grid; gap: 5px; flex: 1; }
.choice-button strong { font-size: 16px; }
.choice-button small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.choice-number { color: var(--gold); font: 800 14px monospace; }
.choice-button > span:last-child { color: var(--gold); font-size: 22px; }
.choice-button-risk { border-color: #87665d; }
.choice-button-risk .choice-number, .choice-button-risk > span:last-child { color: var(--danger); }
.choice-button:disabled { cursor: not-allowed; opacity: .52; }
.choice-button-bonus { border-color: var(--gold); background: #36352c; }
.bonus-character { display: flex; align-items: center; gap: 10px; margin: 16px 0; border: 1px solid var(--gold); background: radial-gradient(circle at 12% 50%, #4b3429, #242a2a 70%); }
.bonus-character[hidden] { display: none; }
.bonus-character img { width: 96px; height: 160px; flex: none; object-fit: contain; image-rendering: pixelated; }
.bonus-character div { padding: 12px 10px 12px 0; }
.bonus-character span { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.bonus-character h2 { margin: 8px 0; font: 800 20px/1.1 Georgia, serif; }
.bonus-character p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.item-use-panel { margin: 18px 0; padding: 15px; border: 1px solid var(--gold); background: #30332e; }
.item-use-panel[hidden] { display: none; }
.item-use-panel > span { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.item-use-panel p { margin: 8px 0; font-size: 14px; }
.item-use-panel .secondary-button { margin-top: 8px; min-height: 44px; padding: 8px 12px; }
.clue-panel { margin: 21px 0 13px; padding: 20px; }
.clue-panel h2 { margin: 9px 0 8px; color: var(--text); font: 800 25px/1.2 Georgia, serif; }
.clue-panel p { margin: 0; color: #d5ded2; line-height: 1.55; }
.clue-note { margin: 0 0 24px; color: var(--aqua); font-size: 13px; line-height: 1.45; }
.result-stamp { display: inline-block; margin: 7px 0 18px; padding: 8px 12px; border: 2px solid var(--gold); color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; transform: rotate(-2deg); }
.consequence-card { margin: 18px 0; padding: 18px; border-color: var(--gold-deep); }
.consequence-card p { margin: 9px 0 0; font-size: 16px; line-height: 1.55; }

.footer {
  display: grid; gap: 5px; margin-top: 38px; padding: 18px 0 0; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; line-height: 1.4;
}
.footer span { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.footer strong { color: var(--text); font-size: 13px; }
.footer small { font-size: 11px; }

@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sky-glow { to { opacity: .78; } }
@keyframes flag-wave { to { transform: scaleX(.79) skewY(8deg); } }
@keyframes firelight { to { box-shadow: 0 0 40px 13px rgba(240,118,44,.42); } }
@keyframes flame { to { transform: scale(.8, 1.1); } }
@keyframes scout-idle { to { translate: 0 -3px; } }
@keyframes ember-rise { to { transform: translate(13px, -44px); opacity: 0; } }
@media (max-width: 360px) {
  .app-shell { padding-inline: 14px; }
  .case-tag { font-size: 9px; padding-inline: 6px; }
  .brand-copy span { font-size: 17px; }
  .art-house::before { box-shadow: 0 0 18px #ed9854, 70px 0 0 #e7a963; }
}
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .progress-track span { transition: none; }
  .scene-art *, .scene-art *::before, .scene-art *::after { animation: none !important; }
}
