:root {
  --bg: #1d1620;
  --bg-2: #261d29;
  --panel: #2d2330;
  --panel-2: #362a39;
  --line: #4a3a4c;
  --text: #f4ead8;
  --muted: #c9b9a6;
  --accent: #f3b562;
  --accent-ink: #1d1620;
  --wood: #6b4a3a;
  --wood-2: #8a5f48;
  --focus: #ffd38a;
  --prelim: #f0a07a;
  --radius: 10px;
  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.55 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: #ffd08f; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 8px; z-index: 10; font-weight: 700; }
.skip:focus { top: 12px; }

.preview-banner {
  background: #4a2e1c; color: #ffe3c2; border-bottom: 2px solid var(--accent);
  padding: 10px 16px; font-size: .95rem; text-align: center;
}

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bg-2);
}
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.15rem; letter-spacing: .01em; }
.brand-mark { width: 30px; height: 30px; image-rendering: pixelated; }
.site-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-header nav a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.site-header nav a:hover { background: var(--panel); }

main { max-width: 1240px; margin: 0 auto; padding: 24px; }

/* Stage */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.tv {
  position: relative; width: 100%;
  background: #120d14; border-radius: 18px; overflow: hidden;
  border: 12px solid var(--wood);
  box-shadow: inset 0 0 0 2px #2a1d22, 0 0 0 2px var(--wood-2), 0 18px 40px rgba(0,0,0,.45);
}
.tv:fullscreen { border: 0; border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
.screen { position: relative; aspect-ratio: 16 / 9; width: 100%; }
.tv:fullscreen .screen { max-height: calc(100vh - 7em); width: auto; margin: 0 auto; }
#studio { width: 100%; height: 100%; display: block; }
.air-tag {
  position: absolute; left: 10px; top: 10px; max-width: calc(100% - 20px);
  background: rgba(29,22,32,.9); color: var(--text); border: 1px solid var(--line);
  font: 600 .78rem/1.3 var(--mono); padding: 5px 9px; border-radius: 6px; letter-spacing: .02em;
}
.air-tag.is-sample { border-color: var(--accent); color: #ffe3c2; }
.lower-third {
  position: absolute; left: 10px; bottom: 10px; display: grid;
  background: rgba(29,22,32,.92); border-left: 4px solid var(--accent); padding: 5px 12px 6px; border-radius: 0 6px 6px 0;
}
.lower-third[hidden] { display: none; }
.lt-name { font-weight: 800; font-size: 1rem; }
.lt-role { font-size: .72rem; color: var(--muted); }
.lt-section { font-size: .78rem; font-weight: 700; color: var(--accent); margin-top: 2px; }
.captions {
  min-height: 4.4em; display: flex; align-items: center; justify-content: center; text-align: center;
  background: #0d0a0f; color: #fff; padding: 10px 16px; border-top: 2px solid #2a1d22;
  font-size: clamp(1rem, 1.7vw, 1.2rem); line-height: 1.4;
}
.captions[hidden] { display: flex; visibility: hidden; }
.tune-in {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  font: 800 1.05rem var(--font); padding: 14px 22px; min-height: 48px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.tune-in[hidden] { display: none; }
body[data-mode="channel"] .tune-in { top: auto; bottom: 10px; left: auto; right: 10px; transform: none; padding: 10px 16px; font-size: .95rem; }

.progress { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ctl, .btn {
  min-height: 44px; min-width: 44px; padding: 8px 14px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  font: 600 .95rem var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
}
.ctl:hover, .btn:hover { background: var(--panel-2); color: var(--text); }
.ctl[aria-pressed="true"] { border-color: var(--accent); }
.speed select { background: transparent; color: var(--text); border: 0; font: inherit; min-height: 30px; }
.speed select option { background: var(--panel); }
.btn { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:hover { background: #ffc77d; color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel); color: #ffd08f; }
.btn-small { min-height: 36px; padding: 4px 10px; font-size: .85rem; }
.voice-note { font-size: .85rem; color: var(--muted); margin-top: 8px; }

.ep-head { margin-top: 18px; }
.ep-topic { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.ep-topic::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--topic, var(--accent)); }
#ep-title { font-size: clamp(1.4rem, 3vw, 2rem); }
.ep-meta { color: var(--muted); font-size: .92rem; }
.ep-summary { font-size: 1.05rem; max-width: 70ch; }

/* Rail */
.rail { display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card[hidden] { display: none; }
.card-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.now-title { font-weight: 700; margin-bottom: 4px; }
.sources { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 14px; }
.source { display: grid; gap: 3px; }
.source a { font-weight: 600; overflow-wrap: anywhere; }
.source-meta { font-size: .85rem; color: var(--muted); }
.source-note { font-size: .82rem; color: var(--muted); font-style: italic; }
.badge { justify-self: start; font: 700 .7rem/1.2 var(--mono); padding: 3px 7px; border-radius: 4px; background: #3d4a3c; color: #d8ecd2; letter-spacing: .02em; }
.badge-prelim { background: #5a3324; color: #ffd6c2; }
.up-next { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.up-next a { display: flex; gap: 8px; align-items: baseline; font-weight: 600; text-decoration: none; color: var(--text); }
.up-next a:hover { color: var(--accent); }
.up-next li > .muted { display: block; padding-left: 18px; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: var(--topic, var(--accent)); flex: none; display: inline-block; }

/* Topics */
.topics, .transcript-wrap, .archive, .hosts, .about, .signup { margin-top: 40px; }
.topic-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.topic-btn {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center;
  padding: 12px 14px; min-height: 56px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700;
}
.topic-btn .dot { background: var(--topic, var(--accent)); grid-row: span 2; width: 14px; height: 14px; }
.topic-btn .count { font-size: .8rem; font-weight: 500; color: var(--muted); }
.topic-btn:hover { background: var(--panel-2); color: var(--text); }
.topic-btn[aria-current="page"] { border-color: var(--topic, var(--accent)); box-shadow: inset 0 0 0 1px var(--topic, var(--accent)); }

/* Transcript */
.transcript-wrap details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.transcript-wrap summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; }
.transcript-wrap summary h2 { display: inline; margin: 0; font-size: 1.15rem; }
.transcript { padding: 8px 0 12px; max-width: 75ch; }
.tr-seg { padding: 10px 12px; border-left: 3px solid transparent; border-radius: 4px; }
.tr-seg.is-current { border-left-color: var(--accent); background: var(--bg-2); }
.tr-seg h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.corrections { margin-top: 16px; background: #3a2a1c; border: 1px solid #8a6a3a; border-radius: var(--radius); padding: 14px 16px; }
.corrections[hidden] { display: none; }
.corrections h2 { font-size: 1.05rem; }

/* Archive */
.archive-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.filter { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.filter select { min-height: 44px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; }
.archive-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ep-card-link {
  display: grid; gap: 6px; height: 100%; padding: 16px; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--topic, var(--accent));
}
.ep-card-link:hover { background: var(--panel-2); color: var(--text); }
.ep-card-topic { font-size: .8rem; font-weight: 700; color: var(--muted); }
.ep-card-title { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.ep-card-meta { font-size: .82rem; color: var(--muted); }

/* Hosts */
.disclosure { background: var(--panel); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 0 8px 8px 0; max-width: 80ch; }
.host-grid { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.host { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.avatar { width: 72px; height: 72px; border-radius: 50%; flex: none; background: #3b2a39; }
.host h3 { margin-bottom: 2px; }
.host-role { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.host p:last-child { margin: 0; font-size: .95rem; }

/* About */
.about-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.about-grid > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.about-grid p:last-child { margin: 0; }
.plain-list { margin: 0; padding-left: 1.2em; }

/* Signup */
.signup { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.news-form { display: grid; gap: 8px; }
.news-row { display: flex; gap: 8px; flex-wrap: wrap; }
.news-row input { flex: 1 1 200px; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); }

.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px; text-align: center; color: var(--muted); font-size: .9rem; }
.site-footer p { max-width: 80ch; margin: 0 auto .6em; }

/* Reduced motion: honour the OS setting and the in-page toggle. */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.reduce-motion * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }

/* Tablet / phone */
@media (max-width: 960px) {
  .stage { grid-template-columns: 1fr; }
  .signup { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { padding: 16px; }
  .site-header { padding: 10px 16px; }
  .tv { border-width: 6px; border-radius: 12px; }
  .lower-third { left: 6px; bottom: 6px; padding: 3px 8px 4px; }
  .lt-name { font-size: .8rem; }
  .lt-role { display: none; }
  .lt-section { font-size: .68rem; }
  .air-tag { font-size: .64rem; padding: 3px 7px; left: 6px; top: 6px; }
  .captions { min-height: 5.6em; padding: 8px 10px; font-size: .95rem; }
  body[data-mode="channel"] .tune-in { bottom: 6px; right: 6px; padding: 6px 12px; min-height: 40px; font-size: .85rem; }
  .controls .ctl { flex: 1 1 auto; justify-content: center; }
}
@media (forced-colors: active) {
  .ctl[aria-pressed="true"] { outline: 2px solid CanvasText; }
}
