:root {
  --bg: #05070b;
  --card: #14171e;
  --green: #00e676;
  --fg: #eef1f6;
  --muted: #8b95a7;
  --ice: #7dd3fc;
  --accent: #ff3b6b;
  --line: rgba(238, 241, 246, 0.1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(0, 230, 118, 0.08), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(125, 211, 252, 0.07), transparent 50%),
    var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.4;
}

p, h1, h2, ul, ol { margin: 0; }

button, a, video { touch-action: manipulation; }

button, a {
  -webkit-tap-highlight-color: rgba(0, 230, 118, 0.28);
}

button:focus,
a:focus,
video:focus {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

video:focus { outline-color: var(--ice); }

@supports selector(:focus-visible) {
  button:focus,
  a:focus,
  video:focus { outline: none; }

  button:focus-visible,
  a:focus-visible,
  video:focus-visible {
    outline: 3px solid var(--green);
    outline-offset: 3px;
  }

  video:focus-visible { outline-color: var(--ice); }
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 20;
  background: var(--green);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.skip:focus { top: calc(8px + var(--sat)); }

.noscript,
.banner {
  margin: 0;
  padding: 12px 16px;
  padding-left: calc(16px + var(--sal));
  padding-right: calc(16px + var(--sar));
  background: var(--card);
  color: var(--fg);
  border-bottom: 1px solid var(--line);
}

.banner { border-left: 4px solid var(--ice); }

.banner strong,
.noscript { color: var(--ice); }

.banner[hidden],
.demo[hidden],
[hidden] { display: none !important; }

.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding-left: var(--sal);
  padding-right: var(--sar);
  padding-bottom: calc(28px + var(--sab));
}

.sticky-stack {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #05070b;
  padding-top: var(--sat);
  margin-left: calc(var(--sal) * -1);
  margin-right: calc(var(--sar) * -1);
  padding-left: var(--sal);
  padding-right: var(--sar);
  border-bottom: 1px solid var(--line);
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 2px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
}

.kicker {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

h1 {
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.show { text-align: right; }

.show-name {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-style: italic;
  font-size: 1.65rem;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.player { padding: 10px 0 12px; }

.stage {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
}

video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  object-fit: contain;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(5, 7, 11, 0.05) 20%, rgba(5, 7, 11, 0.82) 100%);
  pointer-events: none;
}

.stage.has-source .overlay { display: none; }

.overlay-kicker {
  color: var(--ice);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overlay-title {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(1.5rem, 4.6vw, 2.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.status-block { padding: 10px 2px 0; }

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stage:not(.has-source) + .status-block .status-line {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status-detail {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 2px;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7);
  animation: pulse 1.8s ease-out infinite;
  flex: none;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(0, 230, 118, 0); }
}

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  flex: 1 1 9rem;
}

.btn-primary {
  background: var(--green);
  color: #04140c;
  border-color: var(--green);
}

.btn:active { transform: translateY(1px); }

.net-note {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 10px 2px 0;
}

.demo {
  margin-top: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid rgba(125, 211, 252, 0.35);
  border-radius: 14px;
}

.demo p + p { margin-top: 6px; }

.demo .btn { margin-top: 10px; flex: 1 1 auto; }

.gateway-links {
  list-style: none;
  padding: 4px 0 0;
}

.gateway-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ice);
  text-decoration: none;
  padding: 4px 2px;
}

.episodes { padding: 16px 0 8px; }

.episodes-head { padding-bottom: 10px; }

h2 {
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}

.lede {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95rem;
}

.episode-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}

.episode {
  width: 100%;
  text-align: left;
  color: inherit;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 72px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  font: inherit;
}

.episode[aria-current="true"] {
  border-color: var(--green);
  box-shadow: inset 3px 0 0 var(--green);
}

.ep-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  padding-top: 3px;
}

.ep-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ep-series {
  color: var(--ice);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ep-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ep-artist,
.ep-desc { color: var(--muted); font-size: 0.9rem; }

.ep-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ep-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.pill.is-ok { color: var(--green); border-color: rgba(0, 230, 118, 0.45); }
.pill.is-bad { color: var(--accent); border-color: rgba(255, 59, 107, 0.5); }
.pill.is-hls { color: var(--ice); border-color: rgba(125, 211, 252, 0.45); }

.yt {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ice);
  padding: 0 12px 8px;
}

.footer {
  color: var(--muted);
  font-size: 0.85rem;
  display: grid;
  gap: 6px;
  padding-top: 18px;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--green); }
  .episode:hover { border-color: rgba(238, 241, 246, 0.2); }
  .btn-primary:hover { border-color: var(--green); filter: brightness(1.05); }
}

@media (min-width: 960px) and (min-height: 640px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas:
      "stack episodes"
      "extra episodes"
      "footer episodes";
    column-gap: 22px;
    align-items: start;
    min-height: 100dvh;
    padding-top: var(--sat);
  }

  .sticky-stack {
    position: static;
    grid-area: stack;
    margin: 0;
    padding-top: 8px;
    border-bottom: 0;
    background: transparent;
  }

  .player-extra { grid-area: extra; }
  .episodes {
    grid-area: episodes;
    padding-top: 18px;
  }

  .footer { grid-area: footer; }
}

@media (orientation: landscape) and (max-height: 520px) {
  body {
    height: 100dvh;
    overflow: hidden;
  }

  .shell {
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.9fr);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
      "stack episodes"
      "extra episodes";
    gap: 8px 12px;
    padding-top: max(6px, var(--sat));
    padding-bottom: max(6px, var(--sab));
    min-height: 0;
  }

  .player-extra { grid-area: extra; align-self: end; }

  .sticky-stack {
    display: flex;
    flex-direction: column;
    position: relative;
    grid-area: stack;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding-top: 0;
    border: 0;
    background: transparent;
  }

  .header { padding-top: 4px; padding-bottom: 6px; }
  .show-name { font-size: 1.25rem; }
  h1 { font-size: 1.1rem; }
  .mark { width: 32px; height: 32px; }

  .player {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-top: 0;
  }

  .stage {
    flex: 1 1 auto;
    min-height: 0;
    aspect-ratio: auto;
  }

  .transport { padding-top: 8px; }
  .btn { min-height: 44px; padding: 8px 12px; flex: 1 1 7rem; }
  .net-note { padding-top: 6px; }
  .episodes {
    grid-area: episodes;
    min-height: 0;
    overflow: auto;
    padding: 0 0 4px;
    -webkit-overflow-scrolling: touch;
  }
  .footer { display: none; }
}

.is-tight .footer { display: none; }
.is-tight .stage { max-height: 46dvh; aspect-ratio: auto; }

@media (min-width: 1400px) {
  .shell { max-width: 1280px; }
  .btn { min-height: 56px; font-size: 1.08rem; }
  .episode { min-height: 84px; }
  .status-line { font-size: 1.2rem; }
}

@media (max-width: 380px) {
  h1 { font-size: 1.15rem; }
  .show-name { font-size: 1.3rem; }
  .header { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
