@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&family=Press+Start+2P&family=Silkscreen:wght@400;700&family=Pixelify+Sans:wght@400;500;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.5);
  --text-dim: rgba(180, 220, 195, 0.4);
  --text-mid: rgba(200, 230, 210, 0.6);
  --text-bright: rgba(220, 245, 225, 0.95);
}

body {
  background: #03060a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  position: relative;
  padding: 20px;
}

/* ── STARRY BACKGROUND (IMAGE) ────────────────────── */
.stars-bg {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 6, 10, 0.55) 0%, rgba(3, 6, 10, 0.25) 40%, rgba(3, 6, 10, 0.55) 100%),
    url('assets/stars-bg.png') center / cover no-repeat,
    #000;
  pointer-events: none;
  z-index: 0;
}

.stars-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(74, 222, 128, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 15% 85%, rgba(46, 90, 140, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 70% at 90% 20%, rgba(120, 80, 180, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* ── TV CABINET (LOW-POLY) ────────────────────────── */
.tv-wrap {
  position: relative;
  z-index: 10;
  filter:
    drop-shadow(0 30px 60px rgba(0, 0, 0, 0.95))
    drop-shadow(0 0 80px rgba(74, 222, 128, 0.10));
  animation: tvFloat 6s ease-in-out infinite;
}

@keyframes tvFloat {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

.tv-cabinet {
  position: relative;
  padding: clamp(20px, 2.4vw, 40px) clamp(24px, 2.8vw, 50px) clamp(28px, 3vw, 50px);
  border-radius: 0;
  /* polygonal cabinet outline — chamfered corners, like a low-poly UFO panel */
  clip-path: polygon(
    24px 0,
    calc(100% - 24px) 0,
    100% 24px,
    100% calc(100% - 32px),
    calc(100% - 32px) 100%,
    32px 100%,
    0 calc(100% - 32px),
    0 24px
  );
  background:
    linear-gradient(135deg, transparent 49.5%, rgba(0, 0, 0, 0.25) 50%, transparent 50.5%) right top / 50% 50% no-repeat,
    linear-gradient(225deg, transparent 49.5%, rgba(255, 255, 255, 0.04) 50%, transparent 50.5%) left top / 50% 50% no-repeat,
    linear-gradient(160deg, #3a4a52 0%, #232e34 35%, #131b1f 70%, #0a1216 100%);
}

.tv-cabinet::before {
  content: '';
  position: absolute;
  inset: 0;
  /* faceted shading — diagonal polygon planes */
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.05) 0%, transparent 35%),
    linear-gradient(300deg, rgba(0, 0, 0, 0.4) 0%, transparent 35%),
    linear-gradient(45deg, transparent 70%, rgba(74, 222, 128, 0.04) 100%);
  pointer-events: none;
}

/* rivets in corners */
.tv-cabinet::after {
  content: '';
  position: absolute;
  top: 14px; left: 14px; right: 14px; bottom: 14px;
  background:
    radial-gradient(circle at 0    0,    #6a7a82 0, #6a7a82 2.5px, transparent 3px),
    radial-gradient(circle at 100% 0,    #6a7a82 0, #6a7a82 2.5px, transparent 3px),
    radial-gradient(circle at 0    100%, #6a7a82 0, #6a7a82 2.5px, transparent 3px),
    radial-gradient(circle at 100% 100%, #6a7a82 0, #6a7a82 2.5px, transparent 3px);
  pointer-events: none;
}

/* ── SCREEN BEZEL (LOW-POLY) ──────────────────────── */
.tv-bezel {
  position: relative;
  padding: clamp(12px, 1.4vw, 22px);
  background:
    linear-gradient(135deg, #0c1418 0%, #050a0d 100%);
  clip-path: polygon(
    14px 0,
    calc(100% - 14px) 0,
    100% 14px,
    100% calc(100% - 14px),
    calc(100% - 14px) 100%,
    14px 100%,
    0 calc(100% - 14px),
    0 14px
  );
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.03);
}

.tv-bezel::before {
  content: '';
  position: absolute;
  inset: 4px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.5) 100%);
  pointer-events: none;
  clip-path: inherit;
}

/* ── SCREEN ───────────────────────────────────────── */
.tv-screen {
  width: min(82vw, 1400px);
  aspect-ratio: 16 / 10;
  max-height: 72vh;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  outline: none;
  background: #000;
  clip-path: polygon(
    10px 0,
    calc(100% - 10px) 0,
    100% 10px,
    100% calc(100% - 10px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px),
    0 10px
  );
}

.tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow:
    inset  10px  0   24px rgba(0, 0, 0, 0.45),
    inset -10px  0   24px rgba(0, 0, 0, 0.45),
    inset  0    10px 24px rgba(0, 0, 0, 0.35),
    inset  0   -10px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 20;
}

#screen {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.20) 3px,
    rgba(0, 0, 0, 0.20) 4px
  );
  pointer-events: none;
  z-index: 15;
  mix-blend-mode: multiply;
}

.phosphor-glow {
  position: absolute;
  inset: -2px;
  pointer-events: none;
  z-index: 5;
  transition: box-shadow 1.2s ease;
}

/* ── VIDEO OVERLAY ────────────────────────────────── */
.video-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 8;
  display: none;
  background: #000;
}

.video-overlay.show {
  display: block;
  animation: loreIn 0.5s ease;
}

/* ── IFRAME OVERLAY (chart, etc.) ─────────────────── */
.iframe-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 9;
  display: none;
  background: #0a0e12;
  border: none;
}

.iframe-overlay.show {
  display: block;
  animation: loreIn 0.5s ease;
}

/* ── LORE OVERLAY (CH 01) ─────────────────────────── */
.lore-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  padding: clamp(18px, 2.6vw, 42px) clamp(22px, 3.2vw, 56px);
  color: rgba(180, 250, 195, 0.92);
  font-family: 'Pixelify Sans', 'VT323', monospace;
  font-weight: 500;
  text-shadow:
    0 0 6px rgba(74, 222, 128, 0.55),
    0 0 14px rgba(74, 222, 128, 0.25);
  background:
    radial-gradient(ellipse at center, rgba(8, 18, 12, 0.55) 0%, rgba(2, 8, 4, 0.85) 80%),
    #020806;
  pointer-events: auto;
  image-rendering: pixelated;
}

.lore-overlay.show {
  display: flex;
  animation: loreIn 0.6s ease;
}

@keyframes loreIn {
  from { opacity: 0; transform: translateY(8px); filter: brightness(2.5) blur(2px); }
  to   { opacity: 1; transform: translateY(0);    filter: brightness(1) blur(0); }
}

.lore-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Press Start 2P', 'VT323', monospace;
  font-size: clamp(9px, 0.85vw, 13px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(180, 250, 195, 0.85);
  border-bottom: 1px dashed rgba(74, 222, 128, 0.3);
  padding-bottom: clamp(10px, 1.2vw, 18px);
  margin-bottom: clamp(12px, 1.6vw, 22px);
  flex-shrink: 0;
}

.lore-tag-r {
  color: rgba(180, 250, 195, 0.55);
}

.lore-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 12px;
  font-family: 'Pixelify Sans', monospace;
  font-weight: 500;
  font-size: clamp(15px, 1.45vw, 22px);
  line-height: 1.6;
  scroll-behavior: smooth;
}

.lore-scroll::-webkit-scrollbar { width: 8px; }
.lore-scroll::-webkit-scrollbar-track { background: rgba(74, 222, 128, 0.05); }
.lore-scroll::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.3);
  border: 1px solid rgba(74, 222, 128, 0.2);
}
.lore-scroll::-webkit-scrollbar-thumb:hover { background: rgba(74, 222, 128, 0.5); }

.lore-block {
  display: grid;
  gap: clamp(4px, 0.5vw, 7px);
  margin-bottom: clamp(14px, 1.8vw, 24px);
  padding: clamp(10px, 1.2vw, 18px) clamp(14px, 1.6vw, 22px);
  background: rgba(74, 222, 128, 0.04);
  border-left: 2px solid rgba(74, 222, 128, 0.55);
}

.lore-row {
  display: grid;
  grid-template-columns: clamp(100px, 11vw, 170px) 1fr;
  gap: 16px;
  font-family: 'Silkscreen', monospace;
  font-size: clamp(11px, 1.0vw, 15px);
  letter-spacing: 0.06em;
}

.lore-key {
  color: rgba(120, 200, 145, 0.65);
  text-transform: uppercase;
}

.lore-val {
  color: rgba(220, 255, 225, 0.95);
  font-weight: 700;
}

.lore-val.lore-blink {
  animation: loreBlink 1.4s steps(2) infinite;
  color: #4ade80;
}

@keyframes loreBlink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.lore-divider {
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(11px, 1.0vw, 15px);
  letter-spacing: 0.32em;
  color: rgba(74, 222, 128, 0.55);
  text-align: center;
  margin: clamp(20px, 2.4vw, 32px) 0 clamp(12px, 1.4vw, 20px);
  text-transform: uppercase;
  position: relative;
}

.lore-divider::before,
.lore-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 0;
  border-top: 1px dashed rgba(74, 222, 128, 0.25);
}
.lore-divider::before { left: 0; }
.lore-divider::after  { right: 0; }

.lore-p {
  margin-bottom: clamp(10px, 1.2vw, 18px);
  color: rgba(220, 255, 225, 0.88);
  letter-spacing: 0.02em;
}

.lore-p strong {
  color: #4ade80;
  font-weight: normal;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.7);
}

.lore-p em {
  font-style: normal;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
  letter-spacing: 0.05em;
}

.lore-warn {
  margin: clamp(14px, 1.8vw, 24px) 0;
  padding: clamp(10px, 1.2vw, 18px) clamp(14px, 1.6vw, 22px);
  background: rgba(251, 191, 36, 0.06);
  border-left: 2px solid rgba(251, 191, 36, 0.65);
  color: rgba(255, 230, 170, 0.95);
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.lore-list {
  list-style: none;
  padding: clamp(8px, 1vw, 14px) clamp(14px, 1.6vw, 22px);
  background: rgba(74, 222, 128, 0.04);
  border-left: 2px solid rgba(74, 222, 128, 0.4);
  font-family: 'Silkscreen', monospace;
  font-size: clamp(11px, 1vw, 15px);
  letter-spacing: 0.04em;
  display: grid;
  gap: clamp(5px, 0.6vw, 9px);
  color: rgba(220, 255, 225, 0.85);
}

.lore-list li {
  text-transform: lowercase;
}

.lore-foot {
  margin-top: clamp(24px, 2.6vw, 36px);
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(9px, 0.85vw, 13px);
  letter-spacing: 0.16em;
  color: rgba(180, 250, 195, 0.55);
  text-transform: uppercase;
}

.lore-cursor {
  display: inline-block;
  margin-left: 4px;
  color: #4ade80;
  animation: cursorBlink 1s steps(2) infinite;
}

@keyframes cursorBlink {
  0%, 50%   { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.screen-glass {
  position: absolute;
  top: 6px; left: 8px;
  width: 45%; height: 30%;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 25;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 80% 100%, 0 100%);
}

/* ── CONTROLS BAR ─────────────────────────────────── */
.tv-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(14px, 1.8vw, 28px);
  padding: 0 6px;
}

.tv-brand {
  position: relative;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(11px, 1.0vw, 16px);
  color: rgba(180, 220, 195, 0.7);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(74, 222, 128, 0.35);
  padding: 8px 16px 8px 18px;
  background: rgba(74, 222, 128, 0.08);
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.indicator-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.on-air {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 6px var(--accent),
    0 0 14px var(--accent-soft);
  animation: ledPulse 2s ease-in-out infinite;
}

@keyframes ledPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.knobs {
  display: flex;
  gap: 18px;
  align-items: center;
}

.knob {
  width: 34px; height: 34px;
  background:
    linear-gradient(135deg, #6a7a82 0%, #3a4850 30%, #1a2228 70%, #0c1418 100%);
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
  /* hexagon — low-poly knob */
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.8));
}

.knob::before {
  content: '';
  position: absolute;
  inset: 5px;
  background:
    linear-gradient(135deg, #4a5a62 0%, #2a3640 50%, #14201c 100%);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.knob::after {
  content: '';
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 9px;
  background: rgba(180, 220, 195, 0.7);
  z-index: 2;
}

.knob:hover  { transform: rotate(60deg); }
.knob:active { transform: rotate(120deg); }

.knob.ch-knob { width: 40px; height: 40px; }
.knob.ch-knob::after { height: 11px; top: 7px; }

/* ── CHANNEL STRIP ────────────────────────────────── */
.channel-strip {
  display: flex;
  gap: clamp(6px, 0.7vw, 12px);
  margin-top: clamp(16px, 1.8vw, 28px);
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  max-width: 100%;
  width: min(82vw, 1400px);
}

.ch-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 8px clamp(8px, 1vw, 16px);
  height: 38px;
  border: none;
  background: rgba(74, 222, 128, 0.04);
  color: var(--text-mid);
  font-family: 'Silkscreen', monospace;
  font-weight: 700;
  font-size: clamp(9px, 0.9vw, 12px);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  /* angular tag shape */
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}

.ch-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-top: 1px solid rgba(180, 220, 195, 0.18);
  border-bottom: 1px solid rgba(180, 220, 195, 0.18);
  pointer-events: none;
  transition: border-color 0.2s ease;
}

.ch-btn:hover {
  color: var(--text-bright);
  background: rgba(74, 222, 128, 0.08);
  transform: translateY(-1px);
}

.ch-btn:hover::before {
  border-color: rgba(180, 220, 195, 0.45);
}

.ch-btn.active {
  color: #ffffff;
  background: rgba(74, 222, 128, 0.14);
  box-shadow: 0 0 14px var(--ch-color, var(--accent));
}

.ch-btn.active::before {
  border-color: var(--ch-color, var(--accent));
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.08);
}

.ch-btn .ch-num { opacity: 0.55; }

/* ── HINT ─────────────────────────────────────────── */
.hint {
  margin-top: 18px;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(180, 220, 195, 0.22);
  text-align: center;
}

/* ── CHANNEL SWITCH ANIMATION ─────────────────────── */
.tv-screen.switching #screen,
.tv-screen.switching .video-overlay,
.tv-screen.switching .iframe-overlay,
.tv-screen.switching .lore-overlay {
  animation: crtSwitch 0.45s ease forwards;
}

@keyframes crtSwitch {
  0%   { transform: scaleY(1);    filter: brightness(1.2); }
  20%  { transform: scaleY(0.02); filter: brightness(3) blur(1px); }
  55%  { transform: scaleY(0.02); filter: brightness(0.1); }
  75%  { transform: scaleY(1.04); filter: brightness(1.4); }
  90%  { transform: scaleY(0.97); filter: brightness(0.9); }
  100% { transform: scaleY(1);    filter: brightness(1); }
}

/* ── INTRO SCREEN ─────────────────────────────────── */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  animation: introFadeIn 0.6s ease;
}

@keyframes introFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.intro-screen.exiting {
  animation: introExit 0.9s ease forwards;
}

@keyframes introExit {
  0%   { opacity: 1; transform: scale(1); filter: brightness(1); }
  30%  { opacity: 1; transform: scale(1.04); filter: brightness(2.5) blur(2px); }
  60%  { opacity: 1; transform: scale(0.05) scaleY(0.001); filter: brightness(4); }
  100% { opacity: 0; transform: scale(0.05) scaleY(0.001); filter: brightness(0); pointer-events: none; }
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.55) contrast(1.1) saturate(0.85);
  z-index: 1;
}

.intro-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.55) 75%, rgba(0, 0, 0, 0.92) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.5) 100%);
}

.intro-scanlines {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  mix-blend-mode: multiply;
}

.intro-content {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: contentRise 1.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes contentRise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.enter-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

.enter-text {
  position: relative;
  font-family: 'VT323', monospace;
  font-size: clamp(72px, 11vw, 140px);
  letter-spacing: 0.06em;
  color: rgba(232, 255, 234, 0.92);
  text-shadow:
    0 0 18px rgba(74, 222, 128, 0.55),
    0 0 50px rgba(74, 222, 128, 0.3);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: textFlicker 5s ease-in-out infinite;
}

@keyframes textFlicker {
  0%, 100%  { opacity: 1; }
  93%       { opacity: 1; }
  94%       { opacity: 0.55; }
  95%       { opacity: 1; }
  97%       { opacity: 0.75; }
  98%       { opacity: 1; }
}

.enter-btn:hover .enter-text {
  color: #ffffff;
  text-shadow:
    0 0 24px rgba(74, 222, 128, 0.9),
    0 0 70px rgba(74, 222, 128, 0.5),
    0 0 120px rgba(74, 222, 128, 0.25);
  transform: translateY(-2px);
  letter-spacing: 0.09em;
}

.enter-btn:active .enter-text {
  transform: translateY(0);
  text-shadow:
    0 0 30px rgba(255, 255, 255, 0.95),
    0 0 80px rgba(74, 222, 128, 0.7);
}

@media (max-width: 640px) {
  .tv-cabinet { padding: 16px 18px 24px; }
  .ch-btn     { min-width: 50px; height: 28px; font-size: 14px; }
}
