/* ═══════════════════════════════════════════════════════
   庇护之地编年史 · 样式
   哥特典籍风：焦黑 / 骨白 / 血红 / 余烬橙 / 圣金
   ═══════════════════════════════════════════════════════ */

:root {
  --ink:        #0b0706;   /* 焦黑底 */
  --ink-2:      #140d0a;
  --ink-3:      #1d1310;
  --bone:       #d9c8a4;   /* 骨白正文 */
  --bone-dim:   #9a8b6d;
  --blood:      #8f1d1d;   /* 血红 */
  --blood-hi:   #c53b2a;
  --ember:      #ff7a2f;   /* 余烬橙 */
  --gold:       #c9a227;   /* 圣金 */
  --gold-hi:    #eed27a;
  --angel:      #9fc4d8;   /* 天使银蓝 */
  --line:       rgba(201,162,39,.28);
  --serif-zh:   "Noto Serif SC", "Songti SC", "STSong", serif;
  --serif-en:   "Cinzel", "Noto Serif SC", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--serif-zh);
  font-size: 17px;
  line-height: 1.9;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { touch-action: manipulation; }

::selection { background: var(--blood); color: var(--bone); }

/* ── 全局质感层 ── */
.grain {
  position: fixed; inset: -50%; z-index: 90; pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.2s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0,0); } 25% { transform: translate(-2%,1%); }
  50% { transform: translate(1%,-1%); } 75% { transform: translate(-1%,2%); }
  100% { transform: translate(0,0); }
}
.vignette {
  position: fixed; inset: 0; z-index: 91; pointer-events: none;
  background: radial-gradient(ellipse 110% 90% at 50% 45%, transparent 55%, rgba(4,2,1,.75) 100%);
}

/* ── 画面切换 ── */
.screen {
  position: fixed; inset: 0;
  height: 100dvh; /* 移动端浏览器地址栏伸缩时保持满屏（微信/Safari） */
  display: none;
  flex-direction: column;
  opacity: 0;
}
.screen.active {
  display: flex;
  opacity: 1;
  animation: screen-in .7s ease both;
}
@keyframes screen-in {
  from { opacity: 0; transform: scale(1.015); }
  to   { opacity: 1; transform: none; }
}
.hidden { display: none !important; }

/* ═══════════ 标题画面 ═══════════ */
#screen-title {
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 108%, rgba(143,29,29,.55), transparent 65%),
    radial-gradient(ellipse 45% 35% at 50% 112%, rgba(255,122,47,.35), transparent 70%),
    var(--ink);
}
#embers { position: absolute; inset: 0; width: 100%; height: 100%; }

.title-inner {
  position: relative; z-index: 2;
  text-align: center;
  max-width: 620px;
  padding: 0 24px;
}
.title-eyebrow {
  font-size: 13px; letter-spacing: .5em; color: var(--bone-dim);
  margin-bottom: 26px;
  animation: rise .9s .1s ease both;
}
.title-main { animation: rise .9s .25s ease both; }
.title-zh {
  display: block;
  font-size: clamp(44px, 7.5vw, 76px);
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.25;
  background: linear-gradient(180deg, #f3e3b6 15%, var(--gold) 55%, #7a5c14 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 14px rgba(201,162,39,.25));
}
.title-en {
  font-family: var(--serif-en);
  font-size: 14px; letter-spacing: .42em; color: var(--blood-hi);
  margin-top: 14px;
  animation: rise .9s .4s ease both;
}
.title-rule {
  display: flex; align-items: center; gap: 14px;
  margin: 30px auto 26px; width: 300px;
  animation: rise .9s .5s ease both;
}
.rule-line { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.rule-line:last-child { background: linear-gradient(90deg, var(--gold), transparent); }
.rule-gem {
  width: 9px; height: 9px; transform: rotate(45deg);
  background: var(--blood-hi);
  box-shadow: 0 0 12px rgba(197,59,42,.9);
}
.title-blurb {
  color: var(--bone-dim); font-size: 15.5px; line-height: 2.1;
  margin-bottom: 38px;
  animation: rise .9s .6s ease both;
}
#btn-start { animation: rise .9s .75s ease both; }
#btn-continue { margin-top: 14px; animation: rise .9s .85s ease both; }
.title-footnote {
  position: fixed; left: 0; right: 0; bottom: 16px;
  font-size: 11.5px; color: rgba(154,139,109,.5); letter-spacing: .1em;
  animation: rise .9s 1s ease both;
  pointer-events: none;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* ── 按钮 ── */
.btn {
  font-family: var(--serif-zh);
  cursor: pointer;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, rgba(201,162,39,.16), rgba(201,162,39,.05));
  color: var(--gold-hi);
  font-size: 17px; letter-spacing: .35em; text-indent: .35em;
  padding: 15px 46px;
  position: relative;
  transition: all .3s ease;
}
.btn:hover {
  background: linear-gradient(180deg, rgba(201,162,39,.3), rgba(201,162,39,.1));
  box-shadow: 0 0 24px rgba(201,162,39,.25), inset 0 0 14px rgba(201,162,39,.12);
  transform: translateY(-1px);
}
.btn::before, .btn::after {
  content: ""; position: absolute; width: 7px; height: 7px;
  border: 1px solid var(--gold);
}
.btn::before { top: -4px; left: -4px; border-right: 0; border-bottom: 0; }
.btn::after  { bottom: -4px; right: -4px; border-left: 0; border-top: 0; }
.btn-ghost {
  border-color: rgba(154,139,109,.5); color: var(--bone-dim);
  background: transparent; font-size: 14px; padding: 10px 30px;
}
.btn-ghost::before, .btn-ghost::after { display: none; }
.btn-ghost:hover { color: var(--bone); border-color: var(--bone-dim); box-shadow: none; }

/* ═══════════ 顶栏 ═══════════ */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20,13,10,.95), rgba(11,7,6,.85));
  z-index: 5;
}
.hdr-title {
  font-size: 15px; letter-spacing: .45em; text-indent: .45em; color: var(--gold);
}
.hdr-btn {
  font-family: var(--serif-zh);
  background: none; border: none; cursor: pointer;
  color: var(--bone-dim); font-size: 14px; letter-spacing: .12em;
  padding: 6px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color .25s;
}
.hdr-btn:hover { color: var(--gold-hi); }

/* ═══════════ 章节选择 ═══════════ */
#screen-chapters { background: var(--ink); }
.chapters-wrap {
  flex: 1; overflow-y: auto;
  padding: 46px 24px 80px;
  display: flex; flex-direction: column; gap: 22px;
  align-items: center;
}
.chapter-card {
  width: min(760px, 100%);
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line);
  background: linear-gradient(120deg, var(--ink-3), var(--ink-2) 60%);
  cursor: pointer;
  position: relative;
  transition: all .35s ease;
  animation: rise .7s ease both;
}
.chapter-card:nth-child(1) { animation-delay: .05s; }
.chapter-card:nth-child(2) { animation-delay: .12s; }
.chapter-card:nth-child(3) { animation-delay: .19s; }
.chapter-card:nth-child(4) { animation-delay: .26s; }
.chapter-card:nth-child(5) { animation-delay: .33s; }
.chapter-card:hover:not(.locked) {
  border-color: var(--gold);
  transform: translateX(6px);
  box-shadow: -6px 0 0 0 var(--blood), 0 10px 34px rgba(0,0,0,.5);
}
.chapter-num {
  flex: 0 0 92px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-right: 1px solid var(--line);
  font-family: var(--serif-en);
  color: var(--blood-hi);
  gap: 2px;
}
.chapter-num .n { font-size: 34px; font-weight: 700; }
.chapter-num .n-label { font-size: 10px; letter-spacing: .3em; color: var(--bone-dim); }
.chapter-info { flex: 1; padding: 20px 24px; }
.chapter-era { font-size: 12px; letter-spacing: .25em; color: var(--bone-dim); margin-bottom: 6px; }
.chapter-title { font-size: 23px; font-weight: 900; letter-spacing: .1em; color: var(--bone); }
.chapter-sub { font-family: var(--serif-en); font-size: 11px; letter-spacing: .3em; color: var(--gold); margin-top: 4px; }
.chapter-desc { font-size: 13.5px; color: var(--bone-dim); margin-top: 10px; line-height: 1.8; }
.chapter-state {
  flex: 0 0 110px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; letter-spacing: .2em; color: var(--gold);
  border-left: 1px solid var(--line);
}
.chapter-card.locked { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.chapter-card.locked .chapter-state { color: var(--bone-dim); }
.chapter-card.done .chapter-state { color: var(--bone-dim); }

/* ═══════════ 剧情画面 ═══════════ */
#screen-story { background: var(--ink); }
.story-progress { height: 3px; background: rgba(201,162,39,.12); }
#story-progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--blood), var(--ember));
  box-shadow: 0 0 10px rgba(255,122,47,.6);
  transition: width .5s ease;
}
.story-layout {
  flex: 1; display: flex; min-height: 0;
}
.story-art {
  flex: 0 0 46%;
  position: relative;
  border-right: 1px solid var(--line);
  background: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.story-art svg {
  width: 100%; height: 100%;
  display: block;
  animation: art-in 1.1s ease both;
}
/* 网络原画：加载成功后淡入覆盖 SVG；失败则被移除 */
.art-photo {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .9s ease;
  filter: saturate(.92) contrast(1.05) brightness(.96);
}
.art-photo.show { opacity: 1; }
.story-art::after {
  content: ""; position: absolute; inset: 0; z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 105% 90% at 50% 45%, transparent 58%, rgba(6,3,2,.55) 100%);
}
@keyframes art-in {
  from { opacity: 0; transform: scale(1.06); filter: brightness(.4); }
  to   { opacity: 1; transform: none; filter: none; }
}
.story-panel {
  flex: 1; min-width: 0;
  display: flex;
  background:
    radial-gradient(ellipse 90% 60% at 100% 0%, rgba(143,29,29,.08), transparent 60%),
    var(--ink);
}
.story-scroll {
  flex: 1; overflow-y: auto;
  padding: 52px 58px 70px;
  max-width: 720px;
}
.scene-kicker {
  font-size: 12.5px; letter-spacing: .4em; color: var(--blood-hi);
  margin-bottom: 12px;
  animation: rise .6s .1s ease both;
}
.scene-title {
  font-size: clamp(26px, 3vw, 34px); font-weight: 900; letter-spacing: .12em;
  color: var(--gold-hi);
  margin-bottom: 8px;
  animation: rise .6s .2s ease both;
}
.scene-title::after {
  content: ""; display: block;
  width: 64px; height: 2px; margin-top: 16px;
  background: linear-gradient(90deg, var(--blood-hi), transparent);
}
.scene-title:empty { margin: 0; }
.scene-title:empty::after { display: none; }
.scene-body { padding-top: 18px; }
.scene-body p {
  margin-bottom: 20px;
  color: var(--bone);
  animation: rise .7s ease both;
}
.scene-body p:nth-child(1) { animation-delay: .3s; }
.scene-body p:nth-child(2) { animation-delay: .45s; }
.scene-body p:nth-child(3) { animation-delay: .6s; }
.scene-body p:nth-child(4) { animation-delay: .75s; }
.scene-body p:nth-child(5) { animation-delay: .9s; }
.scene-body em { color: var(--ember); font-style: normal; }
.scene-body strong { color: var(--gold-hi); font-weight: 600; }

.scene-quote {
  border-left: 2px solid var(--blood);
  padding: 6px 0 6px 20px;
  margin: 26px 0;
  color: var(--bone-dim);
  font-size: 15.5px;
  animation: rise .7s .5s ease both;
}
.scene-quote .q-by { display: block; margin-top: 8px; font-size: 12.5px; letter-spacing: .2em; color: var(--blood-hi); }

/* ── 抉择 ── */
.choice-prompt {
  margin: 8px 0 18px;
  padding: 18px 22px;
  border: 1px dashed rgba(201,162,39,.4);
  color: var(--gold-hi); font-size: 16px;
  background: rgba(201,162,39,.05);
  animation: rise .7s .4s ease both;
}
.choice-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.choice-btn {
  font-family: var(--serif-zh);
  text-align: left; cursor: pointer;
  border: 1px solid rgba(217,200,164,.25);
  background: rgba(29,19,16,.6);
  color: var(--bone);
  font-size: 15.5px; line-height: 1.7;
  padding: 14px 18px;
  transition: all .25s ease;
  animation: rise .6s ease both;
}
.choice-list .choice-btn:nth-child(1) { animation-delay: .55s; }
.choice-list .choice-btn:nth-child(2) { animation-delay: .68s; }
.choice-list .choice-btn:nth-child(3) { animation-delay: .81s; }
.choice-btn:hover:not(:disabled) {
  border-color: var(--ember); color: var(--gold-hi);
  background: rgba(143,29,29,.18);
  transform: translateX(4px);
}
.choice-btn:disabled { opacity: .35; cursor: default; }
.choice-btn.picked {
  opacity: 1; border-color: var(--ember); color: var(--ember);
  background: rgba(143,29,29,.22);
}
.choice-response {
  margin: 20px 0;
  padding: 16px 20px;
  border-left: 2px solid var(--ember);
  background: rgba(255,122,47,.05);
  color: var(--bone);
  animation: rise .5s ease both;
}
.choice-reveal {
  margin: 24px 0 6px;
  padding: 22px 24px;
  border: 1px solid var(--blood);
  background: linear-gradient(160deg, rgba(143,29,29,.16), rgba(11,7,6,.4));
  animation: rise .6s .2s ease both;
}
.choice-reveal h4 {
  font-size: 13px; letter-spacing: .4em; color: var(--blood-hi);
  margin-bottom: 12px;
}
.choice-reveal p { margin-bottom: 12px; }
.choice-reveal p:last-child { margin-bottom: 0; }

/* ── 场景按钮区 ── */
.scene-actions { margin-top: 34px; display: flex; gap: 14px; align-items: center; }
.btn-next {
  font-family: var(--serif-zh);
  cursor: pointer;
  border: 1px solid var(--gold);
  background: linear-gradient(180deg, rgba(201,162,39,.14), transparent);
  color: var(--gold-hi);
  font-size: 15.5px; letter-spacing: .3em; text-indent: .3em;
  padding: 12px 38px;
  transition: all .3s ease;
  animation: rise .6s .9s ease both;
}
.btn-next:hover {
  box-shadow: 0 0 20px rgba(201,162,39,.25);
  background: linear-gradient(180deg, rgba(201,162,39,.28), rgba(201,162,39,.06));
}
.scene-count {
  font-family: var(--serif-en); font-size: 12px; letter-spacing: .2em;
  color: var(--bone-dim);
  animation: rise .6s 1s ease both;
}

/* ── 章末卡片 ── */
.chapter-end {
  text-align: center; padding-top: 6vh;
  animation: rise .8s ease both;
}
.chapter-end .end-mark {
  font-size: 13px; letter-spacing: .5em; color: var(--blood-hi); margin-bottom: 18px;
}
.chapter-end h3 { font-size: 30px; letter-spacing: .15em; color: var(--gold-hi); margin-bottom: 18px; }
.chapter-end p { color: var(--bone-dim); margin-bottom: 30px; }

/* ═══════════ 图鉴 ═══════════ */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5,3,2,.82);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fade .3s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay-panel {
  width: min(1000px, 94vw); max-height: 88vh;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2));
  box-shadow: 0 30px 80px rgba(0,0,0,.7);
  animation: rise .4s ease both;
}
.overlay-head {
  position: relative;
  padding: 24px 30px 18px;
  border-bottom: 1px solid var(--line);
}
.overlay-head h2 { font-size: 21px; letter-spacing: .3em; color: var(--gold); }
.overlay-sub { font-size: 12.5px; color: var(--bone-dim); margin-top: 6px; letter-spacing: .1em; }
.overlay-close {
  position: absolute; top: 20px; right: 22px;
  background: none; border: 1px solid rgba(217,200,164,.3);
  color: var(--bone-dim); font-size: 14px;
  width: 34px; height: 34px; cursor: pointer;
  transition: all .25s;
}
.overlay-close:hover { color: var(--gold-hi); border-color: var(--gold); }
.codex-grid {
  overflow-y: auto;
  padding: 26px 30px 36px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}
.codex-card {
  border: 1px solid rgba(217,200,164,.18);
  background: rgba(11,7,6,.5);
  cursor: pointer;
  text-align: center;
  padding-bottom: 14px;
  transition: all .3s ease;
}
.codex-card:hover:not(.locked) {
  border-color: var(--gold);
  transform: translateY(-4px);
  box-shadow: 0 12px 26px rgba(0,0,0,.5);
}
.codex-card svg { width: 100%; height: auto; display: block; }
.codex-art { position: relative; }
.codex-photo {
  position: absolute; inset: 2.5% 2.6%;
  width: 94.8%; height: 95%;
  object-fit: cover; object-position: top center;
  opacity: 0;
  transition: opacity .7s ease;
  filter: saturate(.92) contrast(1.05) brightness(.96);
  border: 1px solid rgba(201,162,39,.5);
  box-sizing: border-box;
}
.codex-photo.show { opacity: 1; }
.codex-name { font-size: 15px; font-weight: 600; color: var(--bone); margin-top: 10px; }
.codex-role { font-size: 11.5px; color: var(--bone-dim); letter-spacing: .1em; margin-top: 3px; }
.codex-card.locked { cursor: default; opacity: .5; }
.codex-card.locked .codex-sil { filter: brightness(0) opacity(.5); }
.codex-card.locked .codex-name { color: var(--bone-dim); }

/* 人物详情 */
.char-panel {
  width: min(720px, 92vw);
  flex-direction: row; align-items: stretch;
}
.char-left {
  flex: 0 0 240px;
  border-right: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  background: rgba(11,7,6,.5);
  padding: 20px;
}
.char-left svg { width: 100%; height: auto; }
.char-right { flex: 1; padding: 30px 34px; overflow-y: auto; position: relative; }
.char-right h3 { font-size: 26px; letter-spacing: .12em; color: var(--gold-hi); }
.char-right .char-en { font-family: var(--serif-en); font-size: 12px; letter-spacing: .28em; color: var(--blood-hi); margin: 6px 0 4px; }
.char-right .char-role { font-size: 13px; color: var(--bone-dim); letter-spacing: .15em; margin-bottom: 16px; }
.char-right .char-bio { font-size: 15px; color: var(--bone); line-height: 2; }
.char-right .char-bio p { margin-bottom: 12px; }

/* ── 提示（顶部小横幅：不遮正文、不挡点击） ── */
.toast {
  position: fixed; top: 62px; left: 50%; transform: translateX(-50%);
  z-index: 120;
  pointer-events: none;
  max-width: min(92vw, 480px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 9px 22px;
  border: 1px solid rgba(201,162,39,.7);
  background: rgba(20,13,10,.96);
  color: var(--gold-hi);
  font-size: 13px; letter-spacing: .08em;
  box-shadow: 0 6px 22px rgba(0,0,0,.55), 0 0 14px rgba(201,162,39,.12);
  animation: toast-in .45s ease both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.toast.out { animation: toast-out .4s ease both; }
@keyframes toast-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, -8px); }
}

/* ── 时间线（尾声） ── */
.timeline { margin-top: 10px; border-left: 2px solid var(--blood); padding-left: 24px; }
.timeline li {
  list-style: none; position: relative;
  margin-bottom: 16px; color: var(--bone-dim); font-size: 14.5px;
  animation: rise .6s ease both;
}
.timeline li::before {
  content: ""; position: absolute; left: -29.5px; top: 10px;
  width: 9px; height: 9px; transform: rotate(45deg);
  background: var(--ink); border: 1px solid var(--blood-hi);
}
.timeline li strong { color: var(--gold-hi); font-weight: 600; display: block; font-size: 15.5px; }

/* ── 滚动条 ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #3a2a1c; border: 2px solid var(--ink); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── 响应式 ── */
@media (max-width: 900px) {
  body { overflow: auto; }
  .story-layout { flex-direction: column; }
  .story-art { flex: 0 0 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .story-panel { min-height: 0; }
  .story-scroll {
    min-height: 0; max-width: none; padding: 30px 22px 56px;
    -webkit-overflow-scrolling: touch;
  }
  .chapter-state { display: none; }
  .char-panel { flex-direction: column; max-height: 86dvh; }
  .char-left { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .char-left svg, .char-left .codex-art { max-width: 200px; margin: 0 auto; }
  .title-footnote { bottom: calc(10px + env(safe-area-inset-bottom)); padding: 0 20px; }
}

/* ── 手机窄屏细化 ── */
@media (max-width: 520px) {
  body { font-size: 16px; }
  .title-zh { font-size: clamp(34px, 11vw, 44px); letter-spacing: .08em; }
  .title-en { font-size: 12px; letter-spacing: .3em; }
  .story-art { flex: 0 0 220px; }
  .app-header { padding: 12px 14px; }
  .hdr-title { font-size: 13px; letter-spacing: .3em; text-indent: .3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
  .chapters-wrap { padding: 26px 14px 60px; gap: 16px; }
  .chapter-num { flex: 0 0 64px; }
  .chapter-num .n { font-size: 26px; }
  .chapter-num .n-label { font-size: 8px; letter-spacing: .18em; }
  .chapter-info { padding: 16px 16px; }
  .chapter-title { font-size: 19px; }
  .chapter-desc { font-size: 12.5px; }
  .scene-title { font-size: 24px; }
  .scene-actions { flex-wrap: wrap; }
  .btn-next { width: 100%; padding: 14px 0; text-align: center; }
  .btn { padding: 14px 34px; font-size: 16px; }
  .codex-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; padding: 18px 14px 28px; }
  .overlay-panel { max-height: 92dvh; }
  .overlay-head { padding: 18px 18px 14px; }
  .char-right { padding: 22px 20px; }
  .choice-btn { padding: 13px 14px; font-size: 14.5px; }
  .choice-prompt { padding: 14px 16px; font-size: 15px; }
  .title-blurb { font-size: 14px; }
}
