/* ============================================================================
 * /watch/ — Multi-show smart-TV theme
 * ============================================================================
 * Two views, one stylesheet: a landing-page show grid and a per-show player
 * with a chunky flat-screen-TV chassis. The accent colour (LED, chip, button
 * highlights) is set via the `--tv-accent` custom property on :root from JS
 * so each show has its own visual signature.
 * ========================================================================= */

:root {
  --tv-bezel: #0e0e10;
  --tv-bezel-edge: #050507;
  --tv-bezel-trim: #1d1d22;
  --tv-screen-off: #050608;
  --tv-screen-tint: #0a0f14;
  --tv-stand: #2a2a30;
  --tv-stand-dark: #14141a;
  --tv-led: #c0ff5a;
  --tv-led-glow: rgba(192, 255, 90, 0.55);
  --tv-led-red: #ff4b3a;
  --tv-led-red-glow: rgba(255, 75, 58, 0.6);
  --tv-accent: #ffb800;
  --tv-accent-dim: #c98a00;
  --tv-accent-glow: rgba(255, 184, 0, 0.45);
  --tv-chip-bg: #1b1b22;
  --tv-chip-border: #2a2a35;
  --tv-chip-active: #ffb800;
  --tv-card-bg: #15151a;
  --tv-card-border: #24242c;
  --tv-text: #f5f5f7;
  --tv-text-dim: #9a9aa3;
  --tv-text-dimmer: #65656e;
  --font-screen: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-screen);
  color: var(--tv-text);
  background: radial-gradient(ellipse at 50% 0%, #1a1a22 0%, #0b0b10 60%, #050507 100%);
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.tv-room {
  min-height: 100vh;
  padding: 76px 16px 96px;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

/* ------------------------------------------------------------------------ */
/* Header + breadcrumbs                                                     */
/* ------------------------------------------------------------------------ */

.tv-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.tv-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--tv-text-dim);
  padding: 4px 2px;
}

.tv-crumb {
  color: var(--tv-text-dim);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a.tv-crumb:hover {
  color: var(--tv-text);
  border-bottom-color: var(--tv-accent-dim);
}

.tv-crumb--current {
  color: var(--tv-text);
  font-weight: 600;
}

.tv-crumb-sep {
  color: var(--tv-text-dimmer);
  font-size: 14px;
}

.tv-crumb-back {
  appearance: none;
  background: transparent;
  border: 1px solid var(--tv-card-border);
  color: var(--tv-text-dim);
  font-family: var(--font-mono);
  font-size: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tv-crumb-back:hover {
  color: var(--tv-text);
  border-color: var(--tv-accent-dim);
  background: color-mix(in srgb, var(--tv-accent) 8%, transparent);
}

/* The mounted view fills whatever's left of the room. Views own their own
   spacing so the slot itself stays minimal. */
.tv-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ------------------------------------------------------------------------ */
/* Landing view — show grid                                                 */
/* ------------------------------------------------------------------------ */

.tv-landing {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.tv-landing-intro {
  text-align: center;
  max-width: 68ch;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.tv-landing-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--tv-text);
}

.tv-landing-blurb {
  margin: 0;
  font-size: 14px;
  color: var(--tv-text-dim);
  line-height: 1.55;
}

/* ------------------------------------------------------------------------ */
/* Episodes view — per-show banner + grid                                   */
/* ------------------------------------------------------------------------ */

.tv-episodes {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tv-show-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--show-accent, var(--tv-accent)) 18%, var(--tv-card-bg)) 0%,
    var(--tv-card-bg) 70%
  );
  border: 1px solid var(--tv-card-border);
  border-left: 3px solid var(--show-accent, var(--tv-accent));
  border-radius: 14px;
}

.tv-show-banner-emoji {
  font-size: 40px;
  line-height: 1;
}

.tv-show-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tv-show-banner-name {
  margin: 0;
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--tv-text);
}

.tv-show-banner-tag {
  margin: 0;
  font-size: 13px;
  color: var(--tv-text-dim);
  line-height: 1.4;
}

.tv-inline-loading {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--tv-text-dim);
  padding: 28px 12px;
  letter-spacing: 1.5px;
}

.tv-error-banner {
  background: rgba(40, 6, 6, 0.6);
  border: 1px solid #5a1d15;
  border-radius: 10px;
  padding: 14px 16px;
  color: #ffdcd2;
  font-size: 13px;
}

.tv-ep-tools {
  display: flex;
  justify-content: flex-end;
  padding: 0 2px;
}

.tv-ep-tools.hidden {
  display: none;
}

.tv-show-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.tv-show-card {
  appearance: none;
  border: 1px solid var(--tv-card-border);
  background: var(--tv-card-bg);
  border-radius: 14px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  color: var(--tv-text);
  transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
  /* `--show-accent` is set inline on each card from JS so the hover
     glow tracks each show's signature colour. */
  --show-accent: var(--tv-accent);
}

.tv-show-card:hover {
  transform: translateY(-3px);
  border-color: var(--show-accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--show-accent),
    0 0 24px color-mix(in srgb, var(--show-accent) 30%, transparent);
}

.tv-show-card:focus-visible {
  outline: 2px solid var(--show-accent);
  outline-offset: 2px;
}

.tv-show-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: #0a0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 80px;
}

.tv-show-poster.is-empty {
  color: rgba(255, 255, 255, 0.4);
}

.tv-show-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-show-meta {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tv-show-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--tv-text);
  line-height: 1.25;
}

.tv-show-tag {
  margin: 0;
  font-size: 12.5px;
  color: var(--tv-text-dim);
  line-height: 1.4;
}

/* ------------------------------------------------------------------------ */
/* Landing view — "Continue watching" row                                   */
/* ------------------------------------------------------------------------ */

.tv-continue-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tv-continue-section.hidden {
  display: none;
}

.tv-continue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.tv-continue-card {
  appearance: none;
  border: 1px solid var(--tv-card-border);
  background: var(--tv-card-bg);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  color: var(--tv-text);
  text-decoration: none;
  position: relative;
  transition: transform 0.18s ease, border 0.18s ease, box-shadow 0.18s ease;
  --show-accent: var(--tv-accent);
}

.tv-continue-card:hover {
  transform: translateY(-2px);
  border-color: var(--show-accent);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.55),
    0 0 18px color-mix(in srgb, var(--show-accent) 25%, transparent);
}

.tv-continue-card:focus-visible {
  outline: 2px solid var(--show-accent);
  outline-offset: 2px;
}

.tv-continue-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 44px;
}

.tv-continue-thumb.is-empty {
  color: rgba(255, 255, 255, 0.45);
}

.tv-continue-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Play glyph overlay — visible by default at low opacity, brighter on
   hover so the user reads the card as a "resume playback" affordance. */
.tv-continue-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  opacity: 0.25;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.55) 100%);
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.tv-continue-card:hover .tv-continue-play,
.tv-continue-card:focus-visible .tv-continue-play {
  opacity: 1;
}

.tv-continue-remove {
  appearance: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 12, 0.7);
  color: var(--tv-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
  z-index: 1;
}

.tv-continue-card:hover .tv-continue-remove,
.tv-continue-card:focus-within .tv-continue-remove,
.tv-continue-remove:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.tv-continue-remove:hover {
  background: var(--tv-led-red);
  border-color: var(--tv-led-red);
  color: #fff;
}

.tv-continue-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tv-continue-show {
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-continue-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--show-accent, var(--tv-accent));
  text-transform: uppercase;
}

/* Touch devices have no hover state; keep the ✕ visible at lower
   opacity so it's still discoverable. */
@media (hover: none) {
  .tv-continue-remove {
    opacity: 0.85;
    transform: scale(1);
  }
}

.tv-back-to-shows {
  appearance: none;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1.5px;
  padding: 7px 12px;
  background: transparent;
  color: var(--tv-text-dim);
  border: 1px solid var(--tv-card-border);
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, border 0.15s ease, background 0.15s ease;
}

.tv-back-to-shows:hover {
  color: var(--tv-text);
  border-color: var(--tv-accent-dim);
  background: rgba(255, 184, 0, 0.06);
}

/* ------------------------------------------------------------------------ */
/* Player view                                                              */
/* ------------------------------------------------------------------------ */

.tv-player {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tv-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tv-led);
  box-shadow: 0 0 10px var(--tv-led-glow);
  animation: tv-pulse 2.4s ease-in-out infinite;
}

@keyframes tv-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ------------------------------------------------------------------------ */
/* TV chassis                                                               */
/* ------------------------------------------------------------------------ */

.tv-set {
  display: flex;
  justify-content: center;
  margin: 4px 0 0;
}

.tv-bezel {
  width: min(1100px, 100%);
  background: linear-gradient(180deg, var(--tv-bezel) 0%, var(--tv-bezel-edge) 100%);
  border-radius: 22px;
  padding: 14px 14px 0;
  border: 1px solid var(--tv-bezel-trim);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  position: relative;
}

.tv-bezel-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 8px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--tv-text-dimmer);
  text-transform: uppercase;
}

.tv-channel-chip {
  background: var(--tv-chip-bg);
  color: var(--tv-led);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--tv-chip-border);
  letter-spacing: 1.5px;
  text-shadow: 0 0 6px var(--tv-led-glow);
}

.tv-screen {
  position: relative;
  background: var(--tv-screen-off);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid #000;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8), inset 0 0 0 3px var(--tv-bezel-edge);
}

.tv-video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  outline: none;
}

.tv-base {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 6px;
}

.tv-stand {
  width: 32%;
  max-width: 280px;
  height: 8px;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(180deg, var(--tv-stand) 0%, var(--tv-stand-dark) 100%);
  border: 1px solid #000;
  border-top: 0;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55);
}

/* Loading + no-signal overlays sit ON TOP of the video element. */
.tv-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(180deg, #0a0d10 0%, #050608 100%);
  color: var(--tv-text);
  text-align: center;
  padding: 24px;
}

.tv-overlay.hidden {
  display: none;
}

.tv-overlay-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(14px, 2vw, 18px);
  letter-spacing: 4px;
  color: var(--tv-led);
  text-shadow: 0 0 10px var(--tv-led-glow);
}

#tv-no-signal .tv-overlay-title {
  color: var(--tv-led-red);
  text-shadow: 0 0 10px var(--tv-led-red-glow);
}

.tv-overlay-detail {
  margin: 0;
  font-size: 14px;
  color: var(--tv-text-dim);
  max-width: 50ch;
}

/* Playback error banner (sits ABOVE the controls inside the screen). */
.tv-error {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 50px;
  z-index: 3;
  background: rgba(20, 4, 4, 0.92);
  border: 1px solid #5a1d15;
  border-radius: 8px;
  padding: 12px 14px;
  color: #ffdcd2;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  pointer-events: auto;
}

.tv-error.hidden {
  display: none;
}

.tv-error-link {
  color: var(--tv-accent);
  background: color-mix(in srgb, var(--tv-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tv-accent) 40%, transparent);
  padding: 4px 10px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
}

.tv-error-link:hover {
  background: color-mix(in srgb, var(--tv-accent) 18%, transparent);
}

/* ------------------------------------------------------------------------ */
/* Marquee                                                                  */
/* ------------------------------------------------------------------------ */

.tv-marquee {
  background: var(--tv-card-bg);
  border: 1px solid var(--tv-card-border);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: hidden;
}

.tv-now-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--tv-led-red);
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 8px var(--tv-led-red-glow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tv-rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tv-led-red);
  box-shadow: 0 0 8px var(--tv-led-red-glow);
  animation: tv-pulse 1.8s ease-in-out infinite;
}

.tv-now-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.tv-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--tv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-subtitle {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--tv-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-marquee.is-flashing .tv-title {
  color: var(--tv-led);
  text-shadow: 0 0 8px var(--tv-led-glow);
}

/* Synopsis card under the marquee. */
.tv-summary {
  background: var(--tv-card-bg);
  border: 1px solid var(--tv-card-border);
  border-left: 3px solid var(--tv-accent);
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0;
}

.tv-summary-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tv-text);
}

/* ------------------------------------------------------------------------ */
/* Remote-control button row                                                */
/* ------------------------------------------------------------------------ */

.tv-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.tv-btn {
  appearance: none;
  font-family: var(--font-screen);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--tv-card-border);
  background: linear-gradient(180deg, #25252d 0%, #18181f 100%);
  color: var(--tv-text);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, filter 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tv-btn:hover {
  filter: brightness(1.15);
}

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

.tv-btn.is-accent {
  background: linear-gradient(180deg, var(--tv-accent) 0%, var(--tv-accent-dim) 100%);
  color: #1b1100;
  border-color: var(--tv-accent-dim);
  box-shadow: 0 0 14px var(--tv-accent-glow);
}

.tv-btn--ghost {
  background: transparent;
  color: var(--tv-text-dim);
  border-color: #2a2a32;
  font-weight: 500;
}

.tv-btn--ghost:hover {
  color: var(--tv-text);
  background: #1c1c22;
}

/* Seek buttons (±10s) — visually paired with Prev/Next but secondary. */
.tv-btn--seek {
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
  color: var(--tv-text-dim);
}

.tv-btn--seek:hover {
  color: var(--tv-text);
}

/* Subtitle picker — anchored under the CC button. */
.tv-subs-wrap {
  position: relative;
  display: inline-flex;
}

.tv-subs-btn {
  font-variant: small-caps;
  letter-spacing: 0.05em;
}

.tv-subs-btn.is-active {
  color: var(--tv-accent);
  border-color: var(--tv-accent-dim);
  background: linear-gradient(180deg, #2a261c 0%, #1a1812 100%);
  font-weight: 700;
}

.tv-subs-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--tv-card-border);
  background: #14141a;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tv-subs-menu.hidden {
  display: none;
}

.tv-subs-item {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--tv-text);
  font: inherit;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.tv-subs-item:hover,
.tv-subs-item:focus-visible {
  background: #20202a;
  outline: none;
}

.tv-subs-item.is-current {
  color: var(--tv-accent);
  font-weight: 600;
}

.tv-subs-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--tv-text-dim);
}

/* Subtitle sync slider — only visible while a track is active.
   Directional labels ("Earlier" / "Later") flank the range input so
   the user never has to guess which way fixes their drift. */
.tv-subs-sync {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 10px;
  background: #15151b;
  border: 1px solid var(--tv-card-border);
  flex-wrap: nowrap;
}

.tv-subs-sync.hidden {
  display: none;
}

.tv-subs-sync-hint {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tv-text-dim);
  white-space: nowrap;
  user-select: none;
}

.tv-subs-sync-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 22px;
  background: transparent;
  cursor: pointer;
  margin: 0;
}

.tv-subs-sync-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: #2a2a32;
  border-radius: 2px;
}

.tv-subs-sync-slider::-moz-range-track {
  height: 4px;
  background: #2a2a32;
  border-radius: 2px;
}

.tv-subs-sync-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--tv-accent);
  border: 2px solid #0b0b10;
  box-shadow: 0 0 8px var(--tv-accent-glow);
  cursor: pointer;
}

.tv-subs-sync-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tv-accent);
  border: 2px solid #0b0b10;
  box-shadow: 0 0 8px var(--tv-accent-glow);
  cursor: pointer;
}

.tv-subs-sync-slider:focus-visible {
  outline: 2px solid var(--tv-accent);
  outline-offset: 4px;
  border-radius: 6px;
}

.tv-subs-sync-readout {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-family: var(--font-screen);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--tv-text-dim);
  cursor: pointer;
  user-select: none;
  min-width: 56px;
  border-radius: 6px;
}

.tv-subs-sync-readout:hover,
.tv-subs-sync-readout:focus-visible {
  background: #20202a;
  color: var(--tv-text);
  outline: none;
}

.tv-subs-sync-readout.is-shifted {
  color: var(--tv-accent);
  font-weight: 600;
}

@media (max-width: 640px) {
  /* On narrow screens the controls row wraps — drop the verbose hints
     so the slider+readout still fit on a single line. */
  .tv-subs-sync-hint {
    display: none;
  }
  .tv-subs-sync-slider {
    width: 110px;
  }
}

.tv-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--tv-text-dim);
  font-family: var(--font-mono);
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px dashed var(--tv-card-border);
  cursor: pointer;
  user-select: none;
}

.tv-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--tv-accent);
  cursor: pointer;
}

/* ------------------------------------------------------------------------ */
/* Section blocks (seasons + episodes)                                      */
/* ------------------------------------------------------------------------ */

.tv-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tv-section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--tv-text-dim);
  text-transform: uppercase;
  padding-left: 4px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.tv-section-meta {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--tv-text-dimmer);
}

.tv-chip-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 4px 4px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.tv-chip-row::-webkit-scrollbar {
  height: 8px;
}

.tv-chip-row::-webkit-scrollbar-thumb {
  background: var(--tv-card-border);
  border-radius: 4px;
}

.tv-chip {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  padding: 8px 12px;
  background: var(--tv-chip-bg);
  color: var(--tv-text-dim);
  border: 1px solid var(--tv-chip-border);
  border-radius: 6px;
  cursor: pointer;
  scroll-snap-align: center;
  transition: color 0.15s ease, background 0.15s ease, border 0.15s ease;
}

.tv-chip:hover {
  color: var(--tv-text);
  background: #232330;
}

.tv-chip.is-active {
  background: var(--tv-accent);
  color: #1b1100;
  border-color: var(--tv-accent-dim);
  font-weight: 600;
  box-shadow: 0 0 12px var(--tv-accent-glow);
}

/* Episode grid — Netflix-style cards */
.tv-ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.tv-ep-card {
  appearance: none;
  border: 1px solid var(--tv-card-border);
  background: var(--tv-card-bg);
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  color: var(--tv-text);
  transition: transform 0.15s ease, border 0.15s ease, box-shadow 0.15s ease;
}

.tv-ep-card:hover {
  transform: translateY(-2px);
  border-color: var(--tv-accent-dim);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.tv-ep-card.is-active {
  border-color: var(--tv-accent);
  box-shadow: 0 0 0 2px var(--tv-accent-glow), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.tv-ep-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0a0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tv-ep-thumb.is-empty {
  font-size: 36px;
  color: var(--tv-text-dimmer);
}

.tv-ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-ep-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transition: opacity 0.2s ease;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.65) 100%);
}

.tv-ep-card:hover .tv-ep-play,
.tv-ep-card.is-active .tv-ep-play {
  opacity: 1;
}

.tv-ep-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tv-ep-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--tv-accent);
  text-transform: uppercase;
}

.tv-ep-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--tv-text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------------ */
/* Watch view — end-of-episode "Up next" card                               */
/* ------------------------------------------------------------------------ */

.tv-endcard {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 12, 0.86);
  backdrop-filter: blur(10px);
  z-index: 5;
  padding: 24px;
  animation: tv-endcard-in 0.25s ease-out;
}

.tv-endcard.hidden {
  display: none;
}

@keyframes tv-endcard-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.tv-endcard-inner {
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
}

.tv-endcard-eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--tv-accent);
  text-transform: uppercase;
}

.tv-endcard-thumb {
  width: clamp(180px, 32vw, 280px);
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #0a0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  border: 1px solid var(--tv-card-border);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
}

.tv-endcard-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-endcard-thumb.is-empty {
  color: var(--tv-text-dimmer);
}

.tv-endcard-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tv-endcard-title {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
  color: var(--tv-text);
  line-height: 1.25;
}

.tv-endcard-sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--tv-text-dim);
  letter-spacing: 1px;
}

.tv-endcard-countdown {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--tv-text-dim);
  letter-spacing: 0.5px;
}

.tv-endcard-countdown.hidden {
  display: none;
}

.tv-endcard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}

.tv-endcard-btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--tv-card-border);
  color: var(--tv-text);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.tv-endcard-btn:hover {
  border-color: var(--tv-accent-dim);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.tv-endcard-btn.hidden {
  display: none;
}

.tv-endcard-btn--primary {
  background: var(--tv-accent);
  color: #0a0a10;
  border-color: var(--tv-accent);
  font-weight: 700;
}

.tv-endcard-btn--primary:hover {
  background: color-mix(in srgb, var(--tv-accent) 88%, white);
}

/* ------------------------------------------------------------------------ */
/* Watch view — up-next strip + nav links                                   */
/* ------------------------------------------------------------------------ */

.tv-upnext-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.tv-upnext-card {
  appearance: none;
  background: var(--tv-card-bg);
  border: 1px solid var(--tv-card-border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  color: var(--tv-text);
  transition: transform 0.15s ease, border 0.15s ease;
}

.tv-upnext-card:hover {
  transform: translateY(-2px);
  border-color: var(--tv-accent-dim);
}

.tv-upnext-thumb {
  aspect-ratio: 16 / 9;
  background: #0a0a10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
  color: var(--tv-text-dimmer);
}

.tv-upnext-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tv-upnext-label {
  padding: 6px 10px 10px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--tv-text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-all-eps-link {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--tv-accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--tv-accent-dim);
}

.tv-all-eps-link:hover {
  color: #ffd24a;
}

/* ------------------------------------------------------------------------ */
/* Help footer                                                              */
/* ------------------------------------------------------------------------ */

.tv-help {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--tv-text-dimmer);
  text-transform: uppercase;
}

.tv-help kbd {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 2px;
  background: #15151c;
  border: 1px solid #2a2a35;
  border-radius: 3px;
  color: var(--tv-text-dim);
  font-family: inherit;
  font-size: 10px;
}

.tv-fineprint {
  text-align: center;
  font-size: 11px;
  color: var(--tv-text-dimmer);
  margin: 0;
  font-style: italic;
}

/* ------------------------------------------------------------------------ */
/* Responsive                                                               */
/* ------------------------------------------------------------------------ */

@media (max-width: 768px) {
  .tv-room {
    padding: 64px 10px 80px;
    gap: 14px;
  }

  .tv-bezel {
    padding: 8px 8px 0;
    border-radius: 14px;
  }

  .tv-marquee {
    padding: 10px 12px;
    gap: 10px;
  }

  .tv-title {
    font-size: 15px;
  }

  .tv-subtitle {
    font-size: 11px;
  }

  .tv-summary {
    padding: 8px 12px;
  }

  .tv-summary-text {
    font-size: 12px;
    line-height: 1.45;
  }

  .tv-btn {
    padding: 9px 12px;
    font-size: 13px;
  }

  .tv-ep-grid,
  .tv-show-grid,
  .tv-continue-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
  }

  .tv-ep-meta {
    padding: 8px 10px 10px;
  }

  .tv-ep-title {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .tv-ep-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tv-show-grid,
  .tv-continue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .tv-controls {
    gap: 6px;
  }

  .tv-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  .tv-toggle {
    padding: 6px 10px;
    font-size: 12px;
  }

  .tv-marquee {
    flex-wrap: wrap;
  }

  .tv-now-stack {
    flex-basis: 100%;
  }

  .tv-chip {
    padding: 10px 14px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-led,
  .tv-rec-dot {
    animation: none;
  }

  .tv-show-card,
  .tv-ep-card {
    transition: none;
  }

  .tv-show-card:hover,
  .tv-ep-card:hover {
    transform: none;
  }
}
