/* ============================================================
   懿症宫 · 视觉系统
   配色：宫墙朱红 / 墨黑 / 鎏金 / 月白 / 疯批猩红
   ============================================================ */
:root {
  --ink: #14100e;
  --ink2: #1e1815;
  --paper: #f3e9d7;
  --paper-dim: #d8c9ae;
  --gold: #d4af5f;
  --gold-bright: #f0d48a;
  --red: #a83232;
  --red-deep: #6e1f1f;
  --mad: #ff2e3f;
  --cl: #7fb8a4;
  --yd: #c25b5b;
  --shadow: rgba(0,0,0,.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--ink);
  overflow: hidden;
  font-family: "Noto Serif SC", "Source Han Serif SC", "STZhongsong", "SimSun", serif;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }

.screen {
  position: absolute; inset: 0;
  display: none;
  animation: screenIn .8s ease both;
}
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================
   标题画面
   ============================================================ */
#screen-title { background: var(--ink); }

.title-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 120% 90% at 50% 110%, rgba(168,50,50,.28), transparent 60%),
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(212,175,95,.12), transparent 55%),
    linear-gradient(180deg, #0d0a09 0%, #1a1310 55%, #241612 100%);
}
.title-bg svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: .92;
}
.title-bg::before {
  content: "";
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(13,10,9,.55) 0%, rgba(13,10,9,.15) 40%, rgba(13,10,9,.72) 100%);
  pointer-events: none;
}
.title-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.14) 3px 4px);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.title-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.75) 100%);
  pointer-events: none;
}

.title-inner {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px 16px;
}

.title-seal {
  font-size: 14px; letter-spacing: 12px; text-indent: 12px;
  color: var(--gold);
  border: 1px solid rgba(212,175,95,.45);
  padding: 6px 18px;
  background: rgba(212,175,95,.06);
  backdrop-filter: blur(2px);
}

.title-main {
  font-size: clamp(64px, 13vw, 150px);
  font-weight: 900;
  letter-spacing: .08em;
  line-height: 1;
  display: flex; gap: .06em;
  background: linear-gradient(180deg, #f7ead0 15%, var(--gold-bright) 45%, #9a6b2a 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 24px rgba(212,175,95,.25)) drop-shadow(0 2px 4px rgba(0,0,0,.8));
}
.title-main span {
  animation: charFloat 5s ease-in-out infinite;
  display: inline-block;
}
.title-main span:nth-child(2) { animation-delay: .6s; }
.title-main span:nth-child(3) { animation-delay: 1.2s; }
@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.title-sub {
  font-size: 15px; letter-spacing: 6px; text-indent: 6px;
  color: var(--paper-dim);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.title-quote {
  font-size: 14px; color: rgba(243,233,215,.55);
  font-style: italic; letter-spacing: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

.title-left {
  display: flex; flex-direction: column;
  align-items: center; gap: 14px;
}

.title-menu {
  margin-top: 20px;
  display: flex; flex-direction: column; gap: 12px;
  width: 240px;
}

.btn {
  font-family: inherit;
  font-size: 17px; letter-spacing: 8px; text-indent: 8px;
  padding: 12px 0;
  color: var(--paper);
  background: linear-gradient(180deg, rgba(60,44,36,.9), rgba(34,25,20,.9));
  border: 1px solid rgba(212,175,95,.35);
  cursor: pointer;
  transition: all .25s ease;
  position: relative;
}
.btn:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(90,62,44,.95), rgba(50,34,26,.95));
  box-shadow: 0 0 18px rgba(212,175,95,.18);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(180deg, #8d2f2f, #5c1d1d);
  border-color: rgba(240,180,120,.5);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #a83a3a, #6e2424);
  color: #ffe9c9;
  box-shadow: 0 0 22px rgba(200,80,60,.35);
}
.btn:disabled { opacity: .35; cursor: default; transform: none; }

.title-foot {
  margin-top: 22px;
  font-size: 12px; letter-spacing: 3px;
  color: rgba(243,233,215,.4);
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}

/* ============================================================
   游戏画面
   ============================================================ */
#screen-game { background: #000; }

#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(10,7,6,.85), transparent);
}
.hud-left { display: flex; flex-direction: column; gap: 2px; }
.hud-chapter { font-size: 16px; color: var(--gold-bright); letter-spacing: 2px; }
.hud-loc { font-size: 12px; color: rgba(243,233,215,.55); letter-spacing: 2px; }

.hud-right { display: flex; align-items: center; gap: 14px; }
.stat { display: flex; align-items: center; gap: 6px; }
.stat-name { font-size: 12px; color: var(--paper-dim); letter-spacing: 2px; }
.stat-num { font-size: 12px; width: 30px; color: var(--paper); font-variant-numeric: tabular-nums; }
.bar {
  width: 90px; height: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  overflow: hidden;
}
.bar-fill { height: 100%; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar-fill.cl { background: linear-gradient(90deg, #4f8a76, var(--cl)); }
.bar-fill.yd { background: linear-gradient(90deg, #7e3232, var(--yd)); }

.icon-btn {
  font-family: inherit;
  font-size: 12px; letter-spacing: 2px;
  padding: 5px 10px;
  color: var(--paper-dim);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { color: var(--gold-bright); border-color: var(--gold); }

/* ---------- 舞台 ---------- */
#stage { position: absolute; inset: 0; }

#scene-art {
  position: absolute; inset: 0;
  transition: opacity .6s ease, filter .8s ease;
}
#scene-art svg { width: 100%; height: 100%; display: block; }

#fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

#flash-layer {
  position: absolute; inset: 0; z-index: 30;
  pointer-events: none; opacity: 0;
  background: #fff;
}
#flash-layer.go { animation: flashGo .5s ease-out; }
@keyframes flashGo { 0% { opacity: .85; } 100% { opacity: 0; } }

/* 疯批红屏 */
#mad-overlay {
  position: absolute; inset: 0; z-index: 25;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
  background:
    radial-gradient(ellipse at center, rgba(120,10,16,.18) 30%, rgba(90,6,12,.55) 100%);
  mix-blend-mode: multiply;
}
#mad-overlay.on { opacity: 1; animation: madPulse 3.2s ease-in-out infinite; }
@keyframes madPulse {
  0%, 100% { filter: none; }
  50% { filter: brightness(1.25) saturate(1.3); }
}
.mad-text {
  position: absolute; top: 18%; left: 50%;
  transform: translateX(-50%);
  font-size: 90px; font-weight: 900;
  letter-spacing: 30px; text-indent: 30px;
  color: rgba(255,46,63,.14);
  text-shadow: 0 0 40px rgba(255,46,63,.3);
  animation: madDrift 6s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes madDrift {
  0%, 100% { transform: translateX(-50%) translateY(0) scale(1); }
  50% { transform: translateX(-52%) translateY(10px) scale(1.04); }
}

/* ---------- 立绘 ---------- */
#char-layer {
  position: absolute; inset: 0;
  z-index: 10;
  pointer-events: none;
}
.char {
  position: absolute;
  bottom: clamp(150px, 22vh, 190px);
  width: min(300px, 34vw);
  height: min(460px, 52vw);
  transition: transform .5s ease, opacity .5s ease, filter .5s ease;
  opacity: 0;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.5));
}
.char.show { opacity: 1; }
.char svg { width: 100%; height: 100%; overflow: visible; }
.char .breathe { animation: breathe 4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.012); }
}
.char.speaking { filter: drop-shadow(0 18px 30px rgba(0,0,0,.5)) brightness(1.12); }
.char.dim { filter: drop-shadow(0 18px 30px rgba(0,0,0,.5)) brightness(.55) saturate(.7); }
.char.mad .robe-main { fill: #7e1d24; }
.char.mad .eyes-glow { opacity: 1; }
.eyes-glow { opacity: 0; transition: opacity .8s; }

/* ---------- 对白框 ---------- */
#dialogue-box {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  width: min(880px, 92vw);
  min-height: 150px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(20,14,11,.92), rgba(28,20,15,.95));
  border: 1px solid rgba(212,175,95,.4);
  box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 60px rgba(212,175,95,.04);
  padding: 20px 30px 30px;
  cursor: pointer;
  transition: opacity .3s;
}
#dialogue-box::before {
  content: "";
  position: absolute; inset: 4px;
  border: 1px solid rgba(212,175,95,.15);
  pointer-events: none;
}
#dialogue-box.hidden { opacity: 0; pointer-events: none; }

#dlg-name {
  position: absolute; top: -16px; left: 22px;
  padding: 4px 18px;
  font-size: 15px; letter-spacing: 3px;
  color: #2a1c12;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
}
#dlg-name.inner { background: linear-gradient(180deg, #9db8ad, #6f9484); color: #10201a; font-style: italic; }
#dlg-name.sys { background: linear-gradient(180deg, #8a8a8a, #5c5c5c); color: #111; }
#dlg-name.mad { background: linear-gradient(180deg, #ff5a66, #a81f2a); color: #fff; }

#dlg-text {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.9;
  letter-spacing: 1px;
  min-height: 76px;
  color: var(--paper);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
#dlg-text .inner-voice { color: #a8c8ba; font-style: italic; }
#dlg-text .sys-line { color: #b9ad93; }
#dlg-text .mad-line { color: #ff8a92; }
#dlg-text em { color: var(--gold-bright); font-style: normal; }

#dlg-next {
  position: absolute; right: 16px; bottom: 8px;
  font-size: 13px; color: var(--gold);
  animation: nextBlink 1.2s ease-in-out infinite;
}
@keyframes nextBlink { 0%,100% { opacity: .2; transform: translateY(0);} 50% { opacity: 1; transform: translateY(3px);} }

/* ---------- 选项 ---------- */
#choice-layer {
  position: absolute; inset: 0; z-index: 22;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8,5,4,.45);
  backdrop-filter: blur(2px);
}
#choice-layer.show { display: flex; }
.choice-list {
  display: flex; flex-direction: column; gap: 14px;
  width: min(560px, 88vw);
}
.choice-title {
  text-align: center;
  font-size: 14px; letter-spacing: 4px;
  color: var(--gold);
  margin-bottom: 6px;
}
.choice-btn {
  font-family: inherit;
  text-align: left;
  font-size: 17px; line-height: 1.6;
  padding: 14px 22px;
  color: var(--paper);
  background: linear-gradient(90deg, rgba(40,28,22,.95), rgba(26,18,14,.95));
  border: 1px solid rgba(212,175,95,.35);
  border-left: 4px solid var(--gold);
  cursor: pointer;
  transition: all .22s ease;
  letter-spacing: 1px;
}
.choice-btn:hover {
  border-left-color: var(--gold-bright);
  background: linear-gradient(90deg, rgba(80,52,36,.95), rgba(40,28,20,.95));
  transform: translateX(6px);
  box-shadow: -4px 0 20px rgba(212,175,95,.15);
}
.choice-btn .tag {
  display: inline-block; margin-right: 10px;
  font-size: 12px; color: var(--gold);
  border: 1px solid rgba(212,175,95,.4);
  padding: 1px 8px;
}
.choice-btn.hidden-choice { display: none; }
.choice-btn.locked { opacity: .45; cursor: default; }
.choice-btn.locked:hover { border-color: rgba(212,175,95,.35); background: rgba(255,255,255,.03); transform: none; }
.choice-btn .hint { display:block; font-size: 12px; color: rgba(243,233,215,.45); margin-top: 4px; letter-spacing: 1px; }

/* ---------- 小游戏 ---------- */
#minigame-layer {
  position: absolute; inset: 0; z-index: 24;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(8,5,4,.72);
  backdrop-filter: blur(3px);
}
#minigame-layer.show { display: flex; }
.mg-panel {
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow: auto;
  background: linear-gradient(180deg, #241a13, #171009);
  border: 1px solid rgba(212,175,95,.5);
  box-shadow: 0 20px 80px rgba(0,0,0,.8);
  padding: 26px 30px;
}
.mg-title {
  text-align: center;
  font-size: 20px; letter-spacing: 6px;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.mg-sub {
  text-align: center;
  font-size: 13px; color: var(--paper-dim);
  margin-bottom: 18px; letter-spacing: 1px;
  line-height: 1.7;
}
.mg-cards { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 16px; }
.mg-card {
  width: 150px;
  font-family: inherit;
  background: linear-gradient(160deg, #f0e4cc, #d9c8a4);
  color: #2c2013;
  border: 1px solid #a8895a;
  padding: 10px 12px;
  cursor: grab;
  font-size: 13px; line-height: 1.55;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
  transition: transform .15s, box-shadow .15s;
  text-align: left;
}
.mg-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.5); }
.mg-card .card-t { font-weight: 700; font-size: 14px; display: block; margin-bottom: 3px; color: #6e1f1f; }
.mg-card.used { opacity: .25; pointer-events: none; }
.mg-slots {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 60px; margin-bottom: 16px;
}
.mg-slot {
  min-height: 44px;
  border: 1px dashed rgba(212,175,95,.4);
  background: rgba(212,175,95,.04);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: rgba(243,233,215,.4);
  letter-spacing: 2px;
  transition: all .2s;
}
.mg-slot.filled { border-style: solid; background: rgba(212,175,95,.1); color: var(--paper); }
.mg-slot.hover { background: rgba(212,175,95,.2); border-color: var(--gold-bright); }
.mg-btns { display: flex; gap: 12px; justify-content: center; }
.mg-btn {
  font-family: inherit;
  background: linear-gradient(180deg, #2b2018, #1a120c);
  border: 1px solid rgba(212,175,95,.55);
  color: var(--gold-bright);
  font-size: 14px; letter-spacing: 2px;
  padding: 9px 26px;
  cursor: pointer;
  transition: all .18s;
}
.mg-btn:hover { border-color: var(--gold); background: rgba(212,175,95,.12); transform: translateY(-1px); }
.mg-btn.primary {
  background: linear-gradient(180deg, #8f2f2f, #5c1d1d);
  border-color: rgba(230,120,120,.6);
  color: #f2d9d9;
}
.mg-btn.primary:hover { background: rgba(168,50,50,.35); border-color: #e67878; }
.mg-feedback {
  text-align: center; font-size: 14px; min-height: 22px;
  margin-bottom: 10px; letter-spacing: 1px;
}
.mg-feedback.ok { color: var(--cl); }
.mg-feedback.bad { color: var(--yd); }

/* 找茬清单 */
.mg-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mg-item {
  font-family: inherit;
  display: flex; gap: 12px; align-items: baseline;
  text-align: left;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.12);
  padding: 10px 14px;
  color: var(--paper);
  font-size: 14px; line-height: 1.6;
  cursor: pointer;
  transition: all .18s;
}
.mg-item:hover { border-color: var(--gold); background: rgba(212,175,95,.08); }
.mg-item .no { color: var(--gold); font-size: 12px; min-width: 22px; }
.mg-item.picked { border-color: var(--red); background: rgba(168,50,50,.18); }
.mg-item.picked .no::after { content: " ✚"; color: var(--red); }

/* 感染链节点 */
.mg-chain { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mg-node {
  font-family: inherit;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--paper);
  padding: 11px 14px;
  font-size: 14px; text-align: left; cursor: pointer;
  transition: all .18s;
  line-height: 1.5;
}
.mg-node:hover { border-color: var(--gold); }
.mg-node.picked { border-color: var(--cl); background: rgba(127,184,164,.12); }
.mg-node .ord { color: var(--cl); font-weight: 700; margin-right: 8px; }

/* ---------- toast ---------- */
#toast-layer {
  position: absolute; top: 70px; right: 20px; z-index: 35;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  font-size: 13px; letter-spacing: 1px;
  padding: 8px 16px;
  background: rgba(20,14,11,.92);
  border: 1px solid rgba(212,175,95,.5);
  color: var(--gold-bright);
  animation: toastIn .3s ease, toastOut .4s ease 2.4s forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.toast.bad { border-color: rgba(194,91,91,.6); color: #e8a0a0; }
.toast.good { border-color: rgba(127,184,164,.6); color: #a9d4c4; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px);} to { opacity: 1; transform: none;} }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px);} }

/* ---------- 弹层 ---------- */
#modal-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5,3,2,.7);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
#modal-mask.hidden { display: none; }
#modal {
  width: min(680px, 92vw); max-height: 82vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #241a13, #150e09);
  border: 1px solid rgba(212,175,95,.5);
  box-shadow: 0 20px 80px rgba(0,0,0,.8);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(212,175,95,.25);
}
.modal-head span { font-size: 16px; letter-spacing: 4px; color: var(--gold-bright); }
#modal-close {
  background: none; border: none; color: var(--paper-dim);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
}
#modal-close:hover { color: var(--red); }
#modal-body { padding: 18px 22px; overflow-y: auto; font-size: 14px; line-height: 1.9; }
#modal-body .log-entry { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px dashed rgba(255,255,255,.1); }
#modal-body .log-name { color: var(--gold); font-size: 13px; margin-bottom: 3px; }
#modal-body .log-text { color: var(--paper-dim); }
#modal-body .relic {
  margin-bottom: 16px; padding: 14px 16px;
  background: rgba(212,175,95,.06);
  border: 1px solid rgba(212,175,95,.3);
}
#modal-body .relic h4 { color: var(--gold-bright); margin-bottom: 6px; letter-spacing: 2px; }
#modal-body .relic p { color: var(--paper-dim); font-size: 13px; }
#modal-body .relic.locked { opacity: .4; }
#modal-body .about-p { margin-bottom: 12px; color: var(--paper-dim); }
#modal-body .about-p b { color: var(--gold-bright); }

/* ============================================================
   结局画面
   ============================================================ */
#screen-ending { background: var(--ink); }
.ending-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(168,50,50,.2), transparent 60%),
    linear-gradient(180deg, #0d0a09, #1c1310);
}
.ending-inner {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 20px; text-align: center; padding: 0 24px;
}
.ending-label {
  font-size: 13px; letter-spacing: 8px; text-indent: 8px;
  color: var(--paper-dim);
  border: 1px solid rgba(212,175,95,.4);
  padding: 5px 16px;
}
.ending-name {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 900; letter-spacing: .1em;
  background: linear-gradient(180deg, #f7ead0, var(--gold) 60%, #9a6b2a);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ending-desc {
  max-width: 620px;
  font-size: 16px; line-height: 2;
  color: var(--paper-dim);
  white-space: pre-wrap;
}
.ending-stats {
  font-size: 13px; color: rgba(243,233,215,.5);
  letter-spacing: 2px; line-height: 2;
}
.ending-btns { display: flex; gap: 16px; margin-top: 12px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 720px) {
  .bar { width: 54px; }
  #dlg-text { font-size: 16px; min-height: 64px; }
  #dialogue-box { min-height: 128px; padding: 16px 18px 26px; }
  .char { width: min(220px, 46vw); height: min(340px, 70vw); bottom: 150px; }
  .mad-text { font-size: 54px; letter-spacing: 16px; text-indent: 16px; }
  .hud-chapter { font-size: 13px; }
  .icon-btn { padding: 4px 6px; }
  .mg-card { width: min(150px, 42vw); }
  .choice-btn { font-size: 15px; padding: 12px 16px; }
}

/* 矮屏（横屏手机）：压缩立绘与对白框，避免溢出 */
@media (max-height: 480px) {
  .char { width: min(200px, 42vh); height: min(306px, 64vh); bottom: 118px; }
  #dialogue-box { min-height: 104px; padding: 12px 18px 22px; }
  #dlg-text { font-size: 15px; min-height: 48px; margin-top: 8px; }
  .ending-desc { font-size: 14px; max-width: 78vw; }
  .ending-inner { gap: 12px; }
  /* 封面横屏布局：标题居左，菜单居右 */
  .title-inner {
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    gap: 24px;
    padding: 12px 32px;
  }
  .title-left { align-items: flex-start; text-align: left; }
  .title-main { font-size: clamp(56px, 16vh, 110px); }
  .title-menu { margin-top: 0; width: min(220px, 34vh); gap: 8px; }
  .btn { font-size: 15px; padding: 9px 0; letter-spacing: 6px; text-indent: 6px; }
  .title-foot { position: absolute; bottom: 10px; left: 0; right: 0; margin-top: 0; }
  .title-sub { font-size: 13px; }
  .title-quote { font-size: 12px; }
}

/* 超窄屏（小手机） */
@media (max-width: 400px) {
  #dlg-text { font-size: 15px; }
  .char { width: 52vw; height: 80vw; }
  .title-menu { width: min(240px, 76vw); }
}
