:root {
  color-scheme: dark;
  --ink: #0b1118;
  --ink-2: #131c25;
  --ink-3: #1d2a34;
  --paper: #d7d1c4;
  --paper-2: #eee8da;
  --muted: #9da5a8;
  --gold: #c8a45d;
  --lamp: #e3b764;
  --red: #b43a2e;
  --green: #7e9f80;
  --line: rgba(215, 209, 196, 0.16);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    linear-gradient(135deg, rgba(11, 17, 24, 0.96), rgba(17, 26, 34, 0.94)),
    repeating-linear-gradient(0deg, rgba(215, 209, 196, 0.028) 0, rgba(215, 209, 196, 0.028) 1px, transparent 1px, transparent 7px);
  color: var(--paper);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--lamp);
  outline-offset: 3px;
}

.app {
  min-height: 100vh;
}

.title-page {
  position: relative;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 42px clamp(22px, 7vw, 104px);
  background-image:
    linear-gradient(90deg, rgba(5, 9, 14, 0.93), rgba(5, 9, 14, 0.68) 44%, rgba(5, 9, 14, 0.22)),
    var(--title-image);
  background-size: cover;
  background-position: center;
}

.title-content {
  max-width: 720px;
  animation: rise-in 720ms ease both;
}

.case-kicker {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(200, 164, 93, 0.45);
  padding-bottom: 8px;
}

.title-content h1 {
  margin: 24px 0 10px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(48px, 10vw, 112px);
  line-height: 0.96;
  font-weight: 700;
  color: #f0eadb;
  text-shadow: 0 16px 34px rgba(0, 0, 0, 0.72);
}

.title-subtitle {
  margin: 0 0 34px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(20px, 2.5vw, 34px);
  color: #e0d4bb;
}

.case-stamp {
  display: grid;
  gap: 7px;
  width: min(360px, 100%);
  margin: 0 0 28px;
  padding: 18px 20px;
  border-left: 4px solid var(--red);
  background: rgba(11, 17, 24, 0.72);
  box-shadow: var(--shadow);
}

.case-stamp strong {
  font-size: 18px;
  color: var(--paper-2);
}

.primary-action,
.secondary-action,
.text-action,
.mini-action,
.danger-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 4px;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.primary-action {
  background: var(--gold);
  color: #18130c;
  box-shadow: 0 12px 28px rgba(200, 164, 93, 0.22);
  font-weight: 700;
}

.primary-action:hover,
.secondary-action:hover,
.text-action:hover,
.mini-action:hover,
.danger-action:hover {
  transform: translateY(-1px);
}

.secondary-action {
  background: rgba(215, 209, 196, 0.1);
  color: var(--paper-2);
  border: 1px solid rgba(215, 209, 196, 0.22);
}

.danger-action {
  background: rgba(180, 58, 46, 0.18);
  color: #f2d0cb;
  border: 1px solid rgba(180, 58, 46, 0.42);
}

.text-action,
.mini-action {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(200, 164, 93, 0.35);
}

.mini-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 324px;
}

.sidebar,
.evidence-panel {
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  border-color: var(--line);
  background:
    linear-gradient(rgba(13, 20, 27, 0.95), rgba(13, 20, 27, 0.92)),
    repeating-linear-gradient(90deg, rgba(215, 209, 196, 0.02) 0, rgba(215, 209, 196, 0.02) 1px, transparent 1px, transparent 9px);
}

.sidebar {
  padding: 24px 16px;
  border-right: 1px solid var(--line);
}

.evidence-panel {
  padding: 24px 18px;
  border-left: 1px solid var(--line);
  overflow: auto;
  max-height: 100vh;
}

.brand {
  display: grid;
  gap: 6px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--line);
}

.brand h2 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 24px;
  color: var(--paper-2);
}

.brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 4px;
  background: transparent;
  color: var(--paper);
  text-align: left;
  border: 1px solid transparent;
}

.nav-button:hover {
  background: rgba(215, 209, 196, 0.08);
}

.nav-button.active {
  color: var(--ink);
  background: var(--gold);
}

.nav-button.locked {
  color: rgba(215, 209, 196, 0.38);
}

.sidebar-footer {
  margin-top: 24px;
  display: grid;
  gap: 10px;
}

.audio-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 18px;
  padding: 12px 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.audio-toggle,
.audio-stop {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(215, 209, 196, 0.07);
  color: var(--muted);
  border: 1px solid rgba(215, 209, 196, 0.12);
  font-size: 12px;
}

.audio-toggle.on {
  color: #14100b;
  background: var(--gold);
  border-color: rgba(200, 164, 93, 0.9);
}

.audio-stop {
  grid-column: 1 / -1;
  color: var(--paper);
}

.page {
  min-width: 0;
  padding: 34px clamp(22px, 4vw, 54px) 54px;
  animation: fade-in 260ms ease both;
}

.page-header {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(30px, 4vw, 52px);
  color: var(--paper-2);
}

.page-header p {
  max-width: 820px;
  margin: 0;
  color: #bfc0bb;
  line-height: 1.8;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.full-span {
  grid-column: 1 / -1;
}

.paper-card,
.clue-card,
.person-card,
.document-card,
.question-card,
.timeline-card,
.memory-card {
  position: relative;
  background:
    linear-gradient(145deg, rgba(215, 209, 196, 0.13), rgba(215, 209, 196, 0.055)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 6px);
  border: 1px solid rgba(215, 209, 196, 0.18);
  border-radius: 6px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
}

.paper-card {
  padding: 22px;
}

.paper-card h2,
.document-card h2,
.evidence-panel h2 {
  margin: 0 0 14px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 24px;
  color: var(--paper-2);
}

.paper-card p,
.paper-card li,
.document-card p,
.question-card p,
.timeline-card p {
  color: #c9c5ba;
  line-height: 1.75;
}

.brief-list {
  padding-left: 18px;
  margin: 0;
}

.meta-lines {
  display: grid;
  gap: 10px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(215, 209, 196, 0.16);
}

.meta-line span:first-child {
  color: var(--muted);
}

.meta-line span:last-child {
  color: var(--paper-2);
  text-align: right;
}

.scene-wrap {
  position: relative;
  overflow: visible;
  border: 1px solid rgba(215, 209, 196, 0.2);
  border-radius: 6px;
  box-shadow: var(--shadow);
  background: #0a0e13;
}

.scene-image {
  display: block;
  width: 100%;
  min-height: 360px;
  border-radius: 6px;
  object-fit: cover;
}

.hotspot {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(227, 183, 100, 0.22);
  border: 1px solid rgba(227, 183, 100, 0.72);
  color: #fff3d5;
  box-shadow: 0 0 0 8px rgba(227, 183, 100, 0.08), 0 10px 25px rgba(0, 0, 0, 0.38);
}

.hotspot::after {
  content: attr(aria-label);
  position: absolute;
  top: 48px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 3px;
  background: rgba(9, 14, 20, 0.88);
  color: var(--paper-2);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.hotspot:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.hotspot.collected {
  background: rgba(126, 159, 128, 0.3);
  border-color: rgba(126, 159, 128, 0.95);
}

.hotspot.collected::before {
  content: "✓";
}

.hotspot:not(.collected)::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--lamp);
}

.clue-list,
.people-grid,
.document-grid,
.memory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.clue-card {
  padding: 15px;
  display: grid;
  gap: 8px;
}

.clue-card h3,
.person-card h3,
.document-card h3,
.timeline-card h3,
.question-card h3,
.memory-card h3 {
  margin: 0;
  color: var(--paper-2);
  font-size: 18px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 3px;
  background: rgba(200, 164, 93, 0.16);
  color: #e6cf95;
  font-size: 12px;
}

.tag.red {
  background: rgba(180, 58, 46, 0.18);
  color: #efb7af;
}

.person-card {
  overflow: hidden;
}

.person-card img,
.memory-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--ink-2);
}

.person-body {
  padding: 15px;
}

.quote {
  margin: 12px 0;
  padding: 14px;
  border-left: 3px solid var(--gold);
  background: rgba(5, 9, 14, 0.34);
  color: #e2dccf;
  line-height: 1.75;
  font-family: "SimSun", "Songti SC", serif;
}

.note {
  color: #afa89b;
  font-size: 14px;
  line-height: 1.65;
}

.document-card {
  padding: 18px;
}

.document-text {
  white-space: pre-wrap;
  padding: 14px;
  border-radius: 4px;
  background: rgba(238, 232, 218, 0.08);
  color: #e4ded0;
  line-height: 1.78;
  font-family: "SimSun", "Songti SC", serif;
}

.story-figure {
  margin: 0 0 18px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(215, 209, 196, 0.18);
  background: rgba(8, 12, 17, 0.6);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
}

.story-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
}

.story-figure.compact img,
.story-figure.inline img {
  aspect-ratio: 16 / 9;
}

.story-figure figcaption {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
}

.story-figure figcaption strong {
  color: var(--paper-2);
}

.story-figure figcaption span {
  color: var(--muted);
  line-height: 1.55;
}

.media-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.media-slot {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 5px;
  border: 1px dashed rgba(200, 164, 93, 0.34);
  background: rgba(7, 11, 15, 0.42);
}

.media-slot.compact {
  margin-top: 10px;
}

.media-slot-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.media-slot-head span {
  color: var(--gold);
  font-size: 12px;
}

.media-slot-head strong {
  color: var(--paper-2);
}

.media-slot p {
  margin: 0;
  color: #d4ccbe;
  line-height: 1.65;
}

.media-path {
  display: grid;
  gap: 4px;
}

.media-path span {
  color: var(--muted);
  font-size: 12px;
}

.media-path code {
  display: block;
  overflow-wrap: anywhere;
  padding: 6px 7px;
  border-radius: 4px;
  background: rgba(215, 209, 196, 0.07);
  color: #efd9a0;
  font-size: 12px;
}

.video-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 6, 9, 0.72);
}

.video-modal {
  width: min(760px, 100%);
  padding: 16px;
  border-radius: 6px;
  border: 1px solid rgba(200, 164, 93, 0.36);
  background: rgba(13, 20, 27, 0.98);
  box-shadow: var(--shadow);
}

.video-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.video-modal-head strong {
  color: var(--paper-2);
}

.video-modal video {
  display: block;
  width: 100%;
  max-height: 68vh;
  border-radius: 5px;
  background: #05080c;
}

.video-modal p {
  color: var(--muted);
  line-height: 1.6;
}

.video-modal code {
  color: #efd9a0;
}

.connect-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.connect-pool {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.selectable-clue {
  width: 100%;
  min-height: 150px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid rgba(215, 209, 196, 0.17);
  background: rgba(215, 209, 196, 0.08);
  color: var(--paper);
  text-align: left;
}

.selectable-clue.selected {
  border-color: var(--lamp);
  background: rgba(227, 183, 100, 0.18);
}

.selectable-clue.discovered {
  border-color: rgba(126, 159, 128, 0.55);
}

.selection-box {
  padding: 18px;
  border-radius: 6px;
  border: 1px solid rgba(200, 164, 93, 0.32);
  background: rgba(8, 12, 17, 0.5);
}

.selection-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--paper-2);
}

.contradiction-list {
  display: grid;
  gap: 10px;
}

.contradiction-item {
  padding: 12px;
  border-left: 3px solid var(--red);
  background: rgba(180, 58, 46, 0.11);
}

.timeline-list {
  display: grid;
  gap: 12px;
}

.timeline-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 15px;
}

.timeline-card[draggable="true"] {
  cursor: grab;
}

.timeline-card.dragging {
  opacity: 0.55;
}

.time-pill {
  min-width: 96px;
  padding: 8px 9px;
  border-radius: 4px;
  background: rgba(200, 164, 93, 0.16);
  color: #efd9a0;
  text-align: center;
  font-weight: 700;
}

.move-actions {
  display: flex;
  gap: 6px;
}

.result-banner {
  margin-top: 18px;
  padding: 16px;
  border-radius: 6px;
  border: 1px solid rgba(215, 209, 196, 0.18);
  background: rgba(215, 209, 196, 0.08);
}

.result-banner.success {
  border-color: rgba(126, 159, 128, 0.5);
  background: rgba(126, 159, 128, 0.13);
}

.result-banner.warning {
  border-color: rgba(180, 58, 46, 0.45);
  background: rgba(180, 58, 46, 0.12);
}

.question-list {
  display: grid;
  gap: 16px;
}

.question-card {
  padding: 18px;
}

.option-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 5px;
  border: 1px solid rgba(215, 209, 196, 0.14);
  background: rgba(215, 209, 196, 0.06);
  color: var(--paper);
  line-height: 1.5;
}

.option input {
  margin-top: 4px;
}

.ending-page {
  min-height: calc(100vh - 70px);
  display: grid;
  place-items: center;
}

.ending-card {
  width: min(820px, 100%);
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid rgba(215, 209, 196, 0.2);
  border-radius: 6px;
  background:
    linear-gradient(rgba(9, 14, 20, 0.94), rgba(9, 14, 20, 0.88)),
    repeating-linear-gradient(0deg, rgba(215, 209, 196, 0.03) 0, rgba(215, 209, 196, 0.03) 1px, transparent 1px, transparent 8px);
  box-shadow: var(--shadow);
  animation: fade-in 700ms ease both;
}

.ending-card h1 {
  margin: 0 0 12px;
  font-family: "SimSun", "Songti SC", serif;
  font-size: clamp(34px, 5vw, 58px);
}

.ending-card .status {
  display: inline-flex;
  margin-bottom: 24px;
  padding: 6px 10px;
  color: var(--ink);
  background: var(--gold);
  border-radius: 3px;
  font-weight: 700;
}

.ending-image {
  display: block;
  width: 100%;
  margin-bottom: 22px;
  border-radius: 6px;
  border: 1px solid rgba(215, 209, 196, 0.18);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.ending-text {
  white-space: pre-wrap;
  line-height: 1.9;
  color: #e2dccf;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 18px;
}

.evidence-panel h2 {
  font-size: 22px;
}

.progress-line {
  display: grid;
  gap: 7px;
  margin-bottom: 18px;
  color: #bbb4a8;
  font-size: 14px;
}

.meter {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(215, 209, 196, 0.1);
}

.meter span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.evidence-list {
  display: grid;
  gap: 10px;
}

.evidence-mini {
  padding: 11px;
  border-radius: 5px;
  background: rgba(215, 209, 196, 0.08);
  border: 1px solid rgba(215, 209, 196, 0.12);
}

.evidence-mini strong {
  display: block;
  color: var(--paper-2);
  font-size: 14px;
}

.evidence-mini span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed rgba(215, 209, 196, 0.2);
  border-radius: 6px;
  line-height: 1.65;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 20;
}

.toast {
  width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 6px;
  background: rgba(16, 24, 32, 0.96);
  border: 1px solid rgba(200, 164, 93, 0.45);
  box-shadow: var(--shadow);
  animation: toast-in 260ms ease both;
}

.toast strong {
  display: block;
  margin-bottom: 4px;
  color: var(--lamp);
}

.toast span {
  color: #d8d1c4;
  line-height: 1.55;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.muted {
  color: var(--muted);
}

.locked-copy {
  display: grid;
  place-items: center;
  min-height: 320px;
  text-align: center;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .game-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .evidence-panel {
    position: static;
    grid-column: 1 / -1;
    min-height: 0;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .connect-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .game-shell {
    display: block;
  }

  .sidebar {
    position: static;
    min-height: 0;
    padding: 14px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    padding: 0 4px 12px;
  }

  .brand h2 {
    font-size: 20px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    margin-top: 12px;
  }

  .nav-button {
    justify-content: center;
    padding: 0 8px;
    min-height: 34px;
    font-size: 12px;
  }

  .sidebar-footer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
  }

  .sidebar-footer .secondary-action,
  .sidebar-footer .danger-action {
    min-height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }

  .page {
    padding: 24px 16px 36px;
  }

  .section-grid {
    grid-template-columns: 1fr;
  }

  .scene-image {
    min-height: 290px;
  }

  .hotspot {
    width: 36px;
    height: 36px;
  }

  .timeline-card {
    grid-template-columns: 1fr;
  }

  .move-actions {
    justify-content: flex-start;
  }
}
