/* ==========================================================================
   FreeStream — "Broadcast Editorial"

   Principles:
   · Near-monochrome. The channel logos are the only colour on screen.
   · One signal colour (red) and it is earned only by LIVE / on-air state.
   · Typography carries the hierarchy — weight, size and tracking, not effects.
   · Hairline rules and sharp geometry. No glow, no gradient text.
   ========================================================================== */

:root {
  --black: #000;
  --bg: #08080a;
  --raise: #0e0e11;
  --raise-2: #141418;

  --line: rgba(255, 255, 255, 0.1);
  --line-soft: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.22);

  --ink: #f2f2f3;
  --ink-dim: #a4a4ad;
  --ink-faint: #6b6b76;

  --signal: #ff2d20;
  --signal-soft: rgba(255, 45, 32, 0.14);

  --r: 3px;
  --r-lg: 5px;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur: 0.22s;

  --shell: 26px;
}

* {
  box-sizing: border-box;
}

/* The UA's [hidden] rule is display:none at the lowest specificity, so ANY
   class that sets display (grid/flex/block) silently defeats it. That has
   caused real bugs here — most recently a status overlay that kept painting a
   74% black scrim over the video. Assert it once, globally. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Film grain — the one texture. Barely there, but it kills the flat-digital
   look that makes dark UIs read as cheap. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

button,
select,
input {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--ink);
  color: var(--black);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.26);
  background-clip: padding-box;
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* Shared micro-label: uppercase, wide tracking, small. Used for every
   secondary label in the app so the voice stays consistent. */
.eyebrow,
.ruler-ch,
.hero-tag,
.rail-title,
.tile-meta,
.live-tag {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

/* ==========================================================================
   Ambient background — live muted wash behind Home
   ========================================================================== */

#ambient-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: none;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
/* Only Home gets the wash, and only once a stream is actually decoded. */
body.home-mode #ambient-layer {
  display: block;
}
#ambient-layer.is-on {
  opacity: 1;
}

#ambient {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Heavily blurred and desaturated — this is colour and motion, not picture. */
  filter: blur(72px) saturate(150%) brightness(0.8);
  transform: scale(1.25);
}

/* Scrim keeps every bit of text at full contrast over moving video. */
#ambient-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 8, 10, 0.86) 0%, rgba(8, 8, 10, 0.93) 46%, var(--bg) 88%),
    linear-gradient(90deg, rgba(8, 8, 10, 0.7), transparent 60%);
}

/* Content sits above the wash. */
.topbar,
.filters,
main {
  position: relative;
  z-index: 1;
}

/* The hero's own blurred-logo backdrop would fight the live wash, so it
   steps back while one is running. (#ambient-layer and main are siblings.) */
#ambient-layer.is-on ~ main .hero-bg {
  opacity: 0.2;
}

/* ==========================================================================
   Header
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
  padding: 0 var(--shell);
  background: rgba(8, 8, 10, 0.92);
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  color: var(--black);
  background: var(--ink);
  border-radius: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  position: relative;
  flex: 0 0 auto;
  padding: 19px 0;
  border: 0;
  background: none;
  color: var(--ink-faint);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}
.tab-btn:hover {
  color: var(--ink-dim);
}
.tab-btn.is-active {
  color: var(--ink);
}
/* The active state is a 1px rule, not a coloured pill. */
.tab-btn.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--ink);
}
.tab-btn .star {
  font-size: 11px;
}
.fav-count {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.searchwrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
  flex: 0 1 260px;
}
.search-icon {
  position: absolute;
  left: 0;
  color: var(--ink-faint);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 7px 26px 7px 22px;
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
#search::placeholder {
  color: var(--ink-faint);
}
#search:focus {
  border-bottom-color: var(--ink);
}
.search-kbd {
  position: absolute;
  right: 0;
  font: 500 10px/1 ui-monospace, monospace;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 5px;
  pointer-events: none;
}
#search:focus + .search-kbd {
  opacity: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.icon-btn:disabled {
  opacity: 0.4;
}
.topbar-actions {
  display: none;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px var(--shell);
  border-bottom: 1px solid var(--line-soft);
}

/* Views with nothing to filter drop the bar entirely. */
body.no-filters .filters {
  display: none;
}


.filters select {
  max-width: 178px;
  padding: 5px 8px;
  font-size: 12.5px;
  color: var(--ink-dim);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r);
  outline: none;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.filters select:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-faint);
  cursor: pointer;
}
.check input {
  accent-color: var(--ink);
}

.spacer {
  flex: 1;
}

.stats {
  font-size: 11.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Shell
   ========================================================================== */

main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 34px var(--shell) 90px;
}

.result-info {
  min-height: 18px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.empty {
  grid-column: 1 / -1;
  padding: 72px 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13.5px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* ==========================================================================
   Player
   ========================================================================== */

.player-panel {
  margin-bottom: 34px;
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  animation: fade-in 0.3s var(--ease);
}

.player-stage {
  position: relative;
  background: var(--black);
}

#video {
  display: block;
  width: 100%;
  max-height: 68vh;
  aspect-ratio: 16 / 9;
  background: var(--black);
}

/* In fullscreen the stage must fill the screen and the video letterbox
   inside it — otherwise the 16/9 aspect-ratio rule keeps it small. */
.player-stage:fullscreen,
.player-stage:-webkit-full-screen {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: #000;
}
.player-stage:fullscreen #video,
.player-stage:-webkit-full-screen #video {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
}

.player-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.74);
  pointer-events: none;
}
.player-status.is-error {
  color: var(--signal);
}

/* Once a picture is rendering, the status stops being a scrim and becomes a
   small pill — otherwise it dims the whole screen in fullscreen. */
.player-status.is-toast {
  background: none;
  place-items: end center;
  padding-bottom: 60px;
}
.player-status.is-toast .status-pill {
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-top: 1px solid var(--line-soft);
}

.player-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#player-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: var(--raise-2);
  border-radius: var(--r);
  padding: 4px;
}

.player-title h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.player-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-transform: capitalize;
}

.license-note {
  font-size: 11.5px !important;
}
.license-note a {
  color: var(--ink-dim);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.src-label {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

#sources {
  max-width: 240px;
  padding: 6px 9px;
  font-size: 12.5px;
  color: var(--ink-dim);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: var(--r);
  outline: none;
}

.ghost-btn {
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.ghost-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.ghost-btn:disabled {
  opacity: 0.4;
}

/* ==========================================================================
   Home — editorial hero
   ========================================================================== */


.hero {
  position: relative;
  display: block;
  padding: 0;
  margin-bottom: 56px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  animation: fade-in 0.4s var(--ease);
}

/* The channel's own logo, magnified and blurred, is the only colour here. */
.hero-bg {
  position: absolute;
  inset: -20%;
  z-index: -2;
  background-size: cover;
  background-position: center;
  filter: blur(80px) saturate(150%);
  opacity: 0.5;
  transform: scale(1.1);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
      92deg,
      rgba(8, 8, 10, 0.96) 0%,
      rgba(8, 8, 10, 0.86) 44%,
      rgba(8, 8, 10, 0.4) 100%
    ),
    linear-gradient(0deg, rgba(8, 8, 10, 0.7), transparent 60%);
}

.hero-body {
  position: relative;
  max-width: 640px;
  padding: 54px 48px 48px;
}

.hero-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  color: var(--ink-faint);
}
.hero-tag .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--signal);
}

.hero-logo {
  display: block;
  max-width: 260px;
  max-height: 72px;
  margin: 26px 0 0;
  object-fit: contain;
  object-position: left center;
}

.hero-h1 {
  margin: 24px 0 0;
  font-size: clamp(38px, 5.2vw, 68px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.hero-name {
  margin-top: 18px;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.03em;
}

/* Specs read as a hairline-separated row — an editorial device, not chips. */
.hero-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 20px 0 30px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.chip {
  padding: 11px 16px 11px 0;
  margin-right: 16px;
  font-size: 11.5px;
  color: var(--ink-dim);
  border-right: 1px solid var(--line-soft);
  text-transform: capitalize;
}
.chip:last-child {
  border-right: 0;
  margin-right: 0;
}
.chip-live {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--signal);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10.5px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Solid white primary. Reads far more expensive than any gradient. */
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--black);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--r);
  transition: opacity var(--dur) var(--ease);
}
.hero-btn:hover {
  opacity: 0.82;
}

.hero-btn-alt {
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-dim);
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.hero-btn-alt:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ==========================================================================
   Rails
   ========================================================================== */

.rails {
  display: flex;
  flex-direction: column;
  gap: 42px;
}

.rail-title {
  margin-bottom: 14px;
  padding-bottom: 11px;
  font-size: 10.5px;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line-soft);
}

.rail-strip {
  display: flex;
  gap: 1px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.rail-strip::-webkit-scrollbar {
  display: none;
}

/* Tiles sit in a hairline grid — adjacent, sharing 1px gutters, like a
   contact sheet. No floating cards, no drop shadows. */
.tile {
  flex: 0 0 auto;
  width: 184px;
  padding: 0;
  text-align: left;
  background: var(--raise);
  border: 0;
  outline: 1px solid var(--line-soft);
  outline-offset: 0;
  scroll-snap-align: start;
  transition: background var(--dur) var(--ease);
}
.tile:hover {
  background: var(--raise-2);
  outline-color: var(--line-strong);
  position: relative;
  z-index: 1;
}

.tile-art {
  position: relative;
  height: 104px;
  padding: 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--black);
}

.tile-wash {
  position: absolute;
  inset: -30%;
  background-size: cover;
  background-position: center;
  filter: blur(40px) saturate(140%);
  opacity: 0.28;
  transition: opacity var(--dur) var(--ease);
}
.tile:hover .tile-wash {
  opacity: 0.44;
}

.tile-img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tile-ph {
  position: relative;
  z-index: 1;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-faint);
}

/* A hairline square, not a glowing circle. */
.tile-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.tile-play svg {
  width: 30px;
  height: 30px;
  padding: 8px;
  color: var(--black);
  background: var(--ink);
  border-radius: 2px;
}
.tile:hover .tile-play {
  opacity: 1;
}

.tile-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  font: 500 9.5px/1 ui-monospace, monospace;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.66);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 5px;
}

.tile-body {
  padding: 11px 12px 13px;
}
.tile-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-meta {
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile.is-playing {
  background: var(--raise-2);
  outline-color: var(--ink);
}

/* ==========================================================================
   Live TV grid
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px;
  background: var(--bg);
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background var(--dur) var(--ease);
}
.card:hover {
  background: var(--raise-2);
}
.card.is-playing {
  background: var(--raise-2);
  box-shadow: inset 2px 0 0 var(--ink);
}

.card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.card-logo {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: var(--black);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 3px;
}
.card-logo.placeholder {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
}
.card-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.card-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-faint);
}
.pill {
  font: 500 9.5px/1 ui-monospace, monospace;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 5px;
}
.pill-provider {
  color: var(--ink-dim);
}

.card-cats {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}
.card-cats.is-inferred {
  opacity: 0.6;
}

.card-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px;
  font-size: 13px;
  line-height: 1;
  color: var(--ink-faint);
  background: none;
  border: 0;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), color var(--dur) var(--ease);
}
.card:hover .card-fav {
  opacity: 1;
}
.card-fav.on {
  opacity: 1;
  color: var(--ink);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 34px;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Guide — the EPG grid
   ========================================================================== */

body.guide-mode main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 104px);
  padding-top: 20px;
  padding-bottom: 14px;
  overflow: hidden;
}

body.guide-mode .result-info {
  flex: 0 0 auto;
  margin-bottom: 0;
}

/* Never let the docked preview be squeezed by the lineup below it. Without
   this the panel collapses while the video keeps its height, and main's
   overflow clips it. */
body.guide-mode #player-panel {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.guide {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* basis 0, so the list takes leftover space instead of demanding its full
   content height and forcing every sibling to shrink. */
body.guide-mode .guide {
  flex: 1 1 0;
}

.guide-hint {
  flex: 0 0 auto;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--ink-faint);
}
.guide-hint kbd {
  font: 500 10px/1 ui-monospace, monospace;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 4px;
}

.epg-ruler {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--raise);
  font-size: 11px;
}

.ruler-ch {
  padding: 9px 14px;
  font-size: 9.5px;
  color: var(--ink-faint);
  border-right: 1px solid var(--line);
}

.ruler-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.ruler-slot {
  padding: 9px 14px;
  color: var(--ink-faint);
  border-left: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ruler-slot.is-now {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  border-left: 0;
  font-weight: 500;
}
.now-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
}

.guide-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: var(--bg);
}
.guide-list:focus {
  outline: none;
}

.ch-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  scroll-margin: 6px 0;
}

.ch-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 9px 14px;
  border-right: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.ch-row:hover .ch-cell {
  background: var(--raise);
}

.ch-num {
  flex: 0 0 26px;
  font: 500 12px/1 ui-monospace, monospace;
  color: var(--ink-faint);
  text-align: right;
}

.ch-logo {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: var(--black);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  padding: 3px;
}
.ch-logo.placeholder {
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}

.ch-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-prog {
  display: flex;
  align-items: stretch;
  min-width: 0;
  padding: 6px 10px 6px 0;
}

/* The block runs off the left edge — programming was already underway.
   Its left rule, repeated down the grid, forms the continuous "now" line. */
.prog-block {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 7px 14px 7px 17px;
  background: var(--raise);
  border: 1px solid var(--line-soft);
  border-left: 0;
  transition: background var(--dur) var(--ease);
}
.prog-block::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--signal);
}
.ch-row:hover .prog-block {
  background: var(--raise-2);
}

.live-tag {
  flex: 0 0 auto;
  font-size: 9px;
  color: var(--signal);
  background: var(--signal-soft);
  border-radius: 2px;
  padding: 3px 6px;
}

.prog-label {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prog-q {
  flex: 0 0 auto;
  font: 500 9.5px/1 ui-monospace, monospace;
  color: var(--ink-faint);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 5px;
}

.ch-row.is-cursor .ch-cell {
  background: var(--raise-2);
}
.ch-row.is-cursor .prog-block {
  background: var(--raise-2);
  border-color: var(--line);
}

.ch-row.is-tuned .ch-cell {
  background: var(--raise-2);
  box-shadow: inset 2px 0 0 var(--ink);
}
.ch-row.is-tuned .ch-num,
.ch-row.is-tuned .ch-name {
  color: var(--ink);
}
.ch-row.is-tuned .prog-block {
  background: var(--raise-2);
  border-color: var(--line-strong);
}

/* On wide screens dock the preview beside the channel info, the way a
   satellite box does, so the panel stays short and the lineup keeps rows. */
@media (min-width: 900px) {
  body.guide-mode .player-panel {
    display: flex;
    align-items: stretch;
  }
  body.guide-mode .player-stage {
    flex: 0 0 clamp(300px, 40%, 480px);
  }
  body.guide-mode #video {
    height: 100%;
    max-height: 244px;
  }
  body.guide-mode .player-meta {
    flex: 1 1 auto;
    align-content: center;
    border-top: 0;
    border-left: 1px solid var(--line-soft);
    padding: 18px 20px;
  }
  body.guide-mode .player-controls {
    width: 100%;
    margin-left: 0;
  }
}

/* ==========================================================================
   Find free
   ========================================================================== */

.service-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}
.service-blurb {
  flex: 1;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-faint);
}
.service-cta {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
}
.pill.kind-ad-supported,
.pill.kind-library-card,
.pill.kind-free {
  color: var(--ink-dim);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .nav {
    gap: 18px;
  }
  .searchwrap {
    flex-basis: 190px;
  }
}

@media (max-width: 820px) {
  :root {
    --shell: 16px;
  }
  .topbar {
    height: auto;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px var(--shell);
  }
  .nav {
    order: 3;
    width: 100%;
    gap: 20px;
  }
  .tab-btn {
    padding: 10px 0;
  }
  .searchwrap {
    flex: 1 1 auto;
  }
  main {
    padding-top: 24px;
  }
  .hero-body {
    max-width: none;
    padding: 34px 22px;
  }
  .hero-scrim {
    background: linear-gradient(0deg, rgba(8, 8, 10, 0.95), rgba(8, 8, 10, 0.66));
  }
  .hero-logo {
    max-width: 190px;
    max-height: 56px;
  }
  .tile {
    width: 150px;
  }
  .tile-art {
    height: 88px;
    padding: 16px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .epg-ruler,
  .ch-row {
    grid-template-columns: 150px 1fr;
  }
  .ruler-slots {
    grid-template-columns: repeat(2, 1fr);
  }
  .ruler-slot:nth-child(n + 3) {
    display: none;
  }
  body.guide-mode main {
    height: auto;
    min-height: calc(100vh - 104px);
    overflow: visible;
  }
  .guide-list {
    max-height: 56vh;
  }
}

/* ==========================================================================
   Large screens — fill the display instead of stranding a narrow column
   ========================================================================== */

@media (min-width: 1500px) {
  :root {
    --shell: 44px;
  }
  main {
    max-width: none;
  }
  .hero-body {
    max-width: 820px;
    padding: 76px 64px 68px;
  }
  .hero-logo {
    max-width: 320px;
    max-height: 92px;
  }
  .tile {
    width: 218px;
  }
  .tile-art {
    height: 124px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  }
  .epg-ruler,
  .ch-row {
    grid-template-columns: 320px 1fr;
  }
  .searchwrap {
    flex-basis: 320px;
  }
}

@media (min-width: 2100px) {
  :root {
    --shell: 60px;
  }
  main {
    max-width: 2400px;
  }
  .tile {
    width: 250px;
  }
  .tile-art {
    height: 142px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  }
}

/* ==========================================================================
   Focus — a remote focuses programmatically, so :focus must always read
   ========================================================================== */

.tile:focus,
.card:focus,
.ch-row:focus,
.tab-btn:focus,
.hero-btn:focus,
.hero-btn-alt:focus,
.ghost-btn:focus,
.icon-btn:focus,
.service-card:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  z-index: 5;
}
.ch-row:focus {
  outline-offset: -2px;
}

.icon-btn.is-on {
  color: var(--black);
  background: var(--ink);
  border-color: var(--ink);
}

/* ==========================================================================
   TV mode — 10-foot viewing, D-pad driven
   ========================================================================== */

body.tv {
  font-size: 17px;
}

body.tv .topbar {
  height: 70px;
  gap: 34px;
}
body.tv .tab-btn {
  font-size: 16px;
  padding: 25px 0;
}
body.tv .nav {
  gap: 30px;
}
body.tv .brand {
  font-size: 16px;
}

body.tv .filters select,
body.tv .check,
body.tv .stats {
  font-size: 15px;
}
body.tv .filters select {
  max-width: 230px;
  padding: 9px 12px;
}

body.tv .hero-body {
  padding: 74px 60px 66px;
}
body.tv .hero-name {
  font-size: 26px;
}
body.tv .chip {
  font-size: 14px;
  padding: 13px 20px 13px 0;
  margin-right: 20px;
}
body.tv .hero-btn,
body.tv .hero-btn-alt {
  font-size: 16px;
  padding: 15px 30px;
}

body.tv .rail-title {
  font-size: 13px;
}
body.tv .tile {
  width: 262px;
}
body.tv .tile-art {
  height: 152px;
}
body.tv .tile-name {
  font-size: 17px;
}
body.tv .tile-meta {
  font-size: 12px;
}

body.tv .card-name {
  font-size: 16px;
}
body.tv .grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

body.tv .epg-ruler,
body.tv .ch-row {
  grid-template-columns: 360px 1fr;
}
body.tv .ch-name {
  font-size: 17px;
}
body.tv .ch-num {
  font-size: 15px;
  flex-basis: 34px;
}
body.tv .ch-logo {
  flex-basis: 44px;
  width: 44px;
  height: 44px;
}
body.tv .ch-cell {
  padding: 13px 18px;
}
body.tv .prog-label {
  font-size: 16px;
}
body.tv .live-tag {
  font-size: 11px;
}
body.tv .ruler-ch,
body.tv .ruler-slot {
  font-size: 13px;
  padding: 12px 18px;
}
body.tv .guide-hint {
  font-size: 14px;
}

/* Unmissable focus from across the room. */
body.tv *:focus {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
body.tv .ch-row:focus {
  outline-offset: -3px;
  background: var(--raise-2);
}

/* Hover styling is meaningless without a pointer — don't let it compete
   with the focus ring for "what's selected". */
@media (hover: none) {
  .tile:hover,
  .card:hover {
    background: var(--raise);
  }
}

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