:root {
  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --ink: #1C1A24;
  --muted: #6B6675;
  --line: #EADFD2;
  --accent: #E8741E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE7D6;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11131C;
    --surface: #1A1D29;
    --ink: #F4EFE8;
    --muted: #A29DAD;
    --line: #2A2E3D;
    --accent: #F59A45;
    --accent-ink: #1A1206;
    --accent-soft: #3A2A1C;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 460px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) 20px calc(env(safe-area-inset-bottom) + 32px);
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

header { position: relative; text-align: center; margin-bottom: 28px; }
.settings-button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.settings-button:active { background: var(--accent-soft); }
.settings-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.brand {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 { margin: 6px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }

#player { display: flex; flex-direction: column; align-items: center; }
.play {
  width: 132px;
  height: 132px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform 0.12s ease;
}
.play:active { transform: scale(0.96); }
.play svg { width: 54px; height: 54px; fill: currentColor; }
.play .icon-pause, .play.playing .icon-play { display: none; }
.play.playing .icon-pause { display: block; }
.play.loading { opacity: 0.6; }

.now { margin: 18px 0 14px; min-height: 1.45em; color: var(--muted); font-weight: 600; text-align: center; }

.seek {
  width: 100%;
  height: 28px;
  margin: 0;
  accent-color: var(--accent);
}
.times {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.controls { display: flex; gap: 10px; width: 100%; margin: 18px 0 26px; }
.controls button {
  flex: 1;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
}
.controls button:active { background: var(--accent-soft); }

.chapters { list-style: none; margin: 0; padding: 0; width: 100%; }
.chapters button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
}
.chapters button:active { background: var(--accent-soft); }
.chapters .current button { background: var(--accent-soft); font-weight: 700; }
.chapters .title { flex: 1; }
.chapters .at { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
/* Which presenter reads the section: muted dot for the first voice, accent for the second. */
.chapters .voice { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.55; flex: none; }
.chapters .voice.b { background: var(--accent); opacity: 1; }

.message { text-align: center; color: var(--muted); }

.note {
  margin: -6px 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 14px;
  text-align: center;
}

/* ---------- setup / settings ---------- */
.setup h2 { margin: 0 0 4px; font-size: 22px; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.setup fieldset { margin: 0 0 22px; padding: 0; border: 0; }
.setup legend { margin-bottom: 10px; font-weight: 700; }
.setup label { display: grid; gap: 6px; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
.setup select {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented label, .topics label { margin: 0; }
.segmented input, .topics input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .topics span {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.segmented input:checked + span, .topics input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.segmented input:focus-visible + span, .topics input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.topics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.primary {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
.primary:disabled { opacity: 0.6; }
.link { width: 100%; min-height: 44px; margin-top: 6px; border: 0; background: none; color: var(--muted); }
