:root {
  --bg: #14161a;
  --card: #1c1f25;
  --line: #2a2e36;
  --text: #e9e6df;
  --muted: #8d8f96;
  --accent: #e8a33d;   /* lantern amber */
  --accent-2: #f2c27a;
  --good: #7ec4a1;
  --warn: #e07a6a;
  --jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f3ec; --card: #fffdf8; --line: #e4ddd0; --text: #23211d; --muted: #77736b; --accent: #b86e0e; --accent-2: #8a520a; color-scheme: light; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--ui); -webkit-tap-highlight-color: transparent; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.view { max-width: 560px; margin: 0 auto; padding: 12px 16px 32px; min-height: 100dvh; }
[hidden] { display: none !important; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; justify-content: center; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0 14px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .jp { font: 700 26px var(--jp); color: var(--accent); letter-spacing: .04em; }
.brand .name { font-weight: 600; color: var(--muted); }
.today { text-align: right; font-size: 14px; color: var(--muted); line-height: 1.3; }
.today b { color: var(--text); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 15px; font-weight: 600; margin: 4px 0 10px; letter-spacing: .01em; }
.card h2 + .chips { margin-bottom: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 15px; min-height: 40px; }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #1a1408; font-weight: 600; }
.chips.small button { padding: 5px 11px; font-size: 13px; min-height: 32px; }
.chips.center { justify-content: center; }
#story-pick { margin: -6px 0 6px; }
.setting { font-size: 13px; margin: 0 0 14px; min-height: 1em; }
.who { font-size: 14px; color: var(--muted); margin-bottom: -8px; }
.who b { color: var(--accent-2); font-weight: 600; }

.primary { background: var(--accent); color: #1a1408; font-weight: 700; border-radius: 12px; padding: 10px 16px; }
.primary.big { width: 100%; padding: 16px; font-size: 18px; border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; }
.primary:disabled { opacity: .5; }
.ghost { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.ghost.small { font-size: 13px; padding: 6px 10px; }
.ghost.icon { width: 40px; height: 40px; padding: 0; border-radius: 50%; }
.danger { color: var(--warn); }
.play-ic { width: 0; height: 0; border-left: 14px solid currentColor; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }

.resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--accent); }

.decks { list-style: none; margin: 0; padding: 0; }
.decks li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.decks li:first-child { border-top: 0; }
.decks input { width: 20px; height: 20px; accent-color: var(--accent); }
.decks .t { font-weight: 500; }
.decks .lv { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.decks .prog { grid-column: 2 / 4; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; display: flex; }
.decks .prog i { display: block; height: 100%; }
.decks .prog .a { background: var(--accent-2); opacity: .55; }
.decks .prog .b { background: var(--accent); }
.decks .sub { grid-column: 2 / 4; font-size: 12px; color: var(--muted); margin-top: -2px; }

.how ol, .how ul { padding-left: 20px; margin: 6px 0; }
.how li { margin: 4px 0; font-size: 14px; }
.how p { font-size: 14px; margin: 8px 0 4px; }
.keys { list-style: none; padding: 0 !important; }
kbd { font: 12px var(--ui); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--bg); }

.foot { text-align: center; font-size: 13px; display: grid; gap: 10px; padding-top: 6px; }

/* player */
.ptitle { flex: 1; text-align: center; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.stage { min-height: 46dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 18px; padding: 24px 4px; }
.badge { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 3px 10px; }
.badge.intro { color: var(--good); }
.badge.scene1, .badge.scene2 { color: var(--accent-2); }
.ja { font: 500 clamp(24px, 7vw, 34px)/1.45 var(--jp); letter-spacing: .02em; word-break: keep-all; overflow-wrap: anywhere; }
.ja.hidden { color: transparent; text-shadow: 0 0 18px var(--muted); user-select: none; }
.en { font-size: 17px; color: var(--muted); padding: 6px 10px; border-radius: 8px; max-width: 100%; }
.en.hidden { filter: blur(7px); }
.en.hidden::after { content: ""; }
.counter { font-size: 13px; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 8px 0 18px; }
.ctl { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px; font-size: 14px; color: var(--muted); }
.ctl .ic { font-size: 26px; color: var(--text); line-height: 1; }
.ctl:active { background: var(--card); }
.ctl.main { width: 84px; height: 84px; border-radius: 50%; background: var(--accent); justify-content: center; }
.ctl.main .ic { color: #1a1408; }
#toggle-ic.play { width: 0; height: 0; border-left: 24px solid #1a1408; border-top: 15px solid transparent; border-bottom: 15px solid transparent; margin-left: 6px; }
#toggle-ic.pause { width: 22px; height: 26px; border-left: 7px solid #1a1408; border-right: 7px solid #1a1408; }
.hint { font-size: 13px; margin-top: 18px; }
.flash { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); background: var(--card); border: 1px solid var(--line); padding: 12px 20px; border-radius: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.loading { display: grid; justify-items: center; gap: 14px; padding: 60px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* summary */
.done-mark { font: 700 30px var(--jp); color: var(--accent); margin: 18px 0 4px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.stats div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stats b { display: block; font-size: 24px; }
.stats span { font-size: 13px; color: var(--muted); }
