:root {
  color-scheme: dark;
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", system-ui, sans-serif;
  color: #f1eadc;
  background: #050807;
  --ink: #080d0b;
  --panel: rgba(16, 9, 10, 0.60);
  --gold: #cbb186;
  --muted: #989b91;
  --line: rgba(207, 183, 119, 0.24);
  --danger: #c56157;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #050807; }
button, textarea { font: inherit; }
button { color: inherit; }

#app {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 80% 12%, rgba(155, 119, 49, .12), transparent 30%),
    linear-gradient(145deg, #0c1210 0%, #040706 65%);
}

.phone {
  position: relative;
  width: min(100vw, 500px);
  min-height: 100dvh;
  overflow: hidden;
  border-inline: 1px solid rgba(255,255,255,.05);
  background: var(--ink);
}

.cover {
  min-height: 100dvh;
  background: #050504;
}

.cover-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.cover-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.04) 45%, rgba(0,0,0,.18) 72%, rgba(0,0,0,.72) 100%);
}
.cover-title {
  position: absolute;
  z-index: 2;
  top: max(26px, env(safe-area-inset-top));
  left: clamp(22px, 6vw, 34px);
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: 7px;
  pointer-events: none;
  color: #fff1c8;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.9));
}
.cover-title strong {
  grid-row: 1 / 3;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #fff5d4;
  font: 600 clamp(38px, 10vw, 54px)/.92 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: -.08em;
  text-shadow: 0 1px 0 #987240, 0 0 16px rgba(255,224,151,.18), 0 5px 14px #000;
}
.cover-title span {
  align-self: center;
  justify-self: center;
  padding: 7px 4px;
  border-radius: 2px;
  background: #743024;
  color: #f7dfbd;
  writing-mode: vertical-rl;
  font: 500 11px/1.15 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .12em;
  box-shadow: inset 0 0 0 1px rgba(255,217,158,.16), 0 3px 10px rgba(0,0,0,.5);
}
.cover-title p {
  align-self: end;
  margin: 12px 0 3px;
  color: #e9d8b3;
  font: 500 clamp(12px, 3.6vw, 16px)/1.55 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .08em;
  white-space: nowrap;
  text-shadow: 0 3px 8px #000;
}
.cover-start {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.cover-start span {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 20px));
  display: grid;
  place-items: center;
  width: min(78%, 380px);
  min-height: 64px;
  padding: 0 42px;
  background: url("./assets/edict-submit-frame.png") center / 100% 100% no-repeat;
  color: #f7d990;
  font: 500 17px/1.5 "Songti SC", STSong, serif;
  letter-spacing: .26em;
  text-align: center;
  text-shadow: 0 1px 2px rgba(52,17,8,.72), 0 0 8px rgba(244,200,104,.18);
  filter: drop-shadow(0 8px 16px rgba(25,14,4,.28));
  transform: translateX(-50%);
  animation: cover-pulse 2.2s ease-in-out infinite;
}
@keyframes cover-pulse { 0%, 100% { opacity: .58; } 50% { opacity: 1; } }

.seal, .eyebrow, .event-label { color: var(--gold); letter-spacing: .14em; }
.seal { width: max-content; border: 1px solid #9b513d; background: #4a211b; padding: 8px 12px; }
h1 { margin: 18px 0 10px; font: 700 clamp(42px, 12vw, 68px)/1.02 "Songti SC", STSong, serif; }
.subtitle { color: #d5c49c; font: 500 20px/1.5 "Songti SC", STSong, serif; }
.promise { color: #b8bbb2; line-height: 1.7; }

.primary, .choice, .confirm, .secondary, .action-kind {
  min-height: 48px;
  border: 1px solid var(--line);
  background: rgba(11, 17, 15, .96);
  cursor: pointer;
}
.primary { width: 100%; margin-top: 22px; background: var(--gold); color: #0b0e0c; font-weight: 800; }

.stage {
  position: relative;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #0b100e;
}
.backdrop, .film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.backdrop { opacity: .66; }
.film { z-index: 2; background: #050807; }
.dynamic-portrait { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; opacity: .92; }
.wash { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,6,5,.12), rgba(3,6,5,.08) 48%, rgba(3,6,5,.94) 77%); }

.hud {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) 16px 8px;
  color: #d6c6a0;
}
.hud button { min-width: 88px; min-height: 44px; border: 1px solid var(--line); background: rgba(5,9,8,.78); }
.hud > div { display: flex; gap: 8px; }
.hud > div button:first-child { min-width: 56px; }

.stat-ribbon {
  position: absolute; z-index: 4; top: 70px; left: 0; right: 0; display: flex; gap: 6px; overflow-x: auto;
  padding: 4px 16px 10px; scrollbar-width: none;
}
.stat-ribbon span { flex: 0 0 auto; padding: 6px 9px; border: 1px solid var(--line); background: rgba(16,9,10,.60); backdrop-filter: blur(12px); color: #c9c0bc; font-size: 11px; }
.stat-ribbon b { color: var(--gold); font-variant-numeric: tabular-nums; }

.visual-copy {
  position: relative;
  z-index: 3;
  align-self: end;
  padding: 0 22px 16px;
}
.film-caption { position: absolute; z-index: 4; left: 20px; right: 20px; bottom: max(28px, env(safe-area-inset-bottom)); padding: 12px 14px; border-left: 1px solid var(--gold); background: rgba(16,9,10,.60); backdrop-filter: blur(12px); color: #f1ece7; font-family: "Songti SC", serif; }
.hold-on-end .film-caption { bottom: max(92px, calc(env(safe-area-inset-bottom) + 76px)); }
.film-caption .event-label { color: #d5b778; font-size: 10px; letter-spacing: .16em; }
.film-caption h2 { margin: 5px 0 7px; color: #f0dab0; font: 500 22px/1.25 "Songti SC", STSong, serif; letter-spacing: .1em; }
.film-caption p { margin: 0; color: #f1ece7; font: 500 15px/1.65 "Kaiti SC", STKaiti, KaiTi, serif; }
.film-caption blockquote { margin: 9px 0 0; padding: 8px 10px; border-left: 1px solid rgba(214,174,103,.72); background: rgba(4,3,2,.42); color: #f1d8a5; font: 500 15px/1.7 "Kaiti SC", STKaiti, KaiTi, serif; }
.film-caption-story { background: linear-gradient(145deg, rgba(28,20,13,.82), rgba(6,5,4,.86)); }
.film-continue {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 168px;
  min-height: 48px;
  border-color: rgba(226,199,132,.76);
  border-radius: 999px;
  background: linear-gradient(180deg, #f0d790, #caa75b);
  color: #24170f;
  font: 600 20px/1 "Kaiti SC", STKaiti, KaiTi, serif;
  box-shadow: 0 8px 32px rgba(0,0,0,.52), 0 0 22px rgba(213,177,94,.15);
}
.ink-wash { position: absolute; z-index: 3; inset: -12%; pointer-events: none; background: radial-gradient(ellipse at 50% 48%, transparent 0 18%, rgba(244,240,234,.94) 26%, #110b0b 58%); animation: ink-open 1.05s cubic-bezier(.2,.75,.2,1) forwards; }
@keyframes ink-open { from { opacity: 1; transform: scale(.65) rotate(-2deg); filter: blur(2px); } 72% { opacity: .36; } to { opacity: 0; transform: scale(1.55) rotate(1deg); filter: blur(12px); visibility: hidden; } }
.event-title { margin: 8px 0; font: 700 32px/1.15 "Songti SC", STSong, serif; }

.prelude {
  min-height: 100dvh;
  background: #030504;
  isolation: isolate;
}
.prelude-progress {
  position: absolute;
  z-index: 7;
  top: max(22px, env(safe-area-inset-top));
  left: 22px;
  color: rgba(229,207,155,.62);
  font: 500 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .18em;
}
.intertitle {
  display: grid;
  place-items: center;
  cursor: pointer;
}
.intertitle-backdrop {
  position: absolute;
  inset: -5%;
  width: 110%;
  height: 110%;
  object-fit: cover;
  filter: blur(18px) saturate(.55);
  opacity: .22;
}
.intertitle-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, transparent 0 18%, rgba(2,4,3,.58) 62%),
    linear-gradient(180deg, rgba(2,4,3,.6), rgba(2,4,3,.94));
}
.intertitle-copy {
  position: relative;
  z-index: 3;
  width: 84%;
  text-align: center;
}
.intertitle-copy .event-label { font-size: 12px; }
.intertitle-copy h1 {
  margin: 22px 0 18px;
  color: #ead7a7;
  font: 500 clamp(31px, 8vw, 43px)/1.35 "Songti SC", STSong, serif;
  letter-spacing: .12em;
}
.intertitle-copy p {
  margin: 0;
  color: rgba(241,234,220,.76);
  font: 400 16px/1.9 "Songti SC", STSong, serif;
  letter-spacing: .08em;
}
.tap-hint {
  position: absolute;
  z-index: 4;
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 18px));
  color: rgba(234,215,167,.62);
  font-size: 12px;
  letter-spacing: .2em;
}
.prelude-narrative { background: #050504; }
.narrative-backdrop {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 24%;
  opacity: .86;
  filter: saturate(.72) contrast(1.04);
}
.narrative-portrait {
  position: absolute;
  z-index: 2;
  top: 2%;
  bottom: 19%;
  width: 88%;
  height: 79%;
  object-fit: contain;
  object-position: center top;
  pointer-events: none;
  filter: drop-shadow(0 18px 24px rgba(0,0,0,.7));
}
.narrative-portrait-waner-reading {
  right: -5%;
  object-position: right top;
}
.narrative-portrait-zong-entering {
  right: -8%;
  top: 0;
  height: 82%;
  object-position: right top;
}
.narrative-shade {
  position: absolute;
  z-index: 3;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3,3,2,.36), rgba(3,3,2,.05) 32%, rgba(4,3,2,.3) 52%, rgba(4,3,2,.96) 82%, #040403),
    radial-gradient(circle at 70% 28%, rgba(180,112,44,.14), transparent 42%);
}
.narrative-card {
  position: absolute;
  z-index: 5;
  left: 16px;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  max-height: 64%;
  overflow-y: auto;
  padding: 21px 20px 14px;
  border: 1px solid rgba(205,172,105,.64);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(34,26,18,.9), rgba(8,8,7,.95));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.04), 0 18px 50px rgba(0,0,0,.58);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
.narrative-card .event-label { color: #cda85f; font-size: 11px; }
.narrative-card h1 { margin: 9px 0 13px; color: #f0dab0; font: 500 25px/1.3 "Songti SC", STSong, serif; letter-spacing: .1em; }
.narrative-card p { margin: 0 0 11px; color: #eee4d3; font: 400 15px/1.8 "Songti SC", STSong, serif; text-align: justify; }
.narrative-card blockquote { margin: 3px 0 13px; padding: 10px 12px; border-left: 1px solid #b58b48; background: rgba(5,4,3,.44); color: #e9d09b; font: 500 16px/1.75 "Kaiti SC", STKaiti, KaiTi, serif; }
.narrative-card footer { display: flex; align-items: center; justify-content: space-between; padding-top: 5px; border-top: 1px solid rgba(214,174,103,.16); }
.narrative-card footer > span { color: #8f826e; font-size: 10px; letter-spacing: .14em; }
.narrative-card footer button { min-width: 90px; min-height: 38px; border: 0; background: transparent; color: #dcc38e; font: 500 12px/1 "Songti SC", STSong, serif; letter-spacing: .1em; }
.narrative-card footer b { margin-left: 7px; color: #d6ae67; font-size: 19px; font-weight: 400; }

/* Prelude story pages reuse the same single-beat dialogue card as the main
   stage. Narration and character speech never accumulate on one screen. */
.prelude-narrative { user-select: none; -webkit-user-select: none; }
.prelude-narrative .prelude-dialogue { min-height: 186px; }
.prelude-narrative .prelude-dialogue .text { -webkit-line-clamp: 5; }
.prelude-narrative .prelude-dialogue .continue-control { right: 18px; }
.narrative-header {
  position: absolute;
  z-index: 5;
  top: max(46px, env(safe-area-inset-top));
  left: 20px;
  right: 20px;
  text-align: left;
  pointer-events: none;
}
.narrative-header .event-label { color: #cda85f; font-size: 11px; letter-spacing: .18em; }
.narrative-header h1 { margin: 8px 0 0; color: #f0dab0; font: 500 24px/1.3 "Songti SC", STSong, serif; letter-spacing: .12em; text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.narrative-beats {
  position: absolute;
  z-index: 5;
  left: 18px;
  right: 18px;
  bottom: max(64px, calc(env(safe-area-inset-bottom) + 56px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 56%;
  overflow: hidden;
  pointer-events: none;
}
.beat {
  padding: 14px 16px;
  border-radius: 14px 3px 14px 3px;
  animation: beat-fade-in .42s ease-out both;
  transition: opacity .35s ease, filter .35s ease, transform .35s ease;
}
@keyframes beat-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.beat.is-past { opacity: .42; filter: blur(.4px); }
.beat.is-current { opacity: 1; }
.beat-line { margin: 0; font: 400 15.5px/1.85 "Songti SC", STSong, serif; letter-spacing: .04em; text-align: justify; }
.beat-action {
  border: 1px solid rgba(205,172,105,.36);
  background: linear-gradient(145deg, rgba(20,15,10,.78), rgba(6,5,4,.88));
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.beat-action .beat-line { color: #e6d7b6; }
.beat-speech {
  padding: 12px 18px 14px;
  border: 1px solid rgba(239,210,142,.55);
  background: linear-gradient(155deg, rgba(48,32,16,.92), rgba(24,15,8,.94));
  box-shadow: 0 12px 34px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,231,174,.06);
}
.beat-speaker { margin-bottom: 6px; color: #efd28e; font: 500 12px/1 "Kaiti SC", STKaiti, KaiTi, serif; letter-spacing: .28em; }
.beat-speech .beat-line { color: #f7ecd0; font: 500 16.5px/1.75 "Kaiti SC", STKaiti, KaiTi, serif; letter-spacing: .06em; }
.narrative-tap-hint {
  position: absolute;
  z-index: 5;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(214,174,103,.7);
  font: 400 11px/1 "Songti SC", STSong, serif;
  letter-spacing: .28em;
  pointer-events: none;
  animation: tap-hint-pulse 2.2s ease-in-out infinite;
}
@keyframes tap-hint-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
.video-prelude {
  display: grid;
  place-items: center;
}
.chapter-opener-stage {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #020202;
}
.chapter-opener-film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
  background: #000;
}
.chapter-opener-skip {
  position: absolute;
  z-index: 35;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  min-width: 58px;
  min-height: 38px;
  border: 1px solid rgba(242,228,200,.2);
  border-radius: 999px;
  background: rgba(10,8,6,.2);
  color: rgba(255,248,232,.76);
  font-size: 12px;
  letter-spacing: .14em;
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.chapter-opener-play {
  position: absolute;
  z-index: 35;
  left: 50%;
  bottom: max(34px, calc(env(safe-area-inset-bottom) + 22px));
  transform: translateX(-50%);
  min-width: 150px;
  min-height: 46px;
  border: 1px solid rgba(226,199,132,.5);
  border-radius: 999px;
  background: rgba(5,5,4,.78);
  color: #f0dcae;
  backdrop-filter: blur(10px);
  cursor: pointer;
}
.chapter-opener-fallback {
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 44%, rgba(142,104,53,.19), transparent 28%),
    linear-gradient(155deg, #17120c, #030303 58%, #0e1112);
}
.chapter-opener-fallback-orbit {
  position: absolute;
  z-index: -1;
  width: min(68vw, 290px);
  aspect-ratio: 1;
  border: 1px solid rgba(220,186,115,.24);
  border-radius: 50%;
  box-shadow: 0 0 70px rgba(210,165,82,.08), inset 0 0 55px rgba(210,165,82,.06);
}
.chapter-opener-fallback-orbit::before,
.chapter-opener-fallback-orbit::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 1px solid rgba(220,186,115,.15);
  border-radius: 50%;
}
.chapter-opener-fallback-orbit::after { inset: 30%; }
.chapter-opener-fallback-copy {
  width: min(76%, 320px);
  text-align: center;
  color: #f4ead4;
}
.chapter-opener-fallback-copy .event-label { color: #cfae6c; letter-spacing: .28em; }
.chapter-opener-fallback-copy h1 {
  margin: 12px 0 16px;
  font: 500 clamp(29px, 8vw, 38px)/1.25 "Songti SC", STSong, serif;
  letter-spacing: .12em;
}
.chapter-opener-fallback-copy p {
  margin: 0;
  color: rgba(238,225,199,.78);
  font: 400 15px/1.9 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .06em;
}
.intro-film {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center;
  background: #000;
}
.video-prelude::before,
.video-prelude::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  pointer-events: none;
}
.video-prelude::before {
  top: 0;
  height: 28%;
  background: linear-gradient(#030504 18%, transparent);
}
.video-prelude::after {
  bottom: 0;
  height: 38%;
  background: linear-gradient(transparent, #030504 55%);
}
.cinema-grain {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.018) 3px 4px);
}
.intro-skip {
  position: absolute;
  z-index: 8;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  min-width: 58px;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: rgba(235,220,186,.72);
  font-size: 12px;
  letter-spacing: .14em;
  cursor: pointer;
}
.intro-caption {
  position: absolute;
  z-index: 7;
  left: 24px;
  right: 24px;
  bottom: max(54px, calc(env(safe-area-inset-bottom) + 28px));
  padding-left: 14px;
  border-left: 1px solid rgba(203,177,134,.7);
}
.intro-caption p {
  margin: 9px 0 0;
  color: #f0e7d5;
  font: 500 18px/1.7 "Songti SC", STSong, serif;
  text-shadow: 0 2px 16px #000;
}
.intro-play {
  position: relative;
  z-index: 9;
  min-width: 150px;
  min-height: 48px;
  border: 1px solid rgba(203,177,134,.56);
  background: rgba(5,8,7,.84);
  color: #ead7a7;
  cursor: pointer;
}

.character-prelude { background: #070706; }
.character-art,
.edict-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.character-art { object-position: center 28%; }
.character-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3,3,2,.3), transparent 32%, rgba(4,3,3,.16) 50%, rgba(6,5,4,.94) 76%, #050504 100%);
}
.character-identity {
  position: absolute;
  z-index: 5;
  top: max(54px, calc(env(safe-area-inset-top) + 28px));
  left: 22px;
  padding-left: 12px;
  border-left: 1px solid #d6ae67;
  text-shadow: 0 2px 12px #000;
  display: flex;
  align-items: center;
  gap: 12px;
}
.character-identity small,
.character-identity strong { display: block; }
.character-identity small { color: #bda87d; font-size: 10px; letter-spacing: .14em; }
.character-identity strong { margin-top: 5px; color: #ead7ad; font: 500 24px/1.2 "Songti SC", STSong, serif; letter-spacing: .12em; }
.character-help {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(214,174,103,.78);
  border-radius: 50%;
  background: rgba(8,7,5,.5);
  color: #ead7ad;
  font: 600 16px/1 serif;
  box-shadow: 0 4px 14px rgba(0,0,0,.38);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.character-dialogue {
  position: absolute;
  z-index: 6;
  left: 18px;
  right: 18px;
  bottom: 0;
  min-height: 210px;
  padding: 20px 20px 58px;
  border: 1px solid rgba(205,172,105,.64);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(34,26,18,.82), rgba(10,9,8,.9));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.05), 0 16px 42px rgba(0,0,0,.46);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transform: translateY(-50%);
}
.character-dialogue .speaker { color: #d6ae67; font-size: 13px; letter-spacing: .16em; }
.character-dialogue p { margin: 12px 0 10px; color: #f0e6d4; font: 400 18px/1.75 "Songti SC", STSong, serif; }
.character-dialogue button {
  position: absolute;
  right: 12px;
  bottom: 8px;
  min-width: 90px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #dcc38e;
  font-size: 12px;
}
.character-dialogue button span { margin-left: 7px; color: #d6ae67; font-size: 18px; }
.character-profile-modal {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(4,4,3,.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.character-profile-modal[hidden] { display: none; }
.character-profile-card {
  position: relative;
  width: min(100%, 390px);
  padding: 28px 24px 24px;
  border: 1px solid rgba(214,174,103,.72);
  border-radius: 20px 4px 20px 4px;
  background: linear-gradient(145deg, rgba(36,27,18,.96), rgba(10,9,7,.97));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.06), 0 22px 68px rgba(0,0,0,.62);
  color: #eee2ca;
  font-family: "Kaiti SC", STKaiti, KaiTi, serif;
  text-align: left;
}
.character-profile-card > small,
.character-relation > small { color: #d6ae67; letter-spacing: .16em; }
.character-profile-card h2 { margin: 8px 0 16px; color: #f0dab0; font-size: 32px; }
.character-profile-card p { margin: 0; font-size: 17px; line-height: 1.8; }
.character-relation { margin-top: 20px; padding-top: 18px; border-top: 1px solid rgba(214,174,103,.28); }
.character-relation p { margin-top: 8px; color: #e3d5bb; }
.character-profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(214,174,103,.42);
  border-radius: 50%;
  background: rgba(4,4,3,.36);
  color: #ddc28d;
  font-size: 22px;
}

.edict-intro,
.edict-draft,
.edict-feedback { background: #080705; font-family: "Songti SC", STSong, serif; }
.edict-intro .edict-backdrop { object-position: center; }
.edict-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4,3,2,.44), rgba(4,3,2,.04) 35%, rgba(4,3,2,.2) 58%, rgba(4,3,2,.9) 100%);
}
.edict-voice {
  position: absolute;
  z-index: 5;
  left: 24px;
  right: 24px;
  bottom: 78px;
  padding: 20px;
  border: 1px solid rgba(111,78,39,.72);
  background: rgba(13,10,7,.86);
  box-shadow: 0 18px 48px #000;
  text-align: center;
  backdrop-filter: blur(11px);
  transform: translateY(-50%);
}
.edict-voice small { color: #d6ae67; font-size: 10px; letter-spacing: .18em; }
.edict-voice h1 { margin: 12px 0 8px; color: #ead7ad; font: 500 30px/1.25 "Songti SC", STSong, serif; letter-spacing: .12em; }
.edict-voice p { margin: 0; color: #eee4d3; font-size: 17px; line-height: 1.75; }

.edict-draft .edict-backdrop { object-position: center; filter: brightness(.94) saturate(.9); }
.edict-header {
  position: absolute;
  z-index: 5;
  top: max(42px, calc(env(safe-area-inset-top) + 26px));
  left: 18px;
  right: 18px;
  text-align: center;
  text-shadow: 0 2px 12px #000;
}
.edict-header small { color: #d0b47c; font-size: 9px; letter-spacing: .16em; }
.edict-header h1 { margin: 6px 0 3px; color: #f0dfb9; font: 500 29px/1.2 "Songti SC", STSong, serif; letter-spacing: .18em; }
.edict-header p { margin: 0; color: #c9b999; font-size: 12px; letter-spacing: .1em; }
.edict-clauses {
  position: absolute;
  z-index: 6;
  top: 15.6%;
  left: 10.5%;
  right: 10.5%;
  bottom: auto;
  max-height: 72%;
  overflow-y: auto;
  padding: 4px 8px 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: thin;
}
.edict-clause,
.edict-letter { padding: 10px 4px; border-bottom: 1px solid rgba(100,54,27,.3); }
.edict-letter { border-bottom: 0; }
.edict-clause h2,
.edict-letter h2 { margin: 0 0 8px; color: #61391f; font: 600 12px/1.2 "Songti SC", STSong, serif; letter-spacing: .15em; text-shadow: 0 1px rgba(255,244,207,.5); }
.edict-clause > div,
.edict-letter > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 7px; }
.edict-clause button,
.edict-letter button {
  position: relative;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid rgba(194,163,103,.52);
  border-radius: 8px 2px 8px 2px;
  background: rgba(16,14,13,.9);
  background-image: none;
  color: #eee1c8;
  box-shadow: inset 0 0 0 1px rgba(255,238,196,.06), 0 3px 8px rgba(31,18,9,.18);
  font-size: 11px;
  transition: border-color .14s ease, background .14s ease, color .14s ease;
}
.edict-clause button strong,
.edict-clause button small { display: block; }
.edict-clause button strong { color: inherit; font: 500 12px/1.2 "Songti SC", STSong, serif; }
.edict-clause button small { margin-top: 3px; color: #9f927e; font-size: 8px; }
.edict-clause button.selected,
.edict-letter button.selected {
  border-color: #d9b45e;
  background: #211a11;
  background-image: none;
  color: #f4dfaa;
  box-shadow: inset 0 0 0 1px rgba(255,222,139,.22), 0 0 14px rgba(205,163,74,.18);
}
.edict-clause button.selected small { color: #c2a96f; }
.edict-clause button.selected::after {
  content: "定";
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid #d8b55f;
  outline: 1px solid rgba(216,181,95,.38);
  outline-offset: -4px;
  background: rgba(25,18,10,.82);
  color: #f0ce7b;
  text-shadow: 0 0 7px rgba(237,192,88,.42);
  font: 600 10px/1 "Kaiti SC", STKaiti, KaiTi, serif;
  transform: rotate(-7deg);
}
.edict-letter button { min-height: 38px; font-size: 10px; }
.edict-submit {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 8px;
  min-height: 78px;
  padding: 10px 4px 2px;
}
.edict-context-hint-wrap {
  display: flex;
  justify-content: center;
  margin: 4px 0 6px;
}
.edict-context-hint {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: #2a1a0a;
  font: 400 13px/1.4 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .18em;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(42,26,10,.4);
  text-underline-offset: 4px;
  transition: color .18s ease, text-decoration-color .18s ease;
}
.edict-context-hint:hover,
.edict-context-hint:focus-visible {
  color: #000;
  text-decoration-color: rgba(0,0,0,.7);
  outline: none;
}
.edict-context-modal { z-index: 45; }
.edict-context-card {
  width: min(100%, 380px);
  max-height: min(80vh, 620px);
  display: flex;
  flex-direction: column;
}
.edict-context-card > small { flex: 0 0 auto; }
.edict-context-card h2 { flex: 0 0 auto; margin-bottom: 14px; }
.edict-context-points {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 0 0 22px;
  list-style: decimal;
  color: #d6ae67;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.edict-context-points li { margin-bottom: 16px; }
.edict-context-points li:last-child { margin-bottom: 8px; }
.edict-context-points li::marker { color: #d6ae67; font-weight: 600; }
.edict-context-points strong {
  display: block;
  margin-bottom: 6px;
  color: #f5e1b0;
  font: 500 16px/1.3 "Songti SC", STSong, serif;
  letter-spacing: .1em;
}
.edict-context-points p {
  margin: 0;
  color: #eee2ca;
  font: 400 15px/1.8 "Kaiti SC", STKaiti, KaiTi, serif;
  text-align: justify;
}
.edict-context-closing {
  flex: 0 0 auto;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(214,174,103,.28);
  color: #f0dab0;
  font: 500 14px/1.7 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .06em;
  text-align: center;
}
.edict-error { width: 100%; margin: 0; color: #d59a80; font: 400 10px/1.5 system-ui, sans-serif; text-align: center; }
.edict-submit button,
.feedback-card button {
  min-height: 48px;
  border: 1px solid #f0cd88;
  border-radius: 28px;
  background: linear-gradient(#f4d99c, #c99b50);
  color: #21170c;
  font: 600 16px/1 "Songti SC", STSong, serif;
  letter-spacing: .1em;
}
.edict-draft .edict-submit button {
  width: 220px;
  min-height: 0;
  aspect-ratio: 3 / 1;
  padding: 0 38px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("./assets/edict-submit-frame.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #f8dfaa;
  filter: drop-shadow(0 7px 11px rgba(55,21,12,.28));
  box-shadow: none;
  font: 600 15px/1 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .16em;
}
.edict-draft .edict-submit button:hover { filter: brightness(1.08) drop-shadow(0 7px 11px rgba(55,21,12,.32)); }
.edict-draft .edict-error { color: #8f3028; text-shadow: 0 1px rgba(255,239,201,.45); }

/* Drafting now follows the same one-decision-at-a-time visual grammar as the
   main story: narrated context below, framed choices above, one question per
   screen. The political brief stays reachable without joining the scroll. */
.edict-draft-stepped .edict-backdrop {
  filter: brightness(.66) saturate(.82) contrast(1.04);
}
.edict-step-shade {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4,3,2,.36), rgba(4,3,2,.08) 28%, rgba(4,3,2,.38) 58%, rgba(4,3,2,.9) 100%),
    radial-gradient(circle at 50% 42%, transparent 0 24%, rgba(3,2,2,.4) 76%);
  pointer-events: none;
}
.edict-step-header {
  position: absolute;
  z-index: 6;
  top: max(28px, calc(env(safe-area-inset-top) + 18px));
  left: 28px;
  right: 28px;
  display: grid;
  justify-items: center;
  text-align: center;
  text-shadow: 0 2px 16px #000;
}
.edict-step-header small { color: #d6b978; font-size: 10px; letter-spacing: .16em; }
.edict-step-header strong {
  margin-top: 7px;
  color: #f2dfb5;
  font: 500 26px/1.2 "Songti SC", STSong, serif;
  letter-spacing: .18em;
}
.edict-step-progress { display: flex; width: min(210px, 62vw); gap: 9px; margin-top: 14px; }
.edict-step-progress i { flex: 1; height: 2px; background: rgba(214,185,120,.28); }
.edict-step-progress i.active { background: #d4a955; box-shadow: 0 0 8px rgba(212,169,85,.6); }
.edict-step-progress i.done { background: rgba(212,169,85,.72); }

.edict-single-choice {
  position: absolute;
  z-index: 7;
  top: 25%;
  left: 30px;
  right: 30px;
}
.edict-single-choice > .event-label {
  margin-bottom: 15px;
  color: #d7b875;
  font: 400 11px/1.3 "Songti SC", STSong, serif;
  text-align: center;
  text-shadow: 0 2px 10px #000;
}
.edict-single-choice .choice-list { display: grid; gap: 12px; }
.edict-single-choice .choice {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 72px;
  padding: 10px 52px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("./assets/choice-default-frame.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #eadab8;
  text-align: center;
  box-shadow: none;
}
.edict-single-choice .choice:hover { filter: brightness(1.1); transform: translateY(-1px); }
.edict-single-choice .choice strong {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  color: inherit;
  font: 500 18px/1.35 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .08em;
  white-space: nowrap;
}
.edict-single-choice .choice small {
  display: inline;
  margin: 0;
  color: rgba(234,218,184,.7);
  font: 400 12px/1.35 "Songti SC", STSong, serif;
  letter-spacing: .02em;
}
.edict-single-choice .choice.selected {
  background-image: url("./assets/choice-selected-frame.png");
  color: #5b3714;
}
.edict-single-choice .choice.selected small { color: rgba(91,55,20,.7); }

.edict-narration-card {
  position: absolute;
  z-index: 7;
  left: 18px;
  right: 18px;
  bottom: max(70px, calc(env(safe-area-inset-bottom) + 58px));
  padding: 17px 20px 18px;
  border: 1px solid rgba(205,164,82,.72);
  border-radius: 14px 2px 14px 2px;
  background: rgba(13,10,8,.92);
  box-shadow: 0 16px 42px rgba(0,0,0,.62), inset 0 0 0 1px rgba(255,235,184,.04);
  backdrop-filter: blur(10px);
}
.edict-narration-card .speaker { color: #d6ae67; font: 500 11px/1.3 "Songti SC", STSong, serif; letter-spacing: .16em; }
.edict-narration-card p { margin: 9px 0 12px; color: #d8cdbb; font: 400 14px/1.72 "Kaiti SC", STKaiti, KaiTi, serif; }
.edict-narration-card h2 { margin: 0; color: #f3e6cc; font: 500 19px/1.5 "Songti SC", STSong, serif; letter-spacing: .05em; }

.edict-context-fixed {
  position: absolute;
  z-index: 20;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  min-width: 86px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(214,174,103,.62);
  border-radius: 20px;
  background: rgba(12,10,8,.86);
  color: #e5c987;
  box-shadow: 0 7px 22px rgba(0,0,0,.48);
  font: 500 12px/1 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .12em;
  backdrop-filter: blur(8px);
}
.edict-context-fixed:hover,
.edict-context-fixed:focus-visible { border-color: #efd18d; color: #fff0bd; outline: none; }

.edict-review-step {
  position: absolute;
  z-index: 7;
  top: 23%;
  left: 28px;
  right: 28px;
  padding: 24px 22px 18px;
  border: 1px solid rgba(205,164,82,.7);
  border-radius: 16px 3px 16px 3px;
  background: rgba(13,10,8,.9);
  box-shadow: 0 18px 54px rgba(0,0,0,.62);
  text-align: center;
  backdrop-filter: blur(11px);
}
.edict-review-step h1 { margin: 7px 0 18px; color: #f1dfb8; font: 500 27px/1.3 "Songti SC", STSong, serif; letter-spacing: .12em; }
.edict-review-step ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; text-align: left; }
.edict-review-step li { padding: 10px 12px; border-bottom: 1px solid rgba(214,174,103,.2); }
.edict-review-step li small,
.edict-review-step li strong { display: block; }
.edict-review-step li small { color: #bda36f; font-size: 9px; letter-spacing: .14em; }
.edict-review-step li strong { margin-top: 3px; color: #eee1c7; font: 500 16px/1.4 "Kaiti SC", STKaiti, KaiTi, serif; }
.edict-review-step > p { margin: 16px 0 0; color: #cfc1aa; font: 400 13px/1.7 "Kaiti SC", STKaiti, KaiTi, serif; }
.edict-review-step .edict-submit { min-height: 70px; padding-top: 8px; }

@media (max-height: 760px) {
  .edict-single-choice { top: 22%; }
  .edict-single-choice .choice { min-height: 60px; }
  .edict-narration-card { padding-block: 13px; }
  .edict-narration-card p { margin: 6px 0 8px; font-size: 13px; line-height: 1.55; }
  .edict-narration-card h2 { font-size: 17px; }
  .edict-review-step { top: 19%; padding-block: 18px 12px; }
}

.edict-feedback .edict-backdrop { object-position: center 25%; }
.feedback-shade { background: linear-gradient(180deg, rgba(3,3,2,.32), rgba(4,3,2,.16) 46%, rgba(5,4,3,.94) 80%, #050504); }
.feedback-card {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 64px 28px 24px;
  border: 0;
  background: linear-gradient(0deg, rgba(3,3,2,.98), rgba(4,4,3,.88) 44%, rgba(4,4,3,.48) 74%, transparent);
  box-shadow: none;
  backdrop-filter: none;
  transform: translateY(-50%);
}
.edict-feedback.danger .feedback-card { background: linear-gradient(0deg, rgba(22,7,5,.98), rgba(15,7,5,.88) 44%, rgba(8,4,3,.48) 74%, transparent); }
.feedback-card h2 { margin: 10px 0; color: #e8c985; font: 500 24px/1.2 "Songti SC", STSong, serif; letter-spacing: .12em; }
.numeric-feedback {
  width: max-content;
  max-width: 100%;
  padding: 7px 13px;
  border: 1px solid rgba(215,184,107,.56);
  border-radius: 14px 3px 14px 3px;
  background: rgba(10,8,5,.46);
  color: #f0d89f;
  font-family: "Kaiti SC", STKaiti, KaiTi, serif;
  font-size: 14px;
  letter-spacing: .12em;
}
.feedback-card > p { margin: 0 0 12px; color: #eee4d3; font: 400 17px/1.7 "Songti SC", STSong, serif; }
.feedback-card blockquote { margin: 0 0 16px; padding: 11px 13px; border-left: 1px solid #8f7041; background: rgba(20,16,12,.74); color: #b9ad9b; font: 400 12px/1.7 system-ui, sans-serif; }
.feedback-card button { width: 100%; }

.note-shade { background: linear-gradient(180deg, rgba(3,3,2,.14), rgba(5,4,3,.08) 38%, rgba(5,4,3,.72) 74%, rgba(5,4,3,.94)); }
.taiping-note .edict-backdrop { transform: scale(1.16); transform-origin: left center; }
.note-card {
  position: absolute;
  z-index: 7;
  inset: 0 18px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.note-stack {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.note-lower {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.note-context {
  width: min(100%, 430px);
  margin: 0 0 10px;
  padding-left: 4px;
  align-self: center;
  text-shadow: 0 2px 12px #000;
}
.note-card .attendant-line { margin: 8px 0 0; color: #e7d9c2; font: 400 13px/1.55 "Songti SC", STSong, serif; }
.letter-slip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(128px, 38vw, 188px);
  aspect-ratio: 3 / 4;
  margin: 0;
  filter: drop-shadow(0 15px 22px rgba(0,0,0,.64));
  transform: translate(-50%, -50%) rotate(-1.5deg);
}
.letter-slip > img { width: 100%; height: 100%; object-fit: contain; }
.letter-slip blockquote {
  position: absolute;
  inset: 12% 17% 11%;
  display: grid;
  place-items: center;
  margin: 0;
  color: #3e2819;
  text-shadow: 0 1px rgba(255,255,255,.28);
}
.letter-slip blockquote span {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font: 500 clamp(18px, 4.4vw, 24px)/1.35 "Kaiti SC", STKaiti, "Songti SC", serif;
  letter-spacing: .1em;
}
.note-reply-panel {
  position: relative;
  width: min(100%, 430px);
  padding: 18px 18px 16px;
  overflow: hidden;
  border: 1px solid rgba(213,185,130,.66);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(34,26,18,.84), rgba(12,10,8,.9));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.05), 0 16px 40px rgba(0,0,0,.48);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.cloud-ornament { position: absolute; width: 112px; height: 62px; object-fit: contain; opacity: .42; pointer-events: none; }
.cloud-ornament-top { top: -25px; right: -19px; }
.cloud-ornament-bottom { bottom: -28px; left: -18px; transform: rotate(180deg); opacity: .3; }
.note-card label { position: relative; z-index: 1; display: block; margin-bottom: 8px; color: #dcc99f; font: 400 12px/1.4 "Songti SC", STSong, serif; letter-spacing: .08em; }
.note-card textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 64px;
  min-height: 64px;
  padding: 12px 14px;
  resize: none;
  border: 1px solid rgba(203,169,101,.55);
  border-radius: 9px 2px 9px 2px;
  outline: none;
  background: rgba(7,6,5,.42);
  color: #f2e8d4;
  font: 400 14px/1.55 "Kaiti SC", STKaiti, "Songti SC", serif;
  box-shadow: inset 0 0 18px rgba(0,0,0,.2);
}
.note-card textarea:focus { border-color: #e2bf75; box-shadow: 0 0 0 2px rgba(222,184,105,.1), inset 0 0 18px rgba(0,0,0,.2); }
.note-card textarea::placeholder { color: rgba(221,207,181,.42); }
.note-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(150px, 210px) minmax(44px, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.note-actions button, .note-reply-panel > .note-primary { width: max-content; min-width: 96px; min-height: 42px; padding-inline: 24px; border: 1px solid rgba(213,185,130,.55); border-radius: 18px 3px 18px 3px; background: rgba(22,17,12,.72); color: #d7c5a6; }
.note-actions .note-primary, .note-reply-panel > .note-primary { border-color: #efd28e; background: linear-gradient(180deg, #f1d693, #c99d52); color: #21170c; }
.note-actions .note-primary { min-width: 142px; }
.note-reply-panel > .note-primary { position: relative; z-index: 1; display: block; min-width: 180px; margin-inline: auto; }
.note-response { position: relative; z-index: 1; padding: 1px 2px 12px; }
.note-response small { color: #d6ae67; letter-spacing: .14em; }
.note-response p { margin: 8px 0 0; color: #eee4d3; font: 400 16px/1.6 "Kaiti SC", STKaiti, "Songti SC", serif; }
.note-response-declined p { color: #d6c4a0; font-style: italic; }
.note-reply-panel .edict-error { position: relative; z-index: 1; margin: 4px 0 0; }

/* Entry screen for the Taiping note: only the slip is shown until the
   player commits to "回字条" (unfold Waner's letter) or "不回" (decline). */
.note-prompt { position: relative; z-index: 1; padding: 2px 2px 14px; text-align: center; }
.note-prompt small { display: block; margin-bottom: 6px; color: #d6ae67; letter-spacing: .18em; font-size: 12px; }
.note-prompt p { margin: 0; color: #eee4d3; font: 400 15px/1.65 "Kaiti SC", STKaiti, "Songti SC", serif; }
.note-choice-row { position: relative; z-index: 1; display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.note-choice-row button { min-width: 132px; min-height: 44px; padding-inline: 22px; border-radius: 18px 3px 18px 3px; font: 500 15px/1.4 "Songti SC", STSong, serif; letter-spacing: .12em; cursor: pointer; }
.note-choice-row .note-primary { border: 1px solid #efd28e; background: linear-gradient(180deg, #f1d693, #c99d52); color: #21170c; }
.note-choice-row .note-primary:hover { filter: brightness(1.06); }
.note-choice-row .note-secondary { border: none; background: transparent; color: #b8a684; letter-spacing: .18em; }
.note-choice-row .note-secondary:hover { color: #f5e1b0; }
.waner-letter {
  position: relative;
  z-index: 1;
  max-height: 38vh;
  padding: 4px 4px 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.waner-letter-heading small {
  display: block;
  color: #d6ae67;
  font: 400 11px/1.4 "Songti SC", STSong, serif;
  letter-spacing: .18em;
}
.waner-letter-heading h3 {
  margin: 4px 0 10px;
  color: #f0dab0;
  font: 500 16px/1.3 "Kaiti SC", STKaiti, "Songti SC", serif;
  letter-spacing: .1em;
}
.waner-letter > p {
  margin: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(214,174,103,.22);
  color: #f0e2c2;
  font: 400 15px/1.85 "Kaiti SC", STKaiti, "Songti SC", serif;
  text-align: justify;
  text-indent: 2em;
  letter-spacing: .02em;
}
.waner-letter::-webkit-scrollbar { width: 4px; }
.waner-letter::-webkit-scrollbar-thumb { background: rgba(214,174,103,.28); border-radius: 2px; }
.waner-letter-panel > .note-primary { margin-top: 14px; }
@media (max-height: 720px) {
  .note-card { top: 0; }
  .letter-slip { top: 43%; width: 116px; }
  .note-context { margin-bottom: 0; }
  .note-reply-panel { padding: 14px; }
  .note-card textarea { height: 54px; min-height: 54px; }
  .waner-letter { max-height: 30vh; }
  .waner-letter > p { font-size: 14px; line-height: 1.75; }
  .waner-letter-heading h3 { font-size: 15px; margin: 2px 0 8px; }
}
.edict-letter p { margin: 0; color: #6f4d32; font-size: 10px; line-height: 1.55; }

.fragment-progress { position: absolute; z-index: 6; left: 0; right: 0; bottom: 118px; pointer-events: none; color: #d6bf8b; text-align: center; font: 400 11px/1 system-ui, sans-serif; letter-spacing: .12em; text-shadow: 0 2px 8px #000; }
.fragment-ledger { display: flex; justify-content: center; gap: 14px; margin: 16px 0 8px; color: #d6ae67; font-size: 12px; }
.phase-unlocked { color: #e8c985 !important; }

.dialogue {
  position: relative;
  z-index: 4;
  margin: 0 16px max(78px, env(safe-area-inset-bottom));
  min-height: 142px;
  padding: 18px 18px 50px;
  border-top: 1px solid var(--gold);
  background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 -24px 48px rgba(0,0,0,.2);
  cursor: pointer;
}
.speaker { color: var(--gold); font-weight: 700; }
.speaker-with-help {
  display: flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  gap: 7px;
}
.dialogue-character-help {
  position: static !important;
  display: inline-flex !important;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  flex: 0 0 24px;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  border: 0 !important;
  border-radius: 50% !important;
  appearance: none !important;
  aspect-ratio: auto !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  filter: none !important;
  text-shadow: none !important;
  font: inherit !important;
  letter-spacing: 0 !important;
  transform: none !important;
  cursor: pointer;
}
.character-biography-icon {
  display: block;
  width: 19px;
  height: 19px;
  pointer-events: none;
  filter: drop-shadow(0 0 5px rgba(240,192,104,.18));
  transition: filter .18s ease, transform .18s ease;
}
.dialogue-character-help:hover,
.dialogue-character-help:focus-visible { background: rgba(240,192,104,.08) !important; outline: 1px solid rgba(240,192,104,.45); outline-offset: 2px; }
.dialogue-character-help:hover .character-biography-icon,
.dialogue-character-help:focus-visible .character-biography-icon { filter: drop-shadow(0 0 7px rgba(240,192,104,.52)); transform: scale(1.06); }
.text {
  margin-top: 12px;
  min-height: 4.8em;
  font: 500 20px/1.6 "Songti SC", STSong, serif;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.continue-control { position: absolute; right: 12px; bottom: 8px; min-width: 96px; min-height: 40px; padding: 0 10px; border: 0; background: transparent; color: #d8cba9; cursor: pointer; }
.continue-control span { margin-left: 7px; color: var(--gold); font-size: 20px; }
.continue-control:disabled { opacity: .5; cursor: wait; }

.decision {
  position: relative;
  z-index: 5;
  margin-top: auto;
  padding: 20px 18px max(24px, env(safe-area-inset-bottom));
  background: rgba(16,9,10,.60); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--gold);
}
.decision h2 { margin: 8px 0 16px; font: 700 24px/1.35 "Songti SC", STSong, serif; }
.choice-list { display: grid; gap: 10px; }
.choice { width: 100%; padding: 14px 16px; text-align: left; }
.choice strong, .choice small { display: block; }
.choice small { margin-top: 6px; color: var(--muted); line-height: 1.45; }
.choice-decision { position: absolute; z-index: 6; left: 10%; right: 10%; top: 42%; transform: translateY(-50%); padding: 0; border: 0; background: transparent; backdrop-filter: none; }
.choice-decision h2 { margin-bottom: 20px; padding: 10px 12px; text-align: center; color: #f1ece7; text-shadow: 0 2px 18px #000; }
.choice-decision .event-label { text-align: center; }
.choice-decision .choice { min-height: 58px; border-color: rgba(245,225,176,.62); border-radius: 999px; background: rgba(253,241,194,.92); color: #38251f; text-align: center; box-shadow: 0 0 28px rgba(203,177,134,.16); }
.choice-decision .choice small { color: #745e55; }

.composer textarea { width: 100%; min-height: 96px; resize: none; padding: 12px; color: #f3eee2; border: 1px solid var(--line); background: #0d1311; }
.action-kinds { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; }
.action-kind { min-width: 54px; padding: 0 10px; }
.action-kind.active { border-color: var(--gold); color: var(--gold); }
.fallbacks { margin-top: 14px; }

.sheet {
  position: absolute;
  z-index: 10;
  inset: auto 0 0;
  padding: 22px 18px max(24px, env(safe-area-inset-bottom));
  background: #0b1210;
  border-top: 1px solid var(--gold);
  box-shadow: 0 -18px 42px rgba(0,0,0,.55);
}
.sheet h2 { font: 700 28px/1.2 "Songti SC", STSong, serif; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.secondary, .confirm { padding: 0 12px; }
.confirm { background: var(--gold); color: #0b0e0c; font-weight: 800; }

.settlement {
  position: relative;
  z-index: 6;
  min-height: 100dvh;
  padding: max(80px, env(safe-area-inset-top)) 24px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  background: linear-gradient(180deg, #070b09, #11140f 60%, #070908);
  text-align: center;
  overflow-y: auto;
}
.settlement-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: .98; filter: saturate(.92) contrast(1.02) brightness(1.07); }
.settlement-vignette { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3,4,4,.1), rgba(3,4,4,.18) 35%, rgba(4,5,4,.38) 68%, rgba(5,7,6,.62) 100%); }
.settlement-content {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: calc(100dvh - max(108px, env(safe-area-inset-top)) - max(52px, env(safe-area-inset-bottom)));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 16px rgba(0,0,0,.88);
}
.achievement { width: 88px; height: 88px; margin: 12px auto; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font: 700 38px serif; }
.achievement.ending-emblem {
  width: clamp(112px, 31vw, 148px);
  height: clamp(112px, 31vw, 148px);
  margin: 6px auto 10px;
  border: 0;
  border-radius: 0;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.66));
}
.achievement.ending-emblem img { display: block; width: 100%; height: 100%; object-fit: contain; }
.settlement h1 {
  max-width: 92%;
  margin: 0 0 12px;
  font: 600 clamp(42px, 11vw, 58px)/1.12 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .08em;
}
.settlement-epilogue {
  width: min(92%, 420px);
  margin-top: 2px;
}
.settlement-epilogue h2 {
  margin: 0 0 10px;
  font: 600 clamp(24px, 6.4vw, 32px)/1.35 "Kaiti SC", STKaiti, KaiTi, serif;
}
.settlement .settlement-epilogue p {
  margin: 0;
  color: #f0e9dd;
  font: 400 clamp(17px, 4.4vw, 21px)/1.72 "Kaiti SC", STKaiti, KaiTi, serif;
}
.settlement-sources {
  width: min(90%, 430px);
  margin: clamp(20px, 3.4vh, 32px) auto 0;
  padding-top: 14px;
  border-top: 1px solid rgba(190, 170, 130, .22);
  text-align: left;
}
.settlement .settlement-sources p {
  margin: 0;
  color: rgba(202, 198, 190, .72);
  font: 400 clamp(11px, 2.9vw, 13px)/1.65 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .025em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .86);
}
.settlement .settlement-sources p + p { margin-top: 9px; }
.settlement .settlement-sources strong {
  color: rgba(218, 211, 199, .82);
  font-weight: 500;
}
.settlement .settlement-sources span { color: rgba(190, 187, 181, .68); }
.settlement h2,
.settlement p,
.settlement .phase-unlocked { font-family: "Kaiti SC", STKaiti, KaiTi, serif; }
.settlement p { color: #e5ddd0; font-size: 18px; line-height: 1.7; }
.settlement .primary {
  display: block;
  width: max-content;
  min-width: 190px;
  max-width: 100%;
  min-height: 48px;
  margin: clamp(34px, 5.5vh, 52px) auto 0;
  padding: 0 34px;
  border: 1px solid #e7c97f;
  border-radius: 22px 4px 22px 4px;
  background: linear-gradient(180deg, #eed397, #c69a53);
  color: #21170c;
  font-family: "Kaiti SC", STKaiti, KaiTi, serif;
  font-size: 18px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,245,211,.22), 0 10px 28px rgba(0,0,0,.28);
}
.settlement .phase-unlocked {
  max-width: 88%;
  margin: 12px auto 0;
  color: rgba(220, 194, 135, .82) !important;
  font-size: clamp(10px, 2.7vw, 12px);
  line-height: 1.5;
  letter-spacing: .035em;
}
.error { padding: 24px; color: #f0c1b8; }

/* A single primary action uses the cinnabar plaque with gold lettering. */
:is(
  .primary,
  .confirm,
  .feedback-card button:not(.dialogue-character-help),
  .note-primary
) {
  display: grid !important;
  place-items: center !important;
  width: min(100%, 380px) !important;
  min-width: 168px !important;
  min-height: 64px !important;
  margin-inline: auto !important;
  padding: 0 34px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  background-image: url("./assets/edict-submit-frame.png") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  color: #f7d990 !important;
  font-family: "Kaiti SC", STKaiti, KaiTi, serif !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  text-shadow: 0 1px 2px rgba(52,17,8,.72), 0 0 8px rgba(244,200,104,.18) !important;
  filter: drop-shadow(0 8px 16px rgba(35,16,8,.3));
}
:is(
  .primary,
  .confirm,
  .feedback-card button:not(.dialogue-character-help),
  .note-primary
):hover {
  background-color: transparent !important;
  filter: brightness(1.06) drop-shadow(0 8px 16px rgba(35,23,8,.28));
}
:is(
  .primary,
  .confirm,
  .feedback-card button:not(.dialogue-character-help),
  .note-primary
):disabled {
  opacity: .55;
  filter: saturate(.45);
}

/* Secondary actions retain the restrained dark paper and single gold outline. */
.note-actions > button:not(.note-primary) {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  color: #dfceb0;
  box-shadow: none;
}
.note-actions > .note-primary {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  flex: none;
  width: 100% !important;
  min-width: 0 !important;
  min-height: 58px !important;
  background-image: url("./assets/primary-action-frame.png") !important;
  color: #5a3a12 !important;
  text-shadow: 0 1px rgba(255,249,223,.5) !important;
}

.stage.interaction-performance-stage {
  position: relative;
  display: block;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0;
}
.interaction-performance-stage .backdrop { opacity: .72; }
.interaction-performance-card {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 36px), 420px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px 20px 18px;
  border: 1px solid rgba(205,172,105,.66);
  border-radius: 20px 4px 20px 4px;
  background: linear-gradient(145deg, rgba(43,31,19,.84), rgba(9,8,7,.92));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.05), 0 18px 46px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-family: "Kaiti SC", STKaiti, KaiTi, serif;
  transform: translate(-50%, -50%);
}
.interaction-performance-card > img {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 76px;
  height: 76px;
  margin: 0;
  border: 1px solid rgba(205,172,105,.7);
  border-radius: 50%;
  object-fit: cover;
  object-position: center 12%;
  background: #120f0b;
  box-shadow: 0 8px 22px rgba(0,0,0,.36);
}
.interaction-performance-card > .event-label { min-height: 76px; padding-right: 92px; }
.interaction-performance-card .stage-direction { color: #bcae96; font-size: 14px; }
.beat-stage-direction {
  margin: 4px 0 10px;
  color: #bcae96;
  font: 400 13px/1.65 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .05em;
}
.interaction-performance-card blockquote { margin: 12px 0; color: #f1e5cd; font-size: 23px; line-height: 1.7; }
.interaction-performance-card .performance-reason { margin: 0; color: #c8b998; font-size: 13px; line-height: 1.6; }
.interaction-performance-card .primary { width: max-content; min-width: 154px; margin: 20px auto 0 !important; border-radius: 18px 4px 18px 4px; font-family: "Kaiti SC", STKaiti, KaiTi, serif; }

.cast-sheet { position: absolute; z-index: 20; inset: 72px 12px 18px; overflow: auto; padding: 0 18px 22px; border: 1px solid var(--line); border-radius: 12px; background: rgba(24,27,43,.82); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 20px 60px rgba(0,0,0,.5); scrollbar-width: thin; scrollbar-color: rgba(214,174,103,.32) transparent; }
.cast-sheet > header { position: sticky; z-index: 3; top: 0; display: flex; align-items: flex-start; justify-content: space-between; margin: 0 -18px; padding: 18px 18px 12px; border-bottom: 1px solid rgba(203,177,134,.18); background: linear-gradient(180deg, rgba(24,27,43,.98) 72%, rgba(24,27,43,.9)); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.cast-sheet header small, .cast-sheet article small { display: block; color: #c9c0bc; }
.cast-sheet h2 { margin: 4px 0 0; font-family: "Noto Serif SC", "Songti SC", serif; }
.cast-sheet header button { width: 44px; height: 44px; border: 1px solid var(--line); background: transparent; }
.cast-sheet article { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid rgba(203,177,134,.16); }
.cast-sheet .avatar { width: 52px; height: 52px; display: block; object-fit: cover; object-position: center; border: 1px solid var(--gold); border-radius: 50%; background: #0a0908; box-shadow: inset 0 0 0 2px rgba(214,174,103,.1), 0 5px 16px rgba(0,0,0,.36); }
.cast-sheet .cast-body { min-width: 0; }
.cast-sheet .cast-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cast-sheet article strong { display: block; color: #f5e1b0; }
.cast-sheet article p { margin: 6px 0 0; color: #f1ece7; font-size: 13px; line-height: 1.55; }
.cast-sheet article p b { margin-right: 6px; color: #bda97c; font-size: 11px; font-weight: 500; letter-spacing: .08em; }
.faction-overview { margin: 16px 0 18px; padding: 12px; border: 1px solid rgba(214,174,103,.25); border-radius: 9px; background: linear-gradient(145deg, rgba(75,52,31,.24), rgba(10,12,21,.36)); box-shadow: inset 0 0 22px rgba(214,174,103,.04); }
.faction-versus { display: grid; grid-template-columns: minmax(0,1fr) 30px minmax(0,1fr); align-items: stretch; }
.faction-camp { min-width: 0; padding: 10px 8px; border-radius: 7px; background: rgba(7,8,14,.3); }
.faction-camp small { color: #a79b92; font-size: 10px; letter-spacing: .12em; }
.faction-camp strong { display: block; min-height: 40px; margin-top: 5px; color: #f0d9a7; font: 600 15px/1.35 "Noto Serif SC", "Songti SC", serif; }
.faction-camp p { margin: 8px 0 0; color: #d8d1ca; font-size: 11px; line-height: 1.65; }
.faction-camp-wei { border-top: 2px solid rgba(184,101,78,.74); }
.faction-camp-alliance { border-top: 2px solid rgba(110,151,164,.8); }
.faction-vs { align-self: center; color: #d6ae67; font: 600 11px/1 Georgia, serif; text-align: center; }
.faction-pivot { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 7px; margin: 10px 0; padding: 8px 10px; border: 1px solid rgba(214,174,103,.22); border-radius: 999px; background: rgba(214,174,103,.07); }
.faction-pivot span { color: #d6ae67; font-size: 10px; letter-spacing: .1em; }
.faction-pivot strong { color: #f3dfb1; font-size: 13px; }
.faction-pivot small { color: #c5bbb0; font-size: 10px; line-height: 1.35; }
.faction-context { padding-top: 9px; border-top: 1px solid rgba(214,174,103,.15); }
.faction-context p { display: grid; grid-template-columns: 62px 1fr; gap: 6px; margin: 5px 0 0; color: #cec5bb; font-size: 11px; line-height: 1.55; }
.faction-context b { color: #d3ba86; font-weight: 500; }
.faction-list-label { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; color: #a99d91; font-size: 11px; letter-spacing: .18em; }
.faction-list-label i { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(214,174,103,.25), transparent); }
.faction-group { margin: 0 0 14px; padding: 13px 13px 1px; border: 1px solid rgba(203,177,134,.18); border-radius: 9px; background: rgba(7,8,14,.22); }
.faction-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.faction-group-heading small { color: #a99b90; font-size: 10px; letter-spacing: .12em; }
.faction-group-heading h3 { margin: 3px 0 0; color: #f0d9a7; font: 600 17px/1.35 "Noto Serif SC", "Songti SC", serif; }
.faction-group-heading > span { flex: 0 0 auto; padding: 3px 8px; border: 1px solid rgba(214,174,103,.28); border-radius: 999px; color: #bea979; font-size: 10px; }
.faction-group-summary { margin: 8px 0 11px; color: #bfb6ad; font-size: 11px; line-height: 1.5; }
.faction-group-wei { box-shadow: inset 2px 0 rgba(184,101,78,.55); }
.faction-group-alliance { box-shadow: inset 2px 0 rgba(110,151,164,.62); }
.faction-group-pivot { box-shadow: inset 2px 0 rgba(214,174,103,.45); }
.cast-bio-toggle {
  flex: 0 0 auto;
  padding: 4px 12px;
  border: 1px solid rgba(214,174,103,.6);
  border-radius: 999px;
  background: rgba(8,7,5,.42);
  color: #ead7ad;
  font: 500 12px/1.4 "Songti SC", STSong, serif;
  letter-spacing: .12em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.cast-bio-toggle:hover,
.cast-bio-toggle:focus-visible {
  background: rgba(214,174,103,.16);
  border-color: rgba(214,174,103,.9);
  color: #fbe6b6;
  outline: none;
}
.cast-bio-modal { z-index: 40; }
.cast-bio-card {
  width: min(100%, 400px);
  max-height: min(78vh, 620px);
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
}
.cast-bio-card > small { flex: 0 0 auto; }
.cast-bio-card h2 { flex: 0 0 auto; margin-bottom: 6px; }
.cast-bio-era {
  flex: 0 0 auto;
  margin: 0 0 14px;
  padding-bottom: 12px;
  color: #d6ae67;
  font: 400 13px/1.6 "Songti SC", STSong, serif;
  letter-spacing: .08em;
  border-bottom: 1px solid rgba(214,174,103,.22);
}
.cast-bio-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
  -webkit-overflow-scrolling: touch;
}
.cast-bio-scroll p {
  margin: 0 0 12px;
  color: #eee2ca;
  font: 400 15px/1.8 "Kaiti SC", STKaiti, KaiTi, serif;
  text-align: justify;
}
.cast-bio-scroll p:last-child { margin-bottom: 0; }
.cast-bio-scroll::-webkit-scrollbar { width: 4px; }
.cast-bio-scroll::-webkit-scrollbar-thumb { background: rgba(214,174,103,.28); border-radius: 2px; }

.cue-story-intertitle { background: #050504; cursor: default; }
.cue-story-intertitle::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 62% 28%, rgba(166,103,42,.16), transparent 34%),
    linear-gradient(145deg, rgba(49,32,18,.34), rgba(4,4,3,.96));
}
.cue-story-intertitle .intertitle-copy { width: min(84%, 390px); text-align: left; }
.cue-story-intertitle .intertitle-copy h1 { margin: 16px 0 18px; font-size: clamp(29px, 7vw, 38px); }
.cue-story-intertitle .intertitle-copy p { color: rgba(241,234,220,.88); font: 400 17px/1.9 "Kaiti SC", STKaiti, KaiTi, serif; letter-spacing: .03em; }
.cue-story-intertitle blockquote { margin: 20px 0 0; padding: 15px 16px; border-left: 1px solid #c3954b; background: rgba(12,9,6,.52); color: #efd8a8; font: 500 18px/1.85 "Kaiti SC", STKaiti, KaiTi, serif; }
.cue-story-next { display: block; min-width: 154px; min-height: 46px; margin: 24px auto 0; border: 1px solid rgba(214,174,103,.7); border-radius: 999px; background: rgba(214,174,103,.1); color: #f0dab0; font: 500 13px/1 "Songti SC", STSong, serif; letter-spacing: .16em; }
.cue-story-next span { margin-left: 8px; color: #d6ae67; font-size: 18px; }

/* Demo-derived court-night interface */
.stage {
  display: block;
  background: #080909;
  font-family: "Songti SC", STSong, serif;
}
.stage .backdrop { opacity: .78; filter: saturate(.78) contrast(1.04); }
.stage .dynamic-portrait { opacity: .94; filter: saturate(.8) contrast(1.03); }
.stage .wash {
  background:
    linear-gradient(180deg, rgba(4,4,3,.8) 0, rgba(4,4,3,.12) 18%, transparent 48%, rgba(8,7,6,.62) 67%, #050504 100%),
    linear-gradient(90deg, rgba(0,0,0,.28), transparent 24%, transparent 76%, rgba(0,0,0,.45));
}
.story-topbar {
  position: absolute;
  z-index: 8;
  inset: 0 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(4,4,3,.92), rgba(4,4,3,.28) 70%, transparent);
}
.story-topbar .chapter-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; }
.story-topbar small { color: #d6ae67; font-size: 10px; letter-spacing: .16em; }
.story-topbar strong { overflow: hidden; color: #eee4d3; font-size: 15px; font-weight: 500; letter-spacing: .06em; text-overflow: ellipsis; white-space: nowrap; }
.round-control {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.46));
}
.round-control img { display: block; width: 100%; height: 100%; object-fit: contain; }
.round-control:hover { filter: brightness(1.08) drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.live-mark { color: #cbbba3; font: 400 10px/1 system-ui, sans-serif; white-space: nowrap; }
.live-mark i { display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 0; border-radius: 50%; background: #a84c3a; box-shadow: 0 0 8px #c6674d; }
.beat-progress { position: absolute; z-index: 8; top: 78px; left: 82px; right: 82px; display: flex; gap: 7px; }
.beat-progress i { flex: 1; height: 1px; background: rgba(125,108,83,.42); }
.beat-progress i.active { background: #d6ae67; box-shadow: 0 0 8px rgba(214,174,103,.55); }

.stage .stat-ribbon {
  top: 91px;
  left: 16px;
  right: 16px;
  gap: 5px;
  padding: 0 0 8px;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.stage .stat-ribbon span {
  padding: 4px 7px;
  border-color: rgba(108,84,50,.78);
  background: rgba(9,8,6,.7);
  color: #aa9a83;
  font: 400 9px/1.2 system-ui, sans-serif;
  backdrop-filter: blur(8px);
}
.stage .stat-ribbon b { color: #e2c27f; margin-left: 3px; }
.story-rail {
  position: absolute;
  z-index: 9;
  right: 10px;
  top: 43%;
  display: grid;
  gap: 14px;
}
.global-story-rail { z-index: 34; }
.story-rail button {
  width: 52px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d7bd8b;
  text-shadow: 0 2px 5px #000;
}
.story-rail button span {
  display: grid;
  width: 42px;
  height: 42px;
  margin: auto;
  place-items: center;
  border: 1px solid #aa8041;
  border-radius: 50%;
  background: rgba(9,8,6,.72);
  box-shadow: inset 0 0 0 3px rgba(214,174,103,.05), 0 4px 18px rgba(0,0,0,.45);
  font: 500 18px/1 serif;
}
.story-rail .rail-svg-icon {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.story-rail .rail-svg-icon img {
  display: block;
  width: 34px;
  height: 34px;
}
.story-rail small { display: block; margin-top: 4px; font: 400 10px/1.2 system-ui, sans-serif; }

/* Pure video shots keep the persistent story tools in the upper-right safe
   area, below the shot's own skip control. Other story layouts retain the
   mid-right rail so it stays clear of dialogue and choices. */
.video-prelude .global-story-rail,
.film-stage .global-story-rail {
  top: max(68px, calc(env(safe-area-inset-top) + 54px));
  right: 10px;
  bottom: auto;
  gap: 10px;
}
.chapter-opener-stage .global-story-rail { display: none; }

.prelude-storyline-modal {
  position: absolute;
  z-index: 38;
  inset: 0;
  display: grid;
  align-items: end;
  padding: 84px 66px 20px 16px;
  background: rgba(3,3,3,.66);
  backdrop-filter: blur(8px);
}
.prelude-storyline-modal > section {
  max-height: 78vh;
  padding: 20px 18px 18px;
  border: 1px solid rgba(214,174,103,.55);
  border-radius: 18px 4px 18px 4px;
  background: rgba(13,11,9,.96);
  box-shadow: 0 20px 60px #000;
  overflow: hidden;
}
.prelude-storyline-modal header { display: flex; align-items: flex-start; justify-content: space-between; }
.prelude-storyline-modal header small { color: #bba270; font-size: 10px; letter-spacing: .12em; }
.prelude-storyline-modal h2 { margin: 4px 0 14px; color: #f0dbad; font: 500 26px/1.2 "Songti SC", STSong, serif; }
.prelude-storyline-modal header button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(214,174,103,.38);
  border-radius: 50%;
  background: transparent;
  color: #d9bc83;
  font-size: 21px;
}
.prelude-storyline-modal ol {
  max-height: 58vh;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}
.prelude-storyline-modal li {
  display: grid;
  grid-template-columns: 12px 28px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: #756f65;
}
.prelude-storyline-modal li i { width: 7px; height: 7px; border: 1px solid #746243; border-radius: 50%; }
.prelude-storyline-modal li span { font: 400 9px/1 system-ui, sans-serif; }
.prelude-storyline-modal li strong { font: 400 13px/1.35 "Kaiti SC", STKaiti, KaiTi, serif; }
.prelude-storyline-modal li.done { color: #a99571; }
.prelude-storyline-modal li.done i { background: #9c8150; }
.prelude-storyline-modal li.active { color: #f0d69c; }
.prelude-storyline-modal li.active i { border-color: #e4b95f; background: #e4b95f; box-shadow: 0 0 10px rgba(228,185,95,.7); }
.visual-copy { position: absolute; z-index: 5; left: 24px; bottom: 210px; padding: 0; }
.visual-copy .eyebrow { font-size: 11px; text-shadow: 0 2px 10px #000; }

.reading-mode .dialogue {
  position: absolute;
  z-index: 7;
  left: 18px;
  right: 72px;
  bottom: 0;
  min-height: 168px;
  margin: 0;
  padding: 18px 18px 46px;
  border: 1px solid rgba(205,172,105,.64);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(34,26,18,.82), rgba(10,9,8,.9));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.05), 0 16px 42px rgba(0,0,0,.46);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transform: translateY(-50%);
}
.reading-mode .visual-copy { display: none; }
.reading-mode .speaker {
  width: max-content;
  min-width: 104px;
  padding: 6px 20px;
  border-radius: 16px 4px 16px 4px;
  background: linear-gradient(90deg, rgba(52,48,37,.84), rgba(43,39,31,.68));
  color: #ddc58f;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .16em;
  text-align: center;
}
.reading-mode .text {
  min-height: 3.5em;
  margin-top: 10px;
  color: #eee4d3;
  font: 400 18px/1.72 "Songti SC", STSong, serif;
  -webkit-line-clamp: 4;
}
.reading-mode .continue-control {
  right: 72px;
  bottom: 8px;
  min-width: 98px;
  min-height: 38px;
  color: #d9c49a;
  font: 400 11px/1 system-ui, sans-serif;
  letter-spacing: .08em;
}
.reading-mode .continue-control span { color: #dfbd7b; }

.choice-mode .visual-copy { bottom: 42px; }
.choice-decision {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0;
  padding: 128px 70px 156px 28px;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  transform: none;
}
.choice-decision > .event-label { margin-bottom: 16px; text-align: center; font-size: 10px; text-shadow: 0 2px 12px #000; }
.choice-decision .choice-list {
  display: grid;
  width: 100%;
  max-width: 100%;
  align-self: center;
  gap: 12px;
}
.choice-decision .choice {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 64px;
  padding: 8px 52px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-image: url("./assets/choice-default-frame.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  color: #eadab8;
  text-align: center;
  clip-path: none;
  box-shadow: none;
  transition: filter .16s ease, transform .16s ease;
}
.choice-decision .choice:hover { filter: brightness(1.09); transform: translateY(-1px); }
.choice-decision .choice strong { font: 500 18px/1.35 "Kaiti SC", STKaiti, KaiTi, serif; letter-spacing: .08em; }
.choice-decision .choice small { display: none; }
.choice-decision--described .choice { min-height: 82px; padding-block: 12px; }
.choice-decision--described .choice small {
  display: block;
  margin-top: 3px;
  color: rgba(234, 218, 184, .72);
  font: 400 11px/1.45 "Songti SC", STSong, serif;
  letter-spacing: .03em;
}
.choice-decision--described .choice.selected small { color: rgba(91, 55, 20, .72); }
.choice-decision .choice.selected {
  background-image: url("./assets/choice-selected-frame.png");
  color: #5b3714;
  filter: drop-shadow(0 0 12px rgba(236,194,99,.28));
}
.choice-decision .choice:disabled:not(.selected) { opacity: .68; filter: saturate(.72); }
.generation-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: #d8c49b;
  font: 400 11px/1.5 "Kaiti SC", STKaiti, KaiTi, serif;
  letter-spacing: .05em;
  text-shadow: 0 2px 12px #000;
}
.generation-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d6ad63;
  box-shadow: 0 0 12px rgba(236,194,99,.74);
  animation: generation-pulse .9s ease-in-out infinite alternate;
}
@keyframes generation-pulse { to { opacity: .35; transform: scale(.72); } }
.choice-footer { position: absolute; left: 28px; right: 72px; bottom: max(42px, calc(env(safe-area-inset-bottom) + 16px)); text-align: center; }
.choice-footer h2 { margin: 0 0 14px; color: #eadab8; font: 400 18px/1.55 "Songti SC", STSong, serif; letter-spacing: .08em; text-shadow: 0 2px 16px #000; }
.decision-ornament { display: flex; align-items: center; justify-content: center; gap: 10px; color: #b99b67; font-size: 11px; letter-spacing: .18em; }
.decision-ornament i { width: 64px; height: 1px; background: linear-gradient(90deg, transparent, #8b6a38); }
.decision-ornament i:last-child { background: linear-gradient(90deg, #8b6a38, transparent); }

.composer {
  position: absolute;
  z-index: 8;
  inset: auto 72px max(20px, env(safe-area-inset-bottom)) 18px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  transform: translateY(-50%);
}
.composer-heading { margin: 0 2px 12px; text-shadow: 0 2px 14px #000; }
.composer h2 { margin: 6px 0 0; color: #eee4d3; font: 400 17px/1.5 "Songti SC", STSong, serif; }
.composer .event-label { font-size: 10px; }
.composer-frame {
  position: relative;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(205,172,105,.64);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(34,26,18,.82), rgba(10,9,8,.9));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.05), 0 16px 42px rgba(0,0,0,.46);
  backdrop-filter: blur(9px);
}
.composer textarea {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 72px;
  min-height: 72px;
  padding: 12px 14px;
  resize: none;
  border: 1px solid rgba(203,169,101,.54);
  border-radius: 10px 2px 10px 2px;
  outline: none;
  background: rgba(7,6,5,.42);
  color: #f2e8d4;
  font: 400 14px/1.55 "Kaiti SC", STKaiti, "Songti SC", serif;
}
.composer textarea:focus { border-color: #e2bf75; box-shadow: 0 0 0 2px rgba(222,184,105,.1); }
.composer textarea::placeholder { color: rgba(221,207,181,.42); }
.composer .primary {
  display: block;
  width: max-content;
  min-width: 158px;
  min-height: 44px;
  margin: 12px auto 0;
  padding: 0 28px;
  border: 1px solid #f0cd88;
  border-radius: 20px 3px 20px 3px;
  background: linear-gradient(#f4d99c, #c99b50);
  color: #21170c;
}
.composer .action-kinds { position: relative; z-index: 1; display: flex; gap: 6px; margin: 0 0 10px; padding-bottom: 2px; }
.composer .action-kind { min-width: max-content; min-height: 30px; padding: 0 12px; border-color: rgba(101,80,51,.76); border-radius: 7px 2px 7px 2px; background: #17130f; background-image: none; color: #bfae94; font-size: 10px; }
.composer .action-kind.active { border-color: #d6ae67; background: #6a4b25; background-image: none; color: #f0d499; }
.composer .fallbacks { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; padding-top: 11px; }
.composer .fallbacks .event-label { flex: 0 0 100%; margin-bottom: 1px; text-align: center; }
.composer .fallbacks .choice { width: max-content; min-height: 32px; margin: 0; padding: 5px 16px; border-color: #6a5638; border-radius: 8px 2px 8px 2px; background: #17130f; background-image: none; color: #c8b698; font-size: 11px; }

.sheet {
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid #987440;
  border-radius: 4px;
  background: linear-gradient(rgba(25,20,15,.98), rgba(9,8,7,.98));
}
.sheet h2 { color: #ead7ad; font-weight: 400; }
.sheet .confirm { border-color: #f0cd88; border-radius: 24px; background: linear-gradient(#f4d99c, #c99b50); }
.choice-secrecy { color: #8f8576; font-size: 12px; line-height: 1.6; }

.director-notice {
  position: absolute;
  z-index: 20;
  top: 126px;
  right: 14px;
  width: min(224px, calc(100% - 28px));
  border: 1px solid rgba(190,145,72,.7);
  border-radius: 12px 2px 12px 2px;
  background: linear-gradient(145deg, rgba(31,25,18,.96), rgba(8,8,8,.97));
  box-shadow: 0 12px 34px rgba(0,0,0,.46), inset 0 0 20px rgba(175,126,55,.05);
  animation: director-notice-in .18s ease-out;
}
@keyframes director-notice-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.director-notice-main {
  display: grid;
  width: 100%;
  min-height: 74px;
  padding: 11px 34px 11px 13px;
  border: 0;
  background: transparent;
  color: #e9d4a8;
  text-align: left;
  cursor: pointer;
}
.director-notice-main small { color: #c89d51; font: 500 9px/1.2 system-ui, sans-serif; letter-spacing: .16em; }
.director-notice-main strong { margin-top: 3px; font: 500 15px/1.35 "Songti SC", STSong, serif; letter-spacing: .06em; }
.director-notice-main span { margin-top: 4px; color: #9f927e; font: 400 10px/1.35 system-ui, sans-serif; }
.director-notice-main:hover { background: rgba(200,157,81,.07); }
.director-notice-dismiss {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #a99a82;
  font-size: 18px;
  cursor: pointer;
}
.director-notice.is-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  min-width: 166px;
  padding: 10px 12px;
  pointer-events: none;
}
.director-notice.is-loading > i {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 1px solid rgba(200,157,81,.28);
  border-top-color: #d6ae67;
  border-radius: 50%;
  animation: director-notice-spin .8s linear infinite;
}
@keyframes director-notice-spin { to { transform: rotate(360deg); } }
.director-notice.is-loading > span { display: grid; gap: 3px; }
.director-notice.is-loading strong { color: #d9c49b; font: 500 11px/1.2 system-ui, sans-serif; }
.director-notice.is-loading small { color: #8f8576; font: 400 9px/1.2 system-ui, sans-serif; }

.director-sheet {
  position: absolute;
  z-index: 24;
  left: 14px;
  right: 14px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  max-height: calc(100% - 120px);
  overflow: auto;
  padding: 22px 18px 18px;
  border: 1px solid #9d7a43;
  background: linear-gradient(150deg, rgba(31,25,18,.98), rgba(7,8,9,.99));
  box-shadow: 0 24px 70px rgba(0,0,0,.72), inset 0 0 30px rgba(175,126,55,.08);
}
.director-sheet h2 { margin: 8px 0 12px; color: #ead7ad; font: 500 22px/1.3 "Songti SC", STSong, serif; }
.director-sheet p { color: #eee5d7; line-height: 1.75; }
.director-sheet > small { display: block; color: #aa9d89; line-height: 1.5; }
.director-sheet ul { margin: 14px 0; padding: 12px 12px 12px 30px; border: 1px solid rgba(184,145,78,.3); color: #cfbc98; line-height: 1.8; }
.director-sheet .primary { width: min(100%, 260px) !important; min-height: 48px; margin: 18px auto 0 !important; }
.director-close { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border: 0; background: transparent; color: #cbb992; font-size: 24px; }

.director-event-stage .backdrop { filter: brightness(.42) saturate(.75); }
.event-script-card {
  position: absolute;
  z-index: 8;
  left: 14px;
  right: 14px;
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  max-height: calc(100% - 120px);
  overflow: auto;
  padding: 22px 18px;
  border: 1px solid #9d7a43;
  background: linear-gradient(rgba(22,17,13,.95), rgba(7,7,7,.99));
  box-shadow: 0 -20px 55px rgba(0,0,0,.5);
}
.event-script-card .stage-direction { color: #aa9d89; font-size: 13px; font-style: italic; }
.event-script-card blockquote { margin: 12px 0; color: #f2e4c6; font: 500 20px/1.75 "Songti SC", STSong, serif; }
.sidequest-situation { margin: 0 0 16px; padding: 11px 12px 12px; border: 1px solid rgba(200,157,81,.34); background: rgba(139,98,36,.08); }
.sidequest-situation small { display: block; margin-bottom: 5px; color: #c89d51; font-size: 11px; letter-spacing: .16em; }
.sidequest-situation p { margin: 0; color: #ddd0b8; font-size: 13px; line-height: 1.65; }
.mission-objective { display: grid; gap: 4px; margin: 16px 0 12px; padding: 12px; border-left: 2px solid #c89d51; background: rgba(139,98,36,.1); }
.mission-objective small, .mission-objective span { color: #9f927e; font-size: 11px; }
.mission-objective strong { color: #e6d1aa; font-weight: 500; }
.event-strategies { display: grid; gap: 8px; }
.event-strategies button, .event-exit { min-height: 46px; padding: 10px 14px; border: 1px solid #8f6e3c; background: rgba(22,24,34,.94); color: #ebd8b4; text-align: left; }
.event-exit { width: 100%; margin-top: 10px; border-color: #4e493f; background: rgba(8,8,8,.82); color: #9b9284; }

/* Intent-first strategy buttons render as tight tags; the full narrative
   only surfaces after the player commits to that intent. */
.event-strategies.intent-strategies button {
  font: 500 15px/1.55 "Songti SC", STSong, serif;
  letter-spacing: .06em;
  padding: 12px 14px;
}
.event-strategies.intent-strategies button:hover {
  border-color: #d6ae67;
  color: #f5e1b0;
}

/* Intent-preview overlay reuses the profile modal base but renders on top
   of the whole event card so the narrative gets the player's full focus. */
.intent-preview-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: rgba(6,5,3,.72);
  backdrop-filter: blur(2px);
  animation: onboarding-fade-in .22s ease-out;
}
.intent-preview-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  padding: 22px 22px 20px;
  border: 1px solid rgba(214,174,103,.55);
  background: linear-gradient(180deg, rgba(34,27,18,.98), rgba(21,17,12,.98));
  color: #ead7ad;
  box-shadow: 0 18px 44px rgba(0,0,0,.55);
}
.intent-preview-card small {
  display: block;
  color: #c89d51;
  font-size: 11px;
  letter-spacing: .22em;
}
.intent-preview-card h3 {
  margin: 6px 0 12px;
  font: 500 20px/1.35 "Songti SC", STSong, serif;
  color: #f5e1b0;
}
.intent-preview-scroll {
  max-height: 40vh;
  overflow-y: auto;
  padding-right: 4px;
}
.intent-preview-scroll p {
  margin: 0;
  color: #ead7ad;
  font: 400 15px/1.85 "Kaiti SC", KaiTi, serif;
  text-indent: 2em;
  text-align: justify;
}
.intent-preview-card footer {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.intent-preview-card footer button {
  flex: 1;
  min-height: 42px;
  padding: 10px 12px;
  font: 500 14px/1.4 "Songti SC", STSong, serif;
  letter-spacing: .1em;
  cursor: pointer;
}
.intent-preview-back {
  border: 1px solid #4e493f;
  background: rgba(8,8,8,.82);
  color: #9b9284;
}
.intent-preview-back:hover { color: #ead7ad; border-color: #8f6e3c; }
.intent-preview-confirm {
  border: 1px solid #d6ae67;
  background: linear-gradient(180deg, rgba(201,155,80,.28), rgba(139,98,36,.22));
  color: #f5e1b0;
}
.intent-preview-confirm:hover { background: linear-gradient(180deg, rgba(214,174,103,.42), rgba(158,110,42,.34)); }
.intent-preview-confirm:disabled, .intent-preview-back:disabled { opacity: .5; cursor: not-allowed; }

/* Decision timeline / world-line rewind. */
.story-timeline-stage {
  overflow: hidden;
  background: radial-gradient(circle at 50% 20%, #1c5551 0, #102f32 42%, #071517 100%);
  color: #efe5cd;
}
.story-timeline-stage .backdrop { opacity: .18; filter: blur(3px) saturate(.7); }
.story-timeline-stage .wash {
  background:
    radial-gradient(circle at 18% 16%, rgba(230,194,104,.18), transparent 24%),
    linear-gradient(180deg, rgba(8,35,37,.3), rgba(4,15,17,.93));
}
.timeline-header {
  position: absolute;
  z-index: 8;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: max(27px, calc(env(safe-area-inset-top) + 14px)) 18px 17px;
  border-bottom: 1px solid rgba(218,177,93,.34);
  background: linear-gradient(180deg, rgba(6,21,22,.96), rgba(6,21,22,.68));
  backdrop-filter: blur(12px);
}
.timeline-header > button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(218,177,93,.68);
  border-radius: 50%;
  background: rgba(5,19,20,.62);
  color: #e7c77f;
  font-size: 25px;
}
.timeline-header small { color: #b8a87c; font: 400 10px/1.3 system-ui, sans-serif; letter-spacing: .12em; }
.timeline-header h1 { margin: 4px 0 0; color: #f3d99d; font: 500 27px/1.1 "Songti SC", STSong, serif; letter-spacing: .14em; }
.timeline-map {
  position: absolute;
  z-index: 7;
  inset: 105px 0 47px;
  padding: 24px 18px 42px 46px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.timeline-map::before {
  content: "";
  position: absolute;
  top: 38px;
  bottom: 55px;
  left: 31px;
  width: 1px;
  background: linear-gradient(#e0b967, rgba(86,150,141,.74), #e0b967);
  box-shadow: 0 0 14px rgba(100,204,190,.35);
}
.timeline-origin,
.timeline-current {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: #d9c18b;
  font: 500 13px/1.4 "Songti SC", STSong, serif;
  letter-spacing: .12em;
}
.timeline-origin > i,
.timeline-current > i {
  position: absolute;
  left: -21px;
  width: 11px;
  height: 11px;
  border: 2px solid #efca78;
  border-radius: 50%;
  background: #173f3e;
  box-shadow: 0 0 0 5px rgba(222,181,94,.09), 0 0 13px rgba(237,196,105,.46);
}
.timeline-nodes { display: grid; gap: 13px; margin: 13px 0; }
.timeline-node {
  position: relative;
  width: 100%;
  min-height: 102px;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 13px 12px 13px 10px;
  border: 1px solid rgba(210,173,94,.5);
  border-radius: 5px 20px 5px 20px;
  background: linear-gradient(120deg, rgba(34,75,69,.94), rgba(20,46,48,.88));
  color: #efe3c9;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(248,220,153,.035), 0 8px 24px rgba(0,0,0,.25);
}
.timeline-node::before {
  content: "";
  position: absolute;
  left: -22px;
  width: 21px;
  height: 1px;
  background: #b9914c;
}
.timeline-node-index {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid rgba(230,190,104,.62);
  border-radius: 50%;
  color: #eacb87;
  font: 500 10px/1 system-ui, sans-serif;
}
.timeline-node-copy { min-width: 0; }
.timeline-node-copy small,
.timeline-node-copy strong,
.timeline-node-copy em { display: block; }
.timeline-node-copy small { color: #aebfae; font: 400 9px/1.3 system-ui, sans-serif; letter-spacing: .1em; }
.timeline-node-copy strong { margin-top: 5px; color: #f0ddb3; font: 500 14px/1.45 "Songti SC", STSong, serif; }
.timeline-node-copy em { margin-top: 6px; color: #d3ad65; font: normal 500 13px/1.4 "Kaiti SC", STKaiti, serif; }
.timeline-rewind { color: #bba673; font: 400 10px/1 system-ui, sans-serif; white-space: nowrap; }
.timeline-rewind b { color: #efca78; font-size: 19px; vertical-align: -2px; }
.timeline-node:disabled { opacity: .55; }
.timeline-current { min-height: 52px; display: grid; gap: 2px; padding-left: 2px; }
.timeline-current span { color: #9cae9e; font: 400 9px/1 system-ui, sans-serif; letter-spacing: .13em; }
.timeline-current strong { color: #e9c978; font: 500 15px/1.4 "Songti SC", STSong, serif; }
.timeline-empty { margin: 28px 0; padding: 34px 24px; border: 1px dashed rgba(212,177,99,.38); text-align: center; color: #b9ad91; }
.timeline-empty strong { color: #e8d2a1; }
.timeline-empty p { margin: 8px 0 0; font-size: 12px; line-height: 1.65; }
.timeline-legend {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(218,177,93,.22);
  background: rgba(5,18,19,.92);
  color: #918c7d;
  font: 400 9px/1 system-ui, sans-serif;
}
.timeline-legend span:first-child { color: #c3ad79; }
.timeline-confirm {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2,10,11,.77);
  backdrop-filter: blur(8px);
}
.timeline-confirm > section {
  width: min(100%, 390px);
  padding: 25px 22px 20px;
  border: 1px solid rgba(225,185,99,.72);
  border-radius: 20px 5px 20px 5px;
  background: linear-gradient(145deg, #173c3a, #0b2022);
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.timeline-confirm small { color: #d9b86f; letter-spacing: .16em; }
.timeline-confirm h3 { margin: 9px 0 12px; color: #f1d99e; font: 500 21px/1.45 "Songti SC", STSong, serif; }
.timeline-confirm p { margin: 0; color: #c8bea8; font: 400 13px/1.75 system-ui, sans-serif; }
.timeline-confirm div { display: grid; grid-template-columns: 1fr 1.2fr; gap: 10px; margin-top: 20px; }
.timeline-confirm button { min-height: 44px; border-radius: 16px 3px 16px 3px; }
#timeline-cancel { border: 1px solid rgba(183,164,124,.35); background: transparent; color: #bcb39e; }
#timeline-confirm { border: 1px solid #e1bb6a; background: linear-gradient(#dcb65f, #9f7537); color: #1a1710; font-weight: 700; }
.cue-timeline-toggle {
  position: absolute;
  z-index: 9;
  top: max(16px, env(safe-area-inset-top));
  left: 16px;
  min-height: 38px;
  border: 1px solid rgba(214,174,103,.5);
  background: rgba(6,15,15,.64);
  color: #ddc58f;
}
.hud > div { display: flex; gap: 8px; }
.settlement-timeline,
.performance-timeline { width: 100%; min-height: 42px; margin: 0 0 10px; border: 1px solid rgba(214,174,103,.48); background: rgba(8,25,24,.66); color: #dcc58f; }

@media (max-height: 720px) {
  .intent-preview-scroll { max-height: 34vh; }
  .intent-preview-scroll p { font-size: 14px; line-height: 1.7; }
}

@media (max-width: 390px) {
  .story-topbar { padding-inline: 12px; }
  .stage .stat-ribbon { left: 12px; right: 12px; }
  .reading-mode .dialogue { left: 12px; right: 62px; padding: 16px 15px 44px; }
  .choice-decision { padding-inline: 22px 62px; }
  .choice-footer { left: 18px; right: 62px; }
  .composer { left: 12px; right: 62px; padding: 0; }
  .story-rail { right: 6px; }
}

/* First-time onboarding: highlight the "?" character-help button
   on the first character prelude that exposes a biography. */
.character-help.is-onboarding {
  position: relative;
  z-index: 40;
  border-color: rgba(245,222,167,.95);
  color: #fff3c8;
  background: rgba(30,20,10,.72);
  box-shadow:
    0 0 0 2px rgba(214,174,103,.7),
    0 0 22px 6px rgba(214,174,103,.55),
    0 6px 20px rgba(0,0,0,.55);
  animation: character-help-pulse 1.6s ease-in-out infinite;
}
@keyframes character-help-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 2px rgba(214,174,103,.65), 0 0 18px 4px rgba(214,174,103,.5), 0 6px 20px rgba(0,0,0,.55); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 3px rgba(245,222,167,.9), 0 0 30px 10px rgba(214,174,103,.7), 0 8px 26px rgba(0,0,0,.6); }
}

.onboarding-overlay {
  position: absolute;
  z-index: 25;
  inset: 0;
  background: rgba(4,4,3,.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: onboarding-fade-in .32s ease;
  cursor: pointer;
}
@keyframes onboarding-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.onboarding-spotlight {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(245,222,167,.9);
  box-shadow:
    0 0 0 9999px rgba(4,4,3,.05),
    0 0 24px 6px rgba(214,174,103,.55),
    inset 0 0 12px rgba(245,222,167,.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: onboarding-halo 1.8s ease-in-out infinite;
}
@keyframes onboarding-halo {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(4,4,3,.05), 0 0 22px 6px rgba(214,174,103,.5), inset 0 0 10px rgba(245,222,167,.3); }
  50% { box-shadow: 0 0 0 9999px rgba(4,4,3,.05), 0 0 34px 12px rgba(214,174,103,.75), inset 0 0 16px rgba(245,222,167,.5); }
}
.onboarding-arrow {
  position: absolute;
  width: 2px;
  height: 42px;
  background: linear-gradient(to bottom, rgba(214,174,103,.05), rgba(245,222,167,.9));
  transform: translateX(-50%);
  pointer-events: none;
}
.onboarding-arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  width: 10px;
  height: 10px;
  border-top: 2px solid rgba(245,222,167,.95);
  border-left: 2px solid rgba(245,222,167,.95);
  transform: translate(-50%, 0) rotate(45deg);
}
.onboarding-tip {
  position: absolute;
  left: 50%;
  width: min(84%, 320px);
  padding: 18px 20px 16px;
  border: 1px solid rgba(214,174,103,.72);
  border-radius: 18px 4px 18px 4px;
  background: linear-gradient(145deg, rgba(36,27,18,.96), rgba(10,9,7,.97));
  box-shadow: inset 0 0 0 1px rgba(255,231,174,.06), 0 22px 60px rgba(0,0,0,.6);
  color: #eee2ca;
  font-family: "Songti SC", STSong, serif;
  text-align: left;
  transform: translateX(-50%);
  cursor: default;
}
.onboarding-tip small { display: block; color: #d6ae67; letter-spacing: .18em; font-size: 11px; }
.onboarding-tip h3 { margin: 8px 0 8px; color: #f5e1b0; font-size: 20px; font-weight: 500; letter-spacing: .06em; }
.onboarding-tip p { margin: 0 0 14px; color: #e3d5bb; font-size: 14px; line-height: 1.75; }
.onboarding-cta {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 18px;
  border: 1px solid rgba(214,174,103,.7);
  border-radius: 999px;
  background: rgba(214,174,103,.14);
  color: #f5e1b0;
  font: 500 13px/1 "Songti SC", STSong, serif;
  letter-spacing: .16em;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.onboarding-cta:hover,
.onboarding-cta:focus-visible {
  background: rgba(214,174,103,.28);
  border-color: rgba(245,222,167,.95);
  color: #fff3c8;
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .ink-wash { display: none; }
}

/* 此身为笔 retains the shared player and deterministic interaction layout. */
.chapter-resume { position:absolute; z-index:5; bottom:135px; left:12%; width:76%; padding:13px; border:1px solid #ac8a52; background:#242018e8; color:#e8d4ac; border-radius:8px; cursor:pointer; }
.legacy-save-entry { position:absolute; z-index:7; bottom:190px; left:12%; width:76%; min-height:44px; display:grid; place-items:center; color:#e8d4ac; font:12px/1.5 system-ui,sans-serif; text-shadow:0 2px 6px #000; }
.cishen-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:5px 8px; }
.cishen-stage .beat-progress { opacity:0; }
.cishen-stage { background:#d0c1a7; }
.cishen-stage .dynamic-portrait.static-portrait { object-fit:contain; object-position:center top; }
.cishen-stage .choice-decision--described { max-height:76%; overflow-y:auto; }
.settlement #enter-cishen { margin-bottom:12px; }

.cishen-stage .dynamic-portrait.static-portrait { top:142px; height:calc(100% - 142px); object-fit:cover; object-position:center 12%; }
.cishen-stage .cast-sheet .avatar { object-position:center 12%; }
.cishen-stage { background:#312b23; }
.cishen-stage.choice-mode .visual-copy { display:none; }
.cishen-stage .choice-decision--described { inset:150px 66px 24px 22px; max-height:none; padding:0; justify-content:center; }
.cishen-stage .choice-decision .choice { display:block; min-height:94px; padding:15px 18px; border:1px solid #9a7b48; border-radius:12px 3px; background:linear-gradient(135deg,#302821,#181713); text-align:left; box-shadow:0 5px 18px #0003; }
.cishen-stage .choice-decision .choice small { display:block; margin-top:8px; color:#d1c2aa; font:13px/1.65 'Songti SC',STSong,serif; }
.cishen-stage .choice-decision .choice.selected { background:#dbc091; color:#2a2118; }
.cishen-stage .choice-footer { margin-top:20px; }
@media (max-height:700px) { .cishen-stage .choice-decision--described { justify-content:flex-start; } .cishen-stage .choice-decision .choice { min-height:80px; padding:10px 14px; } }

.cishen-free { color:#d7c5a4; margin-top:15px; font-size:13px; }
.cishen-free summary { cursor:pointer; padding:8px; }
.cishen-free textarea { width:100%; min-height:68px; border:1px solid #8c7349; color:#f0e3c8; background:#171510; padding:10px; }
.cishen-free button { background:#29241c; border:1px solid #8c7349; color:#ead7b2; padding:9px 14px; border-radius:5px; }
.cishen-free p { font-size:13px; line-height:1.65; }
.cishen-stage .cast-avatar-button { width:52px; height:52px; align-self:start; padding:0; border:0; border-radius:50%; background:none; cursor:pointer; }
.cishen-stage .cast-avatar-button:focus-visible { outline:2px solid #e1c081; outline-offset:4px; }
.cishen-stage .cast-sheet .cast-member--text-only { grid-template-columns:1fr; }
.cishen-stage.has-character-overlay .global-story-rail { visibility:hidden; pointer-events:none; }
.chapter-character-card .chapter-bio-avatar { display:block; flex:0 0 auto; width:110px; height:130px; margin:16px auto 0; object-fit:cover; object-position:center 12%; border:1px solid #9f814c; border-radius:3px; background:#171410; }
.chapter-character-card .cast-bio-scroll { margin-top:14px; }
.chapter-sources-slot:empty { display:none; }

/* Independent scene plates and transparent actors. */
.cishen-stage .backdrop { object-fit:cover; object-position:center; opacity:1; }
.cishen-stage .dynamic-portrait.static-portrait { inset:auto 0 0; width:100%; height:calc(100% - 135px); object-fit:contain; object-position:center bottom; filter:drop-shadow(0 12px 14px #0003); opacity:1; }
.cishen-stage .wash { background:linear-gradient(180deg,#070705bb 0%,#07070522 23%,transparent 48%,#07070599 100%); }
.cishen-stage.choice-mode .wash { background:#0d0b08b3; }

.film::cue { color:#fff3dc; background:#15110de6; font-family:"Songti SC",serif; font-size:18px; }

.has-timed-subtitles .film-caption { display:none; }
.cishen-film .film { object-fit:contain; }
.cishen-film .global-story-rail { display:none; }
.cishen-film { overflow:clip; }
.cishen-film .ink-wash { display:none; }

/* A separate chapter card, before the first scene and its media cue. */
.chapter-title-page { background:#050505; color:#c9aa70; display:flex; align-items:center; justify-content:center; overflow:clip; text-align:center; font-family:"Songti SC",STSong,serif; }
.chapter-title-content { width:100%; padding:32px; transform:translateY(-24px); animation:chapter-title-reveal 1.4s ease-out both; }
.chapter-title-book { margin:0 0 30px; font-size:14px; letter-spacing:.55em; padding-left:.55em; color:#a78d5f; }
.chapter-title-rule { display:block; width:1px; height:46px; margin:0 auto 30px; background:linear-gradient(transparent,#967c4e); }
.chapter-title-number { margin:0 0 20px; font-size:13px; letter-spacing:.5em; padding-left:.5em; }
.chapter-title-page h1 { margin:0; font-size:clamp(32px,7vw,42px); font-weight:400; letter-spacing:.22em; padding-left:.22em; color:#dec28a; }
.chapter-title-era { margin:30px 0 0; font-size:12px; letter-spacing:.25em; color:#a78d5f; }
.chapter-title-prologue { margin:44px 0 0; font-size:14px; line-height:2.3; letter-spacing:.12em; color:#b69e73; }
.chapter-title-enter { position:absolute; bottom:max(9%,32px); padding:14px 26px; background:transparent; border:0; color:#c9aa70; font:15px "Songti SC",STSong,serif; letter-spacing:.35em; cursor:pointer; }
.chapter-title-enter:hover { color:#f0d8a2; }
.chapter-title-enter:focus-visible { outline:1px solid #c9aa70; outline-offset:5px; }
.chapter-title-enter:disabled { opacity:.5; cursor:wait; }
@keyframes chapter-title-reveal { from { opacity:0; } to { opacity:1; } }
@media (max-height:560px) { .chapter-title-content { transform:translateY(-20px); } .chapter-title-rule { height:20px; margin-bottom:16px; } .chapter-title-book { margin-bottom:16px; } .chapter-title-prologue { margin-top:20px; } .chapter-title-enter { bottom:12px; } }
@media (prefers-reduced-motion:reduce) { .chapter-title-content { animation:none; } }

.settlement .chapter-replay { display:block; width:auto; margin:18px auto 0; padding:9px 18px; border:1px solid #806c46; border-radius:4px; background:transparent; color:#c9b584; font:14px/1.5 "Songti SC",STSong,serif; letter-spacing:.1em; cursor:pointer; }
.settlement .chapter-replay:hover { border-color:#d6bb80; color:#f0d8a2; background:#c9aa700c; }
.settlement .chapter-replay:focus-visible { outline:2px solid #d6bb80; outline-offset:4px; }
.settlement .chapter-replay:disabled { opacity:.5; cursor:wait; }

/* Chapter outcomes: six authored variants, shared accessible live controls. */
.chapter-outcome { padding:0!important; background:#070908; overflow-y:auto; }
.outcome-backdrop { position:absolute; inset:0; background:linear-gradient(#040605b8,#040605b0 45%,#040605ed),url('./media/cishen-e02/scenes/office.png') center/cover; opacity:.6; }
.outcome-content { position:relative; z-index:2; width:100%; min-height:100%; padding:50px 28px 28px; display:flex; align-items:center; flex-direction:column; text-align:center; }
.chapter-outcome .outcome-kicker { font-size:12px; letter-spacing:.16em; color:#b99a60; margin:0 0 25px; }
.chapter-outcome h1 { color:#dfc181; font-size:clamp(38px,10vw,58px); font-weight:400; margin:0; letter-spacing:.12em; }
.outcome-emblem { width:245px; max-width:74%; height:235px; object-fit:contain; mix-blend-mode:screen; margin:14px 0; }
.chapter-outcome .outcome-line { margin:4px 0 16px; font-size:19px; color:#eadbc0; }
.outcome-prose { width:100%; max-width:440px; margin:0 0 30px; padding:8px 12px; color:#fff; font:17px/1.9 'Kaiti SC',STKaiti,serif; text-shadow:0 2px 8px #000; }
.outcome-actions { width:100%; max-width:350px; display:grid; gap:13px; }
.outcome-actions button { min-height:47px; padding:10px 20px; font:21px 'Kaiti SC',STKaiti,serif; letter-spacing:.16em; cursor:pointer; border:1px solid #a88a50; border-radius:16px 2px; }
.outcome-actions .outcome-next { color:#352811; background:linear-gradient(120deg,#a58047,#ead198,#b79250); box-shadow:inset 0 0 0 3px #e8d7a755,0 0 22px #cc9c4025; }
.outcome-actions .outcome-return { color:#d6bc83; background:#070908bb; }
.outcome-actions .chapter-replay { margin:0 auto; min-height:40px; font-size:13px; }
.outcome-actions button:focus-visible { outline:2px solid #ffe1a4; outline-offset:4px; }
.chapter-outcome .outcome-foot { margin:25px 0 0; color:#9c8354; font-size:12px; letter-spacing:.1em; }
@media(max-height:750px) { .outcome-content { padding-top:28px; } .outcome-emblem { height:175px; margin:8px 0; } }

.outcome-actions .outcome-next,.outcome-actions .outcome-return { border-radius:0; clip-path:polygon(6% 0,94% 0,100% 50%,94% 100%,6% 100%,0 50%); }
.outcome-actions .outcome-next::before,.outcome-actions .outcome-return::before { content:'◇'; float:left; }
.outcome-actions .outcome-next::after,.outcome-actions .outcome-return::after { content:'◇'; float:right; }
.outcome-content { min-height:100dvh; justify-content:center; }

.full-storyline { background:#0a0d0c; color:#e1d2b5; overflow-y:auto; padding:28px 22px 50px; }
.full-storyline header { position:relative; padding:15px 0 24px; border-bottom:1px solid #705d3a; }
.full-storyline header>button { position:absolute; right:0; top:0; font-size:28px; }
.full-storyline h1 { font:32px 'Kaiti SC',serif; color:#dfc181; }
.full-storyline p { font-size:14px; line-height:1.8; color:#b9b1a1; }
.full-storyline button { padding:10px 14px; background:#171b17; color:#dec58f; border:1px solid #7c6742; cursor:pointer; border-radius:4px; }
.full-storyline button:disabled { opacity:.4; cursor:default; }
.full-storyline button:focus-visible { outline:2px solid #e8cd8b; outline-offset:3px; }
.story-chapter { margin-top:28px; }
.story-chapter h2 { font-size:22px; color:#dec58f; }
.story-choice-node { margin:22px 0 0 7px; padding:0 0 22px 18px; border-left:1px solid #6d5937; }
.story-choice-node h3 { font-size:17px; line-height:1.7; }
.story-choice-node ul { padding-left:18px; font-size:14px; line-height:1.9; color:#aaa89e; }
.story-choice-node li.was-chosen { color:#eed092; }

.story-jumps { display:flex; gap:12px; margin:20px 0; } .story-jumps a { color:#dec58f; border-bottom:1px solid #7c6742; padding:6px 12px; text-decoration:none; }

/* Dialogue portraits use bust framing; scene plates and cinematic clips keep their framing. */
.stage .dynamic-portrait:not(.static-portrait) { inset:5% auto auto 50%; width:150%; height:150%; max-width:none; transform:translateX(-50%); object-fit:cover; object-position:center top; }
.character-prelude .character-art { inset:0 auto auto 50%; width:140%; height:140%; max-width:none; transform:translateX(-50%); object-fit:cover; object-position:center 18%; }
.stage,.narrative-prelude,.character-prelude { overflow:hidden; }

.chapter-opening-page { background:#0b0d0b; padding:48px 30px 30px; color:#ece4d5; overflow-y:auto; display:flex; flex-direction:column; }
.chapter-opening-page header { margin-bottom:24px; }
.chapter-opening-page header small { color:#baa16d; letter-spacing:.15em; }
.chapter-opening-page h1 { font:32px 'Kaiti SC',STKaiti,serif; color:#dec18a; margin:20px 0 12px; }
.chapter-opening-page header p { color:#9f937d; font-size:12px; }
.chapter-opening-page article { font:19px/2 'Kaiti SC',STKaiti,serif; }
.chapter-opening-page article p { margin:0 0 1.3em; text-indent:2em; }
.chapter-opening-page nav { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-top:auto; padding-top:24px; }
.chapter-opening-page nav button { background:transparent; border:1px solid #756240; color:#d8bd83; padding:12px; cursor:pointer; }
.chapter-opening-page nav span { color:#9f937d; font-size:12px; }
.chapter-opening-page button:focus-visible { outline:2px solid #eed296; outline-offset:3px; }
.chapter-opening-page button:disabled { opacity:.5; }
@media(max-height:750px) { .chapter-opening-page { padding:26px 24px; } .chapter-opening-page article { font-size:17px; line-height:1.9; } }

/* Authored chapters share a readable, scrollable layout at every option count. */
.cishen-stage .choice-decision--described {
  justify-content:flex-start;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding-right:3px;
  scrollbar-width:thin;
  scrollbar-color:#806c46 transparent;
}
.cishen-stage .choice-list,
.cishen-stage .chapter-choice-context,
.cishen-stage .cishen-free,
.cishen-stage .choice-footer { flex-shrink:0; }
.chapter-choice-context h2 { margin:0 0 12px; color:#eadab8; font:20px/1.6 "Kaiti SC",STKaiti,serif; }
.chapter-choice-context p { margin:0 0 18px; color:#bba886; font:12px/1.6 "Songti SC",STSong,serif; }
.chapter-choice-context strong { color:#efd29a; }
.cishen-stage .choice-footer { position:static; margin:20px 0 6px; }
.cishen-stage .choice .choice-cost { display:inline-block; margin-top:11px; color:#dbbc7c; font:12px/1.4 "Songti SC",STSong,serif; }
.cishen-stage .choice .choice-payment-note { display:block; margin-top:7px; color:#f0c2a0; font:12px/1.7 "Songti SC",STSong,serif; }
.cishen-stage .choice.selected .choice-cost,
.cishen-stage .choice.selected .choice-payment-note { color:#5a3b1f; }
.cishen-stage .choice.choice-unaffordable { opacity:.7; cursor:not-allowed; }
.chapter-choice-error { padding:12px; border-left:2px solid #d5a066; color:#f0c2a0; font:13px/1.8 "Songti SC",STSong,serif; }
.cishen-free button:disabled { opacity:.5; cursor:not-allowed; }
.chapter-sources { margin:18px 0; color:#b9a785; font:13px/1.8 "Songti SC",STSong,serif; text-align:left; }
.chapter-sources summary { cursor:pointer; width:fit-content; color:#d6bc83; }
.chapter-sources ul { margin:8px 0 0; padding-left:18px; }
.chapter-sources p { margin:4px 0; }
.chapter-sources a { color:#ddc99e; text-underline-offset:3px; overflow-wrap:anywhere; }
.chapter-sources a:focus-visible { outline:1px solid #ddc99e; outline-offset:4px; }
.authored-reading-page { padding-bottom:max(30px,env(safe-area-inset-bottom)); }
.authored-reading-page article { white-space:pre-line; }
.authored-reading-page nav { position:sticky; bottom:0; background:linear-gradient(transparent,#0b0d0b 25%); padding-top:26px; }
.authored-reading-page nav button { min-height:44px; }
.outcome-backdrop { width:100%; height:100%; object-fit:cover; filter:brightness(.33) saturate(.7); pointer-events:none; }
.outcome-glyph { display:grid; place-items:center; width:170px; height:170px; flex:0 0 auto; margin:28px 0; border:1px solid #a88a50; border-radius:50%; box-shadow:inset 0 0 0 8px #070908,inset 0 0 0 9px #77613b; color:#d7ba7c; font:75px/1 "Kaiti SC",STKaiti,serif; }
.outcome-prose { white-space:pre-line; }
.outcome-actions button:disabled { opacity:.55; cursor:wait; }

/* The new chapter plates use separate scenery, transparent gold art, and live type.
   Scope every rule so the six existing chapter outcomes retain their layout. */
.chapter-outcome--illustrated { isolation:isolate; background:#060706; }
.chapter-outcome--illustrated .outcome-backdrop {
  background:none;
  opacity:1;
  filter:brightness(.76) saturate(.72);
  object-position:center top;
}
.chapter-outcome--illustrated .outcome-scrim {
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(ellipse at 50% 36%,#04050491 0%,#04050463 43%,transparent 78%),
    linear-gradient(180deg,#04050470 0%,#04050466 38%,#040504a3 65%,#040504eb 100%);
}
.chapter-outcome--illustrated .outcome-content {
  min-height:100dvh;
  padding:clamp(30px,5dvh,56px) 6% max(22px,env(safe-area-inset-bottom));
  justify-content:flex-start;
}
.chapter-outcome--illustrated .outcome-content > * { flex-shrink:0; }
.chapter-outcome--illustrated .outcome-kicker {
  margin:0 0 18px;
  color:#b99a62;
  font:12px/1.65 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.13em;
  text-shadow:0 2px 12px #000;
}
.chapter-outcome--illustrated h1 {
  max-width:100%;
  margin:0;
  padding-left:.08em;
  color:#ddc187;
  font:400 clamp(36px,10.8vw,55px)/1.18 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.08em;
  text-shadow:0 2px 20px #000,0 0 22px #e3bd5420;
  text-wrap:balance;
}
.chapter-outcome--illustrated .outcome-emblem {
  display:block;
  width:78%;
  max-width:350px;
  height:clamp(210px,30dvh,310px);
  margin:17px 0;
  object-fit:contain;
  mix-blend-mode:normal;
  filter:drop-shadow(0 3px 12px #0008);
}
.chapter-outcome--illustrated .outcome-line {
  max-width:100%;
  margin:0 0 14px;
  color:#eee4cf;
  font:clamp(17px,4.3vw,21px)/1.65 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.035em;
  text-shadow:0 2px 10px #000;
  text-wrap:balance;
}
.chapter-outcome--illustrated .outcome-prose {
  width:100%;
  max-width:430px;
  margin:0 0 24px;
  padding:0;
  border:0;
  background:none;
  box-shadow:none;
  color:#fff;
  font:clamp(15px,3.85vw,18px)/1.85 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.025em;
  text-wrap:pretty;
}
.chapter-outcome--illustrated .outcome-actions {
  max-width:360px;
  width:94%;
  gap:12px;
}
.chapter-outcome--illustrated .outcome-actions button {
  position:relative;
  width:100%;
  min-height:48px;
  padding:10px 24px;
  font:20px/1.35 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.15em;
}
.chapter-outcome--illustrated .outcome-actions .outcome-next {
  min-height:54px;
  margin:0;
  border:1px solid transparent;
  border-radius:0;
  color:#392d16;
  background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201000%20150%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22gold%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%22.2%22%3E%3Cstop%20stop-color%3D%22%23aa874b%22%2F%3E%3Cstop%20offset%3D%22.34%22%20stop-color%3D%22%23e2cb90%22%2F%3E%3Cstop%20offset%3D%22.72%22%20stop-color%3D%22%23d0b277%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23a88549%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M62%203H938L995%2075L938%20147H62L5%2075Z%22%20fill%3D%22url(%23gold)%22%20stroke%3D%22%23efdaa3%22%20stroke-width%3D%221.2%22%20stroke-linejoin%3D%22round%22%20vector-effect%3D%22non-scaling-stroke%22%2F%3E%3Cpath%20d%3D%22M70%2012H930L979%2075L930%20138H70L21%2075Z%22%20fill%3D%22none%22%20stroke%3D%22%23f3deb9%22%20stroke-width%3D%22.9%22%20stroke-linejoin%3D%22round%22%20vector-effect%3D%22non-scaling-stroke%22%2F%3E%3C%2Fsvg%3E") center / 100% 100% no-repeat border-box;
  box-shadow:none;
  text-shadow:0 1px 0 #e9d6a077;
}
.chapter-outcome--illustrated .outcome-actions .outcome-return {
  color:#d3b984;
  border-color:transparent;
  background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%201000%20150%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22gold%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%221%22%20y2%3D%22.2%22%3E%3Cstop%20stop-color%3D%22%23aa874b%22%2F%3E%3Cstop%20offset%3D%22.34%22%20stop-color%3D%22%23e2cb90%22%2F%3E%3Cstop%20offset%3D%22.72%22%20stop-color%3D%22%23d0b277%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%23a88549%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20d%3D%22M62%203H938L995%2075L938%20147H62L5%2075Z%22%20fill%3D%22%2304060596%22%20stroke%3D%22%23b99a5f%22%20stroke-width%3D%221.2%22%20stroke-linejoin%3D%22round%22%20vector-effect%3D%22non-scaling-stroke%22%2F%3E%3Cpath%20d%3D%22M70%2012H930L979%2075L930%20138H70L21%2075Z%22%20fill%3D%22none%22%20stroke%3D%22%23806940%22%20stroke-width%3D%22.9%22%20stroke-linejoin%3D%22round%22%20vector-effect%3D%22non-scaling-stroke%22%2F%3E%3C%2Fsvg%3E") center / 100% 100% no-repeat border-box;
  box-shadow:none;
}
.chapter-outcome--illustrated .outcome-next::before,
.chapter-outcome--illustrated .outcome-return::before,
.chapter-outcome--illustrated .outcome-next::after,
.chapter-outcome--illustrated .outcome-return::after {
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  float:none;
  font-size:15px;
  line-height:1;
}
.chapter-outcome--illustrated .outcome-next::before,
.chapter-outcome--illustrated .outcome-return::before { left:15px; }
.chapter-outcome--illustrated .outcome-next::after,
.chapter-outcome--illustrated .outcome-return::after { right:15px; }
.chapter-outcome--illustrated .outcome-actions .chapter-replay:not(.outcome-replay-primary) {
  width:fit-content;
  min-height:36px;
  margin:0 auto;
  padding:6px 10px;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
  color:#baaa89;
  font-size:13px;
  letter-spacing:.1em;
  text-decoration:underline;
  text-underline-offset:5px;
}
.chapter-outcome--illustrated .outcome-actions button:hover:not(:disabled) { filter:brightness(1.14); }
.chapter-outcome .outcome-cycle-note {
  margin:0;
  color:#b7b0a1;
  font:12px/1.7 "Songti SC",STSong,serif;
  letter-spacing:.02em;
  text-wrap:balance;
}
.epilogue-stage .recorded-caption {
  margin:0 0 8px;
  color:#cab987;
  font:12px/1.5 "Songti SC",STSong,serif;
  letter-spacing:.04em;
}
.epilogue-stage .recorded-caption span { display:block; color:#b6ad96; font-size:11px; }
.epilogue-stage .recorded-portrait { filter:saturate(.85); }
.recorded-empty { padding:18px; color:#c9bea4; font:15px/1.8 "Songti SC",STSong,serif; }
.epilogue-kept-record { width:100%; margin:0 0 22px; color:#e8e0cf; }
.epilogue-kept-record p { margin:0 0 10px; font:13px/1.6 "Songti SC",STSong,serif; color:#c5b388; }
.epilogue-kept-record blockquote { margin:0; font:17px/1.8 "Kaiti SC",STKaiti,serif; white-space:pre-wrap; overflow-wrap:anywhere; }
.chapter-outcome--illustrated .outcome-actions button:focus-visible {
  outline:2px solid #fff0c3;
  outline-offset:-6px;
}
.chapter-outcome--illustrated .outcome-foot {
  margin:auto 0 0;
  padding-top:24px;
  color:#a28a5a;
  font:12px/1.7 "Kaiti SC",STKaiti,KaiTi,serif;
  letter-spacing:.08em;
  text-wrap:balance;
}
.chapter-outcome--illustrated .outcome-full-story {
  width:100%;
  max-width:430px;
  margin:-12px 0 24px;
  color:#d7c093;
  border:0;
  background:none;
}
.outcome-full-story summary {
  width:fit-content;
  margin:0 auto;
  padding:8px 10px;
  cursor:pointer;
  font:14px/1.6 "Kaiti SC",STKaiti,KaiTi,serif;
  text-underline-offset:4px;
}
.outcome-full-story summary:hover { text-decoration:underline; }
.outcome-full-story summary:focus-visible { outline:1px solid #d7c093; outline-offset:3px; }
.chapter-outcome--illustrated .outcome-prose--full {
  margin:16px 0 0;
  text-align:left;
  line-height:2;
  overflow-wrap:anywhere;
}
@media(max-height:750px) {
  .chapter-outcome--illustrated .outcome-content { padding-top:28px; }
  .chapter-outcome--illustrated .outcome-emblem { height:195px; margin:14px 0; }
  .chapter-outcome--illustrated .outcome-kicker { margin-bottom:14px; }
}
@media(prefers-reduced-motion:reduce) {
  .chapter-outcome--illustrated * { scroll-behavior:auto; }
}
.story-jumps { flex-wrap:wrap; gap:6px; }
.story-jumps a { padding:6px 9px; }
.full-storyline .story-chapter { scroll-margin-top:18px; }
@media(max-height:700px) {
  .cishen-stage .choice-decision--described { top:142px; }
  .chapter-choice-context h2 { font-size:18px; }
  .outcome-glyph { width:130px; height:130px; font-size:58px; margin:18px 0; }
}

/* Illustrated background reading: one anchored artwork, live text, independent scroll. */
.phone.intro-reading-page {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  isolation: isolate;
  background: #0b0e0d;
  color: #f3ead9;
}
.intro-reading-art, .intro-reading-scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.intro-reading-art { object-fit: cover; z-index: -3; }
.intro-reading-scrim {
  z-index: -2;
  background: linear-gradient(180deg, rgba(5,10,9,.45) 0%, rgba(5,10,9,.36) 35%, rgba(5,10,9,.22) 65%, rgba(5,10,9,.18) 86%, rgba(5,10,9,.62) 100%), linear-gradient(90deg, rgba(4,9,8,.18), transparent 85%);
}
.intro-reading-page::after {
  content: '';
  position: absolute;
  inset: 12px;
  z-index: -1;
  border: 1px solid rgba(201,167,99,.22);
  pointer-events: none;
}
.intro-reading-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #776743 transparent;
  scroll-padding-block: 20px;
  outline-offset: -5px;
}
.intro-reading-content {
  --art-reveal-space: 15vh;
  padding: max(42px, env(safe-area-inset-top)) 30px var(--art-reveal-space);
  background: linear-gradient(180deg, rgba(4,9,8,.58) 0%, rgba(4,9,8,.58) calc(100% - var(--art-reveal-space)), transparent 100%);
}
.intro-reading-page header { margin: 0 0 27px; }
.intro-reading-page header small {
  display: block;
  color: #dec38c;
  font-size: 12px;
  letter-spacing: .2em;
}
.intro-reading-page h1 {
  color: #efd6a3;
  font-family: 'STKaiti', 'Kaiti SC', KaiTi, serif;
  font-size: clamp(29px, 7.8vw, 39px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .06em;
  margin: 20px 0 15px;
  text-wrap: balance;
}
.intro-reading-page header p {
  color: #d0bd98;
  font-size: 12px;
  line-height: 1.8;
  margin: 0;
}
.intro-reading-page header::after {
  content: '';
  display: block;
  margin-top: 22px;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, #a58a54, rgba(165,138,84,.12));
}
.intro-reading-page article {
  font: 18px/1.95 'STKaiti', 'Kaiti SC', KaiTi, serif;
  letter-spacing: .025em;
  white-space: normal;
  color: #f7f0e2;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.intro-reading-page article p { margin: 0 0 1.25em; text-indent: 2em; overflow-wrap: anywhere; }
.intro-reading-page article p:last-child { margin-bottom: 0; }
.intro-reading-page .chapter-sources {
  margin: 25px 0 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid rgba(191,163,106,.35);
  background: transparent;
  color: #e0d1b5;
  font-size: 13px;
  line-height: 1.85;
  text-shadow: 0 1px 3px #000;
}
.intro-reading-page .chapter-sources summary { color: #e3c88e; cursor: pointer; min-height: 32px; }
.intro-reading-page .chapter-sources ul { padding-left: 20px; margin: 8px 0 0; }
.intro-reading-page .chapter-sources li { margin: 0 0 12px; }
.intro-reading-page .chapter-sources a { color: #eed6a5; text-underline-offset: 4px; overflow-wrap: anywhere; }
.intro-reading-page .chapter-sources p { margin: 8px 0 0; }
.intro-reading-page nav {
  position: relative;
  bottom: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 0;
  padding: 18px 24px max(25px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(4,8,7,.76) 38%, rgba(4,8,7,.92));
}
.intro-reading-page nav > span { font-size: 11px; color: #e0c991; letter-spacing: .06em; white-space: nowrap; }
.intro-reading-page nav button {
  min-height: 44px;
  padding: 10px 8px;
  border: 1px solid rgba(197,165,103,.65);
  border-radius: 1px;
  background: rgba(10,15,12,.40);
  color: #eed6a5;
  font: 14px/1.5 'STKaiti', 'Kaiti SC', KaiTi, serif;
  letter-spacing: .06em;
  white-space: normal;
  cursor: pointer;
}
.intro-reading-page nav button:last-child { background: rgba(135,107,53,.20); border-color: #b89a62; }
.intro-reading-page nav button:hover { background: rgba(166,137,78,.28); }
.intro-reading-page nav button:disabled { opacity: .55; cursor: wait; }
.intro-reading-page :focus-visible { outline: 2px solid #f0d597; outline-offset: 3px; }
.intro-reading-page .intro-reading-scroll:focus-visible { outline-offset: -5px; }
@media (max-width: 360px), (max-height: 680px) {
  .intro-reading-content { --art-reveal-space: 14vh; padding: 30px 24px var(--art-reveal-space); }
  .intro-reading-page h1 { font-size: 29px; margin-top: 17px; }
  .intro-reading-page header { margin-bottom: 22px; }
  .intro-reading-page article { font-size: 17px; line-height: 1.9; }
  .intro-reading-page nav { padding: 12px 20px max(18px, env(safe-area-inset-bottom)); gap: 8px; }
}

/* Chapter cast adopts the prologue's faction overview, grouped rows and biography sheet. */
.chapter-cast-sheet { inset: 64px 12px 18px; }
.chapter-cast-sheet > header { gap: 12px; }
.chapter-cast-sheet > header > div { min-width: 0; }
.chapter-cast-sheet > header > button { flex: 0 0 44px; color: #ead6b0; cursor: pointer; }
.chapter-cast-sheet h2 { font-size: 23px; }
.chapter-cast-sheet .cast-sheet-era { color: #bcad93; font-size: 11px; line-height: 1.6; margin: 8px 0 0; }
.chapter-cast-sheet .faction-versus { grid-template-columns: minmax(0,1fr) 28px minmax(0,1fr); }
.chapter-cast-sheet .faction-vs { writing-mode: vertical-rl; justify-self: center; line-height: 1.6; letter-spacing: .12em; font-family: 'Songti SC', serif; }
.chapter-cast-sheet .faction-pivot { grid-template-columns: auto minmax(0,1fr); border-radius: 7px; }
.chapter-cast-sheet .faction-pivot small { grid-column: 1 / -1; font-size: 11px; line-height: 1.6; }
.chapter-cast-sheet .faction-context p { grid-template-columns: 56px minmax(0,1fr); }
.chapter-cast-sheet .faction-group article { grid-template-columns: 48px minmax(0,1fr); gap: 10px; }
.chapter-cast-sheet .cast-avatar-button {
  display: block; width: 48px; height: 48px; align-self: start; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer;
}
.cast-portrait-frame {
  position: relative; display: block; width: 48px; height: 48px; overflow: hidden;
  border: 1px solid #bca16a; border-radius: 50%; background: #15151a;
  box-shadow: 0 4px 12px #0005; isolation: isolate;
}
.cast-portrait-frame .cast-portrait-image {
  position: absolute; display: block; width: var(--cast-face-scale, 240%); height: auto; max-width: none; max-height: none;
  left: var(--cast-face-x, 50%); top: 50%; transform: translate(-50%, var(--cast-face-y, -24%));
  object-fit: fill; pointer-events: none;
}
.cast-portrait-initial { display: grid; place-items: center; width: 100%; height: 100%; color: #e5c791; font: 24px 'Kaiti SC', STKaiti, serif; }
.chapter-cast-sheet .cast-body > small { font-size: 11px; line-height: 1.65; margin-top: 5px; }
.chapter-cast-sheet .cast-body .cast-member-relation { color: #c9bfae; }
.chapter-cast-sheet .cast-name-row { align-items: center; gap: 6px; }
.chapter-cast-sheet .cast-name-row strong { font-size: 15px; }
.chapter-cast-sheet .cast-bio-toggle { min-height: 32px; padding: 5px 9px; font-size: 11px; letter-spacing: .04em; }
.chapter-cast-sheet .cast-recorded-tag { display: inline-block; padding-top: 4px; color: #cfb681; }
.chapter-cast-sheet .recorded-empty { margin: 16px 0; color: #c9bca5; font: 15px/1.9 'Kaiti SC', STKaiti, serif; }
.chapter-cast-sheet :focus-visible, .chapter-cast-biography :focus-visible { outline: 2px solid #eed197; outline-offset: 3px; }
.chapter-cast-biography { max-height: min(82dvh, 700px); min-height: 0; padding: 26px 22px 22px; }
.chapter-cast-biography > small { padding-right: 28px; font-size: 11px; line-height: 1.75; }
.chapter-cast-bio-heading { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 16px; align-items: center; margin: 18px 0 12px; flex: 0 0 auto; }
.chapter-cast-bio-heading > div { min-width: 0; }
.chapter-cast-bio-heading h2 { margin: 0 0 7px; font-size: 27px; line-height: 1.3; }
.chapter-cast-bio-heading p { font-size: 12px; color: #cab996; line-height: 1.6; }
.cast-portrait-frame--large { width: 72px; height: 72px; }
.chapter-cast-biography .cast-bio-era { font-size: 12px; margin: 0 0 14px; }
.chapter-cast-biography .cast-bio-scroll { overscroll-behavior: contain; outline-offset: -2px; }
.chapter-cast-biography .cast-bio-scroll p { font-size: 15px; line-height: 1.85; margin: 0 0 15px; }
.chapter-cast-biography .cast-recorded-note { color: #c5b596; font-size: 13px !important; }
.cast-bio-relation { margin-top: 18px; border-top: 1px solid #b59a6444; padding-top: 14px; }
.cast-bio-relation h3 { margin: 0 0 8px; font: 15px 'Songti SC', serif; color: #dec18d; }
.chapter-cast-biography .character-profile-close { width: 40px; height: 40px; }
@media (max-width: 360px) {
  .chapter-cast-sheet { inset-inline: 8px; padding-inline: 12px; }
  .chapter-cast-sheet > header { margin-inline: -12px; padding-inline: 12px; }
  .chapter-cast-sheet .faction-overview { padding: 9px; }
  .chapter-cast-sheet .faction-group { padding-inline: 10px; }
  .chapter-cast-sheet .faction-group article { grid-template-columns: 42px minmax(0,1fr); gap: 9px; }
  .chapter-cast-sheet .cast-avatar-button, .chapter-cast-sheet .cast-portrait-frame { width: 42px; height: 42px; }
  .chapter-cast-sheet .faction-camp strong { font-size: 14px; }
  .chapter-cast-sheet .faction-camp p { font-size: 11px; }
  .global-bio-modal:has(.chapter-cast-biography) { padding: 16px; }
  .chapter-cast-biography { padding-inline: 18px; }
}
@media (max-height: 620px) {
  .chapter-cast-sheet { top: 20px; bottom: 12px; }
  .global-bio-modal:has(.chapter-cast-biography) { padding: 14px; }
  .chapter-cast-biography { max-height: calc(100dvh - 28px); padding-block: 20px 14px; }
  .chapter-cast-bio-heading { margin-block: 12px 8px; grid-template-columns: 52px minmax(0,1fr); gap: 12px; }
  .chapter-cast-biography .cast-portrait-frame--large { width: 52px; height: 52px; }
  .chapter-cast-bio-heading h2 { font-size: 23px; }
}
