:root {
  color-scheme: dark;
  --bg: #080d12;
  --panel: #111820;
  --panel-2: #18212b;
  --text: #f6f8fb;
  --muted: #a8b3c1;
  --line: #26313d;
  --channel: #2fc36f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #080d12;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 54px);
  background: rgba(8, 13, 18, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--channel);
  color: #061008;
  border-radius: 8px;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.eyebrow,
.program-card span,
.program-item span,
.channel-card span,
.channel-card small,
.footer {
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 6px;
  overflow: auto;
}

.nav a,
.live-link,
.actions a,
.actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #101720;
  white-space: nowrap;
}

.live-link,
.actions button {
  background: var(--channel);
  border-color: transparent;
  color: #061008;
  font-weight: 800;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 54px);
}

.watch-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: stretch;
}

.player-wrap {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  aspect-ratio: 16 / 9;
  background: #05080b;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.player {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #05080b;
}

.player-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 12px;
  padding: clamp(22px, 5vw, 56px);
  background:
    linear-gradient(180deg, rgba(8, 13, 18, 0.14), rgba(8, 13, 18, 0.9)),
    url("/poster.svg") center / cover;
  pointer-events: none;
}

.player-fallback[hidden] {
  display: none;
}

.player-fallback span,
.eyebrow {
  margin: 0;
  color: var(--channel);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-fallback strong {
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.95;
}

.player-fallback p,
.now-panel p,
.program-item p {
  margin: 0;
  line-height: 1.55;
}

.now-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.now-panel h1,
.section-head h2 {
  margin: 0;
  line-height: 1.02;
}

.now-panel h1 {
  font-size: clamp(2rem, 5vw, 4.5rem);
}

.program-card,
.program-item,
.channel-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.program-card {
  padding: 18px;
}

.program-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.25rem;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.actions button {
  cursor: pointer;
  font: inherit;
}

.channel-section,
.rail-section {
  margin-top: 36px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

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

.channel-card {
  min-height: 150px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-top: 4px solid var(--card-color);
  font: inherit;
}

.channel-card[data-active="true"] {
  outline: 2px solid var(--card-color);
  background: #1c2732;
}

.channel-card strong,
.channel-card small {
  display: block;
}

.channel-card strong {
  margin: 12px 0 8px;
  font-size: 1.14rem;
}

.program-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.program-item {
  min-height: 150px;
  padding: 18px;
}

.program-item strong {
  display: block;
  margin: 10px 0;
  font-size: 1.15rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 54px) 42px;
  border-top: 1px solid var(--line);
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .watch-shell,
  .program-rail {
    grid-template-columns: 1fr;
  }

  .player-wrap {
    min-height: 240px;
  }
}

@media (max-width: 620px) {
  main {
    padding: 14px;
  }

  .nav {
    width: 100%;
  }

  .now-panel {
    padding: 18px;
  }

  .footer {
    flex-direction: column;
  }
}
