/* ===== 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: 36px;
}

*, *::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;
}

/* ===== 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.5rem;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #1a1a1a;
  font-family: var(--font-display);
  font-size: 1rem; letter-spacing: 0.15em;
}
.sticky-name { color: #fff; }
.sticky-sep { color: #333; }
.sticky-role { color: #555; }

/* ============================================================
   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: 2rem; padding-top: calc(var(--sticky-h) + 1rem);
  gap: 1.5rem;
}

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

/* Side arrows */
.tv-arrow {
  background: none; border: none; cursor: pointer;
  width: 48px; height: 48px; 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 {
  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: 8px 12px 10px;
  border-top: 1px solid #222;
}
.vhs-left { flex-shrink: 0; }
.vhs-label {
  font-family: var(--font-display);
  font-size: 0.85rem; color: #3a3a3a; letter-spacing: 0.2em;
}
.vhs-center {
  display: flex; align-items: center; gap: 4px;
}
.vhs-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 32px;
  background: #222; color: #888;
  border: 1px solid #333; border-radius: 2px;
  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: 16px; height: 16px; }
.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); }

.vhs-btn-play {
  width: 52px; height: 36px;
  background: #1a1a1a; border-color: #444;
  color: var(--accent-default);
}
.vhs-btn-play:hover {
  color: #fff; background: #222;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.4), 0 0 8px rgba(212,160,23,0.3);
}
.vhs-btn-play svg { width: 20px; height: 20px; }

.vhs-right {
  display: flex; gap: 8px; flex-shrink: 0;
}
.vhs-knob {
  width: 12px; height: 12px; 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;
}

/* ============================================================
   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(auto-fill, minmax(250px, 1fr));
  gap: 4px;
}

.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);
}

/* ===== 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: 28px; height: 28px; }
  .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: 0.8rem; letter-spacing: 0.1em; }
}
@media (max-width: 480px) {
  .hero { padding: 1rem; padding-top: calc(var(--sticky-h) + 0.5rem); gap: 1rem; }
  .tv-arrow { width: 20px; height: 20px; }
  .guide-row { grid-template-columns: 45px 1fr; }
  .guide-genre { display: none; }
  .sticky-sep, .sticky-role { display: none; }
}
