:root {
  color-scheme: light;
  --ink: #242b29;
  --ink-deep: #162728;
  --paper: #f4efe4;
  --paper-lit: #faf5e9;
  --paper-muted: #ece4d3;
  --paper-line: #d7c9b1;
  --soft: #655c4e;
  --red: #8c382d;
  --red-dark: #732d26;
  --green: #3c675b;
  --gold: #a1814d;
  --serif: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Noto Serif SC', SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font: 1rem/1.65 var(--sans);
  background:
    radial-gradient(ellipse at 47% 0%, #fffcf1 0%, transparent 67%),
    repeating-linear-gradient(93deg, #75532405 0 1px, transparent 1px 6px),
    var(--paper);
}
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 2px solid #9b493c;
  outline-offset: 4px;
}
main:focus { outline: none; }
a { color: var(--red-dark); text-underline-offset: .2em; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.25; }
svg { flex: none; }
::selection { color: #fff4db; background: var(--red); }

.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  white-space: nowrap; clip-path: inset(50%);
}
.skip-link:focus { position: fixed; z-index: 5; left: 1rem; top: 1rem; padding: .65rem 1rem; background: var(--paper-lit); }
.shell { width: min(1200px, calc(100% - 8rem)); margin-inline: auto; }
.icon { vertical-align: middle; width: 1.25em; height: 1.25em; }
.eyebrow { color: var(--red-dark); font-size: .79rem; font-weight: 650; letter-spacing: .13em; }
.eyebrow i { display: inline-block; vertical-align: .15em; width: .43em; height: .43em; background: var(--red); transform: rotate(45deg); margin-right: .45em; }

.topbar { color: #f3e7cd; background: #152323; border-bottom: 1px solid #ae8c5755; }
.topbar-inner { width: min(1336px, calc(100% - 5.5rem)); height: 66px; margin-inline: auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.brand { display: flex; align-items: center; gap: .72rem; justify-self: start; padding: 0; border: 0; background: none; color: #f8ecd0; text-align: left; }
.brand span { display: flex; align-items: baseline; gap: .9rem; font: 700 1.45rem/1 var(--serif); letter-spacing: .08em; white-space: nowrap; }
.brand small { font: 400 .73rem/1 var(--sans); letter-spacing: .05em; color: #c6b794; }
.topbar nav { display: flex; align-self: stretch; align-items: stretch; gap: .65rem; }
.topbar nav button { position: relative; display: grid; place-items: center; padding: 0 1rem; border: 0; background: none; color: #d5c7a8; font-size: .9rem; letter-spacing: .12em; white-space: nowrap; }
.topbar nav button:hover, .topbar nav button[aria-current] { color: #fff2d2; }
.topbar nav button[aria-current]::after { content: ''; width: 1.6rem; height: 2px; position: absolute; bottom: 0; background: #c67c62; }
.sound-button { display: grid; place-items: center; justify-self: end; width: 41px; height: 41px; padding: 0; color: #d9cdad; background: #f5e3ba08; border: 1px solid #d9c39740; border-radius: 50%; }
.sound-button:hover, .sound-button[aria-pressed="true"] { background: #f5e3ba20; color: #fff1ce; }
.topbar button:focus-visible, .hero button:focus-visible { outline-color: #f0cb87; }

.hero { isolation: isolate; position: relative; display: grid; min-height: 466px; color: #f5e8ce; background: #233333; overflow: hidden; }
.hero-world { position: absolute; z-index: -1; inset: 0; background:
  linear-gradient(90deg, #152525f2 0%, #182525cf 24%, #17252582 44%, transparent 71%),
  linear-gradient(0deg, #13232288 0%, transparent 32%),
  url('art/palace.webp') center 51% / cover no-repeat; }
.hero-world::after { content: ''; position: absolute; inset: .95rem 1.15rem; border: 1px solid #e2c99529; pointer-events: none; }
.hero-content { position: relative; display: flex; align-items: center; padding: 2.7rem 0 3.1rem; }
.hero-copy { width: min(100%, 36rem); }
.hero-date { display: flex; align-items: center; flex-wrap: wrap; gap: .66rem; color: #dec796; font-size: .82rem; font-weight: 650; letter-spacing: .12em; }
.hero-date > span:first-child { width: 25px; height: 1px; background: #c4a169; }
.hero-date-divider { opacity: .58; font-weight: 300; margin-inline: .06rem; }
.hero h1 { display: flex; align-items: flex-start; gap: .5rem; margin: .48rem 0 .43rem; color: #f2e4c7; font-family: var(--serif); font-weight: 800; font-size: clamp(4.65rem, 7.8vw, 8.05rem); line-height: 1.06; letter-spacing: .11em; text-shadow: 0 3px 14px #1a181698; white-space: nowrap; }
.title-mark { display: grid; place-items: center; align-content: center; color: #f4d5a5; background: #8f3f32; border: 1px solid #edb68e88; outline: 1px solid #a24f4177; outline-offset: 3px; border-radius: 1px; margin-top: .72em; padding: .27em .36em .18em; font: 700 .17em/1.1 var(--serif); letter-spacing: 0; box-shadow: 0 3px 10px #25151295; }
.title-mark b { display: block; font: inherit; }
.hero-tagline { color: #f2e3c6; font: 600 clamp(1.27rem, 2vw, 1.7rem)/1.35 var(--serif); letter-spacing: .1em; }
.hero-description { margin-top: .62rem; color: #e2dbc9; font-size: .96rem; line-height: 1.8; letter-spacing: .025em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .68rem; margin-top: 1.45rem; }
.hero-saved { margin-top: .58rem; color: #e0cda6; font-size: .8rem; }
.hero-location { position: absolute; right: .05rem; bottom: 1.65rem; display: flex; align-items: center; gap: .44rem; font-size: .81rem; letter-spacing: .08em; color: #e9dab9; text-shadow: 0 1px 3px #111; }

.button { display: inline-flex; justify-content: center; align-items: center; gap: .44rem; min-height: 47px; padding: .62rem 1.12rem; border-radius: 2px; border: 1px solid transparent; font-weight: 640; font-size: .92rem; letter-spacing: .055em; text-align: center; transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease; }
.primary { color: #fff0d4; background: var(--red); border-color: #b16d54; box-shadow: inset 0 0 0 2px #761f1838, 0 2px 5px #41231317; }
.primary:hover { background: #a14837; border-color: #ca8763; }
.secondary.light { color: #f0e0bd; background: #1122227d; border-color: #dcc08c7d; }
.secondary.light:hover { background: #253b39; border-color: #ead3a0c7; }
.outline { color: var(--red-dark); background: transparent; border-color: #bda886; }
.outline:hover { background: #e9d9bb7d; border-color: #9a754d; }
.button.compact { min-height: 37px; padding: .3rem .8rem; font-size: .85rem; }
.button:disabled { opacity: .45; }
.text-button { padding: .2rem 0; border: 0; background: none; color: var(--red-dark); text-underline-offset: .2em; }
.text-button:hover { text-decoration: underline; }
.text-button:disabled { opacity: .48; text-decoration: none; }

.role-section { padding-top: 1.65rem; padding-bottom: 1.35rem; scroll-margin-top: 1rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: .6rem 1rem; margin-bottom: .94rem; }
.section-heading h2 { margin-top: .16rem; font-weight: 800; font-size: clamp(1.75rem, 3vw, 2.6rem); letter-spacing: .045em; }
.section-heading > p { color: var(--soft); font: 500 1rem/1.4 var(--serif); margin-bottom: .24rem; letter-spacing: .05em; }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .92rem; }
.role-card { display: block; min-width: 0; width: 100%; overflow: hidden; border: 1px solid var(--paper-line); background: #f9f3e4; border-radius: 3px; padding: 0; text-align: left; color: var(--ink); box-shadow: 0 4px 11px #4d351508; transition: transform .21s ease, border-color .21s ease, box-shadow .21s ease; }
.role-card:hover { transform: translateY(-3px); border-color: var(--role-tone); box-shadow: 0 9px 16px #4d351526; }
.role-card[aria-pressed="true"] { border-color: var(--role-tone); box-shadow: 0 0 0 2px var(--role-tone), 0 7px 18px #4d35151c; }
.role-image { height: clamp(6rem, 10vw, 9rem); display: flex; align-items: end; justify-content: space-between; gap: .6rem; padding: .62rem .73rem; color: #fff0cf; background: linear-gradient(0deg, #191b1bd9, #20252300 75%), var(--role-image) center var(--role-position, 48%) / cover no-repeat, var(--ink-deep); }
.role-maid, .scene-maid { --role-image: url('art/maid.webp'); --role-position: 43%; }
.role-physician, .scene-physician { --role-image: url('art/physician.webp'); --role-position: 45%; }
.role-steward, .scene-steward { --role-image: url('art/steward.webp'); --role-position: 49%; }
.role-historian, .scene-historian { --role-image: url('art/historian.webp'); --role-position: 44%; }
.role-seal, .mini-seal { display: inline-grid; place-items: center; flex: none; width: 2.05rem; height: 2.05rem; color: #f8e5b7; background: var(--red); border: 1px solid #d4a172; outline: 1px solid #7c322a9e; outline-offset: 1px; border-radius: 1px; font: 700 1.15rem/1 var(--serif); }
.role-place { padding-bottom: .05rem; line-height: 1.35; font-size: .78rem; letter-spacing: .04em; text-align: right; text-shadow: 0 2px 2px #111; }
.role-caption { display: grid; gap: .19rem; padding: .65rem .78rem .72rem; min-height: 74px; border-top: 2px solid var(--role-tone); }
.role-caption strong { font: 800 clamp(1.15rem, 1.7vw, 1.45rem)/1.23 var(--serif); }
.role-caption > span { font-size: .83rem; color: var(--soft); letter-spacing: .035em; }
.role-brief { display: flex; justify-content: space-between; align-items: center; gap: 1rem 1.5rem; padding: 1rem 1.15rem; margin-top: 1.05rem; border: 1px solid #c7ae88; background: #eee3cc; border-left: 3px solid var(--red); border-radius: 2px; scroll-margin-bottom: 1rem; animation: fade-in .24s ease both; }
.role-brief h3 { margin: .18rem 0; font-size: 1.4rem; }
.role-brief h3 small { color: var(--soft); font-size: .83em; font-weight: 500; margin-left: .48rem; }
.role-brief > div > p:last-child { font-size: .92rem; color: var(--soft); }
.role-brief .button { flex: none; }

.site-foot, .game-foot { display: flex; justify-content: space-between; align-items: center; gap: .45rem 1rem; padding-block: .8rem 1.3rem; color: var(--soft); font-size: .78rem; border-top: 1px solid var(--paper-line); }
.site-foot div { display: flex; gap: .9rem; }
.site-foot button { color: var(--soft); padding: .1rem 0; border: 0; background: none; }
.site-foot button:hover { color: var(--red-dark); text-decoration: underline; text-underline-offset: .2em; }

.game { padding-block: 1.25rem .6rem; }
.game-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; margin-bottom: .77rem; }
.where { display: flex; align-items: center; gap: .4rem; color: #514a3b; font-size: .9rem; font-weight: 650; letter-spacing: .065em; }
.where .icon { color: var(--red); }
.save-status { font-size: .77rem; color: var(--soft); white-space: nowrap; }
.chapter-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid #d5c6ac; border-radius: 3px; background: #e9deca; margin-bottom: 1.05rem; }
.chapter-step { position: relative; display: flex; align-items: center; justify-content: center; gap: .54rem; padding: .55rem .6rem; color: #665b49; font-size: .84rem; line-height: 1.2; }
.chapter-step + .chapter-step { border-left: 1px solid #d5c6ac; }
.chapter-step.current { background: #f7efdc; color: var(--red-dark); font-weight: 700; }
.chapter-step.passed { color: var(--green); }
.chapter-step small { font-variant-numeric: tabular-nums; font-size: .78rem; }
.chapter-dot { width: .41rem; height: .41rem; background: #ab9670; transform: rotate(45deg); }
.current .chapter-dot { background: var(--red); }
.passed .chapter-dot { background: var(--green); }

.game-layout { display: grid; grid-template-columns: minmax(0, 2.55fr) minmax(235px, 1fr); gap: 1.13rem; align-items: start; }
.story-column { min-width: 0; scroll-margin-top: .75rem; }
.scene { min-height: 151px; position: relative; display: flex; align-items: end; justify-content: start; padding: .74rem 1rem; color: #fff0cf; background: linear-gradient(0deg, #1a2626e8, transparent 69%), var(--role-image, url('art/palace.webp')) center var(--role-position, 55%) / cover no-repeat, var(--ink-deep); border: 1px solid #59462e; border-bottom: 0; border-radius: 3px 3px 0 0; }
.scene.act-2 { background-image: linear-gradient(0deg, #142629ed, #122d3640 74%), var(--role-image, url('art/palace.webp')); }
.scene.act-3 { background-image: linear-gradient(0deg, #221d1aed, #602e2844 76%), url('art/palace.webp'); background-position: center, center 56%; }
.scene.scene-trial { background-image: linear-gradient(0deg, #2d1918ef, #58191452 76%), url('art/palace.webp'); }
.scene > span { display: flex; align-items: center; gap: .38rem; color: #f5e1bb; font-size: .83rem; letter-spacing: .05em; text-shadow: 0 1px 2px #111; }

.paper, .status-panel { border: 1px solid var(--paper-line); background: linear-gradient(135deg, #fffafa38, transparent 60%), var(--paper-lit); box-shadow: 0 3px 11px #6342190a; border-radius: 3px; }
.paper { padding: clamp(1.05rem, 2.5vw, 1.8rem); min-width: 0; }
.scene + .paper { border-radius: 0 0 3px 3px; }
.event-overline { display: flex; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
.event-overline small { font-size: .78rem; color: var(--soft); letter-spacing: .045em; text-align: right; }
.paper h1, .decision-result h2 { margin: .27rem 0 .7rem; font-size: clamp(2rem, 4vw, 3.05rem); font-weight: 800; letter-spacing: .035em; }
.event-body { color: #36382f; font: 500 clamp(1.03rem, 1.7vw, 1.18rem)/1.85 var(--serif); white-space: pre-line; }
blockquote { margin: .83rem 0 1.1rem; padding: .52rem .85rem; color: #664936; background: #efe5d0; border-left: 2px solid #b87b62; font: 600 1rem/1.7 var(--serif); white-space: pre-line; }

.task { margin-top: 1.12rem; padding: .9rem .95rem; border: 1px solid #cfb98d; border-radius: 2px; background: #f1e8d2; }
.task-head { display: flex; align-items: center; gap: .56rem; }
.task-head > .icon { width: 1.6rem; height: 1.6rem; color: var(--red-dark); }
.task-head h3 { font-size: 1.27rem; }
.task-head .eyebrow { font-size: .73rem; letter-spacing: .1em; }
.task-prompt { margin: .47rem 0 .58rem; color: #463e31; font-size: .9rem; white-space: pre-line; }
.task-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.task-piece { display: flex; align-items: center; gap: .48rem; min-width: 0; padding: .39rem .55rem; color: var(--ink); background: #faf2dc; border: 1px solid #cfbf9e; border-radius: 2px; text-align: left; }
.task-piece:hover, .task-piece[aria-pressed="true"] { border-color: var(--red); background: #edd9bc; }
.task-piece strong, .task-piece small { display: block; overflow-wrap: anywhere; }
.task-piece strong { font-size: .88rem; line-height: 1.35; }
.task-piece small { font-size: .75rem; color: var(--soft); line-height: 1.4; }
.task-order { flex: none; display: inline-grid; place-items: center; width: 1.32rem; height: 1.32rem; color: #675940; border: 1px solid #d1bf9a; border-radius: 50%; font-size: .78rem; line-height: 1; }
.task-piece[aria-pressed="true"] .task-order { color: #fff0d4; background: var(--red); border-color: var(--red); }
.task-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .59rem; }
.task-actions > span { flex: 1 1 7.4rem; margin-right: auto; color: #5c5140; font-size: .82rem; }
.task-actions .text-button { font-size: .83rem; }
.task-feedback { color: var(--red-dark); margin-top: .39rem; font-size: .88rem; }
.task-feedback.good, .task-result { color: #2d5c4c; }
.task-result { margin-left: auto; white-space: nowrap; font-size: .82rem; font-weight: 680; }
.task-solved { background: #e9ebd8; border-color: #b3bf9b; }

.choices { margin-top: 1.2rem; }
.choices h2 { margin-bottom: .5rem; font-size: 1.43rem; }
.choice { width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .72rem; text-align: left; color: var(--ink); background: #f9f2e0; border: 1px solid var(--paper-line); border-radius: 2px; padding: .64rem .78rem; margin-top: .43rem; transition: background .18s ease, border-color .18s ease; }
.choice:not(:disabled):hover { background: #f0e2c7; border-color: #a37454; }
.choice:disabled { color: #665d50; background: #efe8da; }
.choice-seal { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border: 1px solid #bf9675; border-radius: 2px; color: var(--red-dark); font: 700 .97rem/1 var(--serif); }
.choice:disabled .choice-seal { color: #776957; border-color: #bfb29c; }
.choice-copy, .choice-copy strong, .choice-copy span, .choice-copy small { display: block; min-width: 0; }
.choice-copy strong { font-size: .98rem; line-height: 1.42; }
.choice-copy span { color: var(--soft); font-size: .83rem; line-height: 1.5; }
.choice-copy small { color: var(--red-dark); margin-top: .15rem; font-size: .75rem; line-height: 1.4; }
.choice-end { color: var(--red-dark); font-size: 1.38rem; }
.choice:disabled .choice-end { color: #776957; }

.side-column { display: grid; gap: .78rem; min-width: 0; }
.status-panel { padding: .95rem 1rem 1rem; }
.status-heading { display: flex; align-items: center; gap: .69rem; margin-bottom: .65rem; }
.status-heading .mini-seal { width: 2.5rem; height: 2.5rem; }
.status-heading h2 { margin-block: .04rem; font-size: 1.52rem; }
.status-heading > div > p:last-child { font-size: .77rem; color: var(--soft); }
.side-title { display: flex; align-items: center; gap: .45rem; color: var(--red-dark); margin-bottom: .58rem; }
.side-title h2 { color: var(--ink); font-size: 1.27rem; }
.meter-stack { display: grid; gap: .48rem; }
.meter-label { display: flex; justify-content: space-between; gap: .5rem; align-items: center; color: #574770; font-size: .83rem; line-height: 1.3; }
.meter-label span { color: #484234; }
.meter-label strong { color: #4b4a40; font-variant-numeric: tabular-nums; font-size: .81rem; }
.meter-track { position: relative; height: 5px; margin-top: .26rem; background: #e5d9bf; border-radius: 999px; overflow: hidden; }
.meter-track span { display: block; width: var(--meter, 0); height: 100%; border-radius: inherit; background: #617d69; }
.personal .meter-track span { background: #9b7653; }
.personal .danger .meter-label strong, .personal .danger .meter-label span { color: var(--red-dark); }
.personal .danger .meter-track span { background: var(--red); }
.news-line + .news-line { border-top: 1px solid var(--paper-line); padding-top: .48rem; margin-top: .48rem; }
.news-line strong { font-family: var(--serif); font-size: 1rem; line-height: 1.35; }
.news-line p { color: var(--soft); font-size: .83rem; line-height: 1.57; }
.dispatch .text-button { margin-top: .35rem; font-size: .82rem; }
.game-foot { margin-top: 1.18rem; }

.decision-result { animation: fade-in .23s ease both; }
.chosen-act { color: var(--red-dark); font-weight: 650; font-size: .94rem; margin-bottom: .54rem; }
.deltas { display: flex; gap: .38rem; flex-wrap: wrap; margin: .85rem 0 .62rem; }
.delta { padding: .19rem .42rem; border-radius: 2px; font-size: .79rem; line-height: 1.5; color: #465b44; background: #e5ebd8; border: 1px solid #b5c19c; white-space: nowrap; }
.delta.negative { color: #853b30; background: #f2e0d1; border-color: #dcb4a0; }
.result-note { margin-top: .61rem; padding: .59rem .7rem; color: #433a31; background: #eee5d0; border-left: 2px solid #9b8256; border-radius: 1px; font-size: .9rem; }
.result-note strong { display: block; font-family: var(--serif); font-size: 1.05rem; }
.result-note small { display: block; font-size: .72rem; color: var(--red-dark); margin-bottom: .16rem; }
.result-note.major { background: #ece4d1; border-color: var(--red); }
.result-footer { display: flex; justify-content: end; margin-top: .95rem; }

.ending-hero { position: relative; color: #f4e3c3; padding-block: 2rem 2.6rem; background: linear-gradient(90deg, #172523f4, #1b2728c4 47%, #2a31353e), url('art/palace.webp') center 58% / cover no-repeat, #233333; border-bottom: 2px solid #aa8259; }
.ending-copy h1 { margin: .3rem 0 .38rem; color: #f7e8ca; font-size: clamp(2.7rem, 7vw, 5.3rem); line-height: 1.1; }
.ending-copy > p:last-child { color: #e2d2b1; font-size: .96rem; }
.ending { padding-block: 1.25rem 2.3rem; }
.ending-paper h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); margin: .22rem 0 .55rem; }
.ending-actions { display: flex; flex-wrap: wrap; gap: .47rem; margin-top: .86rem; }
.prior-run { margin-top: .58rem; font-size: .83rem; color: var(--soft); }
.ending-history { border-top: 1px solid var(--paper-line); margin-top: 1.15rem; padding-top: .93rem; }
.annals { display: grid; gap: .68rem; }
.annal { padding: .7rem .82rem; background: #f0e7d3; border: 1px solid #dfcfaf; border-left: 2px solid #a47f56; border-radius: 2px; }
.annal h3 { margin: .08rem 0 .24rem; font-size: 1.28rem; }
.annal p { font-size: .9rem; color: #453f32; }
.annal-moment { color: var(--red-dark); font-size: .76rem; letter-spacing: .055em; }
.cause-list { border-top: 1px solid #d8c8a7; padding: .38rem 0 0 1.05rem; margin: .52rem 0 0; }
.cause-list li { padding-block: .15rem; color: #57483a; font-size: .82rem; }
.cause-list li span { margin-right: .44rem; }
.cause-list li strong { margin-right: .38rem; }
.cause-list li small { display: block; color: #665744; font-size: .78rem; }
.historical-note, .story-anchor { padding: .55rem .68rem; margin-top: .64rem; color: #574a38; background: #eae2d0; border-left: 2px solid #9c825c; font-size: .82rem; }

.dialog { width: min(650px, calc(100% - 1.75rem)); max-height: min(86vh, 860px); margin: auto; padding: 0; color: var(--ink); border: 1px solid #b49d75; border-radius: 4px; background: var(--paper-lit); box-shadow: 0 22px 76px #100f0fa6; }
.dialog::backdrop { background: #151d1ed1; }
.dialog[open] { animation: fade-in .21s ease both; }
.dialog-frame { display: flex; flex-direction: column; max-height: min(86vh - 2px, 858px); }
.dialog-bar { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.1rem 1.3rem .85rem; background: #efe1c5; border-bottom: 1px solid #cfbd98; }
.dialog-bar h2 { font-size: 1.92rem; margin-top: .14rem; }
.close { display: grid; flex: none; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid #bda886; border-radius: 2px; color: var(--red-dark); background: none; font-size: 1.45rem; line-height: 1; }
.close:hover { background: #e0ceac; }
.dialog-content { overflow: auto; padding: 1rem 1.3rem 1.3rem; }
.dialog-intro { color: #443a30; font-size: .96rem; margin: 0 0 .9rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem; }
.reference-list { display: grid; gap: .65rem; }
.reference-list article { border-top: 1px solid var(--paper-line); padding-top: .64rem; }
.reference-list h3 { margin-bottom: .25rem; font-size: 1.2rem; }
.reference-list p, .reference-list a { font-size: .89rem; }
.book-tabs { display: flex; flex-wrap: wrap; gap: .41rem; margin-bottom: .68rem; }
.book-tabs button { min-height: 39px; padding: .32rem .65rem; color: #625244; border: 1px solid var(--paper-line); border-radius: 2px; background: #f5ecd7; font-size: .88rem; }
.book-tabs button[aria-pressed="true"] { color: #fff1d4; border-color: var(--red); background: var(--red); }
.archive-list { display: grid; gap: .42rem; }
.archive-list article { display: flex; align-items: center; gap: .67rem; border: 1px solid var(--paper-line); background: #f1e8d1; padding: .5rem .7rem; border-radius: 2px; }
.archive-list p, .empty-text { color: var(--soft); font-size: .86rem; }
.empty { padding: 3rem 1.15rem; text-align: center; }

@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1000px) {
  .shell { width: calc(100% - 4.25rem); }
  .topbar-inner { width: calc(100% - 3rem); }
  .hero { min-height: 420px; }
}
@media (max-width: 740px) {
  .shell { width: calc(100% - 2rem); }
  .topbar-inner { width: calc(100% - 1.75rem); height: 58px; }
  .brand { gap: .42rem; }
  .brand img { width: 28px; height: 28px; }
  .brand span { font-size: 1.11rem; letter-spacing: .03em; }
  .brand small { display: none; }
  .topbar nav { gap: .04rem; }
  .topbar nav button { padding: 0 .55rem; font-size: .82rem; letter-spacing: .03em; }
  .sound-button { width: 34px; height: 34px; }
  .hero { min-height: 382px; }
  .hero-content { padding-inline: .46rem; padding-block: 2.12rem 3.1rem; }
  .hero-world { background-position: center, center, 65% 55%; background-image: linear-gradient(90deg, #162525ee, #192525a6 52%, #1b232355), linear-gradient(0deg, #172625b5 0%, transparent 51%), url('art/palace.webp'); }
  .hero-world::after { inset: .49rem; }
  .hero h1 { font-size: clamp(3.8rem, 13.4vw, 5.6rem); }
  .hero-date { font-size: .75rem; letter-spacing: .055em; gap: .42rem; }
  .hero-date > span:first-child { width: 14px; }
  .hero-description { font-size: .86rem; line-height: 1.74; }
  .hero-location { bottom: .72rem; right: .32rem; font-size: .72rem; }
  .hero-actions { margin-top: 1.12rem; }
  .role-section { padding-block: 1.25rem 1rem; }
  .section-heading { gap: .2rem .5rem; margin-bottom: .72rem; }
  .section-heading > p { font-size: .81rem; }
  .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .68rem; }
  .role-image { height: clamp(5rem, 22vw, 9rem); padding: .46rem .56rem; }
  .role-caption { min-height: 61px; padding: .47rem .59rem .53rem; }
  .role-caption > span { font-size: .76rem; }
  .role-seal { width: 1.66rem; height: 1.66rem; font-size: .95rem; }
  .role-place { font-size: .72rem; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .side-column .dispatch { grid-column: 1 / -1; }
  .game { padding-top: .78rem; }
  .scene { min-height: 110px; }
  .status-panel { padding: .7rem .65rem .75rem; }
}
@media (max-width: 430px) {
  .section-heading { display: block; }
  .section-heading > p { margin: .22rem 0 0; }
  .role-brief { display: grid; }
  .role-brief .button { justify-self: start; }
  .site-foot { flex-wrap: wrap; }
  .where { letter-spacing: 0; font-size: .79rem; }
  .save-status { font-size: .7rem; }
  .chapter-step { padding-inline: .29rem; gap: .28rem; font-size: .76rem; }
  .chapter-step small { font-size: .69rem; }
  .task-options { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.story-anchor { line-height: 1.55; }
.story-anchor b { color: #6e5132; margin-right: .32rem; }
.mobile-status { display: none; }
@media (max-width: 740px) {
  .mobile-status { display: flex; justify-content: space-around; gap: .55rem; margin: -.48rem 0 .64rem; color: #655540; font-size: .79rem; }
  .mobile-status b { margin-left: .18rem; color: var(--ink); font-variant-numeric: tabular-nums; }
  .mobile-status b.urgent { color: var(--red); }
}

.task-glyph {
  width: 1.95rem; height: 1.95rem; display: inline-grid; place-items: center; flex: none;
  color: #793c2e; border: 1px solid currentColor; border-radius: 2px;
  font: 800 1.15rem/1 var(--serif); transform: rotate(-4deg);
}
.task-maid .task-piece {
  padding-left: .65rem;
  background-image: repeating-linear-gradient(45deg, #a3805c13 0 1px, transparent 1px 3px);
  border-left: 3px double #ac775c;
}
.task-physician .task-piece { border-left: 4px solid #638272; }
.task-physician .task-glyph { color: #3c675b; }
.task-steward .task-options { gap: .29rem .45rem; }
.task-steward .task-piece { border-left: 4px solid #9b7954; border-radius: 1px 5px 5px 1px; }
.task-historian .task-piece { background-image: repeating-linear-gradient(0deg, transparent 0 19px, #b69b6620 19px 20px); }
.task-historian .task-glyph { color: #4d606f; }
.postscript-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .58rem; }
.postscript-grid article { padding: .67rem .71rem; border-top: 2px solid #98774e; background: #efe5d0; }
.postscript-grid h3 { margin-bottom: .22rem; font-size: 1.16rem; }
.postscript-grid p { color: #4e4437; font-size: .88rem; }
@media (max-width: 550px) { .postscript-grid { grid-template-columns: minmax(0, 1fr); } }

.scene.act-2 { background-image: linear-gradient(0deg, #182526df, #1e353720 78%), url('art/garden.webp'); background-position: center, center 49%; }
.scene.act-3 { background-image: linear-gradient(0deg, #251e1ae2, #432d2b33 79%), url('art/gate.webp'); background-position: center, center 51%; }
.scene.scene-trial { background-image: linear-gradient(0deg, #261515ed, #58191452 76%), url('art/gate.webp'); background-position: center, center 40%; }
.archive-list details { border: 1px solid var(--paper-line); border-radius: 2px; background: #f1e8d1; }
.archive-list summary { display: flex; align-items: center; gap: .67rem; padding: .55rem .7rem; cursor: pointer; list-style: none; }
.archive-list summary::-webkit-details-marker { display: none; }
.archive-list summary::after { content: '+'; color: var(--red-dark); margin-left: auto; font-size: 1.2rem; padding-inline: .15rem; }
.archive-list details[open] summary::after { content: '−'; }
.archive-list summary:hover { background: #ebddc1; }
.archive-list summary strong, .archive-list summary small { display: block; }
.archive-list summary small { color: var(--soft); }
.archive-entry { padding: .55rem .65rem .65rem; border-top: 1px solid var(--paper-line); }
.archive-entry .button { margin-top: .5rem; }

.scene > p { margin-left: auto; padding-left: .5rem; color: #f5e3bf; font: 500 .9rem/1.4 var(--serif); text-shadow: 0 1px 4px #151313; text-align: right; }
@media (max-width: 430px) { .scene > p { display: none; } }
.annal .annal-baseline { margin-top: .33rem; color: var(--soft); font-size: .81rem; }
