:root {
  --bg: #16110d;
  --surface: #221a14;
  --surface-2: #2d231b;
  --text: #f3e6d0;
  --muted: #a8977f;
  --faint: #6b5d4c;
  --accent: #f2b45a;
  --border: #3a2e24;
  --fs: 28px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  line-height: 1.4;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; }

/* ---------- home ---------- */
.page { padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }
.brand { font-size: 28px; font-weight: 700; margin: 8px 0 6px; }
.lead { color: var(--muted); margin: 0 0 20px; font-size: 16px; }
.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; margin-bottom: 20px;
}
.seg button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-size: 15px; color: var(--muted);
}
.seg button.on { background: var(--accent); color: #2a1c0b; font-weight: 600; }
.card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; margin-bottom: 12px;
}
.card .emoji { font-size: 34px; }
.card .t { font-size: 20px; font-weight: 600; }
.card .s { color: var(--muted); font-size: 14px; }
details.legend {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 16px; margin-top: 8px;
}
details.legend summary { font-weight: 600; cursor: pointer; }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 10px; font-size: 15px; }
.legend-note { color: var(--muted); font-size: 14px; margin-top: 10px; }

/* ---------- intro ---------- */
.cast { list-style: none; padding: 0; margin: 0 0 20px; }
.cast li {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.cast .ic { font-size: 26px; width: 34px; text-align: center; }
.cast .nm { font-weight: 600; }
.cast .hn { color: var(--muted); font-size: 15px; }
.primary {
  width: 100%; border: 0; border-radius: 14px; padding: 16px; font-size: 18px; font-weight: 700;
  background: var(--accent); color: #2a1c0b;
}
.link { background: none; border: 0; color: var(--muted); padding: 8px 0; font-size: 16px; }

/* ---------- reader ---------- */
.reader { display: flex; flex-direction: column; height: 100dvh; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
}
.iconbtn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  min-width: 40px; height: 40px; padding: 0 10px; font-size: 15px; color: var(--muted);
}
.iconbtn.on { color: var(--accent); border-color: var(--accent); }
.progress { flex: 1; height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); transition: width .25s; }

.stage {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 0 20px; overflow: hidden; user-select: none; -webkit-user-select: none;
}
.prev, .next { color: var(--faint); font-size: calc(var(--fs) * 0.62); line-height: 1.35; }
.prev { margin-bottom: 18px; }
.next { margin-top: 22px; }
.next::before { content: "▸ "; }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.who .chip {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px;
  font-size: 15px; font-weight: 600; background: var(--surface-2); border: 1px solid currentColor;
}
.who .voice { font-size: 14px; color: var(--muted); }
.cues { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.cue {
  font-size: 15px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text);
}
.current { font-size: var(--fs); line-height: 1.35; font-weight: 500; }
.current strong { color: var(--accent); font-weight: 800; }
.current.whisper { font-style: italic; opacity: .85; }
.current.loud { font-weight: 700; }
.pause { margin-top: 16px; color: var(--muted); font-size: 15px; display: flex; align-items: center; gap: 8px; }
.pause .dots span {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  margin-right: 4px; animation: breathe 1.6s ease-in-out infinite;
}
.pause .dots span:nth-child(2) { animation-delay: .3s; }
@keyframes breathe { 0%,100% { opacity: .25 } 50% { opacity: 1 } }

.controls {
  display: flex; gap: 12px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
}
.controls button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 16px; height: 64px; font-size: 22px;
}
.controls .back { width: 80px; color: var(--muted); }
.controls .fwd { flex: 1; background: var(--accent); color: #2a1c0b; border: 0; font-weight: 700; font-size: 20px; }

.plain .cues, .plain .who .voice, .plain .pause { display: none; }
.plain .current strong { color: inherit; font-weight: inherit; }

.end { text-align: center; padding-top: 18vh; }
.end .moon { font-size: 64px; }
.end h2 { font-size: 26px; margin: 12px 0 24px; }
