:root {
  color-scheme: dark;
  --ink: #16151a;
  --panel: #211e23;
  --cream: #f4e9dc;
  --muted: #c3b5aa;
  --soft-gold: #f1bf87;
  --amber: #f4c593;
  --red: #ec8882;
  --line: #8c6e59;
  --display: "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 45% -15%, #4d3329 0, transparent 46rem),
    var(--ink);
  color: var(--cream);
  font-family: var(--body);
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 5px;
}
.shell { max-width: 1320px; margin-inline: auto; padding-inline: clamp(14px, 4vw, 62px); }
.masthead, .footline { display: flex; justify-content: space-between; align-items: center; }
.masthead { min-height: 72px; gap: 12px; }
.wordmark, .edition { font-size: .83rem; letter-spacing: .19em; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; }
.wordmark i, #recording i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 14px #ee827a88;
}
.edition { color: var(--muted); }
.masthead nav { display: flex; gap: clamp(7px, 2vw, 20px); }
.masthead nav button, .text-button {
  background: transparent; border: 0; padding: 7px 10px;
  color: var(--muted); font-size: .86rem; min-height: 44px;
}
.masthead nav button:hover, .text-button:hover { color: var(--cream); }
.theater {
  position: relative; isolation: isolate;
  background: #201a1b; border: 1px solid #776251;
  border-radius: 5px; overflow: hidden;
}
.scene { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.scenery {
  position: absolute; inset: 0;
  background-image: var(--scene-art);
  background-size: cover; background-position: center;
}
.scene[data-scene="foyer"] { --scene-art: url("./assets/foyer.webp"); }
.scene[data-scene="stage"] { --scene-art: url("./assets/stage.webp"); }
.scene[data-scene="booth"] { --scene-art: url("./assets/booth.webp"); }
.scene::after {
  content: ""; position: absolute; z-index: 1; inset: 0;
  background: linear-gradient(180deg, #141118be 0%, transparent 24%, transparent 52%, #14111847 74%, #16151a 100%);
}
.scene[data-mode="title"]::after {
  background: linear-gradient(90deg, #17141cfa 0%, #17141cec 25%, #17141c93 52%, #17141c30 100%),
              linear-gradient(0deg, #17141c 0%, transparent 34%);
}
.sprite {
  position: absolute; z-index: 0;
  height: min(84%, 555px); aspect-ratio: 627 / 836;
  right: 12%; bottom: 7%;
  background: url("./assets/lin-yan.webp") var(--pose-x, 0%) top / 300% 100% no-repeat;
  filter: drop-shadow(0 8px 22px #17131880);
}
.sprite[data-pose="open"] { --pose-x: 50%; }
.sprite[data-pose="warm"] { --pose-x: 100%; }
.title-screen {
  min-height: clamp(505px, calc(91svh - 82px), 690px);
  display: flex; align-items: center; padding: clamp(30px, 7vw, 86px);
}
.eyebrow {
  font-size: .82rem; font-weight: 550; color: var(--soft-gold); letter-spacing: .22em;
  margin: 0 0 clamp(14px, 3vw, 30px);
}
h1 { font: 600 clamp(3.1rem, 8.2vw, 7.3rem)/1.16 var(--display); letter-spacing: -.065em; margin: 0; }
h1 span { color: var(--soft-gold); }
.lede { color: var(--muted); margin: 21px 0 0; line-height: 1.8; font-size: clamp(1rem, 1.8vw, 1.2rem); }
.mobile-break { display: none; }
.title-actions { display: flex; gap: 10px 20px; flex-wrap: wrap; margin-top: clamp(24px, 4vw, 42px); }
.primary {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 1.2em;
  min-height: 45px; border: 1px solid transparent; border-radius: 3px;
  padding: 9px 16px; background: var(--amber); color: #2d1b14; font-weight: 650;
  font-size: .9rem; text-align: left;
}
.primary:hover { background: #ffdbac; }
.play-screen {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: clamp(530px, calc(92svh - 88px), 700px);
  padding: clamp(16px, 3vw, 36px);
}
.scene-caption {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: clamp(230px, 35svh, 360px);
  color: var(--cream); font-size: .76rem; letter-spacing: .14em;
}
.scene-caption span { background: #20191bd9; border: 1px solid #a580655e; padding: 7px 10px; border-radius: 3px; }
#recording { display: inline-flex; align-items: center; gap: 7px; }
.dialogue {
  width: min(100%, 870px); margin-inline: auto; position: relative;
  min-height: 202px; padding: 21px clamp(17px, 3vw, 34px) 19px;
  background: linear-gradient(135deg, #2a2325fa, #211e23fa 65%);
  border: 1px solid #907360; border-top: 2px solid var(--soft-gold);
  border-radius: 4px; box-shadow: 0 11px 36px #110e1475;
}
.dialogue-heading { display: flex; align-items: center; gap: 15px; }
.dialogue-heading::after { content: ""; height: 1px; flex: 1; background: #8a6a544a; }
.dialogue h2 {
  color: var(--soft-gold); font: 600 1rem/1.4 var(--display); letter-spacing: .11em;
  margin: 0;
}
.dialogue h2:focus { outline: none; }
.dialogue-text {
  min-height: 55px; margin-block: 9px 12px;
  font-size: clamp(.96rem, 1.6vw, 1.1rem); line-height: 1.85; overflow-wrap: anywhere;
}
.dialogue-text p { margin: 0; }
.dialogue-text p + p { margin-top: 6px; }
.claim { display: inline; }
.claim.preview { color: #e7b6a8; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.claim.removed { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--red); }
.word {
  display: inline-block; min-height: 44px; min-width: 44px; padding: 1px 6px;
  border: 0; border-radius: 3px;
  color: var(--soft-gold); font-weight: 650; background: #f4bf8124;
  text-decoration: underline; text-underline-offset: .27em; text-decoration-style: dashed;
}
.word:hover { background: #f4bf8145; color: #fff5e6; }
.hint { color: var(--muted); margin: -1px 0 12px; line-height: 1.55; font-size: .82rem; }
.actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.actions.stacked { display: grid; align-items: stretch; justify-content: stretch; grid-template-columns: 1fr; }
.actions.stacked .text-button { justify-self: end; }
.choice {
  width: 100%; text-align: left; padding: 9px 13px; min-height: 44px;
  background: #f4c5930e; border: 1px solid #9a7e64; border-radius: 3px;
  color: var(--cream); font-size: .94rem; line-height: 1.45;
}
.choice:hover { background: #f4c5932b; border-color: var(--amber); }
.footline { min-height: 52px; gap: 14px; color: var(--muted); font-size: .75rem; letter-spacing: .075em; }
.footline p { margin-block: 9px; }
.act-indicator { display: flex; gap: 6px; }
.act-indicator i { background: #765e50; width: 17px; height: 2px; }
.act-indicator i.done { background: var(--soft-gold); }
dialog {
  color: var(--cream); background: var(--panel); border: 1px solid #ab8b70; border-radius: 5px;
  width: min(600px, calc(100% - 28px)); max-height: min(80svh, 720px);
  padding: clamp(16px, 3vw, 28px); box-shadow: 0 16px 70px #000a;
}
dialog::backdrop { background: #17131bd4; }
.modal-head, .modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.modal-head h2 { font: 600 1.3rem/1.4 var(--display); color: var(--soft-gold); margin: 0; }
.modal-actions { justify-content: flex-end; margin-top: 20px; }
.log-list { display: grid; gap: 12px; overflow-y: auto; max-height: 56svh; margin-top: 12px; }
.log-list p { margin: 0; line-height: 1.7; color: var(--cream); font-size: .92rem; }
.log-list .log-name { color: var(--soft-gold); margin-right: 9px; font-size: .79rem; }
.log-list del { color: var(--muted); }
@media (max-width: 640px) {
  .masthead { min-height: 52px; }
  .title-screen { padding: 32px 23px; min-height: clamp(465px, calc(100svh - 110px), 660px); }
  .scene[data-mode="title"]::after {
    background: linear-gradient(90deg, #17141cee, #17141c74 100%), linear-gradient(0deg, #17141c, transparent 52%);
  }
  .scene[data-mode="title"] .scenery { background-position: 32%; }
  .play-screen { padding: 12px; min-height: clamp(530px, calc(100svh - 106px), 680px); }
  .scene-caption { min-height: clamp(187px, 31svh, 245px); }
  .scene[data-mode="play"] .scenery { bottom: 18%; background-position: 27% 35%; }
  .sprite { height: auto; width: min(70vw, 310px); right: 2%; top: 42px; bottom: auto; }
  .scene[data-mode="play"]::after { background: linear-gradient(180deg, #17141c74, transparent 24%, transparent 36%, #16151a 88%); }
  .dialogue { padding-top: 16px; min-height: 188px; }
  .footline { min-height: 44px; font-size: .69rem; }
}
@media (max-width: 359px) {
  .shell { padding-inline: 8px; }
  .title-screen { padding-inline: 16px; }
  h1 { font-size: 2.95rem; }
  .mobile-break { display: initial; }
  .play-screen { padding: 9px; }
  .actions { gap: 5px; }
  .dialogue { padding-inline: 13px; }
}
