:root {
  --broadcast-bg: #070b0f;
  --broadcast-panel: #111820;
  --broadcast-panel-soft: #18222c;
  --broadcast-ink: #f4f7f8;
  --broadcast-muted: #9caab5;
  --broadcast-line: rgba(255, 255, 255, 0.12);
  --broadcast-green: #7dffbd;
  --broadcast-blue: #69c9ff;
  --broadcast-red: #ff786f;
  --broadcast-radius: 18px;
  --toolbar-height: 72px;
  /* TV CONTENT CALIBRATION CONTROLS
   * These affect only .teleporter-screen-content inside the fixed TV aperture.
   * Defaults fill the aperture without moving, scaling, or clipping provider UI.
   */
  --tv-content-offset-x: 0px;
  --tv-content-offset-y: 0px;
  --tv-content-width: 100%;
  --tv-content-height: 100%;
  --tv-content-safe-aspect: 16 / 9;
  --tv-content-fit: contain;
  --tv-content-inner-padding: 0px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--broadcast-bg);
}

body.teleporter-revision {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--broadcast-ink);
  background:
    radial-gradient(circle at 18% 18%, rgba(38, 102, 128, 0.22), transparent 31rem),
    radial-gradient(circle at 88% 82%, rgba(92, 52, 120, 0.18), transparent 32rem),
    var(--broadcast-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--broadcast-blue);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 0.75rem 1rem;
  color: #07121a;
  background: var(--broadcast-blue);
  border-radius: 10px;
  font-weight: 800;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.broadcast-shell {
  min-height: 100vh;
}

.broadcast-toolbar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: var(--toolbar-height);
  display: grid;
  grid-template-columns: auto minmax(155px, 1fr) auto minmax(185px, auto);
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem clamp(0.75rem, 2vw, 1.5rem);
  border-bottom: 1px solid var(--broadcast-line);
  background: rgba(7, 11, 15, 0.94);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(18px);
}

.toolbar-button,
.broadcast-shortcuts a {
  min-height: 44px;
  border: 1px solid var(--broadcast-line);
  border-radius: 12px;
  color: var(--broadcast-ink);
  background: rgba(255, 255, 255, 0.055);
  text-decoration: none;
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  cursor: pointer;
}

.toolbar-button:hover,
.broadcast-shortcuts a:hover {
  border-color: rgba(105, 201, 255, 0.65);
  background: rgba(105, 201, 255, 0.12);
}

.menu-icon {
  width: 19px;
  display: grid;
  gap: 4px;
}

.menu-icon i {
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.broadcast-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--broadcast-ink);
  text-decoration: none;
}

.broadcast-brand__signal {
  position: relative;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--broadcast-green);
  box-shadow: 0 0 0 6px rgba(125, 255, 189, 0.1), 0 0 24px rgba(125, 255, 189, 0.75);
}

.broadcast-brand small,
.toolbar-button small {
  display: block;
  color: var(--broadcast-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.05;
  text-transform: uppercase;
}

.broadcast-brand strong,
.toolbar-button strong {
  display: block;
  max-width: 19rem;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.broadcast-shortcuts {
  display: flex;
  gap: 0.45rem;
}

.broadcast-shortcuts a {
  display: inline-grid;
  place-items: center;
  padding: 0.5rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 750;
}

.toolbar-button--country {
  justify-content: flex-start;
  min-width: 185px;
}

.toolbar-button--country > span:nth-child(2) {
  min-width: 0;
  flex: 1;
  text-align: left;
}

.country-pip {
  width: 32px;
  height: 32px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #07121a;
  background: var(--broadcast-blue);
  font-size: 0.68rem;
  font-weight: 900;
}

.teleporter-stage {
  width: min(100%, 1680px);
  margin: 0 auto;
  padding: clamp(0.65rem, 1.4vw, 1.25rem);
}

.teleporter-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 1rem;
}

body.teleporter-panel-open .teleporter-app {
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
}

.teleporter-player-zone {
  grid-column: 1;
  display: grid;
  gap: 0.8rem;
}

.teleporter-player-surface {
  overflow: hidden;
  border: 1px solid rgba(118, 209, 255, 0.3);
  border-radius: clamp(14px, 2vw, 24px);
  background: #000;
  box-shadow: 0 30px 72px rgba(0, 0, 0, 0.42);
}

.teleporter-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
}

.teleporter-screen-content {
  position: absolute;
  top: var(--tv-content-offset-y);
  left: var(--tv-content-offset-x);
  width: min(var(--tv-content-width), calc(100% - var(--tv-content-offset-x)));
  height: var(--tv-content-height);
  max-height: calc(100% - var(--tv-content-offset-y));
  min-width: 0;
  min-height: 0;
  aspect-ratio: var(--tv-content-safe-aspect);
  padding: var(--tv-content-inner-padding);
  box-sizing: border-box;
}

.teleporter-screen-content > video,
.teleporter-screen-content > .teleporter-youtube,
.teleporter-screen-content .teleporter-youtube iframe,
.teleporter-screen-content .teleporter-youtube__player {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #000;
}

.teleporter-screen-content > video {
  object-fit: var(--tv-content-fit);
}

.screen-standby {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(160px, 34%) 1fr;
  align-items: center;
  gap: clamp(1rem, 4vw, 3rem);
  padding: clamp(1rem, 5vw, 5rem);
  min-height: 0;
  background:
    linear-gradient(118deg, rgba(3, 9, 13, 0.18), rgba(3, 9, 13, 0.84)),
    radial-gradient(circle at 28% 50%, #1e5268, #08131a 47%, #030709 78%);
}

.screen-standby img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 22px 42px rgba(0, 0, 0, 0.48));
}

.standby-copy {
  position: relative;
  z-index: 7;
  max-width: 34rem;
}

.standby-copy strong {
  display: block;
  margin: 0.25rem 0 0.6rem;
  font-size: clamp(1.65rem, 4vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.standby-copy > span:last-child {
  display: block;
  color: #c5d4dc;
  font-size: clamp(0.85rem, 1.6vw, 1.08rem);
  line-height: 1.55;
}

.standby-eyebrow,
.player-status,
.rail-kicker {
  color: var(--broadcast-green);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.signal-dots {
  display: inline-flex;
  gap: 5px;
}

.signal-dots i {
  width: 6px;
  height: 6px;
  display: block;
  border-radius: 50%;
  background: var(--broadcast-muted);
}

.signal-dots i:first-child {
  background: var(--broadcast-green);
}

.player-readout {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(250px, 2fr);
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--broadcast-line);
  border-radius: 14px;
  background: rgba(17, 24, 32, 0.88);
}

.player-readout p,
.player-readout h2 {
  margin: 0;
}

.player-readout h2 {
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.player-readout > #stationMeta {
  color: #c3ced5;
  font-size: 0.82rem;
}

.player-notice {
  grid-column: 3;
  color: var(--broadcast-muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.player-schedule {
  grid-column: 2 / -1;
  color: #f4e5a8;
  font-size: 0.82rem;
  font-weight: 700;
}

.youtube-help {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.8rem;
  border: 1px solid rgba(255, 188, 96, 0.55);
  border-radius: 12px;
  color: #f1dfc6;
  background: rgba(104, 56, 14, 0.22);
  font-size: 0.8rem;
  line-height: 1.5;
}

.youtube-help p {
  margin: 0.25rem 0 0;
}

.firefox-location-bar {
  width: 82px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid rgba(220, 230, 236, 0.55);
  border-radius: 7px;
  background: #eef2f5;
}

.firefox-location-bar__shield {
  width: 17px;
  height: 19px;
  display: block;
  flex: 0 0 auto;
  clip-path: polygon(50% 0, 94% 16%, 86% 71%, 50% 100%, 14% 71%, 6% 16%);
  background: linear-gradient(145deg, #8c62ff, #5c2fb0);
}

.firefox-location-bar__address {
  height: 10px;
  flex: 1;
  border-radius: 999px;
  background: #aebac4;
}

.youtube-help__toggle {
  min-height: 38px;
  margin-top: 0.65rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 213, 153, 0.62);
  border-radius: 8px;
  color: #fff7ea;
  background: rgba(255, 255, 255, 0.1);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.youtube-help__instructions {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 213, 153, 0.28);
}

.teleporter-drawer {
  position: fixed;
  z-index: 60;
  top: calc(var(--toolbar-height) + 0.75rem);
  bottom: 0.75rem;
  width: min(420px, calc(100vw - 1.5rem));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background:
    linear-gradient(180deg, rgba(28, 40, 50, 0.98), rgba(12, 18, 24, 0.99));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(24px);
}

.teleporter-drawer {
  left: 0.75rem;
  padding: 1rem;
  border-radius: 18px;
}

.teleporter-panel {
  position: sticky;
  z-index: 10;
  top: calc(var(--toolbar-height) + 0.75rem);
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  max-height: calc(100svh - var(--toolbar-height) - 1.5rem);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background:
    linear-gradient(180deg, rgba(28, 40, 50, 0.98), rgba(12, 18, 24, 0.99));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 4px 18px;
}

.rail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.rail-heading--panel {
  position: sticky;
  z-index: 3;
  top: 0;
  padding: 1rem 1rem 0.8rem;
  background: linear-gradient(180deg, #1b2731 76%, rgba(27, 39, 49, 0));
}

.rail-heading h2 {
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
  letter-spacing: -0.025em;
}

.rail-kicker {
  margin: 0;
}

.drawer-close,
.panel-close {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--broadcast-line);
  border-radius: 50%;
  color: var(--broadcast-ink);
  background: rgba(255, 255, 255, 0.06);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.panel-compact-toggle {
  display: none;
}

.drawer-intro,
.rail-count {
  color: var(--broadcast-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.category-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.rail-button,
.rail-back {
  min-height: 44px;
  border: 1px solid var(--broadcast-line);
  border-radius: 10px;
  color: var(--broadcast-ink);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.rail-button {
  padding: 0.65rem 0.75rem;
  text-align: left;
}

.rail-button[aria-pressed="true"] {
  border-color: rgba(105, 201, 255, 0.8);
  background: rgba(105, 201, 255, 0.17);
  box-shadow: inset 3px 0 0 var(--broadcast-blue);
}

.rail-back {
  align-self: flex-start;
  margin: 0 1rem 0.25rem;
  padding: 0.5rem 0.75rem;
}

.rail-count {
  margin: 0;
  padding: 0.45rem 1rem 0.7rem;
  border-bottom: 1px solid var(--broadcast-line);
}

.teleporter-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0.65rem 0.7rem 1rem;
  list-style: none;
}

.country-choice,
.station-choice {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--broadcast-ink);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  cursor: pointer;
}

.country-choice:hover,
.station-choice:hover,
.country-choice:focus-visible,
.station-choice:focus-visible {
  border-color: rgba(105, 201, 255, 0.55);
  background: rgba(105, 201, 255, 0.11);
}

.station-choice[aria-pressed="true"] {
  border-color: var(--broadcast-green);
  background: rgba(125, 255, 189, 0.11);
}

.country-choice__flag,
.station-choice__code {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--broadcast-panel-soft);
}

.country-choice__flag {
  font-size: 1.2rem;
}

.station-choice__code {
  color: var(--broadcast-blue);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.choice-copy {
  min-width: 0;
}

.choice-copy strong,
.choice-copy small {
  display: block;
}

.choice-copy strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-copy small {
  margin-top: 0.15rem;
  overflow: hidden;
  color: var(--broadcast-muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-count {
  color: var(--broadcast-muted);
  font-size: 0.66rem;
  text-align: right;
}

.station-choice--more {
  display: block;
  min-height: 48px;
  color: var(--broadcast-blue);
  text-align: center;
  font-weight: 800;
}

.message-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px dashed var(--broadcast-line);
  border-radius: 12px;
  color: var(--broadcast-muted);
  line-height: 1.45;
}

.message-card strong {
  color: var(--broadcast-ink);
}

.teleporter-footnote {
  margin: 0.85rem 0 0;
  border: 1px solid var(--broadcast-line);
  border-radius: 12px;
  color: var(--broadcast-muted);
  background: rgba(17, 24, 32, 0.65);
  font-size: 0.78rem;
}

.teleporter-footnote summary {
  padding: 0.85rem 1rem;
  color: #c9d6dd;
  cursor: pointer;
  font-weight: 800;
}

.teleporter-footnote__copy {
  padding: 0 1rem 0.8rem;
  line-height: 1.55;
}

.teleporter-footnote__copy a {
  color: var(--broadcast-blue);
}

@media (max-width: 840px) {
  :root {
    --toolbar-height: 64px;
  }

  .broadcast-toolbar {
    grid-template-columns: auto 1fr auto;
    min-height: var(--toolbar-height);
    gap: 0.45rem;
    padding: 0.5rem;
  }

  .broadcast-shortcuts {
    display: none;
  }

  .toolbar-button {
    min-height: 46px;
    padding: 0.55rem 0.65rem;
  }

  .toolbar-button--menu > span:last-child,
  .toolbar-button--country .country-pip,
  .toolbar-button--country small {
    display: none;
  }

  .toolbar-button--country {
    min-width: 0;
    max-width: 150px;
  }

  .broadcast-brand small {
    display: none;
  }

  .broadcast-brand strong {
    font-size: 0.82rem;
  }

  .teleporter-stage {
    padding: 0.5rem;
  }

  body.teleporter-panel-open .teleporter-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .teleporter-player-zone {
    grid-row: 1;
  }

  .teleporter-panel {
    position: relative;
    top: auto;
    grid-column: 1;
    grid-row: 2;
    max-height: min(16.5rem, 34svh);
    border-radius: 16px;
  }

  /* TV CONTENT CALIBRATION CONTROLS — mobile defaults keep the fixed dial clear. */
  :root {
    --tv-content-offset-x: 0px;
    --tv-content-offset-y: 0px;
    --tv-content-width: 100%;
    --tv-content-height: 100%;
    --tv-content-safe-aspect: 16 / 9;
    --tv-content-fit: contain;
    --tv-content-inner-padding: 0px;
  }

  .teleporter-panel.is-compact {
    max-height: min(16.5rem, 34svh);
  }

  .teleporter-panel.is-compact.is-expanded {
    max-height: min(70svh, 38rem);
  }

  .panel-compact-toggle {
    min-height: 40px;
    display: block;
    align-self: flex-start;
    margin: 0 1rem 0.35rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid rgba(105, 201, 255, 0.58);
    border-radius: 9px;
    color: var(--broadcast-blue);
    background: rgba(105, 201, 255, 0.1);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
  }

  .teleporter-crt__topline > span:last-child,
  .teleporter-crt__footer > span:last-child {
    display: none;
  }

  .player-readout {
    grid-template-columns: auto 1fr;
  }

  .player-readout > #stationMeta,
  .player-schedule,
  .player-notice {
    grid-column: 1 / -1;
  }

  .youtube-help {
    grid-template-columns: 1fr;
  }

  .screen-standby {
    grid-template-columns: minmax(90px, 32%) 1fr;
    gap: 0.75rem;
    padding: 1rem;
  }

  .standby-copy strong {
    font-size: clamp(1.1rem, 6vw, 2.4rem);
  }

  .standby-copy > span:last-child {
    font-size: 0.72rem;
  }
}

@media (max-width: 520px) {
  .country-pip,
  .broadcast-brand__signal {
    display: none;
  }

  .toolbar-button--country {
    max-width: 118px;
  }

  .toolbar-button--country strong {
    font-size: 0.72rem;
  }

  .teleporter-crt__topline,
  .teleporter-crt__footer {
    min-height: 28px;
    font-size: 0.58rem;
  }

  .player-readout {
    padding: 0.7rem;
  }

  .player-readout h2 {
    font-size: 0.95rem;
  }

  .player-notice {
    font-size: 0.7rem;
  }

  .category-rail {
    grid-template-columns: 1fr;
  }

  .teleporter-panel.is-compact {
    max-height: min(15rem, 32svh);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
