/* ============================================
   RETRO TV STATION GRAPHICS
   Late 80s Cable TV / VHS Aesthetic
   ============================================ */

:root {
  /* CRT Phosphor Colors */
  --cyan: #00ffff;
  --magenta: #ff00ff;
  --yellow: #ffff00;
  --hot-pink: #ff1493;
  --electric-blue: #00bfff;

  /* Background colors */
  --deep-blue: #0a0a1a;
  --midnight: #0d0d2b;
  --purple-dark: #1a0a2e;

  /* Text colors */
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-glow: #00ffff;

  /* Timing */
  --scan-speed: 8s;
  --flicker-speed: 0.1s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: 'VCR OSD Mono';
  src: url('https://cdn.jsdelivr.net/gh/grilledfish/VCR-OSD-Mono@master/VCR_OSD_MONO_1.001.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

body {
  width: 1920px;
  height: 1080px;
  overflow: hidden;
  background: #000;
  font-family: 'VCR OSD Mono', 'Share Tech Mono', monospace;
}

/* ============================================
   CRT SCREEN CONTAINER
   ============================================ */

.crt-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    var(--deep-blue) 0%,
    var(--midnight) 50%,
    var(--purple-dark) 100%
  );
  overflow: hidden;
}

/* Scan Lines */
.scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 100;
}

/* VHS Tracking Distortion */
.vhs-tracking {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 90;
  opacity: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    transparent 45%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(255, 255, 255, 0.08) 46%,
    rgba(255, 255, 255, 0.03) 47%,
    transparent 47%,
    transparent 100%
  );
}

.vhs-tracking.active {
  animation: vhs-roll 0.3s linear;
}

@keyframes vhs-roll {
  0% {
    opacity: 1;
    transform: translateY(-100%);
  }
  100% {
    opacity: 1;
    transform: translateY(100%);
  }
}

/* Static Noise Overlay */
.static-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  pointer-events: none;
  z-index: 95;
  mix-blend-mode: overlay;
}

/* CRT Vignette */
.crt-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 80;
}

/* CRT Curvature Effect */
.crt-curvature {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  box-shadow:
    inset 0 0 100px rgba(0, 0, 0, 0.5),
    inset 0 0 200px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  pointer-events: none;
  z-index: 85;
}

/* Phosphor Flicker */
.phosphor-flicker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.01);
  pointer-events: none;
  z-index: 75;
  animation: phosphor 0.05s infinite;
}

@keyframes phosphor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.98; }
}

/* ============================================
   BROADCAST CONTENT
   ============================================ */

.broadcast-content {
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 10;
}

/* Scene Management */
.scene {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}

.scene.active {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   RETRO BACKGROUND
   ============================================ */

.retro-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Grid Floor (80s aesthetic) */
.grid-floor {
  position: absolute;
  bottom: 0;
  left: -50%;
  width: 200%;
  height: 60%;
  background:
    linear-gradient(90deg,
      transparent 0%,
      transparent calc(50% - 1px),
      var(--magenta) calc(50% - 1px),
      var(--magenta) calc(50% + 1px),
      transparent calc(50% + 1px),
      transparent 100%
    ),
    linear-gradient(0deg,
      rgba(255, 0, 255, 0.5) 0%,
      transparent 100%
    );
  background-size: 80px 100%, 100% 100%;
  transform: perspective(500px) rotateX(60deg);
  transform-origin: center top;
  animation: grid-scroll 20s linear infinite;
  opacity: 0.3;
}

.grid-floor::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 38px,
    var(--cyan) 38px,
    var(--cyan) 40px
  );
  opacity: 0.5;
}

@keyframes grid-scroll {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 80px 0, 0 0; }
}

/* Sun Burst */
.sun-burst {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(
    circle,
    var(--hot-pink) 0%,
    var(--magenta) 20%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0.6;
  filter: blur(2px);
  animation: sun-pulse 4s ease-in-out infinite;
}

.sun-burst::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    var(--yellow) 0%,
    var(--hot-pink) 50%,
    transparent 70%
  );
  border-radius: 50%;
}

@keyframes sun-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.6; }
  50% { transform: translateX(-50%) scale(1.1); opacity: 0.8; }
}

/* Floating Shapes */
.floating-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shape {
  position: absolute;
  opacity: 0.15;
}

.shape-1 {
  top: 20%;
  left: 10%;
  width: 100px;
  height: 100px;
  border: 3px solid var(--cyan);
  transform: rotate(45deg);
  animation: float-1 10s ease-in-out infinite;
}

.shape-2 {
  top: 60%;
  right: 15%;
  width: 80px;
  height: 80px;
  background: var(--magenta);
  border-radius: 50%;
  animation: float-2 8s ease-in-out infinite;
}

.shape-3 {
  top: 30%;
  right: 20%;
  width: 0;
  height: 0;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid var(--yellow);
  animation: float-3 12s ease-in-out infinite;
}

@keyframes float-1 {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(-30px); }
}

@keyframes float-2 {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.1); }
}

@keyframes float-3 {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-25px) rotate(10deg); }
}

/* ============================================
   CHANNEL BUG
   ============================================ */

.channel-bug {
  position: absolute;
  top: 40px;
  right: 60px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'VCR OSD Mono', monospace;
  z-index: 50;
  opacity: 0.7;
}

.bug-text {
  font-size: 24px;
  color: var(--text-secondary);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.bug-number {
  font-size: 48px;
  font-weight: bold;
  color: var(--cyan);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 20px var(--cyan),
    2px 2px 0 rgba(0, 0, 0, 0.8);
}

/* ============================================
   UP NEXT CONTAINER
   ============================================ */

.up-next-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

/* Up Next Label */
.up-next-label {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 32px;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 8px;
  text-shadow:
    0 0 10px var(--yellow),
    0 0 20px var(--yellow),
    0 0 40px rgba(255, 255, 0, 0.5);
  animation: label-glow 2s ease-in-out infinite;
}

.up-next-label .blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes label-glow {
  0%, 100% { text-shadow: 0 0 10px var(--yellow), 0 0 20px var(--yellow); }
  50% { text-shadow: 0 0 20px var(--yellow), 0 0 40px var(--yellow), 0 0 60px var(--yellow); }
}

/* Up Next Card */
.up-next-card {
  display: flex;
  gap: 40px;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(20, 20, 40, 0.9) 100%
  );
  border: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 30px;
  box-shadow:
    0 0 30px rgba(0, 255, 255, 0.3),
    inset 0 0 60px rgba(0, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.up-next-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(
    45deg,
    var(--cyan),
    var(--magenta),
    var(--cyan)
  );
  z-index: -1;
  opacity: 0.5;
  filter: blur(10px);
}

/* Thumbnail */
.thumbnail-container {
  position: relative;
  width: 280px;
  height: 160px;
  flex-shrink: 0;
}

.thumbnail {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e, #0a0a1a);
  border: 2px solid var(--magenta);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  text-align: center;
}

.film-icon {
  font-size: 48px;
  filter: grayscale(1);
  opacity: 0.5;
}

.thumbnail-glare {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%
  );
  pointer-events: none;
}

/* Show Info */
.show-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 500px;
}

.show-title {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 36px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow:
    2px 2px 0 var(--magenta),
    4px 4px 0 rgba(255, 0, 255, 0.3);
  line-height: 1.2;
}

.show-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 18px;
  color: var(--cyan);
}

.separator {
  color: var(--magenta);
}

.show-description {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 72px;
  overflow: hidden;
}

/* ============================================
   COUNTDOWN TIMER
   ============================================ */

.countdown-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.countdown-label {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 18px;
  color: var(--text-secondary);
  letter-spacing: 4px;
}

.countdown-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.countdown-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--hot-pink);
  border-radius: 8px;
  padding: 15px 25px;
  min-width: 100px;
}

.countdown-value {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 64px;
  color: var(--hot-pink);
  text-shadow:
    0 0 20px var(--hot-pink),
    0 0 40px var(--hot-pink);
  line-height: 1;
}

.countdown-unit {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  margin-top: 5px;
}

.countdown-colon {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 64px;
  color: var(--hot-pink);
  text-shadow: 0 0 20px var(--hot-pink);
  animation: colon-blink 1s step-end infinite;
}

@keyframes colon-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================
   SCHEDULE SCREEN
   ============================================ */

.schedule-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 900px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.schedule-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 3px solid var(--cyan);
  padding-bottom: 15px;
}

.schedule-title {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 42px;
  color: var(--cyan);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 20px var(--cyan);
  letter-spacing: 4px;
}

.schedule-date {
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  color: var(--yellow);
}

.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.schedule-item {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(0, 0, 0, 0.5);
  border-left: 4px solid var(--magenta);
  padding: 15px 20px;
  transition: all 0.3s ease;
}

.schedule-item.current {
  border-left-color: var(--cyan);
  background: rgba(0, 255, 255, 0.1);
}

.schedule-item.current .item-time {
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan);
}

.item-time {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 24px;
  color: var(--hot-pink);
  min-width: 120px;
}

.item-title {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 22px;
  color: var(--text-primary);
  flex: 1;
  text-transform: uppercase;
}

.item-duration {
  font-family: 'Share Tech Mono', monospace;
  font-size: 16px;
  color: var(--text-secondary);
}

.schedule-nav {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.nav-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.3;
  transition: all 0.3s ease;
}

.nav-dot.active {
  opacity: 1;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* ============================================
   LOWER THIRD
   ============================================ */

.lower-third {
  position: absolute;
  bottom: 60px;
  left: 60px;
  right: 60px;
  height: 80px;
  z-index: 60;
  transition: all 0.5s ease;
}

.lower-third.hidden {
  transform: translateY(150%);
  opacity: 0;
}

.lower-third-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.8) 70%,
    transparent 100%
  );
  border-top: 3px solid var(--cyan);
  border-bottom: 3px solid var(--magenta);
}

.lower-third-content {
  position: relative;
  display: flex;
  align-items: center;
  gap: 30px;
  height: 100%;
  padding: 0 30px;
}

.current-time {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 36px;
  color: var(--yellow);
  text-shadow: 0 0 10px var(--yellow);
  min-width: 140px;
}

.lower-third-divider {
  width: 3px;
  height: 40px;
  background: linear-gradient(
    180deg,
    var(--cyan),
    var(--magenta)
  );
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 15px;
}

.now-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--cyan);
  color: var(--deep-blue);
  padding: 4px 10px;
  font-weight: bold;
}

.now-title {
  font-family: 'VCR OSD Mono', monospace;
  font-size: 28px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ============================================
   GLITCH EFFECTS
   ============================================ */

.glitch {
  animation: glitch 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes glitch {
  0% {
    transform: translate(0);
    filter: hue-rotate(0deg);
  }
  10% {
    transform: translate(-5px, 2px);
    filter: hue-rotate(90deg);
  }
  20% {
    transform: translate(5px, -2px);
    filter: hue-rotate(180deg);
  }
  30% {
    transform: translate(-3px, 1px);
    filter: hue-rotate(270deg);
  }
  40% {
    transform: translate(3px, -1px);
    filter: hue-rotate(0deg);
  }
  50% {
    transform: translate(-2px, 2px);
    clip-path: inset(30% 0 40% 0);
  }
  60% {
    transform: translate(2px, -2px);
    clip-path: inset(60% 0 10% 0);
  }
  70% {
    transform: translate(-1px, 1px);
    clip-path: inset(10% 0 70% 0);
  }
  80% {
    transform: translate(1px, -1px);
    clip-path: none;
  }
  100% {
    transform: translate(0);
    filter: hue-rotate(0deg);
  }
}

/* Chromatic Aberration on hover/focus states */
.chromatic-aberration {
  position: relative;
}

.chromatic-aberration::before,
.chromatic-aberration::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.chromatic-aberration::before {
  color: var(--cyan);
  animation: chromatic-r 0.1s infinite;
  opacity: 0.8;
  mix-blend-mode: screen;
}

.chromatic-aberration::after {
  color: var(--magenta);
  animation: chromatic-b 0.1s infinite;
  opacity: 0.8;
  mix-blend-mode: screen;
}

@keyframes chromatic-r {
  0%, 100% { transform: translate(-2px, 0); }
  50% { transform: translate(-1px, 0); }
}

@keyframes chromatic-b {
  0%, 100% { transform: translate(2px, 0); }
  50% { transform: translate(1px, 0); }
}

/* ============================================
   TYPEWRITER EFFECT
   ============================================ */

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--cyan);
  animation:
    typing 2s steps(40, end),
    blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--cyan); }
}

/* ============================================
   RESPONSIVE ADJUSTMENTS FOR OBS
   ============================================ */

/* Ensure crisp rendering at 1080p */
@media (min-width: 1920px) {
  body {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}
