:root {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #0e1426;
  --quote: #161e35;
  --border: #26314f;
  --text: #eef2ff;
  --muted: #8f9bb8;
  --accent: #06b6d4;
  --ok: #22c55e;
  --kw: #ffffff;
}
body.light {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --quote: #f1f5f9;
  --border: #d5dcea;
  --text: #0f172a;
  --muted: #5b6680;
  --accent: #0284c7;
  --kw: #0f172a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  border-bottom: 1px solid var(--border); background: var(--bg); flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo-ring {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #06b6d4, #3b82f6); font-size: 18px; flex-shrink: 0;
}
.brand h1 { margin: 0; font-size: 15.5px; line-height: 1.2; }
.brand .sub { margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.top-btns { display: flex; gap: 6px; flex-shrink: 0; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; cursor: pointer; font-family: inherit;
}
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.scope-bar {
  display: flex; gap: 6px; padding: 8px 14px; overflow-x: auto; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  scrollbar-width: none;
}
.scope-bar::-webkit-scrollbar { display: none; }
.scope-pill {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; font-family: inherit;
}
.scope-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.main {
  flex: 1; overflow-y: auto; padding: 12px 14px 20px;
  display: flex; flex-direction: column; gap: 12px;
  max-width: 720px; width: 100%; margin: 0 auto;
}

.stage-card, .list-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
}
.stage-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.badge {
  font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
}
.idx { font-size: 12px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.st-title { margin: 0 0 10px; font-size: 17px; line-height: 1.35; }
.st-text {
  background: var(--quote); border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 12px 14px; font-size: 16px; line-height: 1.85;
}
.st-text b.kw { color: var(--kw); font-weight: 800; }
.st-text .slot { color: var(--muted); font-style: italic; }
body.blind .st-text { filter: blur(7px); user-select: none; cursor: pointer; transition: filter .2s; }
body.blind .st-text.revealed { filter: none; user-select: text; }

.st-skel-wrap { margin-top: 10px; font-size: 13px; color: var(--muted); }
.st-skel-wrap summary { cursor: pointer; font-weight: 600; }
.st-skel { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.st-skel li {
  font-size: 12.5px; padding: 5px 9px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}

.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 14px; font-weight: 700; }
.playlist { display: flex; flex-direction: column; gap: 6px; }
.pl-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
}
.pl-row.playing {
  border-color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--surface-2));
}
.pl-num {
  width: 24px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex-shrink: 0;
}
.pl-row.playing .pl-num { color: var(--ok); }
.pl-info { flex: 1; min-width: 0; }
.pl-title { font-size: 13.5px; font-weight: 700; }
.pl-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.pl-state { font-size: 13px; flex-shrink: 0; }

.player-dock {
  flex-shrink: 0; background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
.progress-row { display: flex; align-items: center; gap: 8px; max-width: 720px; width: 100%; margin: 0 auto; }
.time { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; width: 38px; text-align: center; }
.seek { flex: 1; accent-color: var(--accent); height: 5px; cursor: pointer; }
.ctrl-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  max-width: 720px; width: 100%; margin: 0 auto;
}
.rate-sel {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 8px; font-size: 13px; font-weight: 700; font-family: inherit;
}
.ctrl-btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  width: 44px; height: 40px; border-radius: 12px; font-size: 16px; cursor: pointer;
}
.ctrl-btn.play {
  width: 56px; height: 44px; border-radius: 14px; font-size: 18px;
  background: var(--accent); color: #fff; border-color: var(--accent);
}

.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%) translateY(-10px);
  background: var(--text); color: var(--bg); padding: 7px 14px; border-radius: 999px;
  font-size: 12.5px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
