:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-2: #efebe6;
  --text: #17161a;
  --muted: #6b6870;
  --line: #e2ddd6;
  --accent: #e8452c;
  --accent-ink: #ffffff;
  --accent-soft: #fde4de;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --radius: 14px;
  --player-h: 112px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1b1b1f;
    --surface-2: #26262b;
    --text: #f1f0f3;
    --muted: #a19fa8;
    --line: #2e2e34;
    --accent: #ff6a4d;
    --accent-ink: #160805;
    --accent-soft: #3a1c16;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #1b1b1f;
  --surface-2: #26262b;
  --text: #f1f0f3;
  --muted: #a19fa8;
  --line: #2e2e34;
  --accent: #ff6a4d;
  --accent-ink: #160805;
  --accent-soft: #3a1c16;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom) + 16px);
}
svg { width: 24px; height: 24px; fill: currentColor; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); }

/* Topo */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 1.15rem; }
.brand img { border-radius: 8px; }
.brand b { color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.weather {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px 0 8px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.weather[hidden] { display: none; }
.w-icon { font-size: 1.1rem; line-height: 1; }
.w-city { color: var(--muted); }
.w-temp { font-weight: 700; }
@media (max-width: 360px) { .w-city { display: none; } }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg text { fill: currentColor; font-family: system-ui, sans-serif; }
#themeBtn svg { stroke: currentColor; }
#themeBtn .i-sun { fill: none; stroke-width: 1.8; stroke-linecap: round; }
#themeBtn .i-sun circle { fill: currentColor; }
#themeBtn .i-moon { stroke: none; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: block; }
  :root:not([data-theme="light"]) .i-moon { display: none; }
}

main { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* Destaque */
.hero {
  display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center;
  padding: 28px 0 20px;
}
.cover img { width: 100%; aspect-ratio: 1; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--accent); }
.hero h1 { margin: 2px 0 6px; font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; letter-spacing: -.02em; }
.lede { margin: 0 0 16px; color: var(--muted); max-width: 52ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 20px 0 14px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 600;
}
#nextEdition { margin: 12px 0 0; }

@media (max-width: 560px) {
  .hero { grid-template-columns: 84px 1fr; column-gap: 16px; row-gap: 0; padding-top: 20px; }
  .hero-text { display: contents; }
  .cover { grid-row: 1 / span 2; }
  .eyebrow { align-self: end; }
  .hero h1 { align-self: start; margin-bottom: 0; }
  .lede { display: none; }
  .hero-actions, #nextEdition { grid-column: 1 / -1; }
  .hero-actions { margin-top: 18px; }
  .btn-primary { flex: 1; justify-content: center; }
}

/* Lista */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.section-head h2 { margin: 0; font-size: 1.25rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 24px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); position: relative; transition: background .15s; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.ep-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ep {
  display: grid; grid-template-columns: 52px 1fr; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px;
}
.ep.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ep-play {
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.ep-play .i-pause, .play-btn .i-pause { display: none; }
.is-playing .ep-play .i-pause, .player.is-playing .play-btn .i-pause { display: block; }
.is-playing .ep-play .i-play, .player.is-playing .play-btn .i-play { display: none; }
.ep-meta { margin: 0; }
.ep-title { margin: 2px 0 4px; font-size: 1.05rem; line-height: 1.3; }
.ep-desc { margin: 0; color: var(--muted); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ep-credits { margin: 8px 0 0; color: var(--muted); }
.ep-credits strong { color: var(--text); }
.ep-bar { height: 4px; background: var(--surface-2); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.ep-bar span { display: block; height: 100%; width: 0; background: var(--accent); }
.ep-bar[data-empty] { display: none; }
.ep-more { margin-top: 10px; font-size: .92rem; }
.ep-more summary { cursor: pointer; color: var(--muted); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.ep-more h4 { margin: 12px 0 6px; font-size: .9rem; }
.ep-more ul { margin: 0; padding-left: 18px; }
.ep-more li { margin: 3px 0; }
.chapter-link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.ep-transcript div { white-space: pre-wrap; color: var(--muted); max-height: 320px; overflow: auto; padding: 8px; background: var(--surface-2); border-radius: 8px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-right: 6px; vertical-align: 1px; }

/* Player */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(0,0,0,.12);
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
}
.progress-wrap { max-width: 860px; margin: 0 auto; padding-top: 4px; }
#seek {
  width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none;
  --p: 0%;
}
#seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent)) 0/var(--p) 100% no-repeat, var(--surface-2); }
#seek::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-2); }
#seek::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent); border: 0; }
#seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }
.player-row { max-width: 860px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.now { display: flex; align-items: center; gap: 10px; min-width: 0; }
.now-cover { width: 44px; height: 44px; border-radius: 8px; flex: none; }
.now-text { display: flex; flex-direction: column; min-width: 0; }
.now-text strong, .now-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 4px; }
.play-btn {
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
}
.play-btn svg { width: 28px; height: 28px; }
.extra { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); }
.speed-btn {
  min-width: 56px; height: 36px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-variant-numeric: tabular-nums;
}
.speed-btn[data-fast] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

@media (max-width: 640px) {
  .player-row { grid-template-columns: 1fr auto; grid-template-areas: "now extra" "controls controls"; row-gap: 4px; }
  .now { grid-area: now; }
  .extra { grid-area: extra; }
  .controls { grid-area: controls; justify-content: center; gap: 12px; }
  .time { display: none; }
  :root { --player-h: 150px; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
