/* ===== Custom Properties ===== */
:root {
  --bg-primary: #0a0a0a;
  --text-primary: #d4d4d4;
  --text-secondary: #777;
  --accent-default: #d4a017;
  --font-display: 'VT323', monospace;
  --font-body: 'Inter', system-ui, sans-serif;
  --transition-fast: 0.2s ease;
  --transition-medium: 0.4s ease;
  --guide-blue: #0a0f2e;
  --guide-blue-light: #111a40;
  --guide-border: #1a2555;
  --sticky-h: 48px;
  --font-hand: 'Caveat', 'Comic Sans MS', cursive;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}

/* ===== Global Scanlines ===== */
.scanlines {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px);
}
.crt-vignette {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
}
#static-bg {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; opacity: 0.03;
}

/* ===== Channel Change Overlay ===== */
.channel-change {
  position: fixed; inset: 0; z-index: 10000;
  pointer-events: none; opacity: 0; background: #000;
}
.channel-change.active {
  pointer-events: all; animation: channelSwitch 0.6s ease forwards;
}
.channel-change canvas { width: 100%; height: 100%; }

/* ===== Sticky Tagline Bar ===== */
.sticky-tagline {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 9000;
  height: var(--sticky-h);
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  background: rgba(8, 8, 10, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--accent-default) 30%, #1a1a1a);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.5);
  font-family: var(--font-display);
  font-size: 1.35rem; letter-spacing: 0.18em;
}
.sticky-name {
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
}
.sticky-sep { color: var(--accent-default); opacity: 0.6; }
.sticky-role { color: #888; }

/* ============================================================
   THE TV (CAROUSEL)
   ============================================================ */
.hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center;
  padding: 1rem 1.5rem 2rem;
  padding-top: calc(var(--sticky-h) + 0.5rem);
  gap: 1rem;
}

.tv-wrapper {
  display: flex; align-items: center; gap: 1.5rem;
  width: 100%;
  max-width: 1400px;
}

/* Side arrows */
.tv-arrow {
  background: none; border: none; cursor: pointer;
  width: 64px; height: 64px; color: #444; flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}
.tv-arrow:hover { color: #fff; transform: scale(1.2); }
.tv-arrow svg { width: 100%; height: 100%; }

/* TV Set */
.tv-set {
  position: relative;
  flex: 1;
  background: #1a1a1a;
  border-radius: 14px;
  padding: 14px 14px 0;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid #252525;
}

/* TV Screen — enlarged */
.tv-screen {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border-radius: 8px; overflow: hidden;
  background: #000; box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

/* Color bars */
.color-bars {
  position: absolute; inset: 0; display: flex; z-index: 1;
  transition: opacity 0.3s;
}
.color-bars .bar { flex: 1; }
.color-bars.hidden { opacity: 0; pointer-events: none; }

/* Static overlay */
.tv-static {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 5; opacity: 0; pointer-events: none;
}
.tv-static.flash { opacity: 1; }

/* Channel content */
.tv-channel-content {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.tv-channel-content .tv-scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 2px, rgba(0,0,0,0.15) 2px, rgba(0,0,0,0.15) 4px);
}

/* Intro text */
.tv-brand {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 7vw, 5rem); color: #fff;
  text-shadow: 0 0 20px rgba(255,255,255,0.5), 2px 2px 0 rgba(0,0,0,0.8);
  letter-spacing: 0.15em; z-index: 4;
  animation: crtFlicker 0.15s infinite alternate;
}
.tv-subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2vw, 1.3rem); color: rgba(255,255,255,0.7);
  letter-spacing: 0.3em; z-index: 4;
}

/* Game display on screen */
.tv-game-display {
  position: absolute; inset: 0;
}
.tv-game-display img {
  width: 100%; height: 100%; object-fit: cover;
}
.tv-game-initial {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 8rem);
  color: rgba(255,255,255,0.12);
  text-shadow: 0 0 40px currentColor;
  user-select: none;
}

/* Channel HUD */
.tv-channel-hud {
  position: absolute; top: 12px; right: 16px; z-index: 6;
  font-family: var(--font-display);
  font-size: 1.6rem; color: rgba(255,255,255,0.9);
  text-shadow: 0 0 10px rgba(255,255,255,0.4), 2px 2px 0 rgba(0,0,0,0.9);
  opacity: 0;
}

/* ===== On-Screen Game Info (inside TV, bottom) ===== */
.tv-screen-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  z-index: 4; padding: 40px 20px 14px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  text-align: left;
  opacity: 0; transition: opacity 0.3s;
}
.tv-screen-info.visible { opacity: 1; }

.tv-screen-info .screen-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 2.2rem); color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 4px rgba(0,0,0,0.8);
}
.tv-screen-info .screen-genre {
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 1.5vw, 1.1rem);
  letter-spacing: 0.15em; margin-top: 2px;
}
.tv-screen-info .screen-desc {
  font-size: clamp(0.65rem, 1vw, 0.8rem); color: rgba(255,255,255,0.6);
  margin-top: 4px; max-width: 70%;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* ===== VHS Controls ===== */
.vhs-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 14px;
  border-top: 1px solid #222;
  gap: 12px;
}
.vhs-left { flex-shrink: 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
.vhs-label {
  font-family: var(--font-display);
  font-size: 0.95rem; color: #3a3a3a; letter-spacing: 0.2em;
}
.vhs-center {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  position: relative;
}
.vhs-btn {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 36px;
  background: #222; color: #888;
  border: 1px solid #333; border-radius: 3px;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.5);
  transition: all 0.1s;
}
.vhs-btn svg { width: 18px; height: 18px; }
.vhs-btn:hover { color: #fff; background: #2a2a2a; }
.vhs-btn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,0.5); }

/* Big prominent PLAY CTA */
.vhs-btn-play {
  width: auto; min-width: 180px; height: 48px;
  padding: 0 20px; gap: 10px;
  background: linear-gradient(180deg, #b8860b 0%, #8a6308 100%);
  border: 1px solid #daa520;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.2),
    inset 0 -3px 0 rgba(0,0,0,0.3),
    0 0 20px rgba(212, 160, 23, 0.3),
    0 2px 8px rgba(0,0,0,0.6);
  animation: playPulse 2.5s ease-in-out infinite;
  text-decoration: none;
}
.vhs-btn-play::after {
  content: 'PLAY';
}
.vhs-btn-play:hover {
  background: linear-gradient(180deg, #daa520 0%, #b8860b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -3px 0 rgba(0,0,0,0.3),
    0 0 30px rgba(212, 160, 23, 0.6),
    0 4px 12px rgba(0,0,0,0.6);
  animation: none;
  transform: translateY(-1px);
}
.vhs-btn-play:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(212,160,23,0.4);
}
.vhs-btn-play svg {
  width: 22px; height: 22px; flex-shrink: 0;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.4));
}

@keyframes playPulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.3), 0 0 20px rgba(212, 160, 23, 0.3), 0 2px 8px rgba(0,0,0,0.6); }
  50% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), inset 0 -3px 0 rgba(0,0,0,0.3), 0 0 32px rgba(212, 160, 23, 0.6), 0 2px 8px rgba(0,0,0,0.6); }
}

.vhs-right {
  display: flex; gap: 10px; flex-shrink: 0; align-items: center;
}
.vhs-knob {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(145deg, #333, #1a1a1a);
  border: 1px solid #3a3a3a;
}

/* ===== Hero Scroll Hint ===== */
.hero-scroll-hint {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 1rem; letter-spacing: 0.2em; text-transform: uppercase;
  opacity: 0; animation: fadeSlideUp 0.8s ease 1s forwards;
}
.hero-scroll-hint svg { animation: bounceDown 2s ease infinite; }

/* ============================================================
   TV GUIDE
   ============================================================ */
.tv-guide {
  position: relative; z-index: 1;
  max-width: 1000px; margin: 0 auto;
  padding: 0 2rem 4rem;
}
.guide-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 16px 20px;
  background: linear-gradient(90deg, #0d1440, #1a2766);
  border: 1px solid var(--guide-border);
  border-bottom: none; border-radius: 6px 6px 0 0;
}
.guide-logo {
  font-family: var(--font-display);
  font-size: 1.3rem; color: var(--accent-default); letter-spacing: 0.15em;
}
.guide-title {
  font-family: var(--font-display);
  font-size: 1.1rem; color: #8899cc; letter-spacing: 0.2em; flex: 1;
}
.guide-time {
  font-family: var(--font-display);
  font-size: 1rem; color: #6677aa; letter-spacing: 0.1em;
}
.guide-list {
  border: 1px solid var(--guide-border);
  border-radius: 0 0 6px 6px; overflow: hidden;
}
.guide-row {
  display: grid; grid-template-columns: 70px 1fr auto 100px;
  align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--guide-blue);
  border-bottom: 1px solid var(--guide-border);
  cursor: pointer; transition: background 0.15s;
  text-decoration: none; color: inherit;
}
.guide-row:last-child { border-bottom: none; }
.guide-row:hover { background: var(--guide-blue-light); }
.guide-row.active-channel {
  background: linear-gradient(90deg, rgba(212,160,23,0.08), var(--guide-blue));
  border-left: 3px solid var(--accent-default);
}
.guide-ch {
  font-family: var(--font-display);
  font-size: 1.2rem; color: var(--accent-default); letter-spacing: 0.05em;
}
.guide-info { min-width: 0; }
.guide-game-title {
  font-family: var(--font-display);
  font-size: 1.3rem; color: #fff; letter-spacing: 0.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.guide-game-desc {
  font-size: 0.75rem; color: #556688;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
}
.guide-genre {
  font-family: var(--font-display);
  font-size: 0.9rem; letter-spacing: 0.1em; white-space: nowrap;
}
.guide-status {
  font-family: var(--font-display);
  font-size: 0.9rem; color: #4a5577; letter-spacing: 0.1em; text-align: right;
}

/* End-of-schedule row (station ID / sign-off) */
.guide-end-row {
  cursor: default;
  background: repeating-linear-gradient(
    90deg,
    #0a0f2e 0%, #0a0f2e 12.5%,
    #2a2050 12.5%, #2a2050 25%,
    #0a0f2e 25%, #0a0f2e 37.5%,
    #3a2a40 37.5%, #3a2a40 50%,
    #0a0f2e 50%, #0a0f2e 62.5%,
    #4a2525 62.5%, #4a2525 75%,
    #0a0f2e 75%, #0a0f2e 87.5%,
    #252550 87.5%, #252550 100%
  );
  opacity: 0.7;
}
.guide-end-row:hover { background: inherit; }
.guide-end-row .guide-ch { color: #888; letter-spacing: 0.1em; }
.guide-end-row .guide-game-title { color: #ccc; font-style: italic; }
.guide-end-row .guide-game-desc { color: #778; font-style: italic; }
.guide-end-row .guide-genre { color: var(--accent-default); opacity: 0.7; }
.guide-end-row .guide-status { color: #d4a017; }

/* ============================================================
   TILE GRID
   ============================================================ */
.tile-grid-section {
  position: relative; z-index: 1;
  max-width: 1200px; margin: 0 auto;
  padding: 2rem 2rem 3rem;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
@media (max-width: 900px) {
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .tile-grid { grid-template-columns: 1fr; }
}

.tile {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s, filter 0.3s;
  filter: brightness(0.7);
}

.tile:hover img {
  transform: scale(1.05);
  filter: brightness(1);
}

.tile-label {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
  pointer-events: none;
}

.tile-title {
  font-family: var(--font-display);
  font-size: 1.2rem; color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

.tile-genre {
  font-family: var(--font-display);
  font-size: 0.8rem;
  margin-left: 8px;
  letter-spacing: 0.1em;
}

/* Placeholder for tiles without thumbnails */
.tile-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #111;
  font-family: var(--font-display);
  font-size: 3rem;
  color: rgba(255,255,255,0.1);
}

/* ============================================================
   HANDWRITTEN ANNOTATION LAYER (Joel's notes)
   ============================================================ */

/* Toggle button — fixed bottom-right */
.notes-toggle {
  position: fixed;
  bottom: 18px; right: 18px;
  z-index: 9500;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px 10px 12px;
  background: #fef9e3;
  color: #1a1a1a;
  border: 2px solid #1a1a1a;
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 1.35rem; font-weight: 700;
  cursor: pointer;
  transform: rotate(-3deg);
  box-shadow:
    3px 4px 0 rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(254, 249, 227, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.notes-toggle:hover {
  transform: rotate(-3deg) translateY(-2px);
  box-shadow:
    3px 6px 0 rgba(0, 0, 0, 0.5),
    0 0 0 4px rgba(254, 249, 227, 0.3);
}
.notes-toggle:active {
  transform: rotate(-3deg) translateY(1px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.notes-toggle-scribble {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: #c0392b;
}
.notes-toggle-scribble svg { width: 100%; height: 100%; }

.notes-toggle-label { white-space: nowrap; }

body.show-notes .notes-toggle {
  background: #1a1a1a;
  color: #fef9e3;
  border-color: #fef9e3;
}
body.show-notes .notes-toggle-scribble { color: #e74c3c; }

/* Annotation layer container — fills the page */
.notes-layer {
  position: absolute;
  top: 0; left: 0; width: 100%;
  min-height: 100%;
  pointer-events: none;
  z-index: 8500;
  opacity: 0;
  transition: opacity 0.35s ease;
}
body.show-notes .notes-layer { opacity: 1; }

/* Individual annotations */
.note {
  position: absolute;
  font-family: var(--font-hand);
  color: #fff;
  font-weight: 700;
  line-height: 1.1;
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.9),
    0 0 10px rgba(0, 0, 0, 0.7),
    2px 2px 0 rgba(0, 0, 0, 0.5);
  transform: rotate(var(--note-rot, -4deg));
  max-width: 320px;
  white-space: pre-line;
  pointer-events: none;
}
.note--sm { font-size: 1.35rem; }
.note--md { font-size: 1.7rem; }
.note--lg { font-size: 2.1rem; }

/* (Color variants retained for API compatibility — all render white) */
.note--red, .note--green, .note--blue { color: #fff; }

/* Arrow SVG */
.note-arrow {
  position: absolute;
  overflow: visible;
  pointer-events: none;
  color: #fff;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
}
.note-arrow--red, .note-arrow--green, .note-arrow--blue { color: #fff; }
.note-arrow path {
  fill: none; stroke: currentColor;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Bounce animation — gentle vertical float, keeps each note's rotation */
@keyframes noteBounce {
  0%, 100% { transform: rotate(var(--note-rot, -4deg)) translateY(0); }
  50%      { transform: rotate(var(--note-rot, -4deg)) translateY(-6px); }
}
body.show-notes .note {
  animation: noteBounce 2.4s ease-in-out infinite;
}

/* Also bounce the arrows along with their notes (parallel animation) */
@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
body.show-notes .note-arrow {
  animation: arrowBounce 2.4s ease-in-out infinite;
}

/* ============================================================
   PLAY BUTTON CTA ANNOTATION (always visible, per-channel text)
   ============================================================ */
.play-cta {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;  /* arrow tip lands on PLAY button */
  display: flex;
  align-items: flex-start;
  gap: 2px;
  z-index: 20;
  pointer-events: none;
  color: #fff;
  font-family: var(--font-hand);
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.9));
  transform: rotate(-4deg);
  opacity: 0;
  transition: opacity 0.35s ease;
}
body.show-notes .play-cta {
  opacity: 1;
  animation: ctaBounce 2.2s ease-in-out infinite;
}

.play-cta-arrow {
  width: 84px; height: 60px;
  flex-shrink: 0;
  transform: translateY(-6px);
}

.play-cta-text {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    0 0 6px rgba(0, 0, 0, 0.95),
    0 0 12px rgba(0, 0, 0, 0.6),
    2px 2px 0 rgba(0, 0, 0, 0.5);
  margin-top: 28px;
}

@keyframes ctaBounce {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50%      { transform: rotate(-4deg) translateY(-5px); }
}

@media (max-width: 768px) {
  .play-cta { display: none; } /* cramped on mobile */
}

/* ===== Footer ===== */
.site-footer {
  position: relative; z-index: 1;
  text-align: center; padding: 3rem 2rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 1rem; letter-spacing: 0.1em;
  border-top: 1px solid #1a1a1a;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .tv-set { padding: 8px 8px 0; }
  .tv-arrow { width: 32px; height: 32px; }
  .tv-wrapper { gap: 0.5rem; }
  .tv-guide { padding: 0 1rem 3rem; }
  .guide-row { grid-template-columns: 55px 1fr auto; gap: 8px; padding: 10px 12px; }
  .guide-status { display: none; }
  .sticky-tagline { font-size: 1.1rem; letter-spacing: 0.12em; }
  .vhs-btn-play { min-width: 120px; height: 40px; font-size: 1rem; padding: 0 12px; }
  .vhs-label { display: none; }
  .notes-toggle { bottom: 12px; right: 12px; font-size: 1.1rem; padding: 8px 14px 8px 10px; }
  .notes-toggle-scribble { width: 22px; height: 22px; }
  /* Hide notes on small screens — they're designed for large layouts */
  body.show-notes .notes-layer { display: none; }
}
@media (max-width: 480px) {
  .hero { padding: 1rem; padding-top: calc(var(--sticky-h) + 0.5rem); gap: 1rem; }
  .tv-arrow { width: 24px; height: 24px; }
  .guide-row { grid-template-columns: 45px 1fr; }
  .guide-genre { display: none; }
  .sticky-sep, .sticky-role { display: none; }
  .vhs-btn-play { min-width: 100px; font-size: 0.9rem; }
  .notes-toggle-label { display: none; }
}
