:root {
  color-scheme: light;
  font-family: "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  background: #faf8f4;
  color: #241a19;
  --paper: #faf8f4;
  --ink: #241a19;
  --accent: #892936;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid #b24146; outline-offset: 3px; }
#camera { position: fixed; inset: 0; width: 100% !important; height: 100% !important; background: #151214; display: none; }
body[data-mode="ar"] #camera { display: block; }
#home { position: relative; min-height: 100dvh; display: grid; place-content: center; padding: 3.2rem max(1.35rem, env(safe-area-inset-left)) 4.3rem; }
.cover { display: grid; grid-template-columns: minmax(18rem, 31rem) minmax(15rem, 25rem); gap: clamp(1.1rem, 6vw, 5.4rem); align-items: center; }
.cover-art { position: relative; aspect-ratio: 1.24; isolation: isolate; }
.cover-art img { width: 47%; height: auto; position: absolute; top: 50%; left: 50%; border-radius: .2rem; box-shadow: 0 .9rem 2.3rem #32201c31; }
.cover-art img:first-child { transform: translate(-12%, -52%) rotate(8deg); }
.cover-art img:last-child { transform: translate(-92%, -46%) rotate(-10deg); }
.series { color: var(--accent); font-size: .88rem; letter-spacing: .18em; margin: .4rem 0 .55rem; }
h1 { font-family: "Songti TC", "Noto Serif TC", serif; font-size: clamp(2.65rem, 7.5vw, 5.2rem); font-weight: 700; margin: 0; line-height: 1.14; }
.lead { line-height: 1.7; max-width: 22em; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.actions button, .stage-button { min-height: 44px; border: 1px solid var(--accent); border-radius: .28rem; padding: .5rem .95rem; color: #fff; background: var(--accent); }
button.quiet { background: var(--paper); color: var(--accent); }
.status { min-height: 2rem; max-width: 32ch; color: var(--accent); font-size: .85rem; }
.license { position: absolute; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); width: max-content; max-width: 90%; transform: translateX(-50%); color: #665354; text-underline-offset: .19em; font-size: .7rem; }
#stage-header { position: fixed; z-index: 2; top: max(.75rem, env(safe-area-inset-top)); left: .75rem; right: .75rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
#stage-message { margin: 0; max-width: 42ch; border-radius: .35rem; padding: .55rem .7rem; color: var(--ink); background: #faf8f4ef; font-size: .85rem; text-align: center; }
#stage-message:empty { visibility: hidden; }
#chooser, #scan-choice { display: grid; gap: .15rem; font-size: .76rem; color: var(--accent); }
#chooser select, #scan-choice select { min-height: 44px; max-width: 10rem; color: var(--ink); background: #fff; border: 1px solid #b28a86; border-radius: .3rem; padding: .25rem .35rem; }
#scan-guide { position: fixed; pointer-events: none; inset: 50% auto auto 50%; transform: translate(-50%, -50%); width: min(52vw, 31vh); aspect-ratio: 506/800; border: 1px dashed #f7eeeea0; border-radius: .45rem; }
#dialogue { --pair-width: 384px; position: fixed; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(var(--pair-width), 90vw); text-align: center; }
body[data-mode="ar"] #dialogue { left: var(--anchor-x, 50%); top: var(--anchor-y, 50%); }
#scene-name, #caption { background: #faf8f4f4; color: var(--ink); border-radius: .25rem; }
#scene-name { font-family: "Songti TC", "Noto Serif TC", serif; width: max-content; max-width: 100%; margin: 0 auto .6rem; padding: .35rem .65rem; letter-spacing: .08em; }
#caption { min-height: 3.5em; margin: .65rem 0 0; padding: .52rem .62rem; line-height: 1.5; font-size: clamp(.84rem, 2.8vw, .98rem); }
#caption:empty { visibility: hidden; }
#voices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .55rem; }
.voice { min-width: 0; border: 1px solid #66393a38; border-radius: .4rem; overflow: hidden; background: var(--paper); color: var(--ink); padding: 0; box-shadow: 0 .5rem 1.8rem #23171532; }
.voice img { display: block; width: 100%; height: auto; aspect-ratio: 506/800; object-fit: contain; }
.voice span { display: flex; align-items: center; justify-content: space-between; text-align: left; gap: .15rem; min-height: 44px; padding: .24rem .42rem; font-size: clamp(.84rem, 3vw, 1rem); }
.voice span svg { flex: none; color: var(--accent); }
.voice[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.voice.enter { animation: reveal .65s both; }
@keyframes reveal { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 710px) {
  .cover { grid-template-columns: 1fr; max-width: 28rem; gap: .8rem; }
  .cover-art { width: min(100%, 23rem); margin: 0 auto; }
}
@media (max-height: 480px) and (orientation: landscape) {
  #dialogue { width: min(var(--pair-width), 40vw, 88dvh); }
}
@media (prefers-reduced-motion: reduce) {
  .voice.enter { animation: none; }
}

#scan-choice { width: max-content; max-width: 100%; margin-top: .9rem; }
