:root {
  color-scheme: dark;
  --bg: #101719;
  --panel: #202a2c;
  --edge: #455354;
  --ink: #f7efdc;
  --muted: #bdc5b9;
  --yellow: #ffd37b;
  --mint: #b7e9d8;
  font: 16px/1.5 system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: repeating-linear-gradient(0deg, #ffffff05 0 1px, transparent 1px 5px), var(--bg); min-height: 100dvh; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; min-height: 44px; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.hud { border-bottom: 1px solid var(--edge); background: #11191c; padding: env(safe-area-inset-top) 0 0; }
.hud-inner, main { width: min(800px, calc(100% - 40px)); margin-inline: auto; }
.hud-inner { display: flex; align-items: center; gap: clamp(14px, 4vw, 46px); min-height: 61px; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); font-weight: 900; letter-spacing: .06em; line-height: 1.15; text-decoration: none; margin-right: auto; }
.brand small { display: block; color: var(--mint); margin-top: 5px; }
.mark { color: var(--yellow); font-size: 30px; }
small, .eyebrow, .chapter-tag, .count, .location, footer, .caption-index { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: .1em; }
small { font-size: .68rem; }
.balance small, .suspicion small { display: block; color: var(--muted); white-space: nowrap; }
.balance strong { color: var(--yellow); font-size: 1.3rem; line-height: 1.25; }
.suspicion small { display: flex; justify-content: space-between; gap: 12px; }
.suspicion b { color: var(--ink); }
progress { display: block; margin-top: 7px; width: 100%; height: 5px; border: 0; accent-color: #fa7a91; background: var(--edge); }
progress::-webkit-progress-bar { background: var(--edge); }
progress::-webkit-progress-value { background: #fa7a91; }
.inventory, .secondary, .audio { border: 1px solid var(--edge); background: #293638; border-radius: 2px; padding: 8px 13px; }
.inventory:hover, .secondary:hover, .audio:hover { border-color: var(--mint); }
main { padding-top: clamp(14px, 4vw, 28px); }
.heading { display: flex; justify-content: space-between; gap: 10px; align-items: end; }
.eyebrow { margin: 0; color: var(--mint); font-size: .74rem; }
h1 { margin: 5px 0 0; line-height: 1.02; letter-spacing: -.037em; font-weight: 900; font-size: clamp(1.38rem, 5vw, 2.85rem); }
 .chapter-tag span { color: var(--yellow); }
.chapter-tag { color: var(--muted); white-space: nowrap; font-size: clamp(.62rem, 1.3vw, .85rem); padding-bottom: 4px; }
.frame { width: min(100%, 760px); margin-inline: auto; border: 3px double #8b9481; min-width: 0; background: var(--panel); box-shadow: 0 5px 0 #070d0e; }
.heading { max-width: 760px; margin-inline: auto; }
.art { position: relative; height: clamp(240px, 52vw, 382px); overflow: hidden; background: radial-gradient(ellipse at 64% 38%, #815168, transparent 32%), repeating-linear-gradient(105deg, #1d1b32 0 8px, #221d37 8px 28px); }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art img[hidden] { display: none; }
.location { position: absolute; top: 12px; font-size: .66rem; background: #11191ced; padding: 5px 8px; border: 1px solid #82918b; }
.location { left: 12px; color: var(--yellow); }
.scene-audio {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
}
.scene-audio button {
  min-width: 44px;
  padding: 4px 8px;
  border: 1px solid #82918b;
  border-radius: 2px;
  background: #172323f2;
  color: var(--ink);
  font-size: .73rem;
  font-weight: 750;
}
.scene-audio button:hover:not(:disabled) { border-color: var(--mint); }
.scene-audio button:disabled { opacity: .58; }
@media (max-width: 430px) {
  .scene-audio { right: 7px; }
  .scene-audio button { font-size: 1.05rem; }
  .scene-audio button > span:not([aria-hidden]) { display: none; }
}
.caption { display: flex; align-items: start; gap: 12px; padding: 10px 14px; border-top: 2px solid #9a9d82; background: #182022; }
.caption p { margin: 0; color: var(--muted); font-size: .91rem; }
.caption-index { color: var(--yellow); font-size: .76rem; }
.art-notes { padding: 0 16px 10px; color: var(--muted); font-size: .78rem; }
.art-notes summary { min-height: 34px; align-content: center; cursor: pointer; }
.interaction { padding: clamp(13px, 2.8vw, 23px); }
.panel-top, .character, .actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.count { color: var(--muted); font-size: .75rem; }
.steps { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; margin: 7px 0 17px; }
.steps i { background: var(--edge); height: 3px; }
.steps i.active { background: var(--mint); }
.bubble { position: relative; margin-top: 27px; padding: 15px 13px 10px; background: #f6e8c9; border: 2px solid #161d1e; outline: 1px solid #aba487; box-shadow: inset 0 0 0 2px #ddccab, 0 3px 0 #11191b; color: #242a28; }
.character { position: absolute; top: -17px; left: 10px; padding: 3px 10px; border: 1px solid #182325; background: #264947; color: #f1f3db; font: 700 .76rem ui-monospace, monospace; }
.audio { min-width: 44px; padding: 0 8px; color: var(--mint); }
.bubble > p:first-of-type { margin: 0; font-size: clamp(1.02rem, 2.5vw, 1.2rem); font-weight: 650; line-height: 1.4; white-space: pre-line; }
.scene-subtitles {
  position: absolute;
  inset: auto 8px 8px;
  width: fit-content;
  max-width: min(calc(100% - 16px), 580px);
  margin: 0 auto;
  padding: 6px 10px;
  border: 1px solid #f7efdc4d;
  background: #101719ed;
  color: #fff9eb;
  font-size: clamp(.88rem, 3.3vw, 1rem);
  line-height: 1.3;
  font-weight: 650;
  text-align: center;
  white-space: pre-line;
}
.speech-status { margin: 0; color: #ffabb7; font-size: .78rem; }
.bubble .speech-status { color: #7d2426; }
.task-title { margin: 19px 0 2px; font-size: 1.2rem; }
.translation { display: block; margin: 0 0 12px; color: var(--muted); }
.typed-answer {
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid #788273;
  border-radius: 2px;
  background: #121b1d;
  color: var(--ink);
  font: inherit;
}
.typed-answer:focus { outline: 2px solid var(--mint); outline-offset: 2px; }
.typed-answer::placeholder { color: var(--muted); }
.typed-answer[aria-invalid="true"] { border-color: #ffabb7; }
.typed-answer[aria-invalid="true"]::selection { color: #24121b; background: #ffabb7; }
.feedback { min-height: 24px; margin: 10px 0 6px; font-size: .86rem; }
.correct { color: #a5eac3; }
.incorrect { color: #ffabb7; }
.primary { padding: 8px 15px; border: 1px solid var(--yellow); background: var(--yellow); color: #18141a; font-weight: 800; border-radius: 2px; box-shadow: inset 0 -3px 0 #33280b36; }
.primary:hover:not(:disabled) { background: #ffe198; }
.primary:disabled, .secondary:disabled { opacity: .45; }
.complete h2 { font-size: 2rem; line-height: 1.04; margin: 12px 0; }
.complete button { margin: 6px 6px 0 0; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 22px 0 max(22px, env(safe-area-inset-bottom)); font-size: .62rem; color: var(--muted); }
.reference { border-top: 1px solid var(--edge); }
.reference > summary, .alex-note > summary { cursor: pointer; min-height: 44px; align-content: center; font-weight: 700; }
.reference > summary { padding-inline: clamp(15px, 2.8vw, 27px); color: var(--yellow); }
.reference-body { padding: 0 clamp(15px, 2.8vw, 27px) 15px; }
.reference-body p, .reference-body li span { color: var(--muted); }
.reference-body ul { list-style: none; padding: 0; }
.reference-body h3 { margin: 3px 0; }
.reference-body li { display: grid; grid-template-columns: minmax(80px, .7fr) 1fr auto; align-items: center; gap: 9px; border-bottom: 1px solid var(--edge); padding: 4px 0; }
#phrases li { grid-template-columns: 1fr 1fr; }
.alex-note { margin-top: 7px; color: var(--mint); }
.alex-note > summary { font-size: .88rem; }
.grammar-hint { padding: 9px 12px; border-left: 2px solid var(--mint); background: #243635; color: var(--ink); }
.grammar-hint p { margin: 0; }
.grammar-hint p + p { margin-top: 8px; }
.grammar-hint strong { display: block; color: var(--mint); font-size: .82rem; }
@media (max-width: 720px) {
  .hud-inner, main { width: calc(100% - 26px); }
  .hud-inner { min-height: 64px; gap: clamp(7px, 2.5vw, 16px); }
  .brand { font-size: .71rem; gap: 5px; }
  .brand small, .hud small { font-size: .57rem; }
  .mark { font-size: 17px; }
  .inventory { min-width: 44px; padding-inline: 6px; }
  .inventory span { display: none; }
  .suspicion small { gap: 5px; }
}

#scene-cast { position: absolute; inset: 12% 0 0; pointer-events: none; }
.cast {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  background: linear-gradient(transparent 62%, #101719a0);
}
.actor {
  --signal: var(--mint);
  position: relative;
  min-width: 0;
  isolation: isolate;
}
.actor .sprite {
  position: absolute;
  inset: 3px 0 auto;
  margin-inline: auto;
  width: 96%;
  height: 165%;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 3px 4px #0e0b15);
}
.speech-wave {
  position: absolute;
  top: 8px;
  left: calc(50% + clamp(33px, 8vw, 58px));
  display: none;
  align-items: center;
  gap: 3px;
  height: 23px;
  padding: 4px 6px;
  border: 1px solid currentColor;
  border-radius: 5px;
  color: var(--signal);
  background: #101019;
}
.speech-wave i { display: block; width: 3px; height: 10px; background: currentColor; border-radius: 2px; animation: pulse-wave 0.6s ease-in-out infinite alternate; }
.speech-wave i:nth-child(2) { animation-delay: -0.3s; }
.speech-wave i:nth-child(3) { animation-delay: -0.42s; }
.cast[data-speaker]:not([data-speaker="hero"]) .speech-wave { display: flex; }
.frame:has(.cast[data-speaker="hero"]) .task-title { color: var(--yellow); }
@keyframes pulse-wave {
  from { transform: scaleY(.35); }
  to { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .cast .speech-wave i { animation: none; }
}

.timer {
  padding: 4px 8px;
  border: 1px solid var(--edge);
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}
.timer.urgent { border-color: #ffabb7; color: #ffabb7; }
.typed-answer, .feedback { scroll-margin-block: 12px; }
@media (max-width: 480px) {
  .hud-inner, main { width: calc(100% - 18px); }
  .art { height: clamp(180px, 53vw, 246px); }
  .actions { display: grid; grid-template-columns: minmax(0, .8fr) auto minmax(0, 1.2fr); gap: 6px; }
  .actions button { padding-inline: 8px; }
  .actions button { min-height: 48px; }
  .feedback { min-height: 0; }
}

.cutscene h2 { font-size: clamp(1.3rem, 5vw, 1.8rem); margin: 0 0 10px; }
.cutscene p { margin: 0 0 12px; max-width: 62ch; }
.cutscene .cutscene-briefing { padding: 8px 11px; border-left: 2px solid var(--mint); background: #243635; }
.cutscene .primary { margin: 0; min-height: 48px; }
@media (max-width: 480px) { .cutscene .primary { width: 100%; } }

.comic-text-pending { visibility: hidden; }
.bridge-progress { height: 3px; background: var(--edge); }
.bridge-progress::before {
  content: '';
  display: block;
  height: 100%;
  background: var(--mint);
  transform-origin: left;
  transform: scaleX(var(--comic-progress, 0));
}

.chapter-tag { max-width: 46%; white-space: normal; text-align: right; overflow-wrap: anywhere; }
#scene-art[data-glitch="true"] { animation: chip-interference 11s linear infinite; }
@keyframes chip-interference {
  0%, 96%, 99%, 100% { filter: none; }
  97% { filter: contrast(1.35) saturate(.55); }
  98% { filter: hue-rotate(26deg); }
}
@media (prefers-reduced-motion: reduce) { #scene-art[data-glitch="true"] { animation: none; } }
.gear-readout { max-width: 760px; margin: 0 auto 8px; color: var(--muted); font: 700 .76rem ui-monospace, monospace; }
.actor.portrait .sprite { inset: auto 0 0; height: 100%; object-position: center bottom; }

.textbook { margin-top: 16px; padding-top: 13px; border-top: 1px solid #728982; }
.textbook h3 { margin: 0 0 7px; color: var(--mint); font-size: 1.08rem; line-height: 1.25; }
.textbook p { max-width: 62ch; }
.textbook table { width: 100%; margin: 12px 0; border-collapse: collapse; text-align: left; }
.textbook th, .textbook td { padding: 6px 8px; border: 1px solid #536e65; vertical-align: top; overflow-wrap: anywhere; }
.textbook th { background: #192e2a; color: var(--mint); font-size: .79rem; }
.textbook td { width: 50%; }
.textbook td[lang="en"] { color: #fff3d4; font-weight: 650; }
.textbook-note { margin-top: 10px; }
@media (max-width: 480px) { .textbook th, .textbook td { padding-inline: 5px; } }

.grammar-hint .task-guidance { padding-bottom: 8px; border-bottom: 1px solid #536e65; }
.extra-hint { margin: 8px 0 11px; }
.extra-hint-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 10px; }
.extra-hint-status { color: var(--muted); font-size: .79rem; font-variant-numeric: tabular-nums; }
.extra-hint-details { margin-top: 6px; padding: 9px 11px; border-left: 2px solid var(--yellow); background: #373020; }
.extra-hint-details strong { color: var(--yellow); }
.extra-hint-details p { margin: 5px 0 0; }
.extra-hint-answer { font-weight: 800; color: var(--ink); }

.chapter-tools { display: grid; justify-items: end; gap: 4px; flex: 0 1 43%; }
.chapter-tools .chapter-tag { max-width: 100%; }
.chapter-tools .secondary { min-height: 44px; padding: 5px 13px; font-size: .82rem; }
.chapter-menu {
  width: min(460px, calc(100% - 24px));
  max-height: 82dvh;
  overflow: auto;
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
  border: 3px double #8b9481;
}
.chapter-menu::backdrop { background: #080e10ce; }
.chapter-menu header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chapter-menu h2 { margin: 0; font-size: 1.25rem; }
.chapter-menu header button { min-width: 44px; font-size: 1.2rem; }
.chapter-buttons { display: grid; gap: 6px; margin-top: 12px; }
.chapter-buttons button { text-align: left; }
.chapter-buttons [aria-current="true"] { border-color: var(--yellow); color: var(--yellow); }
.choice-label { margin: 14px 0 2px; color: var(--mint); font-size: .95rem; }

.recorded-cast .sprite {
  opacity: .76;
  filter: grayscale(1) sepia(.35) hue-rotate(108deg) saturate(1.7)
    drop-shadow(0 0 11px #65e7e1);
  mask-image: repeating-linear-gradient(#000 0 3px, #0009 3px 4px);
}
.recorded-tag {
  position: absolute;
  left: 10px;
  top: 42px;
  padding: 3px 8px;
  color: #b6fff4;
  border: 1px solid #70d7cf;
  background: #10272be8;
  font: 700 .71rem ui-monospace, monospace;
}

#scene-interaction { position: absolute; inset: 0; pointer-events: none; }
.search-spot { position: absolute; pointer-events: auto; min-height: 44px; padding: 5px 8px; background: #15292bf2; border-color: var(--mint); }
.search-spot[aria-pressed="true"], .mini-menu-group [aria-pressed="true"] { border-color: var(--yellow); color: var(--yellow); }
.spot-handle { top: 44%; right: 12%; }
.spot-bed { right: 4%; bottom: 10%; }
.spot-shelf { top: 26%; left: 8%; }
.spot-vent { bottom: 17%; left: 12%; }
.mini-findings { display: grid; gap: 6px; padding: 0; list-style: none; }
.mini-findings li { display: grid; gap: 2px; padding: 8px 10px; background: #283534; }
.mini-findings [lang="en"] { color: var(--mint); font-weight: 650; }
.mini-feedback { color: var(--yellow); }
.mini-feedback:empty { display: none; }
.mini-menu-group { margin: 0 0 8px; padding: 4px 8px 8px; border: 1px solid var(--edge); }
.mini-menu-group legend { padding-inline: 5px; color: var(--mint); }
.mini-menu-group .secondary { min-height: 44px; }
.local-route-button { display: block; min-height: 48px; }

.scene-ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.scene-ambient::before, .scene-ambient::after { content: ''; position: absolute; pointer-events: none; }
.scene-ambient[data-effect="rain"]::before {
  inset: -34% -8%;
  background: repeating-linear-gradient(115deg, transparent 0 15px, #b6e3f925 16px 17px, transparent 18px 35px);
  mask-image: repeating-linear-gradient(0deg, #000 0 12px, transparent 14px 80px);
  animation: ambient-rain 1.65s linear infinite;
}
.scene-ambient[data-effect="steam"]::before,
.scene-ambient[data-effect="steam"]::after {
  inset: 22% 12% 0;
  background: radial-gradient(ellipse at 42% 85%, #f5ffef45, transparent 56%);
  animation: ambient-steam 6s ease-out infinite;
}
.scene-ambient[data-effect="steam"]::after { animation-delay: -3s; transform-origin: 60% 83%; }
.scene-ambient[data-effect="scan"]::before {
  left: 3%; right: 3%; top: -21%; height: 24%;
  background: linear-gradient(transparent, #72dfca19 72%, #9fffea55);
  animation: ambient-scan 9s linear infinite;
}
.scene-ambient[data-effect="glow"]::before {
  inset: 0;
  background: radial-gradient(ellipse at 80% 19%, #ffc7792c, transparent 55%);
  animation: ambient-glow 7s ease-in-out infinite alternate;
}
@keyframes ambient-rain { to { transform: translate(-33px, 85px); } }
@keyframes ambient-steam {
  from { opacity: 0; transform: translateY(10%) scale(.75); }
  24% { opacity: .8; }
  to { opacity: 0; transform: translateY(-42%) scale(1.34); }
}
@keyframes ambient-scan {
  0%, 62% { opacity: 0; transform: translateY(0); }
  68% { opacity: .7; }
  94% { opacity: .4; transform: translateY(500%); }
  100% { opacity: 0; transform: translateY(520%); }
}
@keyframes ambient-glow { from { opacity: .3; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .scene-ambient { display: none; } }

.cutscene-fx { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cutscene-fx::before, .cutscene-fx::after { content: ''; position: absolute; pointer-events: none; }
.cutscene-signal { display: none; }
.cutscene-fx[data-shot="recording"] .cutscene-signal {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  inset: auto auto 20% 12%;
  width: clamp(92px, 23%, 175px);
  height: 36px;
  background: #0c2028c9;
  border: 1px solid #73ede367;
  box-shadow: 0 0 24px #70eade40;
  animation: signal-appear .7s ease-out both;
}
.cutscene-signal i {
  display: block;
  width: 3px;
  height: 68%;
  border-radius: 2px;
  background: #9af9f0;
  animation: signal-bars .52s ease-in-out infinite alternate;
}
.cutscene-signal i:nth-child(3n) { animation-delay: -.22s; }
.cutscene-signal i:nth-child(3n + 1) { animation-delay: -.38s; height: 44%; }
.cutscene-signal i:nth-child(3n + 2) { animation-delay: -.12s; }
.cutscene-fx[data-shot="scan"]::before {
  top: -18%;
  left: 0;
  right: 0;
  height: 18%;
  background: linear-gradient(transparent, #c8fff135 88%, #b4fff3b0);
  animation: cinematic-scan 2.4s .35s ease-in-out both;
}
.cutscene-fx[data-shot="scan"]::after {
  inset: 0;
  background: linear-gradient(90deg, transparent, #ffcb7729, transparent);
  animation: reveal-detail 2.2s 1.15s ease-out both;
}
.cutscene-fx[data-shot="reveal"]::after {
  inset: 0;
  background: radial-gradient(ellipse at 75% 65%, #85ffe052, transparent 33%);
  animation: reveal-detail 3.3s .25s ease-out both;
}
.cutscene-fx[data-shot="joke-screen"]::after {
  inset: 0;
  background: radial-gradient(ellipse at 68% 48%, #9bffd752, transparent 53%);
  animation: reveal-detail 1.65s ease-out both;
}
.cutscene-fx[data-shot="track"]::after {
  inset: 0;
  background: linear-gradient(112deg, transparent 24%, #f5b56626 47%, transparent 65%);
  animation: passing-light 3.4s ease-out both;
}
.cutscene > h2, .cutscene > p, .cutscene > .bubble { animation: cutscene-caption .48s ease-out both; }
@keyframes signal-appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes signal-bars { from { transform: scaleY(.18); } to { transform: scaleY(.95); } }
@keyframes cinematic-scan { 0% { opacity: 0; } 20% { opacity: 1; } 90% { opacity: .8; } 100% { opacity: 0; transform: translateY(655%); } }
@keyframes reveal-detail { 0%, 100% { opacity: 0; } 45% { opacity: 1; } }
@keyframes passing-light { from { opacity: .12; transform: translateX(-36%); } 50% { opacity: .85; } to { opacity: 0; transform: translateX(36%); } }
@keyframes cutscene-caption { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .cutscene-fx { display: none; }
  .cutscene > h2, .cutscene > p, .cutscene > .bubble { animation: none; }
}

.scene-reaction {
  position: absolute;
  left: 50%;
  top: 53%;
  z-index: 4;
  width: max-content;
  max-width: 90%;
  margin: 0;
  padding: 8px 18px;
  pointer-events: none;
  border: 1px solid currentColor;
  color: #b6fff1;
  background: #10272bec;
  box-shadow: 0 0 20px #81ebd04d;
  font: 800 clamp(.82rem, 3.2vw, 1.12rem) ui-monospace, monospace;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  animation: reaction-stamp 1.05s ease-out both;
}
.scene-reaction[data-kind="reject"], .scene-reaction[data-kind="alert"] {
  color: #ffd2be;
  background: #382022f0;
  box-shadow: 0 0 16px #fc81694f;
}
.scene-reaction[data-kind="clue"] { color: #ffe3a2; background: #383021f0; }
.dialogue-options {
  display: grid;
  min-width: 0;
  gap: 6px;
  margin: 0 0 12px;
  padding: 6px 0 0;
  border: 0;
}
.dialogue-options legend { color: var(--mint); font-weight: 750; padding: 0; }
.options-instruction { margin: 0; color: var(--muted); font-size: .85rem; }
.reply-options { display: grid; gap: 5px; margin: 0; padding-inline-start: 1.65rem; }
.reply-option {
  padding: 6px 9px;
  background: #222f34;
  text-align: start;
  border-inline-start: 2px solid #6daea5;
  animation: option-enter .27s var(--option-delay, 0ms) ease-out both;
}
.reply-choices:not([hidden]) > button { animation: option-enter .28s ease-out both; }
.reply-choices:not([hidden]) > button:nth-of-type(2) { animation-delay: 55ms; }
.reply-choices:not([hidden]) > button:nth-of-type(3) { animation-delay: 110ms; }
.chapter-buttons > button:active, .actions button:active { transform: translateY(1px); }
@keyframes reaction-stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.13) rotate(-2deg); }
  21% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-1deg); }
  76% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes option-enter {
  from { opacity: 0; transform: translateX(7px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .scene-reaction, .reply-option, .reply-choices:not([hidden]) > button { animation: none; }
}

.cast[data-emotion="relief"] .sprite,
.cast[data-emotion="approval"] .sprite {
  filter: drop-shadow(0 3px 4px #0e0b15) drop-shadow(0 0 8px #8ce9c355);
}
.cast[data-emotion="doubt"] .sprite,
.cast[data-emotion="shock"] .sprite {
  filter: drop-shadow(0 3px 4px #0e0b15) drop-shadow(0 0 12px #ffc87e80);
}
.cast[data-emotion="suspicion"] .sprite,
.cast[data-emotion="irritation"] .sprite {
  filter: drop-shadow(0 3px 4px #0e0b15) drop-shadow(0 0 12px #ff727584);
}

#emotion-fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}
#emotion-fx[data-mood] {
  background: radial-gradient(ellipse at 50% 46%, transparent 36%, #170e1b 100%);
  animation: emotion-vignette 660ms ease-out both;
}
#emotion-fx[data-mood="suspicion"],
#emotion-fx[data-mood="irritation"],
#emotion-fx[data-mood="shock"] { animation-duration: 1050ms; }
#emotion-fx[data-mood="shock"] { background: radial-gradient(ellipse at 50% 43%, transparent 24%, #08070b 89%); }
#emotion-fx[data-mood="irritation"] { background: radial-gradient(ellipse at 50% 48%, transparent 33%, #471b25 97%); }
@keyframes emotion-vignette {
  0%, 100% { opacity: 0; }
  24%, 48% { opacity: .73; }
}
.reaction-readable {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  #emotion-fx[data-mood] { animation: none; opacity: .38; }
}

.story-prop {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  perspective: 630px;
}

.story-prop[data-origin="right"] { --prop-start: 28%; --prop-reach: 18%; }

.story-prop-object {
  position: absolute;
  top: 63%;
  left: 50%;
  display: grid;
  align-content: center;
  gap: 8%;
  width: clamp(68px, 17vw, 128px);
  aspect-ratio: 1.65;
  padding: clamp(5px, 1.2vw, 11px);
  border: 1px solid #6f563f;
  border-radius: 6%;
  box-shadow: 0 7px 17px #09080ac4, inset 0 0 18px #986d443e;
  background: linear-gradient(125deg,#d9bc87,#a9895e);
  transform: translate(-50%, -50%) rotate(-7deg);
}

.story-prop-object i, .story-prop-object b {
  display: block;
  width: 63%;
  height: 3px;
  margin-left: 12%;
  background: #654d34b3;
  box-shadow: 0 4px #654d347d;
}

.story-prop-object b { width: 33%; margin-top: 5%; }

.story-prop[data-item="receipt"] .story-prop-object {
  width: clamp(45px, 10vw, 85px);
  aspect-ratio: .64;
  border-radius: 2%;
  background: repeating-linear-gradient(#d3c3a0 0 4px,#c8b996 4px 5px);
}

.story-prop[data-item="pager"] .story-prop-object,
.story-prop[data-item="tablet"] .story-prop-object {
  border: 4px solid #242a29;
  border-radius: 12%;
  background: linear-gradient(130deg, #224841, #122723);
  box-shadow: 0 8px 18px #09080ac4, inset 0 0 13px #66daca56;
}

.story-prop[data-item="pager"] .story-prop-object { width: clamp(44px, 10vw, 80px); }
.story-prop[data-item="pager"] i,
.story-prop[data-item="tablet"] i { background: #74ddbb; box-shadow: 0 0 7px #60dcc2; }
.story-prop[data-item="pager"] b,
.story-prop[data-item="tablet"] b { background: #57a48f; box-shadow: none; }

.story-prop[data-playing][data-motion="take"] .story-prop-object {
  animation: prop-handoff 1.26s cubic-bezier(.36,.03,.24,1) both;
}

.story-prop[data-playing][data-motion="give"] .story-prop-object {
  animation: prop-handoff 1.16s cubic-bezier(.36,.03,.24,1) reverse both;
}

.story-prop[data-playing][data-motion="discover"] .story-prop-object {
  animation: prop-discover 1.2s cubic-bezier(.19,.62,.34,1) both;
}

@keyframes prop-handoff {
  0% { opacity: 0; transform: translate(var(--prop-start, -140%), -72%) scale(.48) rotate(-17deg); }
  18%, 35% { opacity: 1; transform: translate(var(--prop-reach, -130%), -67%) scale(.52) rotate(-12deg); }
  72% { opacity: 1; transform: translate(-45%, -14%) scale(1.05) rotate(4deg); }
  100% { opacity: 1; transform: translate(-58%, 12%) scale(.97) rotate(-7deg); }
}

@keyframes prop-discover {
  0% { opacity: 0; transform: translate(-80%, -68%) scale(.26) rotateY(-46deg); }
  27% { opacity: 1; transform: translate(-69%, -58%) scale(.42) rotateY(-31deg); }
  100% { transform: translate(-50%, -22%) scale(1) rotate(-7deg); }
}

@media (prefers-reduced-motion: reduce) {
  .story-prop[data-playing] .story-prop-object { animation: none; }
}

.actor:has(.gesture-rig) > .sprite { visibility: hidden; }

.gesture-rig {
  position: absolute;
  top: 3px;
  left: 50%;
  height: 165%;
  max-width: 96%;
  aspect-ratio: 8 / 9;
  transform: translateX(-50%);
  filter: drop-shadow(0 3px 4px #0e0b15);
  --arm-joint: 59% 32%;
  --upper-arm: polygon(57% 29%, 61% 27%, 63% 23%, 65% 18%, 79% 18%, 78% 29%, 68% 32%, 62% 36%, 58% 36%);
  --body-cut: polygon(0 0, 100% 0, 100% 18%, 65% 18%, 63% 23%, 61% 27%, 57% 29%, 58% 36%, 62% 36%, 68% 32%, 78% 29%, 100% 29%, 100% 100%, 0 100%);
}

.gesture-rig[data-actor="attendant"] {
  --arm-joint: 53.8% 32%;
  --upper-arm: polygon(51.5% 29%, 55% 27.5%, 57.5% 23%, 59.5% 18%, 74% 18%, 72% 29%, 63% 32%, 57% 36%, 52% 36%);
  --body-cut: polygon(0 0, 100% 0, 100% 18%, 59.5% 18%, 57.5% 23%, 55% 27.5%, 51.5% 29%, 52% 36%, 57% 36%, 63% 32%, 72% 29%, 100% 29%, 100% 100%, 0 100%);
}

.gesture-body, .gesture-limb, .gesture-arm { position: absolute; inset: 0; }
.art .gesture-body, .art .gesture-arm { object-fit: fill; }
.gesture-body { clip-path: var(--body-cut); }
.gesture-arm { clip-path: var(--upper-arm); }
.gesture-limb { transform-origin: var(--arm-joint); }

.gesture-held-permit {
  position: absolute;
  left: 62%;
  top: 17.8%;
  width: 10%;
  height: 6%;
  border: 1px solid #6f563f;
  border-radius: 2px;
  background: linear-gradient(175deg, #ddc79e 35%, #887052 36% 45%, #c4a878 46%);
  box-shadow: 0 2px 3px #201c19b3;
  transform: rotate(12deg);
}

.gesture-rig[data-gesture="wave"] .gesture-limb { animation: mira-wave 1.24s ease-in-out both; }
.gesture-rig[data-gesture="beckon"] .gesture-limb { animation: noah-call .94s ease-in-out both; }
.gesture-rig[data-gesture="reach"] .gesture-limb { animation: noah-reach .98s ease-in-out both; }

@keyframes mira-wave {
  0%, 100% { transform: rotate(0); }
  21%, 52% { transform: rotate(-35deg); }
  35%, 69% { transform: rotate(-15deg); }
}
@keyframes noah-call {
  0%, 100% { transform: rotate(0); }
  35%, 58% { transform: rotate(-25deg); }
}
@keyframes noah-reach {
  0%, 100% { transform: rotate(0); }
  48%, 68% { transform: rotate(13deg) translateX(2%); }
}

.story-prop[data-handoff="permit"][data-playing] .story-prop-object {
  animation: permit-from-palm 1.25s ease-in-out both;
}
@keyframes permit-from-palm {
  0% { top: var(--prop-hand-y, 45%); left: var(--prop-hand-x, 62%); opacity: 0; transform: translate(-50%, -40%) scale(.36) rotate(-8deg); }
  14%, 28% { top: var(--prop-hand-y, 45%); left: var(--prop-hand-x, 62%); opacity: 1; transform: translate(-50%, -40%) scale(.42) rotate(-8deg); }
  62% { top: 64%; left: 52%; opacity: 1; transform: translate(-50%, -50%) scale(.76) rotate(7deg); }
  100% { top: 81%; left: 50%; opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
}
.scene-subtitles, .scene-audio { z-index: 5; }

@media (prefers-reduced-motion: reduce) {
  .gesture-rig .gesture-limb, .story-prop[data-handoff="permit"][data-playing] .story-prop-object {
    animation: none;
  }
}

.cast[data-emotion="warm"] .sprite { filter: drop-shadow(0 0 11px #9ee2a580); }
.cast[data-emotion="rude"] .sprite { filter: drop-shadow(0 0 12px #fa795989); }
.cast[data-emotion="comic"] .sprite { filter: drop-shadow(0 0 10px #f0c2747a); }
#emotion-fx[data-mood="rude"] {
  animation-duration: 950ms;
  background: radial-gradient(ellipse at 50% 46%, transparent 32%, #5b1520 100%);
}

#action-fx {
  position: absolute;
  inset: 12% 0 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

#action-fx > i, #action-fx > span { position: absolute; display: none; }
#action-fx[data-action="scan"] > i:first-child {
  display: block;
  inset: 17% 12%;
  border: 1px solid #8febd363;
  background: linear-gradient(transparent, #72dcc23b, #b6fbe8ea, transparent) center / 100% 12% no-repeat;
  animation: action-scan .9s ease-out both;
}
#action-fx[data-action="note"] > i {
  display: block;
  width: 21%;
  height: 2px;
  left: 18%;
  bottom: 23%;
  background: #d3b88a;
  box-shadow: 0 0 8px #b58b58;
  transform-origin: left center;
  animation: action-note .64s ease-out both;
}
#action-fx[data-action="note"] > i:nth-child(2) { bottom: 20%; width: 18%; animation-delay: .13s; }
#action-fx[data-action="note"] > i:nth-child(3) { bottom: 17%; width: 12%; animation-delay: .25s; }
#action-fx[data-action="door"] > i:first-child,
#action-fx[data-action="door"] > i:nth-child(2) {
  display: block;
  top: 0;
  bottom: 0;
  width: 50%;
  border: 2px solid #c3ad7850;
  background: repeating-linear-gradient(90deg, #1d282ae0 0 18px, #2a3333e0 18px 19px);
  animation: action-door .85s ease-out both;
}
#action-fx[data-action="door"] > i:nth-child(2) { right: 0; animation-name: action-door-right; }
#action-fx[data-action="move"] > i:first-child {
  display: block;
  inset: 0;
  background: linear-gradient(115deg, transparent 26%, #0c151ddd 49%, #8de8d412 54%, transparent 76%);
  animation: action-move .78s ease-in-out both;
}
#action-fx[data-action="stamp"] > span,
#action-fx[data-action="offline"] > span,
#action-fx[data-action="broken-sign"] > span {
  display: block;
  inset: 37% 0 auto;
  width: max-content;
  max-width: 90%;
  margin: auto;
  border: 3px double #34221a;
  padding: .3em .55em;
  color: #271f20;
  background: #edcc91;
  box-shadow: 3px 4px 0 #161019b8;
  font: 900 clamp(1.02rem,5vw,2.1rem)/1.1 ui-monospace, monospace;
  animation: action-stamp .84s cubic-bezier(.15,.83,.4,1) both;
}
#action-fx[data-action="broken-sign"] > span { animation-name: action-sign-fall; }
@keyframes action-scan {
  0% { opacity: 0; background-position: center top; }
  20%, 72% { opacity: 1; }
  100% { opacity: 0; background-position: center bottom; }
}
@keyframes action-note {
  0% { opacity: 0; transform: scaleX(0); }
  27%, 68% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; }
}
@keyframes action-door { 0% { transform: translateX(0); opacity: .8; } 100% { transform: translateX(-100%); opacity: 0; } }
@keyframes action-door-right { 0% { transform: translateX(0); opacity: .8; } 100% { transform: translateX(100%); opacity: 0; } }
@keyframes action-move { 0% { transform: translateX(-80%); opacity: 0; } 50% { opacity: .8; } 100% { transform: translateX(80%); opacity: 0; } }
@keyframes action-stamp {
  0% { transform: rotate(-17deg) scale(1.55); opacity: 0; }
  24%, 100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}
@keyframes action-sign-fall {
  0%, 27% { transform: rotate(0) translateY(0); }
  88%, 100% { transform: rotate(24deg) translateY(80%); }
}

@media (prefers-reduced-motion: reduce) {
  #action-fx[data-action] > i { display: none; }
  #action-fx[data-action] > span { animation: none; }
}

.scene-hero {
  position: absolute;
  z-index: 2;
  bottom: -7%;
  width: 52%;
  height: 93%;
  overflow: hidden;
  pointer-events: none;
  filter: drop-shadow(0 5px 8px #0e0b15);
}
.scene-hero[data-shot="shared"] {
  left: -9%;
}
.scene-hero[data-shot="reverse"] {
  left: 50%;
  bottom: -11%;
  width: min(94%, 520px);
  height: 108%;
  transform: translateX(-50%);
}
#scene-cast[data-camera="hero"] { visibility: hidden; }
.art .scene-hero img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }

.answer-reference {
  margin-top: .75rem;
  color: var(--muted);
  font-size: .87rem;
}
.answer-reference summary { cursor: pointer; min-height: 34px; align-content: center; }
.answer-reference li + li { margin-top: .45rem; }
.answer-reference span[lang="en"] { color: var(--ink); }

.scene-audio #story-skip {
  min-width: 46px;
  min-height: 32px;
  border-color: #dfc587;
  background: #e7cc93;
  color: #242025;
  font-size: .79rem;
  font-weight: 850;
  opacity: 1;
}
.scene-audio #story-skip:disabled { opacity: .46; }

#scene-cast[data-staging] {
  inset: 0;
  --actor-x: 50%;
  --counter-y: var(--counter-line, 73%);
}

#scene-cast[data-staging] .actor {
  clip-path: inset(0 0 calc(100% - var(--counter-y)));
}
#scene-cast[data-staging] .actor .sprite {
  left: var(--actor-x);
  right: auto;
  top: max(8%, calc(var(--counter-y) - 53%));
  width: 52%;
  height: 131%;
  transform: translateX(-50%);
}
#scene-cast[data-staging] .actor.portrait .sprite {
  top: calc(var(--counter-y) - 48%);
  height: 51%;
}
#scene-cast[data-staging] .gesture-rig {
  left: var(--actor-x);
  top: max(8%, calc(var(--counter-y) - 53%));
  height: 131%;
  max-width: 52%;
}
#scene-cast[data-staging] .speech-wave {
  left: calc(var(--actor-x) + 10%);
  top: max(9%, calc(var(--counter-y) - 50%));
}
#scene-cast .cast[data-action="arrive"] .actor { animation: actor-arrival .68s ease-out both; }
#scene-cast .cast[data-action="present"] .actor { animation: actor-action .61s ease-out both; }
#scene-cast .cast[data-action="check"] .actor { animation: actor-check .67s ease-out both; }
@keyframes actor-arrival {
  from { transform: translateX(-2.2%); opacity: .48; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes actor-action {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-1.5%); }
}
@keyframes actor-check {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(1.7%); }
}
@media (prefers-reduced-motion: reduce) {
  #scene-cast .cast[data-action] .actor { animation: none; }
}

.scene-hero[data-action="arrive"] { animation: actor-arrival .68s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  .scene-hero[data-action] { animation: none; }
}

.answer-reference li > p { margin: .22em 0; }
.answer-reference li button { margin: .3em 0 .45em; min-height: 34px; }

.mira-counter {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  --desk-edge: var(--counter-line, 73%);
}
#scene-cast[data-staging="info"] .actor { clip-path: none; }
#mira-counter #counter-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: inset(var(--desk-edge) 0 0);
}
#mira-counter .counter-props {
  position: absolute;
  left: 47%;
  top: calc(var(--desk-edge) + 2.8%);
  width: clamp(80px, 30%, 230px);
  height: auto;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 3px 4px #0e1212ba);
}
#scene-cast[data-staging="info"] .actor[data-posture="seated"] > :is(.sprite, .desk-work) {
  position: absolute;
  left: var(--actor-x);
  top: calc(var(--counter-y) - 43%);
  height: 74%;
  width: 61%;
  transform: translateX(-50%);
  object-position: center top;
}
.desk-work { visibility: hidden; }
#scene-cast[data-staging="info"] .cast[data-pose="idle"]:not([data-speaker]) .desk-work { visibility: visible; }
#scene-cast[data-staging="info"] .cast[data-pose="idle"]:not([data-speaker]) .actor[data-posture="seated"] > .sprite { visibility: hidden; }
.art .desk-work img {
  position: absolute;
  inset: 0;
  object-fit: contain;
  object-position: center top;
  filter: drop-shadow(0 3px 4px #0e0b15);
}
.desk-work img {
  --desk-rest: 1;
  --desk-tap: 0;
  animation: mira-desk-typing 2.4s steps(1, end) infinite;
}
.desk-work img + img { --desk-rest: 0; --desk-tap: 1; }
@keyframes mira-desk-typing {
  0%, 27%, 47%, 68%, 86%, 100% { opacity: var(--desk-rest); }
  19%, 38%, 58%, 78% { opacity: var(--desk-tap); }
}
@media (prefers-reduced-motion: reduce) {
  .desk-work img { opacity: var(--desk-rest); animation: none; }
}
#scene-cast[data-staging="info"] .actor[data-posture="seated"] .speech-wave,
#scene-cast[data-staging="info"] .actor[data-posture="seated"] .emotion-mark {
  top: calc(var(--counter-y) - 38%);
}
.art:has(#scene-cast[data-staging="info"] .actor[data-posture="seated"]) #mira-counter .counter-props {
  left: 43%;
  width: clamp(80px, 28%, 215px);
}
.art:has(#scene-cast[data-camera="hero"]) #mira-counter { visibility: hidden; }

.bilingual-row { display:flex; align-items:flex-start; gap:.55rem; min-width:0; }
.bilingual-row > :first-child { flex:1; min-width:0; }
.translation-toggle { flex:0 0 auto; min-width:36px; min-height:36px; padding:.2em .45em; color:#b6f2de; border:1px solid #6b978b; border-radius:4px; background:#1c3431; font:800 1rem system-ui; line-height:1; }
.translation-toggle[aria-pressed="true"] { color:#1a2a27; background:#9cddc6; }
.bubble > .bilingual-row p { margin:0; font-size:clamp(1.02rem,2.5vw,1.2rem); font-weight:650; line-height:1.4; white-space:pre-line; }
.bubble > .speech-status { font-size:.78rem !important; color:#7d2426; }
.location { display:flex; align-items:center; gap:5px; max-width:56%; }
.location .translation-toggle { min-width:28px; min-height:28px; font-size:.84rem; }
.world-toolbar { display:flex; flex-wrap:wrap; gap:.6rem; padding:.2rem 0 .7rem; }
#world-content { display:grid; gap:.7rem; }
.world-preview { width:100%; max-height:30vh; object-fit:cover; border:1px solid #73968b; }
.world-list,.world-status { display:grid; gap:.5rem; }
.world-list button[aria-pressed="true"] { outline:2px solid var(--mint); }
.world-status p { margin:0; }

.scene-dialogue {
  position: absolute;
  z-index: 5;
  inset: auto clamp(8px, 3%, 24px) 8px;
  pointer-events: none;
}
.scene-dialogue:empty { display: none; }
.scene-dialogue > .bubble {
  margin: 0;
  padding: 8px 10px 6px;
  background: #f6e8c9f5;
  pointer-events: auto;
}
.scene-dialogue .bubble > .bilingual-row { align-items: flex-start; }
.scene-dialogue .bubble > .bilingual-row > p {
  max-height: clamp(44px, 19vw, 112px);
  overflow: auto;
  overscroll-behavior: contain;
  font-size: clamp(.86rem, 3.2vw, 1.08rem);
  line-height: 1.3;
}
.scene-dialogue .character { top: -19px; }
.scene-dialogue .translation-toggle { min-width: 34px; min-height: 34px; }

#settings-menu label { display: block; margin: .6rem 0 .4rem; }
#story-language {
  width: 100%;
  min-height: 44px;
  padding: .5rem;
  color: #e9eee9;
  background: #24352f;
  border: 1px solid #6b978b;
  border-radius: 4px;
  font: inherit;
}

.world-list .world-lock-note { flex: 1; align-self: center; color: var(--muted); line-height: 1.25; }
.world-list button:disabled { cursor: default; opacity: .58; }

.world-card-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,145px),1fr)); gap:.65rem; }
.world-location-card {
  position:relative; display:grid; grid-template-rows:auto 1fr; overflow:hidden; padding:0;
  text-align:left; color:#f3e9d8; background:#24312e; border:1px solid #728c83; border-radius:.4rem;
}
.world-location-card:hover, .world-location-card[aria-pressed="true"] { border-color:#a4efd5; }
.world-location-card:focus-visible { outline:2px solid #dfeaac; outline-offset:2px; }
.world-location-card img { width:100%; aspect-ratio:1.75; object-fit:cover; display:block; }
.world-location-name { padding:.48rem .6rem; font-weight:700; }
.world-location-marker { position:absolute; top:.4rem; left:.4rem; background:#16342c; color:#c7fae6; border:1px solid #77ae9c; border-radius:.2rem; padding:.12rem .35rem; }

.world-tabs { display:grid; grid-template-columns:1fr 1fr; gap:.3rem; border-bottom:1px solid #6b978b; }
.world-tabs button { border-radius:.35rem .35rem 0 0; min-height:44px; }
.world-tabs button[aria-selected="true"] { color:#102820; background:#a4efd5; border-color:#a4efd5; font-weight:800; }
.world-tab-panel { display:grid; gap:.6rem; }

.art[data-comic]:not(:has(#scene-cast[data-staging="info"] .actor)) #mira-counter { visibility: hidden; }
.scene-narration:has(#narration:empty),
.art:has(#scene-dialogue:not(:empty)) .scene-narration,
.interaction.comic-reaction { display: none; }
.interaction.comic-pacing { padding: 0; }

.emotion-mark {
  --mark-color: #ffe193;
  --mark-ink: #1b1423;
  position: absolute;
  z-index: 4;
  top: 7%;
  left: calc(50% + clamp(32px, 8vw, 72px));
  display: grid;
  place-items: center;
  width: clamp(24px, 6vw, 42px);
  aspect-ratio: 1;
  color: var(--mark-color);
  font: 900 clamp(22px, 5.4vw, 38px)/1 system-ui, sans-serif;
  text-shadow: -2px 0 var(--mark-ink), 2px 0 var(--mark-ink), 0 -2px var(--mark-ink), 0 2px var(--mark-ink);
  filter: drop-shadow(2px 3px 0 #11111b);
  pointer-events: none;
  animation: emotion-mark-pop 1.75s ease-out both;
}
.actor.portrait .emotion-mark { top: 11%; }
.actor:has(.emotion-mark) .speech-wave { visibility: hidden; }
#scene-cast[data-staging] .emotion-mark {
  top: max(10%, calc(var(--counter-y) - 48%));
  left: calc(var(--actor-x) + clamp(30px, 7vw, 66px));
}
.scene-hero .emotion-mark { top: 18%; }
.art > .emotion-mark { top: 19%; left: 74%; }
.emotion-mark[data-shape="sweat"]::before {
  content: '';
  width: 43%;
  height: 62%;
  border: 2px solid var(--mark-ink);
  border-radius: 78% 6% 68% 68%;
  background: linear-gradient(110deg, #f8ffff 10%, #9bfff5 31%, #4cc8f0 70%, #537ddb);
  transform: rotate(-31deg);
}
.emotion-mark[data-shape="vein"] { --mark-color: #ff6d82; animation-name: emotion-vein-pulse; }
.emotion-mark[data-shape="vein"] > i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: rotate(90deg);
}
.emotion-mark[data-shape="vein"]::before,
.emotion-mark[data-shape="vein"]::after,
.emotion-mark[data-shape="vein"] > i::before,
.emotion-mark[data-shape="vein"] > i::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 31%;
  border: solid var(--mark-color);
  border-width: 0 3px 3px 0;
  border-radius: 0 0 52% 0;
  filter: drop-shadow(1px 1px 0 var(--mark-ink));
}
.emotion-mark[data-shape="vein"]::before,
.emotion-mark[data-shape="vein"] > i::before { transform: translate(-52%, -50%) rotate(9deg); }
.emotion-mark[data-shape="vein"]::after,
.emotion-mark[data-shape="vein"] > i::after { transform: translate(51%, 51%) rotate(189deg); }
.emotion-mark[data-shape="sigh"]::before {
  content: '';
  width: 59%;
  height: 34%;
  border: 2px solid var(--mark-ink);
  border-radius: 65% 54% 60% 44%;
  transform: rotate(-17deg);
  background: #e7fbf5;
}
.emotion-mark[data-shape="sigh"]::after {
  content: '';
  position: absolute;
  width: 17%;
  aspect-ratio: 1;
  top: 60%;
  left: 13%;
  border: 2px solid var(--mark-ink);
  border-radius: 50%;
  background: #e7fbf5;
}
.emotion-mark[data-shape="question"] { --mark-color: #d3baff; }
.emotion-mark[data-shape="shock"] { --mark-color: #ffb267; }
.emotion-mark[data-shape="approval"] { --mark-color: #a7eac8; font-size: clamp(18px, 4vw, 28px); }
@keyframes emotion-mark-pop {
  0% { opacity: 0; scale: .58; translate: 0 7px; }
  16% { opacity: 1; scale: 1.12; }
  27%, 74% { opacity: 1; scale: 1; translate: 0 0; }
  100% { opacity: 0; translate: 0 -5px; }
}
@keyframes emotion-vein-pulse {
  0% { opacity: 0; scale: .7; }
  16%, 51% { opacity: 1; scale: 1.16; }
  32%, 76% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: .94; }
}
@media (prefers-reduced-motion: reduce) {
  .emotion-mark, .emotion-mark[data-shape="vein"] { animation: none; }
}

.story-prop[data-item="card"] .story-prop-object {
  width: clamp(54px, 13vw, 100px);
  aspect-ratio: 1.58;
  border: 2px solid #122121;
  background: linear-gradient(145deg, #beded0, #4b857e);
  box-shadow: 0 7px 17px #09080ac4;
}
.story-prop[data-item="card"] .story-prop-object i { width: 23%; background: #e7c179; }
.story-prop[data-item="card"] .story-prop-object b { width: 60%; background: #24474a; }
@media (prefers-reduced-motion: no-preference) {
  .story-prop[data-playing][data-motion="keep"] .story-prop-object {
    animation: prop-pocket .9s ease-in both;
  }
}
@keyframes prop-pocket {
  0%, 27% { opacity: 1; transform: translate(-50%, -40%) scale(.94) rotate(-7deg); }
  100% { opacity: 0; transform: translate(-95%, 56%) scale(.62) rotate(-16deg); }
}

.story-prop[data-item="key"] .story-prop-object {
  width: clamp(44px, 12vw, 82px);
  aspect-ratio: 2.45;
  border: 0;
  background: #d3a75d;
  clip-path: polygon(0 14%, 24% 0, 40% 14%, 46% 35%, 94% 35%, 100% 48%, 96% 71%, 84% 71%, 84% 87%, 72% 87%, 72% 66%, 46% 66%, 40% 88%, 24% 100%, 0 87%);
}
.story-prop[data-item="key"] .story-prop-object i {
  width: 23%;
  aspect-ratio: 1;
  height: auto;
  border-radius: 50%;
  background: #563f2d;
  box-shadow: none;
}
.story-prop[data-item="key"] .story-prop-object b { display: none; }

.cutscene-fx[data-shot="approach"]::after,
.cutscene-fx[data-shot="meeting"]::after {
  inset: 30% 0 0;
  background: radial-gradient(ellipse at 68% 63%, #79efe92d, transparent 57%);
  animation: arrival-light 2.8s ease-in-out infinite alternate;
}
.cutscene-fx[data-shot="cabin"]::before,
.cutscene-fx[data-shot="jetway"]::before {
  inset: 2% 55% 0 -45%;
  background: linear-gradient(105deg, transparent 23%, #91e9ee35 53%, transparent 76%);
  animation: arrival-reflection 3.8s ease-out both;
}
.cutscene-fx[data-shot="chip-light"]::before {
  inset: 13% 17% 21% 28%;
  background: linear-gradient(transparent 44%, #71e9d72d 49%, #a6ffec65 50%, transparent 55%);
  mask-image: radial-gradient(ellipse, #000 21%, transparent 73%);
  animation: arrival-scanner 2.6s ease-out both;
}
.cutscene-fx[data-shot="failed-call"]::before {
  inset: 21% 16% 25% 35%;
  background: radial-gradient(ellipse at 65% 45%, #e8626636, transparent 61%);
  animation: arrival-signal 1.6s ease-in-out 2 both;
}
@keyframes arrival-light {
  from { opacity: .24; }
  to { opacity: .92; }
}
@keyframes arrival-reflection {
  0% { opacity: 0; transform: translateX(0); }
  26% { opacity: .76; }
  100% { opacity: 0; transform: translateX(145%); }
}
@keyframes arrival-scanner {
  0% { opacity: 0; transform: translateY(-30%); }
  25%, 62% { opacity: .8; }
  100% { opacity: 0; transform: translateY(28%); }
}
@keyframes arrival-signal {
  0%, 100% { opacity: 0; }
  33% { opacity: .9; }
}

.art[data-hero-feeling]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}
.art[data-hero-feeling="panic"]::after {
  background: radial-gradient(ellipse at 50% 46%, transparent 22%, #08070bbe 62%, #030307 100%);
  animation: hero-tunnel 1.15s ease-in-out 2 alternate both;
}
.art[data-hero-feeling="anger"]::after {
  background: radial-gradient(ellipse at 50% 45%, transparent 22%, #9b15384a 68%, #741327b8);
  animation: hero-anger-light .55s ease-out both;
}
.art[data-hero-feeling="sad"] #scene-art {
  filter: saturate(.34) brightness(.77) sepia(.12) hue-rotate(11deg);
  animation: hero-sad-drop 3.6s ease-out both;
}
.art[data-hero-feeling="sad"]::after {
  background: linear-gradient(170deg, #213b564f, transparent 80%);
}
.art[data-hero-feeling="shock"]::after {
  background: radial-gradient(ellipse at 50% 44%, #fff8e0b0, #b9c9d84a 72%, #10182361);
  animation: hero-shock-flash .8s ease-out both;
}
.art[data-hero-feeling="shock"] #scene-art { filter: blur(2px) saturate(.68); }
.art[data-hero-feeling="shock"] :is(.scene-ambient, .cutscene-fx)::before,
.art[data-hero-feeling="shock"] :is(.scene-ambient, .cutscene-fx)::after,
.art[data-hero-feeling="shock"] :is(.cutscene-signal i, .speech-wave i) {
  animation-play-state: paused;
}
.art[data-hero-feeling="bashful"]::after {
  background:
    radial-gradient(ellipse at 13% 67%, #f6ad9a5c 0, transparent 37%),
    radial-gradient(circle at 87% 27%, #ffdb9f57 0, transparent 11%),
    radial-gradient(ellipse at 90% 44%, #da67904e, transparent 47%);
  animation: hero-soft-light 1.65s ease-in-out 2 alternate;
}
.art[data-hero-feeling="bashful"] #scene-art { filter: blur(.75px) saturate(1.09); }
.art[data-hero-feeling="resolve"]::after {
  background: linear-gradient(111deg, transparent 37%, #fff4bc52 49%, transparent 63%);
  animation: hero-focus-glint 1.15s ease-out both;
}
.art[data-hero-feeling="resolve"] #scene-art { filter: contrast(1.13) saturate(1.08); }

.art[data-hero-feeling="panic"] :is(#scene-art, #scene-cast, #scene-hero) { animation: hero-camera-panic 1.06s ease-in-out 2 both; }
.art[data-hero-feeling="anger"] :is(#scene-art, #scene-cast, #scene-hero) { animation: hero-camera-anger .55s ease-out both; }
.art[data-hero-feeling="shock"] :is(#scene-art, #scene-cast, #scene-hero) { animation: hero-camera-shock .65s ease-out both; }
.art[data-hero-feeling="bashful"] :is(#scene-art, #scene-cast, #scene-hero) { animation: hero-camera-soft 2.8s ease-in-out both; }
.art[data-hero-feeling="resolve"] :is(#scene-art, #scene-cast, #scene-hero) { animation: hero-camera-resolve 1.7s ease-out both; }

@keyframes hero-tunnel { from { opacity: .73; } to { opacity: 1; } }
@keyframes hero-anger-light { from { opacity: .9; } to { opacity: .42; } }
@keyframes hero-sad-drop { from { scale: 1.055; } to { scale: 1.055; translate: 0 1.6%; } }
@keyframes hero-shock-flash { 0% { opacity: .78; } 38% { opacity: .28; } 100% { opacity: .15; } }
@keyframes hero-soft-light { from { opacity: .4; } to { opacity: .94; } }
@keyframes hero-focus-glint { 0% { translate: -38% 0; opacity: 0; } 40% { opacity: 1; } 100% { translate: 38% 0; opacity: 0; } }
@keyframes hero-camera-panic {
  0%, 100% { scale: 1.035; translate: 0 0; }
  13%, 64% { scale: 1.046; translate: -1px 1px; }
  25%, 76% { scale: 1.053; translate: 1px 0; }
  37%, 87% { scale: 1.046; translate: -1px -1px; }
  50% { scale: 1.04; translate: 1px 1px; }
}
@keyframes hero-camera-anger {
  0% { scale: 1; translate: 0 0; }
  23% { scale: 1.078; translate: 3px -2px; }
  100% { scale: 1.044; translate: 0 0; }
}
@keyframes hero-camera-shock { 0% { scale: 1.065; } 28%, 100% { scale: 1; } }
@keyframes hero-camera-soft { 0%, 100% { scale: 1.018; } 53% { scale: 1.025; translate: 1px -1px; } }
@keyframes hero-camera-resolve { from { scale: 1; } to { scale: 1.043; } }
@keyframes hero-letter-tremor { 25% { translate: .6px 0; } 75% { translate: -.6px .4px; } }

@media (prefers-reduced-motion: reduce) {
  .art[data-hero-feeling]::after,
  .art[data-hero-feeling] :is(#scene-art, #scene-cast, #scene-hero),
  .art[data-hero-feeling="shock"]::after { opacity: .17; }
  .art[data-hero-feeling="anger"]::after { opacity: .45; }
  .art[data-hero-feeling="resolve"]::after { opacity: .2; }
}


#scene-art[data-art="cut-opening-approach"] { object-position: 43% 50%; }
#scene-art[data-art="cut-opening-call"] { object-position: 62% 50%; }
#scene-art[data-art="cut-hero-flashlight-face"] { object-position: 60% 50%; }
#scene-art[data-art="cut-mira-show-tablet"] { object-position: 59% 50%; }
#scene-art[data-art="cut-mira-return-tablet"] { object-position: 60% 50%; }
#scene-art[data-art="cut-lina-metro-platform"] { object-position: 54% 50%; }
.noah-held-permit {
  position: absolute;
  top: 37%;
  left: 62%;
  width: clamp(20px, 5vw, 37px);
  aspect-ratio: 1.52;
  border: 1px solid #6f563f;
  border-radius: 2px;
  transform: rotate(12deg);
  background: linear-gradient(175deg, #ddc79e 35%, #887052 36% 45%, #c4a878 46%);
}

.investigation-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: .55rem;
}
.investigation-actions button { min-height: 44px; width: 100%; }
.investigation-actions .topic-heard { opacity: .8; }

.art:has(#scene-art:is([data-art="cut-noodle-golden-pose"], [data-art="cut-clinic-stand-shadow"], [data-art="cut-noah-triple-tap"])) {
  height: auto;
  aspect-ratio: 2;
}

#scene-art[data-art="cut-noodle-ticket-reveal"] {
  object-position: 45% 50%;
}

.art:has(#scene-art[data-art^="cut-reflect-"],
  #scene-art:is([data-art="cut-archive-alex-briefing"], [data-art="cut-archive-analog-route"])) {
  height: auto;
  aspect-ratio: 2;
}

#credits-usd {
  display: block;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.art:has(#scene-art[data-art^="cut-action-"]) {
  height: auto;
  aspect-ratio: 2;
}

.lesson-reply-label {
  display: block;
  margin-top: .15rem;
  color: var(--amber, #ffd192);
  font-size: .75rem;
}

#story-continue {
  position: absolute;
  z-index: 6;
  right: clamp(12px, 4%, 28px);
  bottom: 13px;
  min-height: 36px;
  padding: .3rem .6rem;
  border: 1px solid #6c837b;
  border-radius: 3px;
  background: #192825;
  color: #e8ffd9;
  font: 700 .85rem system-ui, sans-serif;
}
#story-continue[hidden] { display: none; }
#story-continue span { animation: continue-blink .9s steps(2, end) infinite; }
.art:has(#story-continue:not([hidden])) .scene-dialogue .bubble > .bilingual-row { padding-right: 5.2rem; }
@keyframes continue-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { #story-continue span { animation: none; } }

#game-hud[hidden], #chapter[hidden], .title-screen[hidden] { display: none; }
.title-screen {
  display: grid;
  align-items: end;
  min-height: 100dvh;
  padding: clamp(24px, 6vw, 72px);
  padding-bottom: max(clamp(24px, 6vw, 72px), env(safe-area-inset-bottom));
  background:
    linear-gradient(0deg, #0d1117 6%, #0d1117d9 35%, transparent 76%),
    linear-gradient(90deg, #0d1117b8, transparent 82%),
    #11191c url("assets/opening-hero.webp") 58% 45% / cover no-repeat;
}
.title-content { width: min(660px, 100%); margin-inline: auto; }
.title-content h1 {
  margin: 0 0 1.4rem;
  color: #ffda93;
  font: 900 clamp(2.4rem, 8vw, 5rem)/.97 system-ui, sans-serif;
  letter-spacing: -.055em;
  text-shadow: 0 2px 18px #090b10;
}
.title-content h1 span {
  display: block;
  margin-top: .65rem;
  color: var(--mint);
  font: 750 clamp(.85rem, 3.2vw, 1.45rem)/1.1 ui-monospace, monospace;
  letter-spacing: .24em;
}
.title-actions { display: grid; width: min(100%, 340px); gap: .55rem; }
.title-actions button { min-height: 50px; border-radius: 3px; text-align: left; }
.title-actions .secondary { background: #192728eb; }
.title-actions button:disabled, #save-buttons button:disabled { opacity: .48; }
#settings-menu .sound-setting { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.sound-setting input { width: 1.15rem; height: 1.15rem; accent-color: var(--mint); }

/* The title and game share one framed screen. */
#chapter, .title-screen {
  width: min(940px, calc(100% - 16px));
  margin: 8px auto;
  padding: 0;
}
.title-screen, #chapter .frame {
  height: min(820px, calc(100dvh - 16px));
  border: 2px solid #788d83;
  box-shadow: 0 0 0 1px #101716, 0 14px 40px #0008;
}
.title-screen {
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 5vw, 52px);
}
#chapter .frame { position: relative; width: 100%; overflow: hidden; }
#chapter .frame > .art:has(#scene-art) { width: 100%; height: 100%; aspect-ratio: auto; }
#chapter #scene-art { object-fit: cover; }
#chapter .art:has(#scene-art[data-illustrated]) {
  background: linear-gradient(#0b171aa6, #0b171abf), var(--scene-backdrop) center / cover no-repeat, #162326;
}
#chapter #scene-art[data-illustrated] { object-fit: contain; object-position: center; }
.scene-hud {
  position: absolute;
  z-index: 8;
  inset: 0 0 auto;
  min-height: 37px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  gap: .55rem;
  background: #10191de8;
}
.scene-chapter { display: flex; align-items: baseline; gap: .45rem; min-width: 0; flex: 1; }
.scene-chapter .eyebrow { font-size: .53rem; white-space: nowrap; }
.scene-chapter h1 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(.72rem, 2.4vw, 1rem);
}
.scene-resources { display: flex; align-items: center; gap: .6rem; }
.scene-resources .balance { display: flex; align-items: baseline; gap: .25rem; }
.scene-resources .balance small { font-size: .52rem; }
.scene-resources .balance strong { font-size: .88rem; }
.scene-resources .suspicion { width: 44px; }
.scene-resources .suspicion small { gap: .25rem; font-size: .57rem; }
.scene-resources progress { margin-top: 2px; height: 3px; }
.scene-topic { color: var(--mint); font-size: .62rem; }
.scene-hud .gear-readout { margin: 0; font-size: .64rem; }
.scene-hud #scene-clock { min-width: 2.4em; font-size: .75rem; }
.scene-tools { position: absolute; z-index: 9; top: 43px; display: flex; gap: 5px; }
.scene-tools-left { left: 7px; }
.scene-tools-right { right: 7px; }
.scene-icon {
  display: inline-grid;
  place-items: center;
  width: clamp(32px, 8.5vw, 39px);
  height: clamp(32px, 8.5vw, 39px);
  padding: 0;
  min-height: 0;
  border: 1px solid #92afa3;
  border-radius: 50%;
  background: #162626ed;
  color: #eff8df;
  font-size: 1.08rem;
  line-height: 1;
}
.scene-icon:hover:not(:disabled) { border-color: #e6e5a5; }
.scene-icon:disabled { opacity: .46; }
.scene-icon[hidden], #answer-open[hidden] { display: none; }
#chapter .location { top: 88px; left: 7px; }
#chapter .scene-dialogue { bottom: 56px; }
#chapter #story-continue { bottom: 61px; }
#answer-open { border-color: #e7cc93; color: #ffe4a8; }
#story-skip {
  position: absolute;
  z-index: 9;
  bottom: 8px;
  right: 8px;
  min-height: 38px;
  padding: 4px 12px;
  border: 1px solid #dfc587;
  border-radius: 2px;
  background: #e7cc93;
  color: #242025;
  font-size: .79rem;
  font-weight: 850;
}
#story-skip:disabled { opacity: .48; }
#scene-sheet {
  position: absolute;
  z-index: 8;
  inset: auto 8px 55px;
  max-height: calc(100% - 146px);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#scene-sheet > #interaction {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  pointer-events: auto;
  padding: clamp(8px, 2.5vw, 16px);
  background: #152426f5;
  border: 1px solid #73968b;
  border-radius: 5px;
}
#scene-sheet > #interaction:empty,
#scene-sheet > #interaction.comic-reaction,
#scene-sheet[data-composable]:not([data-answer-open]) > #interaction { display: none; }
#scene-sheet > #interaction.comic-pacing { pointer-events: none; padding: 0; border: 0; }
#scene-sheet > #interaction.cutscene:not(.comic-pacing):not(:has(button)) { display: none; }
#scene-sheet[data-answer-open] > #interaction { padding-top: 40px; }
#answer-close { position: absolute; z-index: 1; top: 5px; right: 6px; pointer-events: auto; }
#scene-sheet h2 { margin: 0 0 .45rem; font-size: 1rem; }
#scene-sheet .steps { display: none; }
#scene-sheet .reply-options { gap: .2rem; }
#scene-sheet .reply-option { margin: 0; }
#scene-sheet .typed-answer { font-size: 16px; }
#scene-sheet .actions button { min-height: 40px; }
#interaction .feedback:empty { display: none; }
#scene-hints { display: grid; gap: .6rem; }
.screen-dialog { max-width: min(720px, calc(100vw - 24px)); }
@media (max-width: 520px) {
  #chapter, .title-screen { width: 100%; margin: 0; }
  .title-screen, #chapter .frame { height: 100dvh; border-width: 0; }
  .scene-hud { padding-inline: 7px; gap: .35rem; }
  .scene-hud #credits-usd, .scene-topic, .scene-hud .gear-readout { display: none; }
}
@media (max-width: 340px) {
  .scene-tools { gap: 3px; }
  .scene-icon { width: 30px; height: 30px; }
}

.scene-tools { gap: clamp(3px, 1vw, 8px); }
.scene-tools .scene-icon {
  --icon-accent: #e8ba6e;
  position: relative;
  color: var(--icon-accent);
  border-color: #9f7b50;
  background: linear-gradient(155deg, #342d2a, #171b20 72%);
  box-shadow: 0 2px 6px #000b, inset 0 1px #fff2ce20;
}
.scene-tools .scene-icon:hover:not(:disabled) { filter: brightness(1.13); }
.scene-tools .scene-icon:active:not(:disabled) { transform: translateY(1px); }
.scene-tools .scene-icon:disabled { filter: saturate(.35); opacity: .58; }
.scene-icon-label {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 2px;
  border-radius: 2px;
  background: #10191dec;
  color: #fffae8;
  font: 700 clamp(6px, 1.95vw, 10px)/1.2 system-ui, sans-serif;
  letter-spacing: 0;
  white-space: nowrap;
}
#chapter .location { top: 105px; }
#save-game {
  position: absolute;
  z-index: 9;
  bottom: 8px;
  left: 8px;
  min-height: 38px;
  padding: 4px 11px;
  border: 1px solid #c0f1ce;
  border-radius: 3px;
  background: linear-gradient(#b8f1c9, #76cfa7);
  color: #123229;
  font-size: .79rem;
  font-weight: 850;
  box-shadow: 0 2px 8px #000a;
}
#save-game:hover { background: #c6f4d0; }
#story-skip { background: linear-gradient(#ffdc95, #ebad5a); }
#story-skip[hidden] { display: none; }
#story-continue { background: #b5e5ce; color: #15362d; border-color: #e2ffeb; }
.slot-button { display: grid; text-align: left; gap: .15rem; }
.slot-button span { color: #d3efe5; font-size: .8rem; }
.slot-button[aria-current="true"] { border-color: #9de6c8; }
#save-message:empty { display: none; }

/* Compact frame, with an in-screen centered answer window. */
#chapter, .title-screen { width: min(760px, calc(100% - 16px)); }
.title-screen, #chapter .frame { height: clamp(240px, 52vw, 382px); }
.title-screen { padding: clamp(12px, 3vw, 26px); }
.title-content h1 { margin-bottom: .75rem; font-size: clamp(1.7rem, 7vw, 3.35rem); }
.title-content h1 span { margin-top: .35rem; }
.title-actions { grid-template-columns: minmax(0, 1fr); width: min(100%, 300px); gap: clamp(3px, .7vw, 6px); }
.title-actions .title-button {
  min-height: clamp(23px, 5vw, 38px);
  padding: 2px 10px;
  border: 1px solid #fff0a1;
  background: linear-gradient(#ffe69a, #edbe55);
  color: #2a1c0c;
  box-shadow: inset 0 -2px #a3673e42, 0 2px 5px #0008;
  text-align: center;
  font-size: clamp(.73rem, 2.8vw, .94rem);
  font-weight: 850;
  line-height: 1.18;
}
.title-actions .title-button:hover:not(:disabled) { background: #fff0ac; }
.title-actions .title-button:disabled { opacity: .63; }
#scene-sheet { max-height: calc(100% - 82px); bottom: 47px; }
#scene-sheet[data-answer-open] {
  z-index: 10;
  inset: 50% auto auto 50%;
  width: min(500px, calc(100% - 18px));
  max-height: calc(100% - 16px);
  transform: translate(-50%, -50%);
}
#scene-sheet[data-answer-open] > #interaction {
  padding: 8px clamp(8px, 2vw, 14px);
  padding-top: 37px;
  box-shadow: 0 0 0 1px #b5d8c0, 0 12px 30px #000b;
}
#scene-sheet[data-answer-open] :is(.panel-top, .task-title) { display: none; }
#scene-sheet[data-answer-open] .answer-form { display: flex; flex-direction: column; gap: .25rem; }
#scene-sheet[data-answer-open] .typed-answer { order: -1; min-height: 36px; }
#scene-sheet[data-answer-open] .translation { display: none; }
#scene-sheet[data-answer-open] .reply-options { font-size: .79rem; }
#scene-sheet[data-answer-open] .dialogue-options { margin-block: 0; }
#scene-sheet[data-answer-open] .actions button { min-height: 34px; }
@media (max-width: 520px) {
  #chapter, .title-screen { margin: 8px auto; }
  .title-screen, #chapter .frame { height: clamp(180px, 53vw, 246px); }
  #chapter .frame, .title-screen { border-width: 1px; }
  #chapter .location { top: 79px; padding: 1px 5px; font-size: .5rem; }
  .scene-hud { min-height: 29px; }
  .scene-tools { top: 33px; gap: 3px; }
  .scene-tools .scene-icon { width: clamp(24px, 7.3vw, 32px); height: clamp(24px, 7.3vw, 32px); }
  .scene-icon-label { top: calc(100% + 2px); }
  #chapter .scene-dialogue { bottom: 40px; }
  #chapter .scene-dialogue .bubble > .bilingual-row > p { max-height: 52px; }
  #chapter #story-continue, #story-skip, #save-game { min-height: 29px; padding-block: 2px; }
  #chapter #story-continue { bottom: 44px; }
  #scene-sheet { bottom: 39px; }
}

/* Burnished controls for the terminal, equipment and conversation screens. */
#chapter .secondary, dialog .secondary, dialog .world-tab, dialog .audio,
#answer-close, #save-game {
  border-color: #9f7b50;
  background: linear-gradient(145deg, #39302a, #1d2226 76%);
  color: #f7ddb3;
}
#chapter .secondary:hover:not(:disabled), dialog .secondary:hover:not(:disabled),
dialog .audio:hover:not(:disabled), #save-game:hover { border-color: #f8cb7d; background: #38312d; }
#chapter .primary, dialog .primary, #story-continue, #story-skip {
  border-color: #efd08f;
  background: linear-gradient(#eed197, #c89759);
  color: #291d16;
}
#chapter .primary:hover:not(:disabled), dialog .primary:hover:not(:disabled),
#story-continue:hover, #story-skip:hover:not(:disabled) { background: #f7dca5; }
dialog .world-location-card { background: #252523; border-color: #8f7357; }
dialog .world-location-card:hover, dialog .world-location-card[aria-pressed="true"] { border-color: #f2c78a; }
dialog .world-tabs button[aria-selected="true"],
dialog .slot-button[aria-current="true"] { border-color: #f1c179; }
dialog .world-tabs button[aria-selected="true"] { background: #dfb475; color: #231910; }
dialog .slot-button span { color: #e0cba9; }
@media (max-width: 520px) {
  .title-screen { padding-block: 7px; }
  .title-content h1 { margin: 0 0 6px; font-size: clamp(1.42rem, 6.1vw, 2rem); }
  .title-content h1 span { margin-top: 3px; font-size: .72rem; }
}

#answer-reference-tools {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 7px;
  display: flex;
  gap: 5px;
  pointer-events: auto;
}
#answer-reference-tools[hidden], #answer-reference-tools button[hidden] { display: none; }
#answer-reference-tools button {
  width: 29px;
  height: 29px;
  min-height: 0;
  color: #f1c57f;
  border-color: #9f7b50;
  background: #222525;
}
#dictionary-search, #tablet-chapter {
  width: 100%;
  min-height: 37px;
  border: 1px solid #9a805c;
  border-radius: 3px;
  background: #141d20;
  color: #f7ddb3;
  font: inherit;
  padding: .3rem .55rem;
}
#dictionary-search { margin-block: 0 .65rem; }
.tablet-shell {
  width: min(660px, calc(100vw - 22px));
  border: 4px solid #72604b;
  border-radius: 15px;
  padding: 10px;
  background: linear-gradient(140deg, #39322c, #191d20 30%, #25211f 85%);
  box-shadow: inset 0 0 0 1px #cab18b50, 0 15px 50px #000b;
}
.tablet-shell > header { padding-inline: .35rem; }
.tablet-shell h2 { color: #ffe2aa; }
.tablet-screen {
  border: 1px solid #8b7654;
  border-radius: 5px;
  padding: clamp(8px, 2vw, 14px);
  background: repeating-linear-gradient(0deg, #c8ffc006 0 1px, transparent 1px 5px), #162422;
  color: #e4efd7;
}
.tablet-banner {
  display: flex;
  align-items: end;
  min-height: 104px;
  padding: .6rem;
  margin-bottom: .65rem;
  background: linear-gradient(0deg, #08110de0, transparent 75%), url("assets/tablet-reference.webp") center / cover, #23362e;
  border: 1px solid #7d7655;
}
.tablet-banner span {
  color: #e6ffc7;
  font: 800 .75rem ui-monospace, monospace;
  text-shadow: 0 1px 4px #000;
}
.tablet-selector { display: block; margin-top: .75rem; color: #f0c983; }
#tablet-rules h3 { margin: .65rem 0 .4rem; color: #f0c983; font-size: .96rem; }
.tablet-rule { margin: 0 0 .4rem; padding: .5rem; border: 1px solid #666d4e; background: #1d2c25; }
.tablet-rule summary { cursor: pointer; color: #ffdfa5; font-weight: 750; }
.tablet-rule p { margin: .45rem 0; line-height: 1.4; }
.tablet-examples { margin: .35rem 0; padding-left: 1.15rem; }
.tablet-examples li span { display: block; color: #b7c8ae; }
.tablet-rule .tablet-note { color: #f2d69f; }

#answer-dock {
  position: absolute;
  z-index: 9;
  bottom: 8px;
  left: 102px;
  right: 65px;
  display: flex;
  gap: 3px;
  align-items: stretch;
}
#answer-dock[hidden] { display: none; }
#answer-input-host { min-width: 0; flex: 1; }
#answer-dock .typed-answer {
  width: 100%;
  min-height: 38px;
  padding: 3px 7px;
  border: 1px solid #c49861;
  border-radius: 3px;
  background: #10191bed;
  color: #fff3d4;
  font: 16px system-ui, sans-serif;
}
#answer-send {
  width: 31px;
  min-height: 0;
  padding: 0;
  border: 1px solid #efd08f;
  border-radius: 3px;
  color: #291d16;
  background: #e6bc7e;
  font-weight: 850;
}
#chapter {
  --right-tools-size: clamp(32px, 8.5vw, 39px);
  --right-tools-gap: clamp(3px, 1vw, 8px);
  --right-tools-top: 43px;
  --answer-bottom: 60px;
}
.scene-tools-right, .scene-tools-lower {
  right: 7px;
  gap: var(--right-tools-gap);
}
.scene-tools-right { top: var(--right-tools-top); }
.scene-tools-lower {
  top: calc(var(--right-tools-top) + var(--right-tools-size) + var(--right-tools-gap));
}
#chapter :is(.scene-tools-right, .scene-tools-lower) .scene-icon {
  width: var(--right-tools-size);
  height: var(--right-tools-size);
}
#scene-sheet[data-answer-open] {
  --answer-rail: calc(15px + 2 * var(--right-tools-size) + var(--right-tools-gap));
  top: auto;
  bottom: var(--answer-bottom);
  left: clamp(8px, calc(45% - 230px), max(8px, calc(100% - var(--answer-rail) - 460px)));
  width: min(460px, calc(100% - var(--answer-rail) - 8px));
  max-height: calc(100% - var(--answer-bottom) - var(--right-tools-top) - var(--right-tools-size) - 4px);
  transform: none;
}
#scene-sheet[data-answer-open] > #interaction { padding-top: 32px; }
#scene-sheet[data-answer-open] .reply-options { gap: .12rem; }
#scene-sheet[data-answer-open] form :is(button[type="submit"], .reset) { display: none; }
@media (max-width: 520px) {
  #chapter {
    --right-tools-size: clamp(24px, 7.3vw, 32px);
    --right-tools-gap: 3px;
    --right-tools-top: 33px;
    --answer-bottom: 43px;
  }
  #answer-dock { left: 93px; right: 62px; }
  #answer-dock .typed-answer { min-height: 29px; }
  #scene-sheet[data-answer-open] > #interaction { padding-top: 30px; }
}

/* Use the available portrait viewport, including when a phone keyboard opens. */
@media (orientation: portrait) and (max-width: 760px), (orientation: portrait) and (pointer: coarse) {
  body { min-height: 100svh; }
  #chapter, .title-screen {
    width: 100%;
    margin: 0;
  }
  .title-screen, #chapter .frame {
    height: 100vh;
    height: 100dvh;
    border: 0;
    box-shadow: none;
  }
  #chapter .frame { height: var(--keyboard-viewport-height, 100dvh); }
  .title-screen {
    padding: max(16px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(24px, calc(env(safe-area-inset-bottom) + 16px))
      max(16px, env(safe-area-inset-left));
  }
  .title-actions { width: min(100%, 340px); gap: 8px; }
  .title-actions .title-button { min-height: 44px; }
  #chapter {
    --screen-safe-top: env(safe-area-inset-top, 0px);
    --screen-safe-bottom: env(safe-area-inset-bottom, 0px);
    --right-tools-size: clamp(32px, 9.5vw, 40px);
    --right-tools-top: calc(39px + var(--screen-safe-top));
    --answer-bottom: calc(54px + var(--screen-safe-bottom));
  }
  #chapter .scene-hud { padding-top: calc(4px + var(--screen-safe-top)); }
  #chapter .scene-tools-left { top: var(--right-tools-top); }
  #chapter .scene-tools-left .scene-icon {
    width: var(--right-tools-size);
    height: var(--right-tools-size);
  }
  #chapter .location { top: calc(var(--right-tools-top) + var(--right-tools-size) + 11px); }
  #chapter .scene-dialogue, #scene-sheet { bottom: var(--answer-bottom); }
  #chapter .scene-dialogue .bubble > .bilingual-row > p { max-height: min(28vh, 12rem); }
  #chapter #story-continue { bottom: calc(var(--answer-bottom) + 4px); }
  :is(#save-game, #story-skip, #answer-dock) { bottom: calc(8px + var(--screen-safe-bottom)); }
  :is(#save-game, #story-skip, #answer-dock .typed-answer) { min-height: 40px; }
  #answer-dock { left: 102px; right: 65px; }
  .screen-dialog {
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
  }
}

#settings-fullscreen:not([hidden]) { display: block; margin-top: .75rem; }
#settings-fullscreen[hidden], #fullscreen-status[hidden] { display: none; }

.scene-dialogue > .bubble { touch-action: manipulation; }


/* Rotated phones share one edge-to-edge scene with inset controls. */
@media (orientation: landscape) and (pointer: coarse) and (max-height: 600px) {
  body { min-height: 100svh; }
  #chapter, .title-screen { width: 100%; margin: 0; }
  .title-screen, #chapter .frame { height: 100dvh; border: 0; box-shadow: none; }
  #chapter .frame { height: var(--keyboard-viewport-height, 100dvh); }
  .title-screen {
    padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  #chapter {
    --landscape-left: env(safe-area-inset-left, 0px);
    --landscape-right: env(safe-area-inset-right, 0px);
    --landscape-bottom: env(safe-area-inset-bottom, 0px);
    --right-tools-top: calc(43px + env(safe-area-inset-top, 0px));
    --answer-bottom: calc(52px + var(--landscape-bottom));
  }
  #chapter .scene-hud {
    padding-top: calc(4px + env(safe-area-inset-top, 0px));
    padding-inline: calc(9px + var(--landscape-left)) calc(9px + var(--landscape-right));
  }
  #chapter .scene-tools-left { top: var(--right-tools-top); left: calc(7px + var(--landscape-left)); }
  #chapter :is(.scene-tools-right, .scene-tools-lower) { right: calc(7px + var(--landscape-right)); }
  #chapter .location { left: calc(7px + var(--landscape-left)); top: calc(var(--right-tools-top) + 52px); }
  #chapter .scene-dialogue {
    bottom: var(--answer-bottom);
    left: calc(8px + var(--landscape-left));
    right: calc(8px + var(--landscape-right));
  }
  #chapter .scene-dialogue .bubble > .bilingual-row > p { max-height: min(25dvh, 6rem); }
  #chapter #story-continue { right: calc(12px + var(--landscape-right)); bottom: calc(var(--answer-bottom) + 4px); }
  #save-game { left: calc(8px + var(--landscape-left)); }
  #story-skip { right: calc(8px + var(--landscape-right)); }
  #answer-dock { left: calc(102px + var(--landscape-left)); right: calc(65px + var(--landscape-right)); }
  :is(#save-game, #story-skip, #answer-dock) { bottom: calc(8px + var(--landscape-bottom)); }
  #scene-sheet { bottom: var(--answer-bottom); }
  #scene-sheet[data-answer-open] {
    left: max(calc(8px + var(--landscape-left)), calc(45% - 230px));
    width: min(460px, calc(100% - var(--answer-rail) - 8px - var(--landscape-left) - var(--landscape-right)));
  }
}
