:root {
  --safe-x: clamp(24px, 5vw, 96px);
  --safe-y: clamp(20px, 5vh, 54px);
  --bg: #000000;
  --glass: rgba(11, 16, 26, 0.84);
  --glass-strong: rgba(9, 13, 22, 0.94);
  --border: rgba(148, 163, 184, 0.24);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --amber: #f59e0b;
  --emerald: #34d399;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.tv-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
}

.tv-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.tv-video {
  object-fit: contain;
  background: #000;
}

.tv-canvas {
  background: #03060c;
}

.tv-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 62%, rgba(0, 0, 0, 0.42) 100%);
}

.is-hidden {
  display: none !important;
}

/* Top-Right Channel Bug */
.osd-bug {
  position: absolute;
  top: var(--safe-y);
  right: var(--safe-x);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.osd-bug.is-subtle {
  opacity: 0.48;
}

.osd-bug-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.osd-ch-num {
  font-size: clamp(1.2rem, 2.1vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.osd-ch-callsign {
  font-size: clamp(1rem, 1.7vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.osd-bug-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(0.78rem, 1.15vw, 0.95rem);
}

.osd-badge {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #bae6fd;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.osd-badge.is-standby {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fde68a;
}

.osd-clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.osd-audio-pill {
  margin-top: 2px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.22);
  border: 1px solid rgba(245, 158, 11, 0.7);
  color: #fef3c7;
  font-size: clamp(0.72rem, 1.05vw, 0.88rem);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* Lower-Third Broadcast Chyron (Attribution HUD) */
.chyron {
  position: absolute;
  left: var(--safe-x);
  bottom: var(--safe-y);
  z-index: 20;
  display: flex;
  align-items: stretch;
  max-width: min(680px, 60vw);
  border-radius: 14px;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}

.chyron.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chyron-accent {
  width: 7px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--amber) 100%);
  flex-shrink: 0;
}

.chyron-body {
  padding: 15px 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chyron-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.75rem, 1.1vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.chyron-license {
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(52, 211, 153, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0;
}

.chyron-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.95rem);
  font-weight: 800;
  line-height: 1.18;
  color: var(--text);
}

.chyron-subtitle {
  margin: 0;
  font-size: clamp(0.88rem, 1.3vw, 1.12rem);
  color: #cbd5e1;
  line-height: 1.35;
}

/* Bottom-Right Key Hints */
.key-hints {
  position: absolute;
  right: var(--safe-x);
  bottom: var(--safe-y);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(11, 16, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: clamp(0.75rem, 1.1vw, 0.92rem);
  color: #cbd5e1;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.key-hints.is-visible {
  opacity: 1;
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  margin-right: 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 700;
}

/* Full-Height Side Channel Guide */
.guide-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--safe-y) var(--safe-x);
  background: rgba(2, 6, 15, 0.62);
  backdrop-filter: blur(6px);
}

.guide-panel {
  width: min(620px, 86vw);
  max-height: calc(100vh - var(--safe-y) * 2);
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  overflow: hidden;
}

.guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
}

.guide-brand {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--accent);
}

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

.guide-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guide-clock {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.guide-privacy-link {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 8px;
}

.guide-list {
  list-style: none;
  margin: 0;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-item {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(30, 41, 59, 0.45);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.guide-item.is-active {
  background: rgba(56, 189, 248, 0.14);
}

.guide-item.is-focused {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.24);
  transform: translateX(6px);
}

.guide-num {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.guide-info-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text);
}

.guide-info-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 2px;
}

.guide-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #a7f3d0;
}

.guide-pill.is-standby {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fde68a;
}

.guide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .key-hints {
    display: none;
  }
  .chyron {
    max-width: calc(100vw - var(--safe-x) * 2);
  }
}
