/* =========================================================
   深眠病栋 —— 全部样式
   ========================================================= */

:root {
  --ink: #05080a;
  --ink-2: #080d10;
  --panel: #0b1215;
  --panel-2: #0e171b;
  --line: rgba(150, 175, 168, 0.16);
  --line-strong: rgba(150, 175, 168, 0.30);
  --text: #d9d7c9;
  --text-dim: #8d9691;
  --text-faint: #5d6864;
  --paper: #e7e1d1;
  --teal: #8fd0c6;
  --teal-dim: #4d7f76;
  --rust: #b4645c;
  --rust-dim: #7d3b36;
  --amber: #c8a06a;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, "MS Mincho", SimSun, serif;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Hiragino Sans", sans-serif;
  --font-scale: 1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

body {
  overflow: hidden;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: default;
}

.hidden { display: none !important; }

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

::selection {
  background: rgba(143, 208, 198, 0.28);
  color: #fff;
}

:focus-visible {
  outline: 1px solid var(--teal);
  outline-offset: 3px;
}

/* =========================================================
   标题画面
   ========================================================= */

.title-screen {
  background:
    radial-gradient(ellipse at 20% 15%, rgba(48, 72, 76, 0.35), transparent 55%),
    radial-gradient(ellipse at 85% 75%, rgba(30, 52, 56, 0.22), transparent 60%),
    linear-gradient(180deg, #040709 0%, #071015 55%, #05090b 100%);
}

.title-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 76% 22%, rgba(205, 214, 198, 0.10), transparent 22%),
    radial-gradient(ellipse at 72% 24%, rgba(205, 214, 198, 0.06), transparent 34%);
}

.title-moon {
  position: absolute;
  right: 16%;
  top: 14%;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, rgba(226, 230, 214, 0.30), rgba(180, 196, 186, 0.08) 60%, transparent 70%);
  filter: blur(1px);
}

.title-hospital {
  position: absolute;
  right: 4%;
  bottom: 16%;
  width: 48%;
  height: 46%;
  background: #04080a;
  opacity: 0.92;
  clip-path: polygon(0 20%, 16% 20%, 16% 0, 34% 0, 34% 20%, 64% 20%, 64% 10%, 100% 10%, 100% 100%, 0 100%);
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.8);
}

.title-hospital::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 6%;
  top: 26%;
  height: 62%;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(180, 196, 180, 0.20) 26px 30px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(4, 8, 10, 0.85) 22px 26px);
  opacity: 0.55;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.2), #000 30%, #000 100%);
}

.title-hospital::after {
  content: "";
  position: absolute;
  left: 46%;
  top: 34%;
  width: 12px;
  height: 10px;
  background: rgba(232, 198, 128, 0.85);
  box-shadow: 0 0 22px 8px rgba(220, 180, 110, 0.35);
  animation: windowFlicker 6.5s infinite;
}

.title-rain {
  position: absolute;
  inset: -10% 0;
  background-image:
    repeating-linear-gradient(102deg, transparent 0 17px, rgba(180, 205, 205, 0.09) 17px 18px, transparent 18px 43px),
    repeating-linear-gradient(102deg, transparent 0 41px, rgba(180, 205, 205, 0.045) 41px 42px, transparent 42px 80px);
  background-size: 100% 240px, 100% 400px;
  animation: titleRain 1.15s linear infinite;
  opacity: 0.7;
  pointer-events: none;
}

.title-fog {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 25% 80%, rgba(80, 110, 108, 0.12), transparent 50%),
    radial-gradient(ellipse at 70% 90%, rgba(70, 100, 100, 0.10), transparent 55%);
  animation: fogDrift 16s ease-in-out infinite alternate;
  pointer-events: none;
}

.title-ecg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9%;
  height: 96px;
  background: linear-gradient(90deg, transparent, rgba(143, 208, 198, 0.22) 30%, rgba(143, 208, 198, 0.30) 50%, rgba(143, 208, 198, 0.22) 70%, transparent);
  clip-path: polygon(0 50%, 30% 50%, 32% 44%, 34% 56%, 36% 20%, 38% 82%, 40% 50%, 100% 50%, 100% 51.5%, 40% 51.5%, 38% 84%, 36% 22%, 34% 58%, 32% 46%, 30% 51.5%, 0 51.5%);
  animation: ecgPulse 3.8s ease-in-out infinite;
  pointer-events: none;
}

.title-wrap {
  position: relative;
  z-index: 2;
  height: 100%;
  max-width: 760px;
  padding: clamp(36px, 8vh, 90px) clamp(28px, 8vw, 120px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.title-kicker {
  margin: 0 0 18px;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.42em;
  color: var(--text-faint);
  text-transform: uppercase;
}

.title-jp {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(40px, 6.6vw, 92px);
  line-height: 1.06;
  letter-spacing: 0.08em;
  color: #e4e2d4;
  text-shadow: 0 0 34px rgba(160, 200, 190, 0.14), 0 2px 0 rgba(0, 0, 0, 0.5);
  position: relative;
  white-space: nowrap;
}

.title-jp::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -14px;
  width: 58%;
  height: 1px;
  background: linear-gradient(90deg, rgba(143, 208, 198, 0.55), transparent);
}

.title-cn {
  margin: 28px 0 0;
  font-family: var(--font-serif);
  font-size: 15px;
  letter-spacing: 0.62em;
  color: var(--teal);
  opacity: 0.85;
}

.title-tag {
  margin: 18px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(13px, 1.3vw, 16px);
  letter-spacing: 0.20em;
  color: var(--text-dim);
}

.title-menu {
  margin-top: clamp(26px, 5vh, 46px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 430px);
}

.menu-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 14px 18px 13px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(16, 26, 29, 0.72), rgba(8, 13, 15, 0.72));
  color: var(--text);
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.menu-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
  transition: background 0.18s ease;
}

.menu-btn b {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.menu-btn span {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--text-faint);
}

.menu-btn:hover,
.menu-btn:focus-visible {
  border-color: rgba(143, 208, 198, 0.42);
  background: linear-gradient(180deg, rgba(22, 36, 39, 0.85), rgba(9, 15, 17, 0.85));
  transform: translateY(-1px);
}

.menu-btn:hover::before,
.menu-btn:focus-visible::before {
  background: var(--teal);
}

.menu-btn.disabled,
.menu-btn:disabled {
  opacity: 0.38;
}

.title-warn {
  margin: clamp(20px, 4vh, 34px) 0 0;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: var(--text-faint);
}

.title-foot {
  margin: 10px 0 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: #414c49;
}

.title-foot span {
  color: var(--text-faint);
}

/* =========================================================
   游戏画面
   ========================================================= */

.game-screen {
  background: #04080a;
}

#stage-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stage-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 7, 9, 0.70) 0%, rgba(3, 7, 9, 0.08) 22%, rgba(3, 7, 9, 0) 55%, rgba(3, 7, 9, 0.50) 78%, rgba(3, 7, 9, 0.90) 100%),
    radial-gradient(ellipse at 50% 55%, transparent 40%, rgba(2, 5, 7, 0.42) 100%);
  pointer-events: none;
}

.stage-grain {
  position: absolute;
  inset: 0;
  opacity: 0.055;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.stage-scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.10) 3px 4px);
  opacity: 0.35;
}

.stage-flash {
  position: absolute;
  inset: 0;
  background: #dfe9e3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* HUD */

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) 26px 18px;
  background: linear-gradient(180deg, rgba(3, 7, 9, 0.78), rgba(3, 7, 9, 0));
  pointer-events: none;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.hud-chapter {
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-place {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 14px;
  pointer-events: auto;
}

.hud-clock {
  font-family: var(--font-serif);
  font-size: 17px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.san-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: rgba(5, 9, 11, 0.55);
}

.san-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-faint);
}

.san-bar {
  width: 92px;
  height: 4px;
  background: rgba(130, 150, 145, 0.18);
  overflow: hidden;
}

.san-fill {
  display: block;
  height: 100%;
  width: 60%;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  transition: width 0.5s ease, background 0.5s ease;
}

.san-num {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--teal);
  min-width: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.san-wrap.danger .san-fill {
  background: linear-gradient(90deg, var(--rust-dim), var(--rust));
}

.san-wrap.danger .san-num {
  color: var(--rust);
}

.hud-btn {
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: rgba(5, 9, 11, 0.45);
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.12em;
  transition: color 0.18s, border-color 0.18s;
}

.hud-btn:hover {
  color: var(--teal);
  border-color: rgba(143, 208, 198, 0.4);
}

/* 弹幕 */

.live-ticker {
  position: absolute;
  z-index: 5;
  top: 88px;
  left: 26px;
  width: min(360px, 40vw);
  padding: 8px 10px;
  background: rgba(4, 8, 10, 0.55);
  border-left: 1px solid rgba(200, 90, 80, 0.6);
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

.live-label {
  display: inline-block;
  margin-right: 8px;
  color: rgba(212, 96, 84, 0.9);
  font-size: 9px;
  letter-spacing: 0.18em;
}

.live-track {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 92px;
  overflow: hidden;
}

.live-comment {
  opacity: 0.8;
  animation: commentIn 0.4s ease;
  transition: opacity 0.4s;
}

.live-comment.out {
  opacity: 0;
}

/* 文本框 */

.textbox {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(74px, calc(env(safe-area-inset-bottom) + 74px));
  transform: translateX(-50%);
  width: min(1040px, calc(100% - 80px));
  min-height: 168px;
  padding: 34px 40px 30px;
  background: linear-gradient(180deg, rgba(7, 12, 14, 0.86), rgba(4, 8, 10, 0.92));
  border-top: 1px solid rgba(143, 208, 198, 0.18);
  border-bottom: 1px solid rgba(143, 208, 198, 0.08);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  cursor: pointer;
  outline: none;
}

.speaker {
  position: absolute;
  left: 28px;
  top: -15px;
  padding: 5px 16px;
  background: #0b1417;
  border: 1px solid currentColor;
  border-color: var(--teal-dim);
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--teal);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.line {
  margin: 0;
  font-family: var(--font-serif);
  font-size: calc(19px * var(--font-scale));
  line-height: 1.95;
  letter-spacing: 0.035em;
  color: #dedbcd;
  min-height: 3.9em;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.next-indicator {
  position: absolute;
  right: 26px;
  bottom: 14px;
  color: var(--teal);
  font-size: 12px;
  animation: nextBounce 1.4s ease-in-out infinite;
  opacity: 0.75;
}

/* 选项 */

.choices {
  position: absolute;
  z-index: 8;
  right: max(40px, calc((100vw - 1040px) / 2));
  bottom: calc(max(74px, env(safe-area-inset-bottom) + 74px) + 190px);
  width: min(540px, 46vw);
  display: flex;
  flex-direction: column;
  gap: 9px;
  animation: choicesIn 0.28s ease;
}

.choice-btn {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  text-align: left;
  background: linear-gradient(90deg, rgba(11, 20, 23, 0.94), rgba(7, 13, 15, 0.90));
  border: 1px solid var(--line);
  border-left: 2px solid rgba(143, 208, 198, 0.35);
  color: var(--text);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.choice-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  flex: 0 0 42px;
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--text-faint);
  border-right: 1px solid rgba(150, 175, 168, 0.10);
}

.choice-text {
  padding: 13px 16px;
  font-family: var(--font-serif);
  font-size: calc(14.5px * var(--font-scale));
  line-height: 1.55;
}

.choice-btn:hover,
.choice-btn:focus-visible {
  background: linear-gradient(90deg, rgba(19, 34, 37, 0.96), rgba(9, 17, 19, 0.92));
  border-color: rgba(143, 208, 198, 0.45);
  border-left-color: var(--teal);
  transform: translateX(-2px);
}

.choice-btn:hover .choice-num {
  color: var(--teal);
}

/* 快捷栏 */

#quickbar {
  position: absolute;
  z-index: 7;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  height: calc(52px + env(safe-area-inset-bottom));
  padding: 0 26px env(safe-area-inset-bottom);
  background: linear-gradient(180deg, rgba(3, 7, 9, 0.15), rgba(3, 7, 9, 0.85));
}

.quick-btn {
  padding: 7px 13px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  border: 1px solid transparent;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}

.quick-btn:hover {
  color: var(--text);
  border-color: var(--line);
}

.quick-btn.active {
  color: var(--teal);
  border-color: rgba(143, 208, 198, 0.35);
  background: rgba(20, 36, 38, 0.5);
}

/* 手机消息 */

.phone-banner {
  position: absolute;
  z-index: 9;
  top: 86px;
  right: 26px;
  width: min(330px, 70vw);
  padding: 12px 14px;
  background: rgba(8, 14, 17, 0.94);
  border: 1px solid rgba(143, 208, 198, 0.22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  animation: phoneIn 0.4s ease;
}

.phone-app {
  display: block;
  font-size: 8px;
  letter-spacing: 0.32em;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.phone-from {
  display: block;
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--teal);
  margin-bottom: 3px;
}

.phone-text {
  display: block;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

/* 屏幕演出 */

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(3px, -3px); }
  60% { transform: translate(-2px, 1px); }
  80% { transform: translate(2px, -1px); }
}

.shake {
  animation: shake 0.42s ease;
}

.glitch {
  animation: glitch 0.16s steps(2) 3;
}

@keyframes glitch {
  0% { filter: none; }
  40% { filter: hue-rotate(8deg) contrast(1.25) saturate(0.8); }
  70% { filter: invert(0.04) hue-rotate(-6deg); }
  100% { filter: none; }
}

body.san-low .stage-scan {
  opacity: 0.55;
}

body.san-low .line {
  text-shadow: 0 0 18px rgba(143, 208, 198, 0.10);
}

body.san-crit .line {
  animation: textBreathe 3.2s ease-in-out infinite;
}

body.san-crit .stage-grain {
  opacity: 0.10;
}

@keyframes textBreathe {
  0%, 100% { opacity: 0.92; letter-spacing: 0.035em; }
  50% { opacity: 1; letter-spacing: 0.045em; }
}

/* =========================================================
   浮层通用
   ========================================================= */

#overlay-root {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 20px;
  pointer-events: auto;
}

.overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 7, 0.72);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.2s ease;
}

.panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0b1316, #070d10);
  border: 1px solid var(--line);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  animation: panelIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--text);
}

.panel-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.tab {
  padding: 6px 12px;
  border: 1px solid transparent;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.tab.active {
  border-color: var(--line-strong);
  color: var(--teal);
}

.panel-close {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.panel-tabs + .panel-close {
  margin-left: 8px;
}

.panel-close:hover {
  color: var(--rust);
  border-color: rgba(180, 100, 92, 0.5);
}

.panel-body {
  padding: 20px 24px 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 208, 198, 0.22) transparent;
}

.panel-body::-webkit-scrollbar {
  width: 8px;
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(143, 208, 198, 0.18);
}

.panel-goal {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-left: 2px solid var(--teal-dim);
  background: rgba(20, 34, 36, 0.35);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}

.panel-goal b {
  color: var(--teal);
  font-weight: 500;
  margin-right: 8px;
  letter-spacing: 0.1em;
}

.note-empty {
  color: var(--text-faint);
  font-size: 12px;
  padding: 20px 0;
}

/* 手记 */

.clue-card {
  padding: 13px 16px 15px;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(143, 208, 198, 0.28);
  background: rgba(12, 20, 23, 0.55);
  margin-bottom: 10px;
}

.clue-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.clue-head h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text);
}

.clue-cat {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.clue-card p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--text-dim);
}

.map-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.map-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(150, 175, 168, 0.08);
  font-size: 12px;
  color: var(--text-faint);
}

.map-row.seen {
  color: var(--text-dim);
}

.map-floor {
  width: 50px;
  flex: 0 0 50px;
  font-family: var(--font-serif);
  color: var(--teal-dim);
  letter-spacing: 0.1em;
}

.map-name {
  flex: 1;
}

.map-state {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

.map-hint {
  margin: 16px 0 0;
  font-size: 11px;
  color: var(--text-faint);
}

/* 记录 */

.log-body {
  max-height: 64vh;
}

.log-row {
  display: flex;
  gap: 14px;
  padding: 7px 2px;
  border-bottom: 1px solid rgba(150, 175, 168, 0.06);
  line-height: 1.7;
}

.log-who {
  flex: 0 0 72px;
  font-family: var(--font-serif);
  font-size: 11px;
  color: var(--text-faint);
  padding-top: 2px;
  letter-spacing: 0.08em;
}

.log-text {
  font-family: var(--font-serif);
  font-size: 12.5px;
  color: var(--text-dim);
}

/* 存档 */

.save-slot {
  display: grid;
  grid-template-columns: 90px 1fr;
  grid-template-areas:
    "name chapter"
    "name time"
    "preview preview";
  gap: 4px 16px;
  width: 100%;
  padding: 13px 16px;
  margin-bottom: 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(12, 20, 23, 0.5);
  transition: border-color 0.16s, background 0.16s;
}

.save-slot:hover:not(.disabled) {
  border-color: rgba(143, 208, 198, 0.4);
  background: rgba(18, 30, 33, 0.7);
}

.save-slot.disabled {
  opacity: 0.4;
}

.save-slot.auto {
  border-left: 2px solid var(--teal-dim);
}

.slot-name {
  grid-area: name;
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--teal);
  letter-spacing: 0.1em;
  align-self: start;
}

.slot-chapter {
  grid-area: chapter;
  font-family: var(--font-serif);
  font-size: 12px;
  color: var(--text);
}

.slot-time {
  grid-area: time;
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.06em;
}

.slot-preview {
  grid-area: preview;
  font-family: var(--font-serif);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-dim);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.slot-empty {
  grid-column: 2;
  font-size: 11px;
  color: var(--text-faint);
}

.save-now {
  margin: 12px 0 0;
  font-size: 10px;
  color: var(--text-faint);
}

/* 设置 */

.settings-body {
  padding-bottom: 20px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(150, 175, 168, 0.07);
  font-size: 12px;
  color: var(--text-dim);
}

.setting-row > span {
  flex: 0 0 132px;
  letter-spacing: 0.08em;
}

.setting-row select {
  flex: 1;
  max-width: 240px;
  padding: 7px 10px;
  background: #0a1215;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
}

.setting-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  max-width: 300px;
  height: 18px;
  background: transparent;
  cursor: pointer;
}

.setting-row input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: rgba(150, 175, 168, 0.22);
  border: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: -5px;
  background: var(--teal-dim);
  border: 1px solid rgba(143, 208, 198, 0.65);
  box-shadow: 0 0 10px rgba(143, 208, 198, 0.25);
}

.setting-row input[type="range"]::-moz-range-track {
  height: 2px;
  background: rgba(150, 175, 168, 0.22);
  border: none;
}

.setting-row input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--teal-dim);
  border: 1px solid rgba(143, 208, 198, 0.65);
}

.setting-row b {
  width: 48px;
  text-align: right;
  font-weight: 400;
  font-size: 11px;
  color: var(--text-faint);
}

.switch-row {
  justify-content: space-between;
}

.switch-row input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: #0a1215;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.switch-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-faint);
  transition: transform 0.18s, background 0.18s;
}

.switch-row input[type="checkbox"]:checked {
  background: rgba(77, 127, 118, 0.28);
  border-color: rgba(143, 208, 198, 0.55);
}

.switch-row input[type="checkbox"]:checked::after {
  transform: translateX(18px);
  background: var(--teal);
}

.settings-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.settings-foot {
  margin: 18px 0 0;
  font-size: 10.5px;
  line-height: 1.8;
  color: var(--text-faint);
}

.warn-line {
  margin: 0 0 14px;
  padding: 8px 12px;
  border: 1px solid rgba(200, 160, 106, 0.3);
  background: rgba(60, 45, 20, 0.15);
  font-size: 11px;
  color: var(--amber);
}

.btn-main,
.btn-ghost,
.btn-danger {
  padding: 10px 22px;
  border: 1px solid var(--line-strong);
  background: rgba(18, 30, 33, 0.7);
  font-family: var(--font-serif);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  color: var(--text);
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}

.btn-main {
  border-color: rgba(143, 208, 198, 0.42);
  color: var(--teal);
}

.btn-main:hover {
  background: rgba(143, 208, 198, 0.12);
  border-color: var(--teal);
}

.btn-ghost:hover {
  border-color: var(--text-faint);
}

.btn-danger {
  border-color: rgba(180, 100, 92, 0.4);
  color: var(--rust);
}

.btn-danger:hover {
  background: rgba(180, 100, 92, 0.12);
  border-color: var(--rust);
}

/* 图鉴 */

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

.gallery-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(11, 19, 22, 0.55);
}

.gallery-card.type-true { border-left: 2px solid var(--teal); }
.gallery-card.type-normal { border-left: 2px solid #a9b6b0; }
.gallery-card.type-bad { border-left: 2px solid var(--rust); }
.gallery-card.type-secret { border-left: 2px solid #7fb8a8; }
.gallery-card.fake { border-left: 2px solid var(--amber); }

.gallery-card.locked {
  opacity: 0.62;
}

.gallery-kind {
  margin: 0 0 6px;
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--text-faint);
}

.gallery-card h3 {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text);
}

.gallery-sub {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-dim);
}

.gallery-desc {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: 11px;
  line-height: 1.75;
  color: var(--text-faint);
}

.gallery-section {
  margin: 26px 0 12px;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.24em;
  color: var(--amber);
  border-bottom: 1px solid rgba(200, 160, 106, 0.18);
  padding-bottom: 8px;
}

.fake-grid .gallery-card h3 {
  color: #d8b27a;
}

/* 菜单 */

.menu-goal {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-dim);
}

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

.menu-item {
  padding: 13px 16px;
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(12, 20, 23, 0.55);
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--text);
  transition: border-color 0.16s, background 0.16s;
}

.menu-item:hover {
  border-color: rgba(143, 208, 198, 0.4);
  background: rgba(18, 30, 33, 0.7);
}

.menu-item.danger {
  color: var(--rust);
  border-color: rgba(180, 100, 92, 0.25);
}

.menu-item.danger:hover {
  border-color: rgba(180, 100, 92, 0.55);
}

/* 判定 */

.check-overlay,
.fake-overlay,
.gameover-overlay {
  z-index: 60;
}

.check-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  padding: 28px 30px 24px;
  text-align: center;
  background: linear-gradient(180deg, #0b1417, #060c0e);
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
  animation: panelIn 0.22s ease;
}

.check-label {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 0.34em;
  color: var(--text-dim);
}

.check-dice {
  font-family: var(--font-serif);
  font-size: 64px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(143, 208, 198, 0.18);
  margin: 8px 0 14px;
}

.check-dice.ok { color: var(--teal); }
.check-dice.bad { color: var(--rust); }

.check-target {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.check-target b {
  color: var(--text-dim);
  font-weight: 400;
}

.check-result {
  margin: 16px 0 0;
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.check-result.ok { color: var(--teal); }
.check-result.bad { color: var(--rust); }

.check-loss {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-faint);
}

.check-next {
  margin-top: 20px;
}

/* 伪结局 */

.fake-overlay .overlay-bg {
  background: rgba(10, 7, 3, 0.82);
}

.fake-card {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 38px 42px 32px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200, 138, 74, 0.10), transparent 60%),
    linear-gradient(180deg, #14100a, #0a0805);
  border: 1px solid rgba(200, 138, 74, 0.32);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.85);
  animation: panelIn 0.3s ease;
}

.fake-kind {
  margin: 0 0 12px;
  font-size: 9px;
  letter-spacing: 0.34em;
  color: var(--amber);
}

.fake-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #e6d7bd;
}

.fake-sub {
  margin: 10px 0 22px;
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(200, 160, 106, 0.75);
}

.fake-desc {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.95;
  color: #b3a78f;
}

.fake-note {
  margin: 24px 0 20px;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-faint);
}

.fake-next {
  border-color: rgba(200, 138, 74, 0.45);
  color: var(--amber);
}

.fake-next:hover {
  background: rgba(200, 138, 74, 0.12);
  border-color: var(--amber);
}

/* Game Over */

.gameover-overlay .overlay-bg {
  background: rgba(8, 2, 2, 0.88);
}

.gameover-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  padding: 38px 40px 30px;
  text-align: center;
  background: linear-gradient(180deg, #140b0b, #080404);
  border: 1px solid rgba(180, 100, 92, 0.35);
  box-shadow: 0 30px 110px rgba(0, 0, 0, 0.9);
  animation: panelIn 0.3s ease;
}

.gameover-sub {
  margin: 0 0 12px;
  font-size: 9px;
  letter-spacing: 0.4em;
  color: rgba(180, 100, 92, 0.75);
}

.gameover-card h2 {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: clamp(30px, 5vw, 42px);
  font-weight: 400;
  letter-spacing: 0.16em;
  color: #d8b4ae;
}

.gameover-desc {
  margin: 0 0 24px;
  font-family: var(--font-serif);
  font-size: 12.5px;
  line-height: 1.9;
  color: #987a75;
}

.gameover-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* 确认弹窗 */

.modal-layer {
  z-index: 80;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 26px 28px 22px;
  background: #0b1316;
  border: 1px solid var(--line-strong);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8);
  animation: panelIn 0.2s ease;
}

.modal-text {
  margin: 0 0 20px;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================================
   结局画面
   ========================================================= */

.ending-screen {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(200, 170, 120, 0.10), transparent 55%),
    linear-gradient(180deg, #090d0f 0%, #101719 60%, #060a0b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 22px;
}

.ending-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(143, 208, 198, 0.08), transparent 60%),
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.06) 3px 4px);
  pointer-events: none;
}

.ending-rain {
  position: absolute;
  inset: -10% 0;
  background-image: repeating-linear-gradient(102deg, transparent 0 22px, rgba(160, 190, 190, 0.045) 22px 23px, transparent 23px 58px);
  animation: titleRain 1.4s linear infinite;
  opacity: 0.5;
  pointer-events: none;
}

.ending-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: clamp(30px, 5vw, 54px) clamp(26px, 6vw, 64px);
  background: linear-gradient(180deg, rgba(8, 13, 15, 0.92), rgba(5, 9, 11, 0.96));
  border: 1px solid var(--line);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  animation: panelIn 0.5s ease;
}

.ending-kind {
  margin: 0 0 14px;
  font-size: 10px;
  letter-spacing: 0.42em;
  color: var(--teal);
}

.ending-screen.type-normal .ending-kind { color: #a9b6b0; }
.ending-screen.type-bad .ending-kind { color: var(--rust); }
.ending-screen.type-secret .ending-kind { color: #7fb8a8; }

.ending-title {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: clamp(34px, 5.4vw, 58px);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--paper);
  text-shadow: 0 0 40px rgba(143, 208, 198, 0.12);
}

.ending-screen.type-bad .ending-title {
  color: #c9a39d;
  text-shadow: 0 0 40px rgba(180, 100, 92, 0.16);
}

.ending-sub {
  margin: 0 0 26px;
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: 0.20em;
  color: var(--text-faint);
}

.ending-desc {
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 2.05;
  color: var(--text-dim);
}

.ending-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.ending-stats b {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 6px;
}

.ending-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.ending-screen.type-bad .ending-bg {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(180, 100, 92, 0.10), transparent 60%),
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.06) 3px 4px);
}

.ending-screen.type-secret .ending-bg {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(90, 180, 160, 0.16), transparent 65%),
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.06) 3px 4px);
}

/* =========================================================
   Toast / Fatal
   ========================================================= */

.toast-root {
  position: fixed;
  z-index: 90;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.toast {
  padding: 7px 16px;
  background: rgba(6, 12, 14, 0.92);
  border: 1px solid var(--line);
  border-left: 2px solid var(--teal-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  animation: toastIn 0.25s ease;
  transition: opacity 0.35s, transform 0.35s;
  white-space: nowrap;
}

.toast.clue {
  border-left-color: var(--teal);
  color: var(--teal);
}

.toast.bad {
  border-left-color: var(--rust);
  color: #c99a94;
}

.toast.good {
  border-left-color: #8fbf9a;
  color: #a9cbb0;
}

.toast.out {
  opacity: 0;
  transform: translateY(-6px);
}

.fatal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 30px;
  background: #05080a;
  text-align: center;
}

.fatal h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--rust);
}

.fatal pre {
  max-width: 80vw;
  max-height: 40vh;
  overflow: auto;
  font-size: 11px;
  color: var(--text-faint);
  white-space: pre-wrap;
}

/* =========================================================
   动画
   ========================================================= */

@keyframes titleRain {
  from { background-position: 0 0, 0 0; }
  to { background-position: -40px 240px, -80px 400px; }
}

@keyframes fogDrift {
  from { transform: translate3d(-2%, 0, 0) scale(1.02); }
  to { transform: translate3d(2%, -1%, 0) scale(1.05); }
}

@keyframes ecgPulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.75; }
}

@keyframes windowFlicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.35; }
  94% { opacity: 0.9; }
  96% { opacity: 0.2; }
  97% { opacity: 0.85; }
}

@keyframes nextBounce {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(4px); opacity: 0.9; }
}

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

@keyframes panelIn {
  from { transform: translateY(10px) scale(0.995); }
  to { transform: translateY(0) scale(1); }
}

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

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

@keyframes phoneIn {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* =========================================================
   响应式
   ========================================================= */

@media (max-width: 860px) {
  .title-wrap {
    padding: 8vh 7vw 6vh;
    max-width: none;
    justify-content: flex-end;
  }

  .title-hospital {
    right: -6%;
    bottom: 26%;
    width: 82%;
    height: 38%;
    opacity: 0.55;
  }

  .title-jp {
    font-size: clamp(40px, 10vw, 66px);
  }

  .title-menu {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .title-tag {
    font-size: 12px;
  }

  .title-ecg {
    bottom: 4%;
    opacity: 0.5;
  }

  #hud {
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }

  .hud-chapter {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .hud-left {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 52%;
    overflow: hidden;
  }

  .hud-place { display: none; }

  .hud-right { flex: 0 1 auto; min-width: 0; gap: 6px; }

  .hud-clock { font-size: 14px; }

  .san-bar { width: 44px; }

  .san-wrap { padding: 4px 7px; gap: 5px; }

  .san-label { display: none; }

  #btn-note { display: none; }

  .hud-btn {
    padding: 6px 8px;
    font-size: 10px;
  }

  .live-ticker {
    top: 72px;
    left: 12px;
    width: 60vw;
  }

  .textbox {
    width: calc(100% - 24px);
    left: 12px;
    transform: none;
    bottom: calc(58px + env(safe-area-inset-bottom));
    min-height: 150px;
    padding: 28px 20px 24px;
  }

  .speaker {
    left: 16px;
    font-size: 12px;
  }

  .line {
    font-size: calc(16px * var(--font-scale));
    line-height: 1.9;
    min-height: 5.7em;
  }

  .next-indicator {
    right: 16px;
    bottom: 10px;
  }

  .choices {
    left: 12px;
    right: 12px;
    bottom: calc(58px + env(safe-area-inset-bottom) + 230px);
    width: auto;
    gap: 6px;
  }

  .choice-text {
    padding: 11px 13px;
    font-size: calc(13.5px * var(--font-scale));
  }

  .choice-num { width: 34px; flex-basis: 34px; }

  #quickbar {
    padding: 0 12px env(safe-area-inset-bottom);
    height: calc(50px + env(safe-area-inset-bottom));
    justify-content: space-evenly;
  }

  .quick-btn {
    padding: 6px 9px;
    font-size: 10px;
  }

  .phone-banner {
    top: 72px;
    right: 12px;
    width: calc(100% - 24px);
  }

  .overlay { padding: 12px; align-items: flex-end; }

  .panel {
    max-height: 84vh;
    width: 100%;
  }

  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 16px; }
  .panel-head h2 { font-size: 16px; }

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

  .ending-screen { align-items: center; padding: 16px; }

  .ending-card {
    padding: 26px 22px;
    max-height: 90vh;
  }

  .ending-title { font-size: clamp(30px, 8vw, 44px); }

  .ending-stats { gap: 12px; }

  .ending-actions {
    flex-direction: column-reverse;
  }

  .ending-actions button { width: 100%; }

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

  .setting-row > span { flex-basis: 100px; }

  .save-slot {
    grid-template-columns: 72px 1fr;
    gap: 3px 10px;
  }

  .slot-name { font-size: 12px; }

  .toast-root { top: 64px; width: calc(100% - 48px); }

  .toast {
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .hud-clock { display: none; }
  .title-jp { font-size: clamp(36px, 12vw, 56px); }
}

@media (max-height: 560px) and (orientation: landscape) {
  .title-wrap {
    justify-content: center;
    padding: 4vh 6vw;
  }

  .title-jp { font-size: clamp(34px, 6vw, 54px); }
  .title-menu { margin-top: 18px; }
  .title-warn, .title-foot { display: none; }

  .textbox {
    bottom: 46px;
    min-height: 108px;
    padding: 22px 24px 16px;
    width: calc(100% - 40px);
    left: 20px;
  }

  .line {
    font-size: calc(14.5px * var(--font-scale));
    min-height: 3em;
  }

  .choices {
    bottom: 166px;
    right: 20px;
    left: auto;
    width: min(420px, 55vw);
  }

  #quickbar { height: 40px; }
  .quick-btn { padding: 4px 8px; font-size: 10px; }

  #hud { padding: 8px 16px; }
  .hud-place { display: none; }

  .panel { max-height: 92vh; }
}

@media (prefers-reduced-motion: reduce) {
  .title-rain,
  .ending-rain,
  .title-fog,
  .title-ecg,
  .title-hospital::after,
  .next-indicator {
    animation: none !important;
  }

  .shake,
  .glitch {
    animation: none !important;
  }

  .panel,
  .ending-card,
  .fake-card,
  .gameover-card,
  .choice-btn,
  .menu-btn {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   �������˳ơ����⸲�ǣ�������ֽ����졢ˮ��
   ========================================================= */

:root {
  --ink: #0b0f10;
  --ink-2: #0e1415;
  --panel: #111718;
  --panel-2: #151d1d;
  --line: rgba(196, 186, 160, 0.16);
  --line-strong: rgba(196, 186, 160, 0.34);
  --text: #ddd6c6;
  --text-dim: #9b988d;
  --text-faint: #6b6a63;
  --paper: #e6dfcc;
  --teal: #8fb8ad;
  --teal-dim: #4f7d74;
  --rust: #b4645c;
  --rust-dim: #7d3b36;
  --amber: #c8a06a;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Hiragino Sans", sans-serif;
}

body { background: var(--ink); }

/* ---------------- ���� ---------------- */

.title-screen {
  background:
    radial-gradient(ellipse at 72% 18%, rgba(180, 160, 120, 0.10), transparent 42%),
    radial-gradient(ellipse at 24% 80%, rgba(60, 90, 84, 0.12), transparent 55%),
    linear-gradient(160deg, #080b0c 0%, #0d1415 52%, #070b0c 100%);
}

.title-paper {
  position: absolute;
  right: 7%;
  top: 13%;
  width: 40%;
  height: 70%;
  transform: rotate(1.4deg);
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(196, 186, 160, 0.07) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(196, 186, 160, 0.045) 31px 32px),
    linear-gradient(180deg, rgba(230, 223, 204, 0.075), rgba(230, 223, 204, 0.025));
  border: 1px solid rgba(196, 186, 160, 0.16);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.title-paper::before {
  content: "";
  position: absolute;
  left: 44px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(180, 100, 92, 0.32);
}

.title-paper::after {
  content: "��";
  position: absolute;
  right: 28px;
  bottom: 22px;
  font-family: var(--font-serif);
  font-size: 120px;
  color: rgba(180, 100, 92, 0.10);
}

.title-grid {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 63px, rgba(196, 186, 160, 0.028) 63px 64px),
    repeating-linear-gradient(90deg, transparent 0 63px, rgba(196, 186, 160, 0.022) 63px 64px);
  mask-image: radial-gradient(ellipse at 60% 50%, #000 20%, transparent 78%);
  pointer-events: none;
}

.title-redline {
  position: absolute;
  left: 7.2%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(180, 100, 92, 0.45) 25%, rgba(180, 100, 92, 0.25) 80%, transparent);
  pointer-events: none;
}

.title-wrap {
  max-width: 820px;
  padding: clamp(36px, 9vh, 100px) clamp(34px, 8vw, 110px);
}

.title-jp {
  font-size: clamp(46px, 7vw, 92px);
  letter-spacing: 0.14em;
  color: #e9e2d2;
  text-shadow: 0 0 32px rgba(143, 184, 173, 0.12), 0 2px 0 rgba(0, 0, 0, 0.5);
}

.title-cn {
  margin-top: 22px;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.5em;
  color: var(--text-faint);
}

.title-tag {
  color: var(--text-dim);
}

.menu-btn b { color: var(--paper); }
.menu-btn span { color: var(--text-faint); }
.menu-btn:hover { border-color: rgba(180, 100, 92, 0.55); }
.menu-btn:hover::before { background: var(--rust); }

.title-warn { color: var(--text-faint); }

/* ---------------- ��Ϸ ---------------- */

.game-screen { background: #080c0d; }

.stage-shade {
  background:
    linear-gradient(180deg, rgba(6, 10, 10, 0.70) 0%, rgba(6, 10, 10, 0.06) 24%, rgba(6, 10, 10, 0) 55%, rgba(6, 10, 10, 0.48) 78%, rgba(6, 10, 10, 0.92) 100%),
    radial-gradient(ellipse at 50% 55%, transparent 38%, rgba(4, 8, 8, 0.45) 100%);
}

.qa-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 12, 0.55);
}

.qa-label { font-size: 9px; letter-spacing: 0.16em; color: var(--text-faint); }
.qa-num { font-family: var(--font-serif); font-size: 13px; color: var(--teal); min-width: 26px; text-align: right; }
.qa-num.bad { color: var(--rust); }

.textbox {
  background: linear-gradient(180deg, rgba(17, 22, 22, 0.94), rgba(9, 13, 13, 0.97));
  border-top: 1px solid rgba(180, 100, 92, 0.28);
  border-bottom: 1px solid rgba(196, 186, 160, 0.08);
}

.speaker {
  background: #121818;
  border-color: var(--rust-dim);
  color: var(--rust);
}

.line { color: #e2dac8; }

.choice-btn {
  background: linear-gradient(90deg, rgba(17, 23, 23, 0.96), rgba(9, 13, 13, 0.94));
  border-left-color: rgba(180, 100, 92, 0.45);
}

.choice-btn:hover,
.choice-btn:focus-visible {
  background: linear-gradient(90deg, rgba(28, 35, 34, 0.98), rgba(13, 18, 18, 0.96));
  border-color: rgba(180, 100, 92, 0.55);
  border-left-color: var(--rust);
}

.choice-btn:hover .choice-num { color: var(--rust); }

.quick-btn.active {
  color: var(--rust);
  border-color: rgba(180, 100, 92, 0.35);
  background: rgba(42, 26, 24, 0.5);
}

.san-wrap.danger .san-fill, .qa-num.bad { background: none; }
.san-wrap.danger .san-fill { background: linear-gradient(90deg, var(--rust-dim), var(--rust)); }
.san-wrap.danger .san-num { color: var(--rust); }

/* ---------------- ����̨ ---------------- */

.workbench-overlay .overlay-bg {
  background: rgba(4, 7, 7, 0.86);
  backdrop-filter: blur(7px);
}

.workbench {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(196, 186, 160, 0.025) 31px 32px),
    linear-gradient(180deg, #111717, #090d0d);
  border: 1px solid var(--line-strong);
  box-shadow: 0 40px 130px rgba(0, 0, 0, 0.8);
  animation: panelIn 0.24s ease;
}

.wb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}

.wb-kicker {
  margin: 0 0 4px;
  font-size: 8px;
  letter-spacing: 0.32em;
  color: var(--text-faint);
}

.wb-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--paper);
}

.wb-meters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.wb-meter {
  padding: 5px 9px;
  border: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

.wb-meter b { color: var(--teal); font-weight: 400; margin-left: 5px; }
.wb-meter.qa b { color: var(--amber); }

.wb-seg {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}

.wb-prompt {
  margin: 0;
  padding: 12px 22px;
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
  background: rgba(180, 100, 92, 0.04);
}

.wb-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr 0.9fr;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.wb-pane {
  padding: 18px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  min-height: 0;
}

.wb-pane:last-child { border-right: none; }

.wb-pane h3 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--rust);
}

.wb-source {
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(80, 70, 55, 0.05) 30px 31px),
    linear-gradient(180deg, #d8d0bc, #c9c1ad);
  color: #201d18;
}

.wb-source h3 { color: #7d3b36; }

.wb-source-text {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.04em;
  white-space: pre-wrap;
}

.wb-source-foot {
  margin: 18px 0 0;
  font-size: 9px;
  color: rgba(50, 45, 38, 0.55);
}

.wb-target-text {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1.95;
  color: var(--text);
}

.wb-term {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(180, 100, 92, 0.06);
  font-size: 10px;
  color: var(--text-faint);
}

.wb-term b { font-family: var(--font-serif); font-size: 18px; color: var(--paper); }
.wb-term em { margin-left: auto; font-style: normal; color: var(--teal); }

.trans-list { display: flex; flex-direction: column; gap: 7px; }

.trans-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(180, 100, 92, 0.4);
  background: rgba(16, 22, 22, 0.8);
  color: var(--text);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}

.trans-card:hover,
.trans-card:focus-visible {
  border-color: rgba(180, 100, 92, 0.6);
  background: rgba(30, 36, 34, 0.9);
  transform: translateX(-2px);
}

.trans-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  flex: 0 0 34px;
  border-right: 1px solid var(--line);
  font-size: 10px;
  color: var(--text-faint);
}

.trans-main { display: flex; flex-direction: column; gap: 5px; padding: 11px 13px; }
.trans-main b { font-family: var(--font-serif); font-size: 13px; font-weight: 400; line-height: 1.6; }
.trans-main em { font-style: normal; font-size: 9px; letter-spacing: 0.06em; color: var(--text-faint); }

.wb-side { background: rgba(13, 18, 18, 0.65); }

.tm-list { list-style: none; margin: 0 0 16px; padding: 0; }

.tm-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 3px 8px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(196, 186, 160, 0.07);
}

.tm-match { font-family: var(--font-serif); font-size: 12px; color: var(--teal); }
.tm-text { font-family: var(--font-serif); font-size: 12px; color: var(--text); }
.tm-author { grid-column: 2; font-size: 9px; color: var(--text-faint); }
.tm-anomaly .tm-match { color: var(--rust); }
.tm-anomaly .tm-text { color: #d8b4ae; }
.tm-row.accepted { opacity: 0.55; }
.tm-empty { font-size: 10px; color: var(--text-faint); }

.wb-term-card {
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: rgba(180, 100, 92, 0.05);
}

.wb-term-card b {
  display: block;
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 500;
  color: var(--paper);
  margin-bottom: 6px;
}

.wb-term-card p { margin: 0 0 6px; font-size: 10px; line-height: 1.7; color: var(--text-faint); }
.wb-term-value { color: var(--teal) !important; }

.wb-rule {
  margin: 16px 0 0;
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.wb-foot {
  padding: 11px 22px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

/* ---------------- ���� ---------------- */

.term-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: rgba(180, 100, 92, 0.04);
}

.term-source {
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 68px;
  border: 1px solid rgba(180, 100, 92, 0.35);
  font-family: var(--font-serif);
  font-size: 36px;
  color: var(--rust);
}

.term-body h4 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 15px; color: var(--paper); }
.term-body p { margin: 0 0 6px; font-size: 11.5px; line-height: 1.75; color: var(--text-dim); }
.term-target { color: var(--teal) !important; }
.dnt-mark { padding: 1px 6px; border: 1px solid var(--rust-dim); color: var(--rust); font-size: 9px; }

.name-list { list-style: none; margin: 0; padding: 0; }
.name-row {
  display: grid;
  grid-template-columns: 100px 1fr 70px;
  gap: 10px;
  align-items: center;
  padding: 10px 6px;
  border-bottom: 1px solid rgba(196, 186, 160, 0.08);
  font-size: 12px;
}
.name-main { font-family: var(--font-serif); color: var(--paper); }
.name-note { color: var(--text-faint); font-size: 10px; }
.name-state { text-align: right; font-size: 9px; letter-spacing: 0.1em; color: var(--teal); }
.name-row.unmentioned .name-main { color: var(--rust); text-decoration: line-through; }
.name-row.unmentioned .name-state { color: var(--rust); }

/* ---------------- �ж� / �ϸ� / ��� ---------------- */

.check-card { background: linear-gradient(180deg, #121818, #090d0d); }

.fake-card {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200, 138, 74, 0.10), transparent 60%),
    linear-gradient(180deg, #17120c, #0a0806);
}

.ending-screen.type-true .ending-title { color: #e6dfcc; }
.ending-screen.type-normal .ending-title { color: #b9b3a4; }
.ending-screen.type-bad .ending-title { color: #c9a39d; }
.ending-screen.type-secret .ending-title { color: #a9cbbf; }

/* ---------------- ��Ӧʽ ---------------- */

@media (max-width: 900px) {
  .title-paper { right: -8%; width: 78%; opacity: 0.55; }
  .title-grid { opacity: 0.5; }
  .title-redline { left: 16px; }
  .title-wrap { padding: 9vh 7vw 6vh; }

  .qa-wrap { display: none; }
  .hud-clock { display: none; }

  .workbench {
    width: 100%;
    max-height: 94vh;
    overflow-y: auto;
  }

  .wb-head { padding: 12px 14px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .wb-head h2 { font-size: 16px; }
  .wb-prompt { padding: 10px 14px; }
  .wb-grid { display: flex; flex-direction: column; overflow: visible; }
  .wb-pane { border-right: none; border-bottom: 1px solid var(--line); max-height: none; }
  .wb-source { order: 1; }
  .wb-target { order: 2; }
  .wb-side { order: 3; }
  .wb-foot { display: none; }
  .trans-main b { font-size: 13px; }
  .term-source { flex-basis: 54px; height: 54px; font-size: 28px; }
  .name-row { grid-template-columns: 84px 1fr 54px; }
}
