@import url('https://fonts.googleapis.com/css2?family=Lekton:ital,wght@0,400;0,700;1,400&family=VT323&display=swap');

:root {
  --bg: #080604;
  --bg-card: #0c0a06;
  --crt: #33ff33;
  --crt-dim: #1a8a1a;
  --crt-glow: rgba(51, 255, 51, 0.15);
  --amber: #ff9500;
  --amber-dim: #8a5000;
  --text: #c8b890;
  --text-dim: #786848;
  --text-muted: #3a3020;
  --border: #1e1a10;
  --chassis-hi: #2a2418;
  --glitch-1: #ff0040;
  --glitch-2: #00ffaa;
  --glitch-3: #ff00ff;
}

/* ═══════════════════════════════════════════════
   GLOBAL GLITCH ANIMATIONS
   ═══════════════════════════════════════════════ */

/* Glitch text class — apply to any element for random jitter */
.glitch-text {
  position: relative;
  display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.glitch-text::before {
  color: var(--glitch-1);
  animation: glitchTop 3s step-end infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch-text::after {
  color: var(--glitch-2);
  animation: glitchBottom 2.5s step-end infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  -webkit-clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}

@keyframes glitchTop {
  0%, 88%, 92%, 100% { transform: translate(0); opacity: 0; }
  89% { transform: translate(-3px, -1px); opacity: 0.7; }
  90% { transform: translate(2px, 1px); opacity: 0.6; }
  91% { transform: translate(-1px, -2px); opacity: 0.8; }
}

@keyframes glitchBottom {
  0%, 85%, 90%, 100% { transform: translate(0); opacity: 0; }
  86% { transform: translate(2px, 1px); opacity: 0.7; }
  87% { transform: translate(-3px, -1px); opacity: 0.6; }
  88% { transform: translate(1px, 2px); opacity: 0.5; }
  89% { transform: translate(-2px, 0); opacity: 0.8; }
}

/* Button glitch on hover */
.glitch-btn {
  position: relative;
  overflow: hidden;
}

.glitch-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(51, 255, 51, 0.1) 15%,
    transparent 30%,
    rgba(255, 0, 64, 0.05) 50%,
    transparent 70%,
    rgba(0, 255, 170, 0.08) 85%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: none;
  pointer-events: none;
}

.glitch-btn:hover::before {
  animation: btnGlitchScan 0.4s ease forwards;
}

@keyframes btnGlitchScan {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.glitch-btn:hover {
  animation: btnJitter 0.15s step-end;
}

@keyframes btnJitter {
  0%   { transform: translate(0); }
  20%  { transform: translate(-1px, 1px); }
  40%  { transform: translate(1px, -1px); }
  60%  { transform: translate(-1px, 0); }
  80%  { transform: translate(1px, 1px); }
  100% { transform: translate(0); }
}

/* Flicker class for any element */
.crt-flicker {
  animation: textFlicker 4s step-end infinite;
}

@keyframes textFlicker {
  0%, 92%, 94%, 96%, 100% { opacity: 1; }
  93% { opacity: 0.6; }
  95% { opacity: 0.85; }
}

/* Typing cursor blink */
@keyframes cursorBlink {
  0%, 49% { border-right-color: var(--crt); }
  50%, 100% { border-right-color: transparent; }
}

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

html, body {
  height: 100%;
  font-family: 'Lekton', monospace;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Matrix code rain background */
.matrix-rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.25;
}

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 1;
}

/* ═══════════════════════════════════════════════
   AUTH SCREEN — Terminal Login
   ═══════════════════════════════════════════════ */

.auth-screen {
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

/* Full-screen scanlines */
.auth-screen::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 4px
  );
}

/* Vignette */
.auth-screen::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.65) 100%);
}

.auth-container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: crtOn 0.8s ease;
}

@keyframes crtOn {
  0%  { opacity: 0; transform: scaleY(0.005) scaleX(0.2); }
  40% { opacity: 1; transform: scaleY(0.005) scaleX(0.8); }
  50% { transform: scaleY(1.1) scaleX(0.95); }
  65% { transform: scaleY(0.95) scaleX(1.02); }
  80% { transform: scaleY(1.02) scaleX(1); }
  100%{ transform: scaleY(1) scaleX(1); }
}

.auth-logo { text-align: center; }

.logo-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 8px;
  color: var(--crt);
  font-family: 'VT323', monospace;
  text-shadow: 0 0 10px var(--crt), 0 0 30px var(--crt-glow);
  animation: logoPulse 3s ease-in-out infinite;
}

.auth-logo h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
  color: var(--crt);
  text-shadow: 0 0 10px var(--crt), 0 0 40px var(--crt-glow);
  font-family: 'VT323', monospace;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: var(--crt);
  background-clip: unset;
}

.auth-subtitle {
  color: var(--crt-dim);
  font-size: 0.9rem;
  margin-top: 4px;
  font-family: 'VT323', monospace;
  letter-spacing: 2px;
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.15);
}

.auth-card {
  background: rgba(5, 5, 2, 0.92);
  border: 1px solid rgba(51, 255, 51, 0.12);
  border-radius: 2px;
  padding: 24px 28px 28px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5), inset 0 0 80px rgba(51, 255, 51, 0.02);
  position: relative;
}

/* ASCII corner decorations */
.auth-card::before {
  content: '╔══════════════════════════════╗';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 0.55rem;
  color: rgba(51, 255, 51, 0.15);
  white-space: nowrap;
  pointer-events: none;
  animation: textFlicker 4s step-end infinite;
}

.auth-card::after {
  content: '╚══════════════════════════════╝';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: 0.55rem;
  color: rgba(51, 255, 51, 0.15);
  white-space: nowrap;
  pointer-events: none;
}

.auth-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(51, 255, 51, 0.12);
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--crt-dim);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'VT323', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  color: var(--crt);
  border-bottom-color: var(--crt);
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.4);
  animation: tabSwitch 0.2s step-end;
}

@keyframes tabSwitch {
  0%   { transform: translateX(-2px); text-shadow: -2px 0 var(--glitch-1), 2px 0 var(--glitch-2); }
  50%  { transform: translateX(1px); text-shadow: 1px 0 var(--glitch-1), -1px 0 var(--glitch-2); }
  100% { transform: translateX(0); }
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--crt-dim);
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.form-group input {
  padding: 10px 12px;
  background: #000;
  border: 1px solid rgba(51, 255, 51, 0.18);
  border-radius: 0;
  color: var(--crt);
  font-size: 0.95rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
  outline: none;
  transition: all 0.2s;
  caret-color: var(--crt);
}

.form-group input:focus {
  border-color: var(--crt);
  box-shadow: 0 0 8px rgba(51, 255, 51, 0.15), inset 0 0 12px rgba(51, 255, 51, 0.03);
  animation: inputFocus 0.1s step-end;
}

@keyframes inputFocus {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-1px); }
  50%  { transform: translateX(1px); }
  75%  { transform: translateX(-1px); }
  100% { transform: translateX(0); }
}

.remember-row {
  display: flex;
  align-items: center;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-family: 'VT323', monospace;
  color: var(--crt-dim);
  cursor: pointer;
  letter-spacing: 1px;
  user-select: none;
}

.remember-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(51, 255, 51, 0.3);
  background: #000;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.remember-label input[type="checkbox"]:checked {
  background: rgba(51, 255, 51, 0.15);
  border-color: var(--crt);
}

.remember-label input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: -2px;
  left: 1px;
  font-size: 12px;
  color: var(--crt);
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.5);
}

.auth-error {
  padding: 8px 12px;
  background: rgba(255, 40, 40, 0.06);
  border: 1px solid rgba(255, 40, 40, 0.2);
  border-radius: 0;
  color: #ff4444;
  font-size: 0.85rem;
  font-family: 'VT323', monospace;
}

.btn-auth {
  padding: 12px;
  border: 1px solid var(--crt);
  border-radius: 0;
  background: rgba(51, 255, 51, 0.06);
  color: var(--crt);
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'VT323', monospace;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.3);
}

.btn-auth:hover {
  background: rgba(51, 255, 51, 0.12);
  box-shadow: 0 0 20px rgba(51, 255, 51, 0.15);
  animation: btnJitter 0.15s step-end;
}

.btn-auth:active {
  animation: btnJitter 0.1s step-end;
  background: rgba(51, 255, 51, 0.18);
}

/* Background glow (replaces orbs) */
.auth-bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  animation: none;
}

.orb-1 {
  width: 600px; height: 600px;
  background: var(--crt);
  opacity: 0.04;
  top: -20%; left: -15%;
}

.orb-2 {
  width: 400px; height: 400px;
  background: var(--crt);
  opacity: 0.03;
  bottom: -15%; right: -10%;
}

.orb-3 {
  width: 300px; height: 300px;
  background: var(--amber);
  opacity: 0.02;
  top: 40%; left: 50%;
}

/* ═══════════════════════════════════════════════
   HUB SCREEN
   ═══════════════════════════════════════════════ */

.hub-screen {
  background: transparent;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 20px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
  background: rgba(8, 6, 4, 0.95);
  border-bottom: 1px solid rgba(51, 255, 51, 0.05);
}

/* Subtle scanline on header */
.hub-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(51, 255, 51, 0.15) 20%,
    rgba(51, 255, 51, 0.3) 50%,
    rgba(51, 255, 51, 0.15) 80%,
    transparent 100%
  );
  animation: headerScan 4s ease-in-out infinite;
}

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

.hub-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon-sm {
  font-size: 0.9rem;
  color: var(--crt);
  font-family: 'VT323', monospace;
  text-shadow: 0 0 6px var(--crt-glow);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
  0%, 100% { opacity: 0.85; text-shadow: 0 0 6px var(--crt-glow); }
  50% { opacity: 1; text-shadow: 0 0 10px var(--crt-glow), 0 0 20px rgba(51, 255, 51, 0.1); }
}

.hub-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--crt);
  font-family: 'VT323', monospace;
  text-shadow: 0 0 8px var(--crt-glow);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: var(--crt);
  background-clip: unset;
}

.hub-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* CRT Color picker */
.color-picker-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.crt-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.color-picker-icon {
  font-size: 1.1rem;
  color: var(--crt);
  text-shadow: 0 0 6px var(--crt-glow);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: color 0.2s;
}

.color-picker-wrapper:hover .color-picker-icon {
  text-shadow: 0 0 12px var(--crt-glow), 0 0 20px var(--crt-glow);
}

.hub-user > span {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
}

.role-badge {
  padding: 2px 8px;
  border-radius: 0;
  font-size: 0.7rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-family: 'VT323', monospace;
}

.role-badge.admin {
  background: rgba(255, 149, 0, 0.08);
  border: 1px solid rgba(255, 149, 0, 0.3);
  color: var(--amber) !important;
  text-shadow: 0 0 4px rgba(255, 149, 0, 0.3);
}

.role-badge.user {
  background: rgba(51, 255, 51, 0.04);
  border: 1px solid rgba(51, 255, 51, 0.12);
  color: var(--crt-dim) !important;
}

.tier-badge {
  padding: 2px 8px;
  border-radius: 0;
  font-size: 0.7rem !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-family: 'VT323', monospace;
  margin-left: 4px;
}

/* ─── Hub Pricing Nav (removed — pricing on TV ribbons) ──── */
.hub-pricing-nav { display: none; }
.tier-badge.tier-free {
  background: rgba(200, 184, 144, 0.06);
  border: 1px solid var(--border);
  color: var(--text-dim) !important;
}
.tier-badge.tier-pro {
  background: rgba(255, 149, 0, 0.1);
  border: 1px solid rgba(255, 149, 0, 0.4);
  color: var(--amber) !important;
  text-shadow: 0 0 6px rgba(255, 149, 0, 0.3);
}
.tier-badge.tier-agency {
  background: rgba(255, 0, 255, 0.08);
  border: 1px solid rgba(255, 0, 255, 0.3);
  color: var(--glitch-3) !important;
  text-shadow: 0 0 6px rgba(255, 0, 255, 0.3);
}

.btn-logout {
  padding: 4px 14px;
  border: 1px solid rgba(255, 60, 60, 0.15);
  border-radius: 0;
  background: transparent;
  color: #884444;
  font-size: 0.8rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: #ff4444;
  color: #ff4444;
  text-shadow: 0 0 6px rgba(255, 68, 68, 0.3);
  animation: btnJitter 0.15s step-end;
}

.hub-main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Room (background atmosphere) */
.room {
  width: 100%;
  height: 100%;
  position: relative;
}

.room-wall {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, rgba(12,10,6,0.55) 0%, rgba(8,6,4,0.4) 100%);
  z-index: 0;
}

/* Subtle ambient CRT light casting on room wall */
.room-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 50% at 50% 45%, rgba(51, 255, 51, 0.015) 0%, transparent 100%);
  animation: roomAmbient 8s ease-in-out infinite;
}

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

.room-floor { display: none; }

/* ═══════════════════════════════════════════════
   TV WALL — 3x3 Grid (fills ALL space)
   ═══════════════════════════════════════════════ */

.tv-wall {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(8px, 1.2vw, 16px);
  width: 100%;
  height: 100%;
  padding: clamp(8px, 1.2vw, 16px);
}

/* ─── Individual TV Unit ─────────────────── */
.tv-unit {
  position: relative;
  transition: all 0.3s ease;
}

.tv-unit.active { cursor: pointer; }

.tv-body {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      88deg,
      transparent,
      transparent 4px,
      rgba(50, 40, 25, 0.04) 4px,
      rgba(50, 40, 25, 0.04) 5px
    ),
    linear-gradient(175deg, #222018 0%, #181510 40%, #0e0c08 100%);
  border: 2px solid #2a2418;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.7),
    0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ─── CRT Screen ─────────────────────────── */
.tv-screen {
  flex: 1;
  margin: 8px 8px 0;
  border-radius: 12px / 10px;
  overflow: hidden;
  background: #010101;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  /* CRT glass curvature */
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.95),
    inset 0 0 15px rgba(0, 0, 0, 0.5);
}

/* Scanlines */
.tv-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.25) 1px,
    rgba(0, 0, 0, 0.25) 2px
  );
}

/* CRT glass reflection */
.tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background:
    radial-gradient(ellipse 130% 80% at 25% 15%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
    linear-gradient(170deg, rgba(255, 255, 255, 0.02) 0%, transparent 25%);
  border-radius: inherit;
}

/* ─── TV Control Panel (bottom bezel) ────── */
.tv-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px 5px;
  height: clamp(20px, 3vh, 28px);
  min-height: 20px;
  position: relative;
}

.tv-led {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.tv-unit.active .tv-led {
  background: var(--crt);
  box-shadow: 0 0 4px var(--crt), 0 0 10px var(--crt);
  animation: ledBlink 3s ease-in-out infinite;
}

.tv-unit.down .tv-led {
  background: #222;
}

@keyframes ledBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.tv-brand {
  font-family: 'Lekton', monospace;
  font-size: clamp(0.38rem, 0.55vw, 0.5rem);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(200, 184, 144, 0.15);
}

/* Active TV brand — glitched, colored per-TV */
.tv-brand-glitch {
  color: var(--brand-color, #33ff33);
  opacity: 0.85;
  text-shadow: 0 0 6px var(--brand-color, #33ff33), 0 0 12px var(--brand-color, #33ff33);
  animation: brandGlitch 1.2s step-end infinite;
  position: relative;
}

.tv-brand-glitch::before,
.tv-brand-glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
}

.tv-brand-glitch::before {
  color: #ff0040;
  animation: brandGlitchTop 0.8s step-end infinite;
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.tv-brand-glitch::after {
  color: #00ffaa;
  animation: brandGlitchBottom 1s step-end infinite;
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

@keyframes brandGlitch {
  0%  { transform: none; opacity: 0.85; }
  5%  { transform: translate(2px, -1px) skewX(-2deg); opacity: 1; }
  10% { transform: translate(-3px, 1px) skewX(3deg); opacity: 0.6; }
  15% { transform: translate(1px, 0) skewX(-1deg); opacity: 0.9; }
  20% { transform: none; opacity: 0.85; }
  40% { transform: translate(-1px, 1px); opacity: 0.7; }
  42% { transform: translate(2px, -1px) skewX(4deg); opacity: 1; text-shadow: 0 0 8px var(--brand-color), -2px 0 #ff0040, 2px 0 #00ffaa; }
  44% { transform: translate(-2px, 0) skewX(-3deg); opacity: 0.5; }
  46% { transform: none; opacity: 0.85; }
  65% { transform: translate(1px, 0); opacity: 0.8; }
  67% { transform: translate(-3px, -1px) skewX(5deg); opacity: 1; text-shadow: 0 0 12px var(--brand-color), -3px 0 #ff0040, 3px 0 #00ffaa; }
  69% { transform: translate(2px, 1px) skewX(-4deg); opacity: 0.4; }
  71% { transform: translate(-1px, 0); opacity: 0.9; }
  73% { transform: none; opacity: 0.85; }
  90% { transform: translate(1px, -1px) skewX(2deg); opacity: 0.7; }
  92% { transform: translate(-2px, 0) skewX(-6deg); opacity: 1; text-shadow: 0 0 15px var(--brand-color), -4px 0 #ff0040, 4px 0 #00ffaa; }
  94% { transform: translate(3px, 1px) skewX(3deg); opacity: 0.3; }
  96% { transform: none; opacity: 0.85; }
  100% { transform: none; opacity: 0.85; }
}

@keyframes brandGlitchTop {
  0%, 100% { transform: translate(0); opacity: 0; }
  8%  { transform: translate(-3px, 0); opacity: 0.8; }
  12% { transform: translate(2px, 0); opacity: 0.5; }
  16% { opacity: 0; }
  40% { transform: translate(4px, 0); opacity: 0.7; }
  44% { transform: translate(-2px, 0); opacity: 0.9; }
  48% { opacity: 0; }
  70% { transform: translate(-4px, 0); opacity: 0.6; }
  74% { transform: translate(3px, 0); opacity: 0.8; }
  78% { opacity: 0; }
  92% { transform: translate(2px, 0); opacity: 0.9; }
  96% { transform: translate(-3px, 0); opacity: 0.5; }
  98% { opacity: 0; }
}

@keyframes brandGlitchBottom {
  0%, 100% { transform: translate(0); opacity: 0; }
  6%  { transform: translate(3px, 0); opacity: 0.7; }
  10% { transform: translate(-2px, 0); opacity: 0.4; }
  14% { opacity: 0; }
  35% { transform: translate(-3px, 0); opacity: 0.8; }
  39% { transform: translate(4px, 0); opacity: 0.6; }
  43% { opacity: 0; }
  60% { transform: translate(2px, 0); opacity: 0.9; }
  64% { transform: translate(-4px, 0); opacity: 0.5; }
  68% { opacity: 0; }
  85% { transform: translate(-2px, 0); opacity: 0.7; }
  89% { transform: translate(3px, 0); opacity: 0.9; }
  93% { opacity: 0; }
}

.tv-dial {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(12px, 1.5vh, 16px);
  height: clamp(12px, 1.5vh, 16px);
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, #2a2418, #1a1610, #2a2418, #1a1610, #2a2418),
    linear-gradient(145deg, #2a2418, #181410);
  border: 1px solid #3a3428;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), inset 0 0 2px rgba(255, 255, 255, 0.03);
}

.tv-dial-mark {
  position: absolute;
  top: 2px;
  left: 50%;
  width: 1px;
  height: 35%;
  background: rgba(200, 184, 144, 0.25);
  transform: translateX(-50%);
}

/* ═══════════════════════════════════════════════
   ACTIVE TV — Green Phosphor CRT
   ═══════════════════════════════════════════════ */

/* Ambient glow on wall behind active TV */
.tv-unit.active::before {
  content: '';
  position: absolute;
  inset: -25%;
  z-index: -1;
  background: radial-gradient(ellipse at center, rgba(51, 255, 51, 0.025) 0%, transparent 70%);
  pointer-events: none;
}

.tv-unit.active .tv-screen {
  background: radial-gradient(ellipse at 50% 50%, #020804 0%, #010101 70%);
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.85),
    inset 0 0 12px rgba(0, 0, 0, 0.4),
    0 0 8px rgba(51, 255, 51, 0.04);
}

/* Live iframe preview inside TV */
.tv-preview-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 400%;
  height: 400%;
  transform: scale(0.25);
  transform-origin: top left;
  border: none;
  pointer-events: none;
  z-index: 1;
  opacity: 0.75;
  filter: brightness(0.8) contrast(1.1);
}

/* Subtle vignette overlay on the preview (no green tint) */
.tv-glitch-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  will-change: opacity;
}

/* ─── CRT Glitch Effects ─────────────────── */

/* Random screen flicker & brightness shift */
.tv-unit.active .tv-screen {
  animation: crtFlicker var(--flicker-dur, 6s) ease-in-out var(--flicker-delay, 0s) infinite;
}

@keyframes crtFlicker {
  0%, 89%, 91%, 93%, 95%, 97%, 100% { opacity: 1; filter: brightness(1); }
  90% { opacity: 0.92; filter: brightness(0.85); }
  92% { opacity: 1; filter: brightness(1.05); }
  94% { opacity: 0.96; filter: brightness(0.9); }
  96% { opacity: 1; filter: brightness(1.08); }
}

/* Horizontal interference bar — chaotic positioning via JS */
.tv-unit.active .tv-screen .tv-glitch-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 8;
  pointer-events: none;
  will-change: top, opacity;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(51, 255, 51, 0.15) 20%,
    rgba(51, 255, 51, 0.25) 50%,
    rgba(51, 255, 51, 0.15) 80%,
    transparent 100%
  );
  opacity: 0.7;
  top: 0;
  transition: none;
}

/* Glitch slice — horizontal offset jitter */
.tv-unit.active .tv-screen .tv-glitch-slice {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 8;
  pointer-events: none;
  height: 0;
  background: rgba(51, 255, 51, 0.03);
  animation: glitchSlice var(--slice-dur, 8s) step-end var(--slice-delay, 0s) infinite;
}

@keyframes glitchSlice {
  0%, 94%, 100% { height: 0; top: 0; transform: translateX(0); }
  95% { height: 8px; top: 30%; transform: translateX(3px); background: rgba(51, 255, 51, 0.06); }
  96% { height: 4px; top: 55%; transform: translateX(-5px); background: rgba(255, 149, 0, 0.06); }
  97% { height: 12px; top: 20%; transform: translateX(4px); background: rgba(51, 255, 51, 0.04); }
  98% { height: 0; }
}

/* RGB split on channel number (chromatic aberration) */
.tv-unit.active .tv-channel {
  animation: rgbSplit var(--rgb-dur, 10s) step-end var(--rgb-delay, 0s) infinite;
}

@keyframes rgbSplit {
  0%, 92%, 96%, 100% { text-shadow: 0 0 8px var(--crt), 0 0 20px rgba(51, 255, 51, 0.4), 0 0 40px rgba(51, 255, 51, 0.12); }
  93% { text-shadow: -2px 0 #ff0040, 2px 0 #00ffaa, 0 0 8px var(--crt), 0 0 20px rgba(51, 255, 51, 0.4); }
  94% { text-shadow: 1px 0 #ff0040, -1px 0 #00ffaa, 0 0 8px var(--crt); }
  95% { text-shadow: 0 0 8px var(--crt), 0 0 20px rgba(51, 255, 51, 0.4), 0 0 40px rgba(51, 255, 51, 0.12); }
}

/* Screen edge glow pulse */
.tv-unit.active .tv-body {
  animation: chassisGlow var(--glow-dur, 5s) ease-in-out var(--glow-delay, 0s) infinite;
}

@keyframes chassisGlow {
  0%, 100% { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04); }
  50% { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 12px rgba(51, 255, 51, 0.04); }
}

/* Noise flash — brief full-screen static burst */
.tv-unit.active .tv-screen .tv-noise-flash {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  animation: noiseFlash var(--noise-dur, 12s) step-end var(--noise-delay, 0s) infinite;
}

@keyframes noiseFlash {
  0%, 93%, 95%, 100% { opacity: 0; }
  93.5% { opacity: 0.08; transform: translate(-2px, 1px); }
  94% { opacity: 0.12; transform: translate(1px, -1px); }
  94.5% { opacity: 0.04; transform: translate(-1px, 0); }
}

/* Rolling horizontal interference bar — chaotic via JS */
.tv-unit.active .tv-screen .tv-rolling-bar {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 7;
  pointer-events: none;
  will-change: top, height, opacity;
  height: 30%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(51, 255, 51, 0.015) 30%,
    rgba(51, 255, 51, 0.03) 50%,
    rgba(51, 255, 51, 0.015) 70%,
    transparent 100%
  );
  opacity: 0.7;
  top: 0;
  transition: none;
}

/* Name glitch */
.tv-unit.active .tv-name {
  color: var(--crt);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.35);
  animation: nameGlitch var(--name-dur, 7s) step-end var(--name-delay, 0s) infinite;
}

@keyframes nameGlitch {
  0%, 96%, 100% { transform: translateX(0); letter-spacing: 2px; }
  97% { transform: translateX(-2px); letter-spacing: 3px; }
  98% { transform: translateX(1px); letter-spacing: 1px; }
  99% { transform: translateX(-1px); letter-spacing: 2px; }
}

/* Random heavy glitch burst — JS toggles .glitch-burst class */
.tv-unit.active .tv-screen.glitch-burst {
  animation: heavyGlitch 0.3s step-end !important;
}

@keyframes heavyGlitch {
  0%   { transform: translateX(-4px) skewX(-1deg); filter: brightness(1.3) hue-rotate(20deg); }
  15%  { transform: translateX(3px) skewX(2deg); filter: brightness(0.7) hue-rotate(-10deg); }
  30%  { transform: translateX(-2px) skewX(-0.5deg); filter: brightness(1.5); }
  45%  { transform: translateX(5px) skewX(1deg); filter: brightness(0.6) saturate(2); }
  60%  { transform: translateX(-3px); filter: brightness(1.2) hue-rotate(15deg); }
  75%  { transform: translateX(1px) skewX(-2deg); filter: brightness(0.8); }
  90%  { transform: translateX(-1px); filter: brightness(1.1); }
  100% { transform: translateX(0) skewX(0); filter: brightness(1); }
}

.tv-unit.active:hover {
  transform: scale(1.04);
  z-index: 10;
}

.tv-unit.active:hover .tv-body {
  border-color: rgba(51, 255, 51, 0.2);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(51, 255, 51, 0.08),
    0 0 80px rgba(51, 255, 51, 0.03);
  animation: none;
}

.tv-unit.active:hover .tv-screen {
  background: radial-gradient(ellipse at 50% 50%, #041a04 0%, #010101 55%);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.75),
    inset 0 0 10px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(51, 255, 51, 0.1);
  animation: none;
  filter: brightness(1.1);
}

.tv-unit.active:active {
  transform: scale(0.98);
}

/* Active click — screen tear effect */
.tv-unit.active:active .tv-screen {
  animation: screenTear 0.15s step-end !important;
}

@keyframes screenTear {
  0%   { clip-path: inset(0 0 50% 0); transform: translateX(2px); }
  33%  { clip-path: inset(50% 0 0 0); transform: translateX(-3px); }
  66%  { clip-path: inset(20% 0 20% 0); transform: translateX(1px); }
  100% { clip-path: none; transform: translateX(0); }
}

/* ─── Screen Content ─────────────────────── */
.tv-channel {
  font-family: 'VT323', monospace;
  font-size: clamp(1.6rem, 3.5vw, 2.8rem);
  position: relative;
  z-index: 2;
  letter-spacing: 2px;
  transition: all 0.3s ease;
}

.tv-unit.active .tv-channel {
  color: var(--crt);
  text-shadow:
    0 0 8px var(--crt),
    0 0 20px rgba(51, 255, 51, 0.4),
    0 0 40px rgba(51, 255, 51, 0.12);
}

.tv-unit.active:hover .tv-channel {
  text-shadow:
    0 0 10px var(--crt),
    0 0 30px rgba(51, 255, 51, 0.5),
    0 0 60px rgba(51, 255, 51, 0.2);
}

/* ─── Admin TV: red hover ─────────────────── */
.tv-unit.admin-tv.active:hover .tv-body {
  border-color: rgba(255, 50, 50, 0.35);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(255, 50, 50, 0.12),
    0 0 80px rgba(255, 50, 50, 0.05);
}
.tv-unit.admin-tv.active:hover .tv-screen {
  background: radial-gradient(ellipse at 50% 50%, #1a0505 0%, #010101 55%);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.75),
    inset 0 0 10px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 50, 50, 0.15);
}
.tv-unit.admin-tv.active:hover .tv-channel {
  text-shadow:
    0 0 10px #ff3333,
    0 0 30px rgba(255, 50, 50, 0.5),
    0 0 60px rgba(255, 50, 50, 0.2);
}

.tv-name {
  font-family: 'VT323', monospace;
  font-size: clamp(0.65rem, 1.2vw, 0.95rem);
  letter-spacing: 2px;
  text-transform: uppercase;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
}

.tv-svg-anim {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.tv-unit.active .tv-name {
  color: var(--crt);
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.35);
}

.tv-desc {
  font-family: 'VT323', monospace;
  font-size: clamp(0.5rem, 0.8vw, 0.7rem);
  color: var(--crt-dim);
  text-align: center;
  padding: 0 12px;
  position: relative;
  z-index: 2;
  line-height: 1.3;
  max-height: 2.6em;
  overflow: hidden;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.15);
  letter-spacing: 1px;
}

/* ─── TV Price Ribbon (diagonal corner, bottom-right) ─────── */
.tv-ribbon {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 70px;
  height: 70px;
  overflow: hidden;
  pointer-events: auto;
  z-index: 10;
  border-radius: 0 0 8px 0;
}

.tv-ribbon-text {
  position: absolute;
  bottom: 14px;
  right: -18px;
  width: 100px;
  text-align: center;
  transform: rotate(-45deg);
  transform-origin: center;
  font-family: 'VT323', monospace;
  font-size: clamp(0.45rem, 0.75vw, 0.65rem);
  letter-spacing: 1px;
  padding: 2px 0;
  white-space: nowrap;
}

.tv-ribbon-active .tv-ribbon-text {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.85), rgba(255, 120, 0, 0.95));
  color: #000;
  text-shadow: 0 0 4px rgba(255, 200, 0, 0.5);
  box-shadow: 0 0 8px rgba(255, 149, 0, 0.3);
}

.tv-ribbon-soon .tv-ribbon-text {
  background: rgba(80, 70, 55, 0.7);
  color: var(--text-dim);
  opacity: 0.55;
}

.tv-ribbon-admin {
  display: none;
}

/* Hover tooltip */
.tv-ribbon-tooltip {
  position: absolute;
  bottom: 85px;
  right: 0;
  min-width: 160px;
  background: rgba(10, 10, 8, 0.95);
  border: 1px solid var(--amber-dim, rgba(255, 149, 0, 0.3));
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'VT323', monospace;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(255, 149, 0, 0.08);
}

.tv-ribbon:hover .tv-ribbon-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ribbon-tooltip-header {
  font-size: 0.95rem;
  color: var(--crt);
  text-shadow: 0 0 6px var(--crt-glow);
  letter-spacing: 2px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 6px;
  text-transform: uppercase;
}

.ribbon-tooltip-plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  gap: 12px;
}

.ribbon-tooltip-plan-name {
  font-size: 0.8rem;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.ribbon-tooltip-plan-price {
  font-size: 0.85rem;
  color: var(--amber);
  text-shadow: 0 0 4px rgba(255, 149, 0, 0.3);
  font-weight: 700;
}

.ribbon-tooltip-soon {
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.6;
  text-align: center;
  padding: 4px 0;
}

.ribbon-tooltip-tier {
  font-size: 0.7rem;
  color: #ff9500;
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 6px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 149, 0, 0.2);
  border-radius: 3px;
  background: rgba(255, 149, 0, 0.06);
}

/* ─── TV Tier Badge (subscription level on each TV) ──────── */
.tv-tier-badge {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'VT323', monospace;
  font-size: clamp(0.5rem, 0.8vw, 0.7rem);
  letter-spacing: 2px;
  padding: 2px 10px;
  border-radius: 3px;
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}
.tv-tier-starter {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
  text-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}
.tv-tier-pro {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
  text-shadow: 0 0 6px rgba(59, 130, 246, 0.4);
}
.tv-tier-agency {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
  text-shadow: 0 0 6px rgba(168, 85, 247, 0.4);
}

/* ─── Profil-ops avatar overlay on TV ─── */
.tv-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
}
.tv-avatar-canvas {
  width: auto;
  height: 70%;
  max-height: 130px;
  image-rendering: auto;
  filter: drop-shadow(0 0 14px rgba(51,204,255,.55)) drop-shadow(0 0 30px rgba(51,204,255,.2));
}

/* ═══════════════════════════════════════════════
   ADMIN TV — Center TV special styling
   ═══════════════════════════════════════════════ */
.tv-unit.admin-tv .tv-body {
  border-color: rgba(255, 50, 50, 0.25);
}
.tv-unit.admin-tv.active .tv-body {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 50, 50, 0.15);
}
.tv-unit.admin-tv .tv-screen {
  background: #080808;
}
.tv-led-red {
  background: #ff3333 !important;
  box-shadow: 0 0 6px rgba(255, 50, 50, 0.6) !important;
}
.admin-channel {
  font-family: 'VT323', monospace;
  font-size: clamp(0.8rem, 1.4vw, 1.2rem);
  color: #ff3333 !important;
  text-shadow: 0 0 10px rgba(255, 50, 50, 0.6);
  position: relative;
  z-index: 3;
}
.admin-tv-title {
  font-family: 'VT323', monospace;
  font-size: clamp(0.7rem, 1.3vw, 1.1rem);
  color: #ff3333;
  text-shadow: 0 0 12px rgba(255, 50, 50, 0.7), 0 0 30px rgba(255, 50, 50, 0.3);
  letter-spacing: 3px;
  text-transform: uppercase;
  position: relative;
  z-index: 3;
  animation: adminGlitch 3s infinite;
}
@keyframes adminGlitch {
  0%, 92%, 100% { opacity: 1; transform: none; }
  93% { opacity: 0.8; transform: translateX(-2px) skewX(-2deg); color: #ff6666; }
  94% { opacity: 1; transform: translateX(2px); }
  95% { opacity: 0.7; transform: translateX(-1px) skewX(1deg); color: #cc0000; }
  96% { opacity: 1; transform: none; }
}
.admin-tv-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 50, 50, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 50, 50, 0.04) 0%, transparent 50%),
    linear-gradient(0deg, transparent 49.5%, rgba(255, 50, 50, 0.03) 49.5%, rgba(255, 50, 50, 0.03) 50.5%, transparent 50.5%),
    linear-gradient(90deg, transparent 49.5%, rgba(255, 50, 50, 0.03) 49.5%, rgba(255, 50, 50, 0.03) 50.5%, transparent 50.5%);
  background-size: 100% 100%, 100% 100%, 20px 20px, 20px 20px;
  animation: circuitPulse 4s ease-in-out infinite alternate;
}
.admin-tv-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(2px 2px at 10% 20%, rgba(255, 50, 50, 0.15) 50%, transparent 50%),
    radial-gradient(2px 2px at 30% 60%, rgba(255, 50, 50, 0.12) 50%, transparent 50%),
    radial-gradient(2px 2px at 50% 40%, rgba(255, 50, 50, 0.18) 50%, transparent 50%),
    radial-gradient(2px 2px at 70% 80%, rgba(255, 50, 50, 0.1) 50%, transparent 50%),
    radial-gradient(2px 2px at 90% 30%, rgba(255, 50, 50, 0.14) 50%, transparent 50%),
    radial-gradient(2px 2px at 40% 90%, rgba(255, 50, 50, 0.16) 50%, transparent 50%),
    radial-gradient(2px 2px at 60% 10%, rgba(255, 50, 50, 0.12) 50%, transparent 50%),
    radial-gradient(2px 2px at 80% 50%, rgba(255, 50, 50, 0.15) 50%, transparent 50%);
  animation: nodesBlink 2s ease-in-out infinite alternate;
}
@keyframes circuitPulse { 0% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes nodesBlink { 0% { opacity: 0.4; } 50% { opacity: 1; } 100% { opacity: 0.6; } }
.tv-unit.admin-locked { cursor: not-allowed; }
.tv-unit.admin-locked .tv-screen { opacity: 0.7; }

/* ═══════════════════════════════════════════════
   DOWN TV — Analog Snow / Static
   ═══════════════════════════════════════════════ */

.tv-unit.down { cursor: default; }

.tv-unit.down .tv-screen {
  background: #111;
  overflow: hidden;
}

/* Canvas-based analog snow (injected by JS) */
.tv-unit.down .tv-snow-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  opacity: 0.75;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* SVG noise layer for extra texture */
.tv-unit.down .tv-static {
  position: absolute;
  inset: 0;
  z-index: 3;
  opacity: 0.3;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  animation: staticFlicker 0.08s steps(4) infinite;
}

@keyframes staticFlicker {
  0%  { transform: translate(0, 0) scale(1.05); }
  25% { transform: translate(-3px, 2px) scale(1.02); }
  50% { transform: translate(2px, -2px) scale(1.06); }
  75% { transform: translate(-1px, 1px) scale(1.03); }
}

/* Horizontal scan lines over snow */
.tv-unit.down .tv-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  pointer-events: none;
}

/* CRT power-off center dot effect */
.tv-unit.down .tv-screen::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 2px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.015);
  z-index: 6;
  animation: crtDot 6s ease-in-out infinite;
}

@keyframes crtDot {
  0%, 70%, 100% { opacity: 0; }
  75%, 90% { opacity: 1; }
}

.tv-unit.down .tv-channel {
  color: #1a1a1a;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  text-shadow: none;
}

.tv-unit.down .tv-name {
  color: #1a1a1a;
  font-size: clamp(0.5rem, 0.8vw, 0.7rem);
}

.tv-unit.down .tv-status {
  font-family: 'VT323', monospace;
  font-size: clamp(0.45rem, 0.65vw, 0.55rem);
  color: #222;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  z-index: 2;
}

/* ═══════════════════════════════════════════════
   TV DIVE TRANSITION
   ═══════════════════════════════════════════════ */

/* Other TVs fade away */
.tv-wall.fade-out .tv-unit:not(.zooming) {
  opacity: 0;
  transform: scale(0.85);
  filter: brightness(0);
  transition: all 0.4s ease;
}

/* The zooming TV stays fully visible (overlay sits on top of it) */
.tv-unit.zooming {
  z-index: 100;
  pointer-events: none;
}

/* Fullscreen dive overlay */
#tv-dive-overlay {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  overflow: hidden;
  background: #010101;
  opacity: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 0;
}

#tv-dive-overlay.diving {
  transition:
    top 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    left 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    width 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.7s cubic-bezier(0.4, 0, 0.2, 1),
    border-radius 0.5s ease;
}

/* Iframe inside the dive overlay — shows actual app content during zoom */
.dive-iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  z-index: 1;
}

/* Topbar replica inside overlay — hidden when small, visible at fullscreen */
.dive-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(51, 255, 51, 0.06);
  background: rgba(8, 6, 4, 0.95);
  opacity: 0;
  transition: opacity 0.3s ease 0.4s;
  pointer-events: none;
}

#tv-dive-overlay.diving .dive-topbar {
  opacity: 1;
}

/* When overlay is at fullscreen, reposition iframe below topbar */
#tv-dive-overlay.diving .dive-iframe {
  top: 42px;
  height: calc(100% - 42px);
}

/* Light scanlines over the zooming iframe */
.dive-scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.12) 1px,
    rgba(0, 0, 0, 0.12) 2px
  );
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Scanlines fade away as overlay reaches full size */
#tv-dive-overlay.diving .dive-scanlines {
  opacity: 0;
  transition: opacity 0.6s ease 0.3s;
}

/* Hub screen darkens during transition */
.hub-screen.diving-out {
  background: #000 !important;
  transition: background 0.3s ease;
}

/* ═══════════════════════════════════════════════
   SERVICE SCREEN
   ═══════════════════════════════════════════════ */

.service-screen {
  background: #000;
  display: flex;
  flex-direction: column;
}

.service-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(51, 255, 51, 0.06);
  background: rgba(8, 6, 4, 0.95);
  flex-shrink: 0;
  height: 42px;
  min-height: 42px;
  position: relative;
}

.service-topbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(51, 255, 51, 0.15) 20%,
    rgba(51, 255, 51, 0.3) 50%,
    rgba(51, 255, 51, 0.15) 80%,
    transparent 100%
  );
  animation: headerScan 4s ease-in-out infinite;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  border: 1px solid rgba(51, 255, 51, 0.12);
  border-radius: 0;
  background: transparent;
  color: var(--crt-dim);
  font-size: 0.85rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  border-color: var(--crt);
  color: var(--crt);
  text-shadow: 0 0 6px var(--crt-glow);
  animation: btnJitter 0.15s step-end;
}

.back-arrow {
  font-size: 1rem;
  transition: transform 0.2s;
}

.btn-back:hover .back-arrow {
  transform: translateX(-3px);
}

.service-current-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
  font-family: 'VT323', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.topbar-spacer { width: 120px; }

/* ─── Service Topbar Pricing Button ───────── */
.service-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.service-pricing-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border: 1px solid rgba(255, 149, 0, 0.2);
  background: rgba(255, 149, 0, 0.04);
  color: var(--amber);
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  letter-spacing: 1.5px;
  text-decoration: none;
  text-transform: uppercase;
  transition: all 0.2s;
  white-space: nowrap;
}

.service-pricing-btn:hover {
  border-color: var(--amber);
  background: rgba(255, 149, 0, 0.12);
  box-shadow: 0 0 10px rgba(255, 149, 0, 0.15);
  text-shadow: 0 0 6px rgba(255, 149, 0, 0.4);
}

.service-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #000;
  display: block;
}

/* ─── Transitions ─────────────────────────── */
.screen-enter {
  animation: screenEnter 0.35s ease;
}

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

/* ═══════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════ */

.btn-admin {
  padding: 4px 14px;
  border: 1px solid rgba(255, 149, 0, 0.2);
  border-radius: 0;
  background: transparent;
  color: var(--amber);
  font-size: 0.8rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-admin:hover {
  border-color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 149, 0, 0.4);
  background: rgba(255, 149, 0, 0.06);
}

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: adminFadeIn 0.3s ease;
}

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

.admin-panel-content {
  background: #0a0906;
  border: 1px solid rgba(255, 149, 0, 0.15);
  width: 500px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 0;
  position: relative;
}

/* Scanlines overlay on admin panel */
.admin-panel-content::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 149, 0, 0.1);
  position: relative;
  z-index: 2;
}

.admin-panel-header h2 {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 149, 0, 0.3);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.btn-admin-close {
  background: transparent;
  border: 1px solid rgba(255, 149, 0, 0.2);
  color: var(--amber);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 10px;
  transition: all 0.2s;
}

.btn-admin-close:hover {
  border-color: var(--amber);
  text-shadow: 0 0 8px rgba(255, 149, 0, 0.5);
}

.admin-section {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 149, 0, 0.06);
  position: relative;
  z-index: 2;
}

.admin-section h3 {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--amber-dim);
  letter-spacing: 2px;
  margin-bottom: 12px;
  text-shadow: 0 0 4px rgba(255, 149, 0, 0.15);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-user-row, .admin-service-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 149, 0, 0.02);
  border: 1px solid rgba(255, 149, 0, 0.06);
  font-family: 'VT323', monospace;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.admin-user-row:hover, .admin-service-row:hover {
  border-color: rgba(255, 149, 0, 0.15);
  background: rgba(255, 149, 0, 0.04);
}

.admin-user-name { color: var(--text); letter-spacing: 1px; }
.admin-user-role {
  font-size: 0.8rem;
  padding: 2px 8px;
  letter-spacing: 1px;
}

.admin-user-role.admin {
  color: var(--amber);
  border: 1px solid rgba(255, 149, 0, 0.3);
}

.admin-user-role.user {
  color: var(--crt-dim);
  border: 1px solid rgba(51, 255, 51, 0.12);
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.admin-btn-sm {
  padding: 3px 8px;
  background: transparent;
  border: 1px solid rgba(255, 149, 0, 0.15);
  color: var(--text-dim);
  font-family: 'VT323', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-btn-sm:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.admin-btn-sm.danger:hover {
  border-color: #ff4444;
  color: #ff4444;
}

.admin-service-name { color: var(--text); letter-spacing: 1px; }
.admin-service-status {
  font-size: 0.8rem;
  letter-spacing: 1px;
}
.admin-service-status.online { color: var(--crt); }
.admin-service-status.offline { color: #ff4444; }

.admin-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 149, 0, 0.02);
  border: 1px solid rgba(255, 149, 0, 0.06);
  font-family: 'VT323', monospace;
}

.admin-stat .stat-label { color: var(--text-dim); font-size: 0.9rem; letter-spacing: 1px; }
.admin-stat .stat-value { color: var(--amber); font-size: 0.9rem; }

.admin-loading {
  text-align: center;
  padding: 16px;
  color: var(--text-dim);
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
}

.admin-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 149, 0, 0.2);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── AI Config (Admin Panel) ────────────── */

.ai-config-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 149, 0, 0.1);
  padding: 14px;
  margin-bottom: 12px;
}

.ai-config-card h4 {
  font-family: 'VT323', monospace;
  color: var(--amber);
  font-size: 1.1rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-config-card .ai-badge {
  font-size: 0.8rem;
  padding: 2px 8px;
  letter-spacing: 1px;
}
.ai-badge.configured { color: var(--crt); border: 1px solid var(--crt); }
.ai-badge.not-configured { color: #ff4444; border: 1px solid #ff4444; }

.ai-provider-select {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ai-provider-btn {
  flex: 1;
  min-width: 80px;
  padding: 6px 8px;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255, 149, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.ai-provider-btn:hover { border-color: rgba(255, 149, 0, 0.3); color: var(--text); }
.ai-provider-btn.active { border-color: var(--amber); color: var(--amber); background: rgba(255, 149, 0, 0.06); }

.ai-key-input {
  width: 100%;
  padding: 6px 10px;
  font-family: 'VT323', monospace;
  font-size: 0.95rem;
  color: var(--crt);
  background: #0a0a08;
  border: 1px solid rgba(255, 149, 0, 0.1);
  outline: none;
  margin-bottom: 8px;
}
.ai-key-input:focus { border-color: var(--amber); box-shadow: 0 0 6px rgba(255, 149, 0, 0.15); }

.ai-save-btn {
  width: 100%;
  padding: 7px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: transparent;
  color: var(--amber);
  border: 1px solid var(--amber);
  cursor: pointer;
  transition: all 0.2s;
}
.ai-save-btn:hover { background: rgba(255, 149, 0, 0.1); }

.ai-copilot-flow { text-align: center; padding: 8px 0; }

.ai-copilot-btn {
  width: 100%;
  padding: 8px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 149, 0, 0.12);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.ai-copilot-btn:hover { border-color: var(--amber); color: var(--amber); }
.ai-copilot-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ai-device-code {
  font-family: 'VT323', monospace;
  font-size: 2rem;
  letter-spacing: 6px;
  color: var(--amber);
  text-shadow: 0 0 10px rgba(255, 149, 0, 0.3);
  padding: 10px 0;
}

.ai-result {
  padding: 8px;
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  letter-spacing: 1px;
  margin-top: 8px;
}
.ai-result.success { color: var(--crt); border: 1px solid var(--crt); background: rgba(51, 255, 51, 0.04); }
.ai-result.error { color: #ff4444; border: 1px solid #ff4444; background: rgba(255, 68, 68, 0.04); }
.ai-result.loading { color: var(--amber); border: 1px solid rgba(255, 149, 0, 0.2); }

/* ─── Responsive ──────────────────────────── */

/* Tablets and smaller */
@media (max-width: 1024px) {
  .tv-wall { gap: clamp(6px, 1vw, 12px); padding: clamp(6px, 1vw, 12px); }
  .tv-screen { margin: 6px 6px 0; }
}

/* Mobile landscape + small tablets */
@media (max-width: 768px) {
  .auth-card { padding: 16px; width: 95vw; }
  .auth-logo h1 { font-size: 1.6rem; }

  .hub-header { padding: 4px 10px; }
  .hub-title { font-size: 0.9rem; letter-spacing: 2px; }
  .hub-user > span { font-size: 0.7rem; }
  .role-badge { font-size: 0.55rem !important; padding: 1px 6px; }
  .btn-logout { font-size: 0.65rem; padding: 3px 10px; }
  .tv-ribbon { width: 55px; height: 55px; }
  .tv-ribbon-text { font-size: 0.45rem !important; width: 80px; bottom: 8px; right: -16px; }
  .tv-ribbon-tooltip { min-width: 130px; bottom: 60px; }

  .tv-wall { gap: 4px; padding: 4px; }
  .tv-screen { margin: 4px 4px 0; border-radius: 8px; }
  .tv-channel { font-size: 1rem !important; }
  .tv-name { font-size: 0.5rem !important; }
  .tv-desc { display: none; }
  .tv-body { border-radius: 6px; }
  .tv-panel { height: 16px; min-height: 16px; padding: 2px 6px; }
  .tv-dial { width: 9px; height: 9px; }
  .tv-led { width: 3px; height: 3px; }

  .service-topbar { padding: 4px 10px; height: 36px; }
  .btn-back { padding: 3px 10px; font-size: 0.75rem; }
  .service-current-name { font-size: 0.75rem; }
}

/* Phone portrait */
@media (max-width: 480px) {
  .auth-container { gap: 16px; }
  .auth-logo h1 { font-size: 1.3rem; letter-spacing: 3px; }
  .auth-subtitle { font-size: 0.75rem; }
  .auth-card { padding: 14px 16px 18px; }
  .auth-tab { font-size: 0.75rem; padding: 8px; }
  .form-group label { font-size: 0.7rem; }
  .form-group input { padding: 9px 10px; font-size: 0.85rem; }
  .btn-auth { padding: 10px; font-size: 0.95rem; }

  .hub-header { padding: 3px 8px; }
  .logo-icon-sm { font-size: 0.7rem; }
  .hub-title { font-size: 0.75rem; }
  .btn-logout { font-size: 0.6rem; padding: 2px 8px; }
  .role-badge { display: none; }
  .tv-ribbon { width: 45px; height: 45px; }
  .tv-ribbon-text { font-size: 0.4rem !important; width: 65px; bottom: 5px; right: -12px; }

  .tv-wall { gap: 3px; padding: 3px; }
  .tv-screen { margin: 3px 3px 0; border-radius: 6px; }
  .tv-channel { font-size: 0.8rem !important; }
  .tv-name { font-size: 0.4rem !important; letter-spacing: 1px !important; }
  .tv-panel { height: 12px; min-height: 12px; padding: 1px 4px; }
  .tv-dial { width: 7px; height: 7px; }
  .tv-body { border-radius: 4px; border-width: 1px; }

  .service-topbar { padding: 3px 8px; height: 32px; }
  .btn-back { padding: 2px 8px; font-size: 0.7rem; gap: 4px; }
  .back-text { display: none; }
  .service-current-name { font-size: 0.7rem; }
}

/* Short screens (landscape phones) */
@media (max-height: 500px) {
  .hub-header { padding: 2px 10px; }
  .tv-wall { gap: 3px; padding: 3px; }
  .tv-panel { height: 10px; min-height: 10px; }
  .tv-screen { margin: 3px 3px 0; }
  .tv-channel { font-size: 0.7rem !important; }
  .tv-name { display: none; }
  .service-topbar { height: 30px; }
}

/* ═══════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════ */

.btn-settings {
  padding: 4px 14px;
  border: 1px solid rgba(51, 255, 51, 0.2);
  border-radius: 0;
  background: transparent;
  color: var(--crt);
  font-size: 0.8rem;
  font-family: 'VT323', monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-settings:hover {
  border-color: var(--crt);
  text-shadow: 0 0 8px var(--crt-glow);
  background: rgba(51, 255, 51, 0.06);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  padding: 0 16px;
}

.settings-grid .form-group {
  margin-bottom: 0;
}

.settings-grid label {
  display: block;
  font-family: 'VT323', monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-bottom: 2px;
  letter-spacing: 1px;
}

.settings-input {
  width: 100%;
  background: rgba(8, 6, 4, 0.8);
  border: 1px solid var(--border);
  color: var(--crt);
  font-family: 'Lekton', monospace;
  font-size: 0.82rem;
  padding: 5px 8px;
  transition: border-color 0.2s;
}

.settings-input:focus {
  outline: none;
  border-color: var(--crt);
  box-shadow: 0 0 6px var(--crt-glow);
}

.settings-cv-upload {
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-cv-status {
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: var(--text-dim);
  flex: 1;
}

.settings-cv-status.has-cv {
  color: var(--crt);
}

.btn-settings-upload {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid rgba(51, 255, 51, 0.2);
  background: transparent;
  color: var(--crt);
  font-family: 'VT323', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}

.btn-settings-upload:hover {
  border-color: var(--crt);
  background: rgba(51, 255, 51, 0.06);
  text-shadow: 0 0 8px var(--crt-glow);
}

.btn-settings-upload.danger {
  border-color: rgba(255, 50, 50, 0.3);
  color: #ff4444;
}
.btn-settings-upload.danger:hover {
  border-color: #ff4444;
  background: rgba(255, 50, 50, 0.1);
  text-shadow: 0 0 8px rgba(255, 50, 50, 0.5);
}

.settings-actions {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-settings-save {
  padding: 6px 20px;
  border: 1px solid var(--crt);
  background: rgba(51, 255, 51, 0.08);
  color: var(--crt);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-settings-save:hover {
  background: rgba(51, 255, 51, 0.15);
  text-shadow: 0 0 8px var(--crt-glow);
}

.settings-feedback {
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  color: var(--crt);
}

/* ═══════════════════════════════════════════════
   GPU OPTIMIZATION: reduce animation load
   ═══════════════════════════════════════════════ */

/* Promote TV screens to own compositor layer */
.tv-unit .tv-screen {
  contain: layout style paint;
}

.tv-unit.down .tv-snow-canvas {
  will-change: contents;
}

/* Respect system preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tv-unit.active .tv-screen,
  .tv-unit.active .tv-screen .tv-glitch-slice,
  .tv-unit.active .tv-channel,
  .tv-unit.active .tv-body,
  .tv-unit.active .tv-screen .tv-noise-flash,
  .tv-unit.active .tv-name {
    animation: none !important;
  }
  .tv-unit.active .tv-screen .tv-glitch-bar,
  .tv-unit.active .tv-screen .tv-rolling-bar {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════
   HERMES TV — iframe with pyramid, no overlays
   ═══════════════════════════════════════════════════════════ */
.tv-unit.hermes-tv .tv-body {
  border-color: #8B0000;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.1), inset 0 0 30px rgba(255, 0, 0, 0.03);
}

.tv-unit.hermes-tv.active .tv-body {
  box-shadow: 0 0 25px rgba(255, 0, 0, 0.25), inset 0 0 40px rgba(255, 0, 0, 0.05);
}

.tv-unit.hermes-tv .tv-screen {
  background: #050505;
}

.hermes-iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400%;
  height: 400%;
  transform: translate(-50%, -50%) scale(0.25);
  transform-origin: center center;
  border: none;
  z-index: 5;
  pointer-events: none;
}

.tv-unit.hermes-tv .tv-led {
  background: #FF0000;
  box-shadow: 0 0 6px #FF0000;
  animation: hermes-led 2s ease-in-out infinite;
}

/* ── Hermes TV — red hover (not green) ── */
.tv-unit.hermes-tv.active:hover .tv-body {
  border-color: rgba(255, 0, 0, 0.35);
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(255, 0, 0, 0.15),
    0 0 80px rgba(255, 0, 0, 0.06);
}
.tv-unit.hermes-tv.active:hover .tv-screen {
  background: radial-gradient(ellipse at 50% 50%, #1a0404 0%, #010101 55%);
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.75),
    inset 0 0 10px rgba(0, 0, 0, 0.3),
    0 0 25px rgba(255, 0, 0, 0.2);
}

@keyframes hermes-led {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #FF0000; }
  50%      { opacity: 0.5; box-shadow: 0 0 3px #660000; }
}
