:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090b0d;
  color: #f1eee7;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, #252b30 0, #101316 42%, #070809 100%);
}

button {
  font: inherit;
}

.game {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #111519;
  border: 0;
  box-shadow: none;
}

.language-switcher {
  display: flex;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 3px;
  background: rgb(7 9 11 / 72%);
  backdrop-filter: blur(8px);
}

.language-switcher button {
  min-width: 34px;
  height: 28px;
  padding: 0 9px;
  border: 0;
  border-right: 1px solid rgb(255 255 255 / 14%);
  color: rgb(239 239 235 / 58%);
  background: transparent;
  cursor: pointer;
  font: 650 .62rem Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .08em;
}

.language-switcher button:last-child { border-right: 0; }
.language-switcher button:hover,
.language-switcher button:focus-visible { color: #fff; outline: 0; background: rgb(255 255 255 / 8%); }
.language-switcher button.is-active { color: #151515; background: #e2d8bd; }

.title-language-switcher {
  position: absolute;
  z-index: 20;
  top: 20px;
  right: 22px;
}

.game:not(.is-title-screen) .title-language-switcher {
  display: none;
}

:lang(zh-Hans) .dialogue,
:lang(zh-Hant) .dialogue,
:lang(zh-Hans) .montage-line,
:lang(zh-Hant) .montage-line {
  font-family: "Songti SC", "Noto Serif CJK SC", "PingFang SC", serif;
  letter-spacing: .015em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.record-toggle {
  padding: 7px 10px;
  border: 1px solid #4e5559;
  color: #d7b46a;
  background: #171b1e;
  cursor: pointer;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.record-toggle #record-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  margin-left: 5px;
  place-items: center;
  border-radius: 50%;
  color: #101214;
  background: #d7b46a;
  font-weight: 800;
}

.record-toggle.has-new #record-count {
  animation: recordPulse 420ms ease;
}

.topbar {
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #343a3f;
  background: #0c0f12;
  letter-spacing: 0.14em;
}

.title {
  font-weight: 750;
}

.scene-label {
  color: #a8adb0;
  font-size: 0.72rem;
}

.stage {
  position: relative;
  height: calc(100vh - 58px);
  height: calc(100dvh - 58px);
  min-height: 0;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  background: linear-gradient(145deg, #283037, #161a1e 62%, #0c0f11);
}

.stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background: #020303;
  opacity: 0;
  transition: opacity 680ms ease;
}

.stage.scene-fade .dialogue-panel { animation: dialogueFade 280ms ease both; }
.stage.scene-exit .scene-video,
.stage.scene-exit .room-placeholder,
.stage.scene-exit .dialogue-panel,
.stage.scene-exit .title-start { animation: sceneExit 300ms ease forwards; }
.stage.scene-soft-in .scene-video,
.stage.scene-soft-in .room-placeholder,
.stage.scene-soft-in .dialogue-panel,
.stage.scene-soft-in .title-start { animation: sceneFade 520ms ease both; }
.stage.scene-shake { animation: sceneShake 240ms ease both; }
.stage.scene-glitch .dialogue-panel { animation: sceneGlitch 360ms steps(2, end) both; }
.stage.scene-collapse { animation: sceneCollapse 900ms ease-in both; }
.stage.scene-collapse::after {
  content: "";
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
  background: #e9edf0;
  animation: singleFlash 900ms ease-in both;
}
.stage.scene-stamp .dialogue-panel { animation: stampIn 380ms cubic-bezier(.2, .8, .2, 1) both; }

.stage.is-blackout {
  background: linear-gradient(145deg, #283037, #161a1e 62%, #0c0f11);
}

.stage.is-blackout::before {
  opacity: 1;
}

.stage.is-blackout .room-placeholder {
  opacity: 0;
}

.stage.is-blackout .room-placeholder::before {
  display: none;
}

.stage.is-blackout.scene-fade .room-placeholder,
.stage.is-blackout.scene-soft-in .room-placeholder,
.stage.is-blackout.scene-exit .room-placeholder {
  animation: none;
  opacity: 0;
}

.room-placeholder {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: grid;
  place-items: center;
  color: transparent;
  background: #020303;
  font-size: clamp(1rem, 3vw, 2.25rem);
  letter-spacing: 0.18em;
  text-align: center;
  transform: scale(var(--scene-scale, 1));
  transform-origin: center;
}

.scene-video {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #020303;
  transform: scale(1.4);
  transform-origin: center;
}

.scene-video[hidden] {
  display: none;
}

.stage.has-scene-video .room-placeholder {
  display: none;
}

.stage.has-scene-image .room-placeholder {
  background-image:
    linear-gradient(180deg, rgb(4 7 9 / 16%), rgb(4 7 9 / 44%)),
    var(--scene-image);
  background-position: center, var(--scene-image-position, center);
  background-repeat: no-repeat;
  background-size: cover;
}

.stage.has-scene-image .room-placeholder::before {
  display: none;
}

.room-placeholder > span[hidden] {
  display: none;
}

.game.is-title-screen .topbar {
  display: none;
}

.game.is-title-screen .stage {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
}

.stage.is-title-screen.has-scene-image .room-placeholder {
  background-image: var(--scene-image);
  background-position: var(--scene-image-position, center);
}

.stage.is-title-screen .dialogue-panel,
.stage.is-title-screen .state-panel {
  display: none;
}

.title-start {
  position: absolute;
  z-index: 5;
  top: 63.5%;
  left: 50%;
  width: clamp(230px, 25%, 380px);
  height: clamp(46px, 8%, 66px);
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.title-start:hover {
  box-shadow: 0 0 24px rgb(255 255 255 / 14%);
}

.title-start:focus-visible {
  outline: 2px solid rgb(255 255 255 / 82%);
  outline-offset: 4px;
}

.title-start[hidden] {
  display: none;
}

.room-placeholder::before {
  display: none;
}

.state-panel {
  display: none;
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 20px;
  gap: 14px;
  padding: 8px 11px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 4px;
  color: #aeb5b8;
  background: rgb(7 9 10 / 72%);
  font: 0.7rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.dialogue-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 205px;
  padding: 30px 32px 24px;
  border: 1px solid #565d61;
  background: rgb(8 11 13 / 94%);
  box-shadow: 0 16px 40px rgb(0 0 0 / 35%);
  transition: width 220ms ease, transform 220ms ease, background 220ms ease;
}

/* Prologue narration sits in the center; interview dialogue returns to the bottom. */
.stage.is-centered {
  align-items: center;
  justify-content: center;
}

.stage.is-centered .dialogue-panel {
  width: min(680px, 86%);
  min-height: 150px;
  padding-top: 34px;
  text-align: center;
  background: rgb(8 11 13 / 88%);
}

.stage.is-document .dialogue-panel {
  width: min(980px, 92%);
}

.stage.is-centered .speaker {
  left: 50%;
  min-width: 140px;
  border-left: 0;
  border-bottom: 2px solid #d7b46a;
  transform: translateX(-50%);
}

.stage.is-centered .continue {
  float: none;
  display: block;
  margin: 0 auto;
  padding-left: 0;
}

/* Voice hierarchy: thought, objective narration, and system records never share a treatment. */
.stage.voice-inner .dialogue-panel {
  width: min(650px, 86%);
  min-height: 0;
  padding: 24px 6px 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  transform: translateY(-72px);
}

.stage.voice-inner.has-scene-image .room-placeholder {
  background-image:
    linear-gradient(rgb(2 4 6 / 48%), rgb(2 4 6 / 58%)),
    radial-gradient(ellipse at center, transparent 18%, rgb(0 0 0 / 72%) 100%),
    var(--scene-image);
  background-position: center, center, var(--scene-image-position, center);
  background-size: cover;
}

.stage.is-memory.has-scene-image .room-placeholder {
  background-image:
    linear-gradient(rgb(2 4 6 / 38%), rgb(2 4 6 / 52%)),
    radial-gradient(ellipse at center, transparent 16%, rgb(0 0 0 / 76%) 100%),
    var(--scene-image);
  background-position: center, center, var(--scene-image-position, center);
  background-size: cover;
}

.stage.is-ending .dialogue {
  cursor: pointer;
}

.stage.is-ending .dialogue:hover {
  color: #fff8e7;
  text-shadow: 0 0 18px rgb(215 180 106 / 42%);
}

.stage.voice-inner .speaker {
  display: none;
}

.stage.voice-inner .dialogue {
  margin-bottom: 10px;
  color: #f0e9da;
  font-style: italic;
  line-height: 1.7;
  text-shadow: 0 2px 14px #000;
}

.stage.voice-inner .continue {
  display: none;
}

.stage.text-advance .dialogue {
  cursor: pointer;
}

.stage.text-advance .dialogue:hover {
  color: #fff8e7;
}

.stage.text-advance .continue {
  display: block;
}

.stage.voice-narration .speaker {
  display: none;
}

.stage.voice-narration .dialogue-panel {
  width: min(760px, 88%);
  min-height: 0;
  padding: 18px 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.stage.voice-narration .dialogue {
  min-height: 0;
  margin: 0;
  color: #f0eee8;
  font-style: normal;
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  line-height: 1.55;
  text-shadow: 0 2px 16px #000, 0 0 5px rgb(0 0 0 / 82%);
}

.stage.voice-system .dialogue-panel {
  width: min(620px, 88%);
  min-height: 0;
  padding: 34px 28px 26px;
  border: 1px solid rgb(215 180 106 / 58%);
  background: rgb(8 10 12 / 94%);
  text-align: center;
}

.stage.voice-system .dialogue {
  min-height: 0;
  margin: 0 0 16px;
  color: #e7c67d;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(.82rem, 1.7vw, 1.02rem);
  letter-spacing: .13em;
  line-height: 1.7;
}

.stage.is-system-plain .dialogue-panel {
  width: min(760px, 88%);
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.stage.is-system-plain .dialogue {
  margin: 0;
  text-shadow: 0 2px 18px #000;
}

.stage.voice-recording {
  align-items: center;
  justify-content: center;
}

.stage.voice-recording .dialogue-panel {
  width: min(620px, 86%);
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.stage.voice-recording .speaker,
.stage.voice-recording .continue {
  display: none;
}

.stage.voice-recording .dialogue {
  min-height: 0;
  margin: 0;
  color: rgb(242 239 232 / 88%);
  font-size: clamp(1.4rem, 3.5vw, 2.2rem);
  font-style: italic;
  letter-spacing: .02em;
  text-shadow: 0 2px 18px #000;
  animation: recordedDrift 3.6s ease-in-out infinite;
}

.stage.voice-inner-interviewer .dialogue-panel {
  border: 1px solid #9a665f;
  background: linear-gradient(90deg, rgb(19 12 14 / 96%), rgb(8 11 13 / 96%));
  box-shadow: 0 16px 42px rgb(0 0 0 / 46%), inset 4px 0 0 #7f3f3b;
}

.stage.voice-inner-interviewer .speaker {
  border-left-color: #b4574f;
  color: #efb3aa;
  background: #261719;
  text-shadow: 1px 0 #713c38, -1px 0 #273c45;
}

.stage.voice-inner-interviewer .dialogue {
  color: #f0dedb;
}

/* Opening story cards: captions live on the image and advance by clicking the text. */
.stage.is-montage {
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(72px, 12vh, 118px);
}

.stage.is-montage .state-panel {
  opacity: 0;
  pointer-events: none;
}

.stage.is-visual-only {
  align-items: center;
  justify-content: center;
}

.stage.is-visual-only .dialogue-panel,
.stage.is-visual-only .state-panel {
  display: none;
}

.stage.is-visual-only .room-placeholder {
  color: rgb(255 255 255 / 38%);
}

.stage.is-montage .dialogue-panel {
  width: min(790px, 92%);
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.stage.is-montage .dialogue {
  display: grid;
  gap: 14px;
  min-height: 0;
  margin: 0;
}

.stage.is-montage-center {
  align-items: center;
  padding-top: 28px;
}

.stage.is-montage-center .dialogue {
  justify-items: center;
  gap: 18px;
}

.stage.is-montage-center .montage-line {
  text-align: center;
}

.montage-line {
  display: block;
  width: 100%;
  padding: 2px 0;
  border: 0;
  color: #f2efe8;
  background: transparent;
  text-shadow: 0 2px 13px rgb(0 0 0 / 92%), 0 1px 3px #000;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.02rem, 2.2vw, 1.42rem);
  line-height: 1.45;
  text-align: left;
}

button.montage-line {
  cursor: pointer;
}

button.montage-line:hover,
button.montage-line:focus-visible {
  color: #fff8e7;
  outline: 0;
  text-shadow: 0 2px 16px rgb(0 0 0 / 100%), 0 0 14px rgb(231 198 125 / 34%);
}

.montage-line.is-past {
  color: rgb(242 239 232 / 72%);
  background: transparent;
}

.montage-line.is-new {
  animation: captionReveal 720ms cubic-bezier(.2, .75, .25, 1) both;
}

.montage-line.montage-title {
  font-size: clamp(1.65rem, 4.4vw, 3rem);
  font-weight: 650;
  letter-spacing: 0.08em;
}

.montage-line.montage-meta {
  color: rgb(242 239 232 / 74%);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(.72rem, 1.5vw, .92rem);
  letter-spacing: .18em;
}

.montage-line.montage-mission {
  margin-top: 22px;
  color: #f4dfad;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 650;
  letter-spacing: .025em;
  line-height: 1.45;
  text-shadow: 0 2px 18px #000, 0 0 18px rgb(215 180 106 / 24%);
}

button.continue[hidden] {
  display: none !important;
}

.speaker[hidden] {
  display: none !important;
}

.speaker {
  position: absolute;
  top: -17px;
  left: 22px;
  min-width: 150px;
  padding: 8px 14px;
  border-left: 3px solid #d7b46a;
  background: #20262a;
  color: #e7c67d;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.12em;
}

.dialogue {
  min-height: 54px;
  margin: 4px 0 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  line-height: 1.6;
  white-space: pre-line;
}

.continue {
  float: right;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.continue:hover,
.continue:focus-visible {
  outline: 0;
}

.continue span {
  display: block;
  width: 11px;
  height: 11px;
  margin: 8px auto;
  border-top: 2px solid #fff;
  border-right: 2px solid #fff;
  transform: rotate(45deg);
  animation: continueBreath 1.8s ease-in-out infinite;
}

.choices {
  display: grid;
  gap: 9px;
}

.choice {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #4a5155;
  color: #e8e5df;
  background: #171c20;
  cursor: pointer;
  text-align: left;
}

.choice:hover,
.choice:focus-visible {
  border-color: #d7b46a;
  background: #22282c;
  transform: translateX(3px);
}

.fragment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.fragment-card {
  min-height: 86px;
  padding: 14px;
  border: 1px dashed #6a7073;
  color: #c6cacc;
  background: linear-gradient(145deg, #1e2428, #101417);
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.fragment-card:hover,
.fragment-card:focus-visible {
  border-color: #d7b46a;
  color: #f5e5bc;
}

.fragment-card.is-found {
  border-style: solid;
  border-color: #75643f;
  color: #e1d7bf;
  cursor: default;
  letter-spacing: 0;
  line-height: 1.45;
}

.assemble-memory,
.document-continue {
  display: block;
  margin-left: auto;
}

.hold-button {
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  margin: 8px auto 2px;
  place-items: center;
  border: 2px solid #d7b46a;
  border-radius: 50%;
  color: #f2dfb4;
  background: radial-gradient(circle, #31383b, #111518 68%);
  cursor: pointer;
  user-select: none;
  touch-action: none;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.hold-button::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgb(215 180 106 / 28%);
  border-radius: inherit;
}

.hold-button.is-holding {
  transform: scale(0.94);
  background: radial-gradient(circle, #54352f, #151719 70%);
  box-shadow: 0 0 42px rgb(188 96 73 / 28%);
}

.document-layout {
  display: grid;
  grid-template-columns: minmax(190px, .9fr) 1.2fr;
  gap: 20px;
  margin: 4px 0 18px;
  text-align: left;
}

.document-sheet {
  min-height: 190px;
  padding: 20px;
  border: 1px solid #b7ab8d;
  color: #24211c;
  background: #d8d1bf;
  box-shadow: 5px 7px 0 rgb(0 0 0 / 25%);
}

.document-sheet.has-document-image {
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: #d8d1bf;
}

.document-sheet.has-document-image img {
  display: block;
  width: 100%;
  height: auto;
}

.document-sheet strong {
  display: block;
  border-bottom: 2px solid #736b59;
  padding-bottom: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.document-sheet p {
  white-space: pre-line;
  font: 0.72rem/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.document-signature {
  display: block;
  margin-top: 28px;
  color: #5b322c;
  font: 700 0.68rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.voice-subtitles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
}

.voice-subtitles p {
  margin: 0;
  color: #f0eadf;
  font: 1.05rem/1.45 Georgia, "Times New Roman", serif;
  opacity: 0;
  animation: subtitleReveal 500ms ease forwards;
}

.end-actions {
  display: flex;
  justify-content: flex-end;
}

.evidence-modal {
  position: absolute;
  z-index: 5;
  inset: 0;
  place-items: center;
  padding: 24px;
  background: rgb(2 4 5 / 78%);
  backdrop-filter: blur(4px);
}

.evidence-modal:not([hidden]) {
  display: grid;
  animation: evidenceIn 220ms ease both;
}

.evidence-card {
  width: min(520px, 92vw);
  padding: 30px;
  border: 1px solid #c09b56;
  background: linear-gradient(135deg, rgb(215 180 106 / 8%), transparent 42%), #11161a;
  box-shadow: 0 26px 70px rgb(0 0 0 / 65%);
}

.evidence-code {
  color: #d7b46a;
  font: 0.68rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
}

.evidence-card h2 {
  margin: 12px 0;
  font: 1.45rem Georgia, "Times New Roman", serif;
}

.evidence-card p {
  color: #bac0c2;
  line-height: 1.65;
  white-space: pre-line;
}

.evidence-close {
  width: 100%;
  margin-top: 14px;
  padding: 11px 16px;
  border: 1px solid #5f6260;
  color: #f2e4bf;
  background: #22272a;
  cursor: pointer;
}

.evidence-close:hover,
.evidence-close:focus-visible { border-color: #d7b46a; }

.record-panel {
  position: absolute;
  z-index: 12;
  top: 0;
  right: 0;
  width: min(430px, 92vw);
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  border-left: 1px solid #5a5f60;
  background: #0d1114;
  box-shadow: -24px 0 70px rgb(0 0 0 / 55%);
}

.record-panel:not([hidden]) {
  display: block;
  animation: recordSlide 240ms ease both;
}

.record-backdrop {
  position: absolute;
  z-index: 11;
  inset: 0;
  border: 0;
  background: rgb(0 0 0 / 54%);
  cursor: default;
}

.record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #373d40;
}

.record-kicker {
  color: #d7b46a;
  font-size: 0.66rem;
  letter-spacing: 0.16em;
}

.record-header h2 {
  margin: 7px 0 0;
  font: 1.55rem Georgia, "Times New Roman", serif;
}

.record-close {
  width: 34px;
  height: 34px;
  border: 1px solid #4a5053;
  color: #bec3c5;
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
}

.record-empty {
  margin: 28px 0;
  color: #7f878a;
  font: 0.78rem ui-monospace, SFMono-Regular, Menlo, monospace;
}

.record-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.record-item {
  position: relative;
  margin-bottom: 14px;
  padding: 17px 17px 17px 22px;
  border: 1px solid #353c40;
  background: #151a1e;
}

.record-item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: #7b6740;
}

.record-item-code,
.record-time {
  color: #d7b46a;
  font: 0.64rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.11em;
}

.record-item h3 {
  margin: 7px 0;
  font-size: 0.95rem;
}

.record-item p {
  margin: 0;
  color: #aeb5b8;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-line;
}

.record-timeline {
  position: relative;
  margin: 10px 0 0 3px;
  padding-left: 21px;
}

.record-timeline::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 4px;
  width: 1px;
  background: #796943;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 9px;
  padding: 7px 0;
  color: #c8cccd;
  font-size: 0.75rem;
}

.timeline-row::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -21px;
  width: 9px;
  height: 9px;
  border: 2px solid #d7b46a;
  border-radius: 50%;
  background: #151a1e;
}

@keyframes sceneFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialogueFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sceneExit {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes evidenceIn {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes sceneShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  55% { transform: translateX(5px); }
  78% { transform: translateX(-2px); }
}

@keyframes sceneGlitch {
  0%, 100% { transform: translate(0); filter: none; }
  20% { transform: translate(-3px, 1px); filter: contrast(1.35); }
  40% { transform: translate(4px, -1px); }
  60% { transform: translate(-2px, 0); filter: hue-rotate(22deg); }
}

@keyframes singleFlash {
  0%, 22% { opacity: 0; }
  30% { opacity: .78; }
  46% { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes sceneCollapse {
  0%, 28% { transform: translateY(0) rotate(0); filter: none; }
  55% { transform: translateY(12px) rotate(-1deg); filter: blur(1px); }
  100% { transform: translateY(70px) rotate(-2.5deg); filter: blur(8px); opacity: 0; }
}

@keyframes stampIn {
  0% { opacity: 0; transform: scale(1.16) rotate(-2deg); }
  70% { opacity: 1; transform: scale(.98) rotate(-.4deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes subtitleReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes captionReveal {
  from { opacity: 0; transform: translateY(7px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes recordedDrift {
  0%, 100% { transform: translateY(0); opacity: .82; }
  50% { transform: translateY(-7px); opacity: 1; }
}

@keyframes continueBreath {
  0%, 100% { opacity: .35; filter: drop-shadow(0 0 1px rgb(255 255 255 / 15%)); transform: translateX(-2px) rotate(45deg); }
  50% { opacity: 1; filter: drop-shadow(0 0 5px rgb(255 255 255 / 85%)); transform: translateX(2px) rotate(45deg); }
}

@keyframes recordSlide {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.24); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}

.restart {
  padding: 10px 18px;
  border: 1px solid #d7b46a;
  color: #f4dfad;
  background: transparent;
  cursor: pointer;
}

@media (max-width: 640px) {
  .stage {
    padding: 18px 12px;
  }

  .game.is-title-screen .stage {
    padding: 0;
  }

  .stage.is-montage {
    padding-top: 72px;
  }

  .stage.is-montage-center {
    padding-top: 18px;
  }

  .dialogue-panel {
    max-height: calc(100dvh - 94px);
    overflow: visible;
    padding: 28px 18px 20px;
  }

  .choices {
    max-height: min(42dvh, 360px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .stage.is-centered .dialogue-panel {
    width: 94%;
  }

  .state-panel {
    left: 12px;
    right: auto;
  }

  .fragment-grid,
  .document-layout {
    grid-template-columns: 1fr;
  }

  .fragment-card {
    min-height: 58px;
  }

  .hold-button {
    width: 124px;
    height: 124px;
  }

  .language-switcher button {
    min-width: 38px;
    height: 36px;
  }

  .record-toggle {
    min-height: 36px;
  }

  .choice,
  .restart,
  .evidence-close {
    min-height: 44px;
  }

  .record-close {
    width: 44px;
    height: 44px;
  }

  .evidence-modal {
    overflow-y: auto;
    padding: 12px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .evidence-card {
    margin: auto;
  }

  .game.is-title-screen .stage.is-title-screen.has-scene-image .room-placeholder {
    background-image: url("assets/title-screen-mobile.png");
    background-position: center;
    background-size: cover;
  }

  .title-start {
    top: 64%;
    width: min(210px, 52%);
    height: 54px;
    border: 0;
    background: transparent;
  }

  .title-language-switcher {
    top: 14px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }

  .scene-label {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

}

@media (max-height: 520px) {
  .stage {
    padding: 12px;
  }

  .dialogue-panel,
  .stage.is-centered .dialogue-panel {
    max-height: calc(100dvh - 82px);
    min-height: 0;
    overflow: visible;
    padding: 22px 18px 14px;
  }

  .dialogue {
    max-height: 24dvh;
    overflow-y: auto;
  }

  .stage.is-montage .dialogue,
  .stage.voice-narration .dialogue,
  .stage.voice-inner .dialogue,
  .stage.voice-recording .dialogue {
    max-height: none;
    overflow: visible;
  }

  .choices {
    max-height: calc(100dvh - 180px);
    overflow-y: auto;
  }

  .stage.voice-inner .dialogue-panel {
    transform: none;
  }

  .stage.is-montage,
  .stage.is-montage-center {
    padding-top: 12px;
  }

  .fragment-card {
    min-height: 48px;
  }

  .hold-button {
    width: 96px;
    height: 96px;
  }

  .evidence-modal {
    overflow-y: auto;
    padding: 8px;
  }

  .evidence-card {
    max-height: calc(100dvh - 74px);
    overflow-y: auto;
  }
}

@media (max-width: 820px) {
  .scene-label {
    display: none;
  }

  .topbar {
    padding-inline: 16px;
  }

  .topbar-actions {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .topbar .title {
    display: none;
  }
}

/* Physical case-file treatment and visual-aid slots. */
.evidence-card {
  position: relative;
  padding: 34px 34px 28px;
  border-color: #9c9179;
  color: #24231f;
  background: repeating-linear-gradient(0deg, transparent 0 27px, rgb(70 66 56 / 6%) 28px), #d6cfbc;
  transform: rotate(-.25deg);
}

.evidence-card::before {
  content: "CONFIDENTIAL";
  position: absolute;
  top: 32px;
  right: 30px;
  padding: 5px 8px;
  border: 2px solid rgb(126 51 44 / 62%);
  color: rgb(126 51 44 / 72%);
  font: 700 .58rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .13em;
  transform: rotate(4deg);
}

.evidence-clip {
  position: absolute;
  top: -12px;
  left: 42px;
  width: 18px;
  height: 50px;
  border: 3px solid #77756e;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  transform: rotate(-5deg);
}

.evidence-code { color: #635d50; }
.evidence-card h2 { margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid #676152; }
.evidence-card p { color: #3f3d36; }

.evidence-visual,
.record-item-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 8px solid #e8e4d9;
  color: rgb(236 233 224 / 68%);
  background:
    linear-gradient(135deg, transparent 49.5%, rgb(255 255 255 / 12%) 50%, transparent 50.5%),
    linear-gradient(45deg, transparent 49.5%, rgb(255 255 255 / 9%) 50%, transparent 50.5%),
    radial-gradient(circle at 50% 45%, #596064, #202528 68%, #101315);
  box-shadow: 0 3px 9px rgb(26 23 18 / 35%);
  font: .62rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .11em;
  text-align: center;
}

.evidence-visual { aspect-ratio: 16 / 9; margin-bottom: 18px; padding: 24px; }
.evidence-visual::before { content: attr(data-image-label); position: absolute; top: 8px; left: 10px; color: rgb(255 255 255 / 38%); font-size: .52rem; }
.evidence-visual.has-image,
.record-item-visual.has-image {
  background-image: var(--evidence-image);
  background-position: center;
  background-repeat: no-repeat;
  background-size: var(--evidence-image-size, cover);
}
.evidence-visual.has-image::before { padding: 3px 5px; color: rgb(255 255 255 / 78%); background: rgb(0 0 0 / 58%); }
.evidence-close { border-color: #555044; color: #e7e0cf; background: #34332e; }

.record-panel {
  width: min(520px, 94vw);
  padding: 38px 32px 32px;
  border-left-color: #756c58;
  color: #26251f;
  background: repeating-linear-gradient(0deg, transparent 0 31px, rgb(69 62 49 / 6%) 32px), #bcb092;
}

.record-panel::before {
  content: attr(data-case-label);
  position: absolute;
  top: 0;
  left: 28px;
  padding: 8px 18px 7px;
  color: #282720;
  background: #d0c19e;
  box-shadow: 2px 2px 0 rgb(0 0 0 / 15%);
  font: 700 .58rem ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em;
}

.record-header { border-bottom: 2px solid #5f594a; }
.record-kicker { color: #625c4d; }
.record-close { border-color: #746c59; color: #454137; }
.record-empty { color: #686253; }

.record-case-meta {
  display: grid;
  grid-template-columns: 1fr 1.5fr .7fr;
  gap: 8px;
  margin: 18px 0 0;
  padding: 10px 0 14px;
  border-bottom: 1px solid rgb(75 69 56 / 35%);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.record-case-meta div { min-width: 0; }
.record-case-meta dt { color: #756e5d; font-size: .5rem; letter-spacing: .11em; }
.record-case-meta dd { overflow: hidden; margin: 4px 0 0; font-size: .65rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.record-case-meta div:last-child dd { color: #7d342f; }

.record-item {
  display: grid;
  grid-template-columns: 122px 1fr;
  gap: 16px;
  padding: 13px;
  border-color: #999079;
  color: #292821;
  background: #d8d1bf;
  box-shadow: 3px 4px 0 rgb(48 43 33 / 16%);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.record-item::before { width: 0; }
.record-item:nth-child(even) { transform: rotate(.25deg); }
.record-item:hover,
.record-item:focus-visible { outline: 0; transform: translateX(-4px) rotate(0); box-shadow: 7px 7px 0 rgb(48 43 33 / 18%); }
.record-item-visual { min-height: 94px; padding: 12px; border-width: 5px; font-size: .5rem; }
.record-item-code,
.record-time { color: #716956; }
.record-item p { color: #514e43; }

@media (max-width: 480px) {
  .record-item { grid-template-columns: 96px 1fr; gap: 11px; }
  .record-panel { padding-right: 20px; padding-left: 20px; }
  .evidence-card { padding: 30px 22px 24px; }
}
