/* The journey atlas and character stage share the colours of an old printed book. */
:root {
  --atlas-paper: #f1ebdc;
  --atlas-line: #c8bca3;
  --atlas-muted: #807760;
  --atlas-green: #566453;
}
[hidden] { display: none !important; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--vermilion); outline-offset: 4px;
}
button:disabled { cursor: default; opacity: .48; }

/* A horizontal scroll on desktop, a winding vertical journey on a phone. */
#screenTitle.atlas-home {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  padding: 0; overflow: hidden; color: var(--ink);
  background: radial-gradient(ellipse at 30% 40%, #f7f2e7 0%, transparent 70%), var(--atlas-paper);
  background-size: auto; background-position: center;
}
.atlas-header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 108px; padding: 20px clamp(24px, 4vw, 64px);
  border-bottom: 1px solid var(--atlas-line); position: relative; z-index: 2;
}
.atlas-brand, .atlas-header .brand { display: flex; align-items: center; gap: 20px; }
.brand-seal { writing-mode: vertical-rl; color: var(--vermilion); border: 2px solid var(--vermilion); font-size: 16px; letter-spacing: .15em; padding: 7px 4px; line-height: 1.15; transform: rotate(-4deg); }
.atlas-brand p { color: var(--atlas-muted); margin-top: 8px; font-size: 11px; letter-spacing: .18em; }
.atlas-header .game-title, .atlas-header .brand-title {
  font-size: 44px; line-height: 1.1; letter-spacing: .19em; text-indent: 0; text-shadow: none;
}
.atlas-header .brand-sub, .atlas-tagline {
  color: var(--atlas-muted); font-size: 12px; line-height: 1.9; letter-spacing: .23em;
}
.atlas-header-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#screenTitle .atlas-header-actions .btn-sub {
  margin: 0; padding: 8px 16px; border-color: transparent; box-shadow: none;
  background: transparent; font-size: 14px; border-radius: 0;
}
#screenTitle .atlas-header-actions .btn-sub:hover { border-color: var(--atlas-line); }
.atlas-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 350px; }
.atlas-map { min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; }
.atlas-toolbar {
  padding: 23px 30px 14px; display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px; position: relative; z-index: 2;
}
.atlas-toolbar label { font-size: 12px; color: var(--atlas-muted); margin-right: 4px; }
.atlas-kicker { display: block; font-size: 17px; letter-spacing: .18em; }
.atlas-caption { display: block; margin-top: 6px; font-size: 11px; color: var(--atlas-muted); letter-spacing: .08em; }
.map-controls { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.atlas-toolbar select {
  min-width: 130px; max-width: 210px; font-size: 13px; font-family: inherit; color: var(--ink-soft);
  padding: 8px 30px 8px 12px; background: #f7f2e6; border: 1px solid #c8bca3; border-radius: 2px;
}
.atlas-toolbar button {
  font-family: inherit; font-size: 13px; color: var(--ink-soft); padding: 8px 12px;
  background: #f7f2e699; border: 1px solid var(--atlas-line); border-radius: 2px; cursor: pointer;
}
.atlas-toolbar button:hover { color: var(--vermilion); border-color: var(--vermilion); }
#mapLocate { margin-left: auto; }
#mapZoomIn, #mapZoomOut { min-width: 34px; }
#mapViewport {
  position: relative; flex: 1; min-height: 0; overflow: auto; cursor: grab;
  scrollbar-width: thin; scrollbar-color: #b2a58c #e7deca;
  overscroll-behavior: contain; isolation: isolate;
}
#mapViewport:active { cursor: grabbing; }
#mapWorld {
  position: relative; width: 2400px; min-height: 430px; height: 100%;
  background-image: radial-gradient(ellipse at 35% 15%, #97a49715, transparent 38%),
    radial-gradient(ellipse at 76% 90%, #b6986820, transparent 40%);
}
#mapDrawing, #mapNodes { position: absolute; inset: 0; width: 100%; height: 100%; }
#mapDrawing { pointer-events: none; overflow: visible; }
.map-compass { position: absolute; left: 30px; bottom: 30px; color: #8a8069; font-size: 18px; line-height: 1.5; text-align: center; pointer-events: none; }
#mapNodes { pointer-events: none; }
.map-road-shadow { fill: none; stroke: #f8f4e6; stroke-width: 14; }
.map-road { fill: none; stroke: #a39372; stroke-width: 2; stroke-dasharray: 5 7; stroke-linecap: round; }
.map-travelled { fill: none; stroke: var(--vermilion); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.map-node {
  pointer-events: auto; position: absolute; transform: translate(-50%, -50%);
  width: 104px; min-height: 133px; display: flex; flex-direction: column; align-items: center;
  font-family: inherit; color: var(--ink); background: none; border: 0; cursor: pointer;
  padding: 0 3px 4px; user-select: none; isolation: isolate;
}
.map-node::before {
  content: ""; width: 80px; height: 80px; position: absolute; top: -3px; left: 12px;
  background: radial-gradient(ellipse at 35% 30%, #bec2a7, #899784 54%, #596454);
  border-radius: 49% 45% 47% 43%; border: 1px solid #a69a7f; z-index: -1;
  box-shadow: 0 4px 12px #6c624b1a; transition: border-color .2s, box-shadow .2s, transform .2s;
}
.map-node img {
  display: block; width: 74px; height: 74px; object-fit: cover; border-radius: 48% 45% 47% 43%;
  opacity: .85; filter: saturate(.58) sepia(.17); transition: filter .2s, opacity .2s;
}
.node-number {
  position: absolute; top: 57px; left: 11px; padding: 2px 5px; color: #f7efdd;
  background: var(--atlas-green); font-family: Georgia, serif; font-size: 11px;
  border: 1px solid var(--atlas-paper); line-height: 1.3;
}
.node-title { font-size: 16px; line-height: 1.45; margin-top: 12px; letter-spacing: .1em; text-align: center; }
.node-status { font-size: 10px; color: var(--atlas-muted); margin-top: 4px; letter-spacing: .12em; }
.map-node:hover::before { transform: scale(1.05); border-color: var(--vermilion); }
.map-node:hover img, .map-node.selected img { filter: saturate(.86); opacity: 1; }
.map-node.selected::before { border: 2px solid var(--vermilion); box-shadow: 0 0 0 5px #9f3b2b12, 0 6px 20px #5748311c; }
.map-node.selected .node-title, .map-node.selected .node-status { color: var(--vermilion); }
.map-node.selected .node-number { background: var(--vermilion); }
.map-node.completed .node-status::before { content: "印 "; color: var(--vermilion); }
.map-node.playing .node-status::before { content: "◆ "; color: var(--vermilion); }
.map-node.skipped { opacity: .65; }
.map-node.skipped::before { border-style: dashed; }
.atlas-legend {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 20px; min-height: 54px; padding: 14px 24px; font-size: 11px; letter-spacing: .1em;
  color: var(--atlas-muted); border-top: 1px solid #c8bca35c;
}
.atlas-legend i { font-style: normal; color: var(--vermilion); margin-right: 5px; }
.chapter-panel {
  min-height: 0; overflow: auto; padding: 24px 28px 28px; border-left: 1px solid var(--atlas-line);
  background: linear-gradient(145deg, #e5dbc62b, #fcf8ed87); scrollbar-width: thin;
}
.chapter-illustration {
  position: relative; margin: 0 0 25px; width: 100%; aspect-ratio: 1.55; overflow: hidden;
  background: linear-gradient(145deg, #b8b79c, #738374); border: 1px solid #b4a587;
}
.chapter-illustration::after { content: ""; position: absolute; inset: 5px; border: 1px solid #f7efdb66; pointer-events: none; }
.chapter-illustration img { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) sepia(.1); }
#chapterNumber { position: absolute; bottom: 13px; left: 13px; font-size: 11px; color: #f5ecd7; background: #243c2bc4; padding: 5px 8px; letter-spacing: .15em; }
.chapter-kicker { color: var(--vermilion); font-size: 11px; letter-spacing: .2em; margin-bottom: 8px; }
#screenTitle #gameSub { font-size: 27px; color: var(--ink); line-height: 1.5; letter-spacing: .08em; text-indent: 0; margin: 0; }
#screenTitle #titleDesc { font-size: 14px; line-height: 1.9; margin: 14px 0 20px; color: #6a604e; }
#chapterProgress { font-size: 12px; letter-spacing: .08em; color: var(--atlas-green); padding: 13px 0; border-top: 1px solid #c8bca37a; }
#chapterRouteNote { color: var(--vermilion); font-size: 12px; line-height: 1.8; }
#chapterRouteNote:empty { display: none; }
#screenTitle #startPanel { display: flex; align-items: stretch; width: 100%; gap: 10px; margin-top: 12px; }
#screenTitle #playerName { width: 100%; min-width: 0; font-size: 14px; text-align: left; border-radius: 2px; box-shadow: none; background: #f8f3e680; }
#screenTitle .chapter-panel .btn-main, #screenTitle .chapter-panel .btn-sub { width: 100%; margin: 0; border-radius: 2px; font-size: 15px; }
#screenTitle .chapter-panel .btn-main { padding: 12px 14px; box-shadow: 0 4px 10px #793d2a18; }
#screenTitle .chapter-panel .btn-sub { padding: 10px 12px; box-shadow: none; background: transparent; }
#welcomeLine { margin: 0; color: var(--atlas-muted); font-size: 12px; }
#btnLogout { align-self: flex-start; color: var(--atlas-muted); text-decoration: none; }
#guestStart { margin-top: 18px; }
#guestStart p { color: var(--atlas-muted); font-size: 12px; line-height: 1.8; margin: 10px 0; }
#modalAuth { z-index: 65; }
#modalAuth #authPanel { width: 100%; max-width: 340px; }
.auth-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 16px; }
.auth-modal-head h2 { font-size: 23px; font-weight: normal; letter-spacing: .15em; }
.atlas-footer { display: flex; justify-content: space-between; gap: 20px; flex: 0 0 auto; border-top: 1px solid var(--atlas-line); padding: 12px 30px; font-size: 10px; color: var(--atlas-muted); letter-spacing: .1em; }

/* The background stays visible; only the active voice gets a paper bubble. */
#bg img { object-position: center 45%; filter: saturate(.83) sepia(.08) brightness(.91); }
#bg .vignette { background: linear-gradient(180deg, #171e1d3d, transparent 30%, transparent 58%, #10161585), radial-gradient(ellipse at center, transparent 35%, #18201945); }
#hud { min-height: 58px; padding: 10px 24px; gap: 16px; background: linear-gradient(180deg, #1b221ee8, #1b221e80 78%, transparent); }
#hud .hud-btn { min-height: 30px; padding: 4px 9px; border-color: #dfd8c145; border-radius: 2px; }
#stage { top: 58px; bottom: 0; padding: 0; overflow: hidden; }
#theatre {
  position: relative; flex: 1 1 auto; min-height: 0; width: 100%; container-type: size;
  --figure-height: clamp(90px, 58cqh, 440px); cursor: pointer;
}
.cast-side {
  position: absolute; top: 0; bottom: 0; width: 46%; display: flex; align-items: flex-end;
  justify-content: center; gap: 5px; pointer-events: none;
}
.cast-left { left: 2%; }
.cast-right { right: 2%; }
.actor {
  position: relative; flex: 0 1 calc(100% / var(--cast-count, 1)); min-width: 0; width: 100%; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  transition: filter .25s; pointer-events: none;
}
.actor-figure { height: var(--figure-height); max-width: 100%; width: 100%; display: flex; justify-content: center; align-items: flex-end; }
.actor-figure img {
  max-width: 100%; max-height: 100%; width: auto; height: 100%; object-fit: contain; object-position: center bottom;
  filter: drop-shadow(0 10px 14px #0b171c66) saturate(.7) brightness(.78);
  transition: filter .28s, transform .28s; transform-origin: bottom center; user-select: none;
}
.actor.speaking { z-index: 4; }
.actor.speaking .actor-figure img { filter: drop-shadow(0 6px 16px #121b2255) saturate(.95) brightness(1.05); transform: translateY(-3px); }
.actor-fallback {
  height: 83%; width: 78%; max-width: 200px; min-height: 60px; display: flex; justify-content: center; align-items: center;
  font-size: clamp(24px, 4vw, 56px); color: #eee5ce; background: linear-gradient(160deg, #777b628a, #303e37e0);
  border: 1px solid #e5d9b660; border-radius: 48% 48% 6px 6px; text-shadow: 0 2px 4px #14281d;
}
.actor-name {
  max-width: 100%; min-height: 26px; padding: 4px 11px; margin: 6px 0 8px; font-size: 12px;
  text-align: center; color: #ede6d3; letter-spacing: .1em; line-height: 1.5;
  background: #18241ad4; border: 1px solid #d9cba545; white-space: normal;
}
.actor.speaking .actor-name { border-color: #e6c7819c; color: #ffe8b4; }
.speech {
  position: absolute; bottom: calc(var(--figure-height) + 56px); width: clamp(190px, 28vw, 370px);
  max-width: 90vw; max-height: calc(100cqh - var(--figure-height) - 66px);
  padding: 17px 21px 18px; color: #302b22; background: #f7f0dff5;
  border: 1px solid #e0d1ad; border-radius: 10px 10px 10px 3px;
  box-shadow: 0 8px 28px #13211935; pointer-events: auto; cursor: pointer;
  animation: speech-arrive .2s ease-out;
}
.cast-left .speech { left: 8%; }
.cast-right .speech { right: 8%; border-radius: 10px 10px 3px 10px; }
.speech::after { content: ""; position: absolute; bottom: -9px; left: 24px; width: 15px; height: 15px; background: #f7f0dff5; border-right: 1px solid #e0d1ad; border-bottom: 1px solid #e0d1ad; transform: rotate(45deg); }
.cast-right .speech::after { left: auto; right: 24px; }
.speech-name { color: var(--vermilion); font-size: 12px; letter-spacing: .13em; margin-bottom: 7px; }
.speech-text { font-size: clamp(15px, 1.35vw, 18px); line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; max-height: calc(100cqh - var(--figure-height) - 126px); overflow-y: auto; scrollbar-width: thin; }
#theatre.large-cast { --figure-height: clamp(90px, 53cqh, 370px); }
.crowded .actor-name { font-size: 11px; padding-inline: 4px; }
#narrationBox {
  flex: 0 0 auto; width: min(1040px, 92%); align-self: center; min-height: 60px;
  max-height: 22dvh; overflow-y: auto; padding: 13px 23px; color: #f2ecdf;
  background: linear-gradient(90deg, #18231bc7, #18231bb5); border: 1px solid #ded2ab42;
  border-left: 2px solid #d4b77b; border-radius: 2px; scrollbar-width: thin;
}
#narrationBox label, #narrationBox .narration-label { display: block; color: #dbbe82; font-size: 11px; letter-spacing: .2em; margin-bottom: 4px; }
#narratorText { font-size: 16px; line-height: 1.85; white-space: pre-wrap; }
#narratorText:empty::after { content: "听来人道一段因果。"; color: #d2ccb48c; font-size: 13px; }
#playbackBar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 9px;
  width: min(1040px, 92%); align-self: center; padding: 9px 0;
}
.playback-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
#readingHint { margin-right: auto; color: #f0e8d3; font-size: 11px; letter-spacing: .12em; text-shadow: 0 1px 4px #152018; }
#playbackBar button {
  font-family: inherit; font-size: 12px; border: 1px solid #ded2aa50; padding: 7px 12px;
  color: #ece5ce; background: #1d2a22c7; border-radius: 2px; cursor: pointer;
}
#playbackBar button:hover, #playbackBar button[aria-pressed="true"] { border-color: #d8bd81; color: #f9dda2; background: #3d4332; }
#playbackBar #btnAdvance { min-width: 112px; color: #f5e6bb; border-color: #d2b97e7a; }
#suggest {
  flex: 0 0 auto; min-height: 0; max-height: 25dvh; overflow-y: auto; scrollbar-width: thin;
  justify-content: center; flex-wrap: wrap; gap: 10px; padding: 0 max(4vw, 20px) max(18px, env(safe-area-inset-bottom));
  background: transparent; backdrop-filter: none;
}
#suggest:empty { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
#suggest .chip {
  flex: 1 1 190px; max-width: 340px; padding: 12px 17px; border-radius: 2px; text-align: left;
  color: #f5ecd6; border: 1px solid #cebd9280; background: #213025eb; font-size: 14px; line-height: 1.65;
  transition: border-color .2s, background .2s;
}
#suggest .chip:hover { color: #fff3d0; border-color: #e0ba70; background: #3a4130f5; }
#suggest .chip::before { content: "◇"; color: #d3b474; margin-right: 8px; }
#historyPanel {
  position: fixed; z-index: 40; top: 58px; bottom: 0; right: 0; width: min(560px, 100vw);
  display: flex; flex-direction: column; background: #f2ebdcfa; border-left: 1px solid #bbaa85;
  box-shadow: -12px 0 48px #101a194d;
}
.history-header, .history-head { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid #c8bca3; }
.history-header h2, .history-head h2 { font-size: 20px; font-weight: normal; letter-spacing: .1em; }
#btnHistoryClose { font-family: inherit; font-size: 13px; color: var(--ink-soft); border: 1px solid var(--atlas-line); padding: 7px 12px; background: transparent; cursor: pointer; }
#historyPanel #log { flex: 1; min-height: 0; padding: 20px 25px; overflow-y: auto; background: none; }
#log .history-dialogue, #log .history-narration { font-size: 15px; line-height: 1.95; margin: 0 0 18px; }
#log .history-dialogue b { font-weight: normal; color: var(--vermilion); }
#log .history-narration { color: #716653; }
@keyframes speech-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 761px) and (max-width: 1100px) {
  .atlas-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .chapter-panel { padding: 20px; }
  .atlas-header { min-height: 88px; padding: 17px 25px; }
  .atlas-toolbar { padding: 18px; }
  #hud { gap: 10px; padding-inline: 14px; }
  #hud .hud-right { gap: 6px; }
  #hud .hud-mid { display: none; }
  #hud .hud-left { flex: 1; }
  .speech { width: clamp(180px, 29vw, 300px); padding: 13px 16px; }
}
@media (max-width: 760px) {
  #screenTitle.atlas-home { overflow-y: auto; overscroll-behavior: contain; }
  .atlas-header { min-height: 80px; gap: 10px; padding: 17px 18px; }
  .atlas-brand, .atlas-header .brand { gap: 10px; }
  .atlas-header .game-title, .atlas-header .brand-title { font-size: 31px; white-space: nowrap; }
  .brand-seal { font-size: 12px; padding: 5px 3px; }
  .atlas-brand p { font-size: 9px; letter-spacing: .06em; margin-top: 5px; }
  .atlas-header .brand-sub, .atlas-tagline { display: none; }
  .atlas-header-actions { gap: 3px; }
  #screenTitle .atlas-header-actions .btn-sub { font-size: 12px; padding: 6px 8px; }
  #screenTitle .atlas-header-actions .btn-main { font-size: 12px; padding: 9px 11px; min-width: 0; letter-spacing: .05em; }
  .atlas-layout { display: flex; flex-direction: column; flex: 1 0 auto; min-height: calc(100dvh - 80px); }
  .atlas-map { flex: 0 0 auto; height: 55dvh; min-height: 320px; }
  .atlas-toolbar { padding: 11px 14px; gap: 6px; }
  .atlas-kicker { font-size: 13px; }
  .atlas-caption { display: none; }
  .map-controls { gap: 5px; }
  .atlas-toolbar select { min-width: 115px; max-width: 180px; font-size: 12px; padding: 7px 20px 7px 8px; }
  .atlas-toolbar button { font-size: 12px; padding: 7px 9px; }
  #mapZoomIn, #mapZoomOut { display: none; }
  #mapWorld { width: 100% !important; height: var(--map-height, 2820px); min-height: 0; }
  #mapViewport { touch-action: pan-y; }
  .map-node { width: 104px; min-height: 122px; }
  .map-node::before { width: 72px; height: 72px; left: 16px; }
  .map-node img { width: 66px; height: 66px; }
  .node-number { top: 49px; left: 17px; }
  .node-title { margin-top: 10px; font-size: 15px; }
  .atlas-legend { gap: 14px; min-height: 39px; padding: 11px 12px; font-size: 10px; }
  .chapter-panel {
    flex: 1 0 auto; overflow: visible; padding: 22px 22px max(28px, env(safe-area-inset-bottom));
    border-left: 0; border-top: 1px solid var(--atlas-line); position: relative;
  }
  .chapter-illustration { float: right; width: 104px; margin: 0 0 12px 18px; aspect-ratio: 1; }
  #screenTitle #gameSub { font-size: 23px; }
  #screenTitle #titleDesc { font-size: 13px; margin: 10px 0 12px; }
  #chapterNumber { font-size: 9px; left: 8px; bottom: 8px; padding: 3px 5px; }
  #chapterProgress { clear: both; }
  #screenTitle #startPanel { display: grid; grid-template-columns: 1fr 1fr; }
  #screenTitle #playerName, #screenTitle #welcomeLine, #screenTitle #btnStart { grid-column: 1 / -1; }
  #screenTitle #btnLogout { justify-self: start; align-self: center; }
  #modalAuth .card { padding: 25px 22px; }
  .atlas-footer { padding: 12px 18px; font-size: 9px; }
  .atlas-footer span:last-child { display: none; }
  #hud { min-height: 79px; align-content: flex-start; flex-wrap: wrap; gap: 4px 10px; padding: 7px 10px 9px; }
  #hud .hud-left { font-size: 12px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #hud .hud-mid { display: none; }
  #hud .hud-right { flex: 1 0 100%; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  #hud .stat { font-size: 10px; }
  #hud .hud-btn { font-size: 11px; padding: 3px 7px; min-height: 27px; }
  #stage { top: 83px; }
  #theatre { --figure-height: clamp(72px, 53cqh, 270px); }
  .cast-side { width: 46%; gap: 2px; }
  .cast-left { left: 2%; }
  .cast-right { right: 2%; }
  .actor-name { min-height: 22px; margin: 4px 0 8px; font-size: 10px; padding: 3px 5px; letter-spacing: 0; }
  .speech {
    bottom: calc(var(--figure-height) + 45px); padding: 12px 14px;
    width: min(265px, 77vw); max-height: calc(100cqh - var(--figure-height) - 50px);
  }
  .speech-name { font-size: 11px; margin-bottom: 4px; }
  .speech-text { font-size: 14px; line-height: 1.7; max-height: calc(100cqh - var(--figure-height) - 102px); }
  .cast-left .speech { left: 0; }
  .cast-right .speech { right: 0; }
  #theatre.large-cast { --figure-height: clamp(42px, 24cqh, 125px); }
  #theatre.large-cast .cast-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: end; align-items: end; gap: 0 3px; }
  #theatre.large-cast .actor { position: static; max-width: 100%; align-self: end; }
  #theatre.large-cast .actor-name { font-size: 9px; padding: 2px 4px; margin: 3px 0; min-height: 19px; }
  #theatre.large-cast .actor-figure { height: var(--figure-height); }
  #theatre.large-cast .cast-side:has(> .actor:only-child) { grid-template-columns: 1fr; }
  #theatre.large-cast .actor:only-child .actor-figure { height: clamp(90px, 48cqh, 250px); }
  #theatre.large-cast .speech { top: 8px; bottom: auto; width: min(310px, 88vw); max-height: calc(44cqh - 36px); }
  #theatre.large-cast .speech-text { max-height: calc(44cqh - 88px); }
  #theatre.large-cast .cast-left .speech { left: 0; }
  #theatre.large-cast .cast-right .speech { right: 0; }
  #theatre.large-cast .cast-left .actor:nth-child(odd) .speech::after { left: 11.5vw; }
  #theatre.large-cast .cast-left .actor:nth-child(even) .speech::after { left: 34.5vw; }
  #theatre.large-cast .cast-right .actor:nth-child(odd) .speech::after { right: 34.5vw; }
  #theatre.large-cast .cast-right .actor:nth-child(even) .speech::after { right: 11.5vw; }
  #theatre.large-cast .cast-side .actor:only-child .speech::after { left: auto; right: 23vw; }
  #narrationBox { width: 94%; padding: 9px 12px; min-height: 51px; max-height: 21dvh; }
  #narratorText { font-size: 14px; line-height: 1.75; }
  #narrationBox label, #narrationBox .narration-label { font-size: 10px; margin-bottom: 3px; }
  #playbackBar { width: 94%; gap: 6px; padding: 7px 0; }
  .playback-actions { gap: 5px; }
  #readingHint { font-size: 10px; letter-spacing: 0; }
  #playbackBar button { padding: 6px 8px; font-size: 11px; }
  #playbackBar #btnAdvance { min-width: 96px; }
  #suggest { display: grid; grid-template-columns: 1fr; gap: 7px; max-height: 24dvh; padding: 0 3% max(12px, env(safe-area-inset-bottom)); }
  #suggest .chip { max-width: none; width: 100%; padding: 9px 12px; font-size: 13px; line-height: 1.6; }
  #historyPanel { top: 83px; }
  .history-header, .history-head { padding: 14px 18px; }
}
@media (max-width: 390px) {
  .atlas-header { padding-inline: 13px; }
  .atlas-header .game-title, .atlas-header .brand-title { font-size: 28px; letter-spacing: .12em; }
  #hud .hud-right { gap: 4px; }
  #hud .hud-btn { font-size: 10px; padding: 3px 5px; }
  #hud .stat { font-size: 9px; }
  #readingHint { max-width: 85px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
@media (max-height: 610px) and (min-width: 761px) {
  .atlas-header { min-height: 70px; padding-block: 12px; }
  .atlas-header .game-title { font-size: 35px; }
  #mapWorld { min-height: 330px; }
  .chapter-panel { padding-top: 15px; }
  .chapter-illustration { aspect-ratio: 2.5; margin-bottom: 15px; }
  #narrationBox { min-height: 42px; padding: 8px 16px; }
  #narratorText { font-size: 14px; }
  #suggest .chip { padding-block: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
