:root {
  --accent: #00ff41;
  --accent-dim: #00aa2a;
  --accent-glow: rgba(0,255,65,0.3);
  --bg: #0a0a0a;
  --panel: #111111;
  --panel-border: #222;
  --text: #c0c0c0;
  --text-dim: #666;
}

body.amber {
  --accent: #ffb000;
  --accent-dim: #aa7500;
  --accent-glow: rgba(255,176,0,0.3);
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Scanline overlay on entire page */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

#root { min-height: 100vh; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: 3px; }

/* CRT warm-up animation */
@keyframes crt-warmup {
  0% { transform: scaleY(0.005) scaleX(0.8); filter: brightness(3) blur(2px); }
  30% { transform: scaleY(0.005) scaleX(1); filter: brightness(2) blur(1px); }
  50% { transform: scaleY(0.6) scaleX(1); filter: brightness(1.5) blur(0.5px); }
  100% { transform: scaleY(1) scaleX(1); filter: brightness(1) blur(0); }
}

.crt-warmup {
  animation: crt-warmup 1.5s ease-out forwards;
}

/* CRT bezel */
.crt-bezel {
  background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 50%, #0d0d0d 100%);
  border-radius: 20px;
  padding: 16px;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.8),
    0 0 15px rgba(0,0,0,0.5),
    0 4px 20px rgba(0,0,0,0.6);
  position: relative;
}

.crt-bezel::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border-radius: 18px;
  border: 1px solid #333;
  pointer-events: none;
}

/* CRT screen */
.crt-screen {
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 40px var(--accent-glow), inset 0 0 20px rgba(0,0,0,0.5);
}

.crt-screen canvas {
  display: block;
  width: 100%;
  image-rendering: auto;
}

/* Scanlines on CRT */
.crt-screen::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0,0,0,0.25) 1px,
    rgba(0,0,0,0.25) 2px
  );
  pointer-events: none;
}

/* Barrel distortion effect */
.barrel-distort {
  border-radius: 12px;
  transform: perspective(800px) rotateX(0.5deg);
}

/* Phosphor glow */
.phosphor-glow {
  filter: contrast(1.1) brightness(1.05);
}

/* Slider styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #222;
  border-radius: 3px;
  outline: none;
  border: 1px solid #333;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
  border: 2px solid var(--accent-dim);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
  border: 2px solid var(--accent-dim);
}

/* Toggle button */
.toggle-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: var(--text-dim);
  padding: 4px 10px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
}

.toggle-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.toggle-btn:hover {
  border-color: var(--accent-dim);
}

/* Knob styling */
.knob-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.knob-label {
  font-family: 'VT323', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.knob-value {
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: var(--accent);
}

/* Drag zone */
.drop-zone {
  border: 2px dashed var(--accent-dim);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(0,255,65,0.02);
}

body.amber .drop-zone {
  background: rgba(255,176,0,0.02);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(0,255,65,0.05);
  box-shadow: 0 0 20px var(--accent-glow);
}

body.amber .drop-zone:hover, body.amber .drop-zone.dragover {
  background: rgba(255,176,0,0.05);
}

/* Waveform graticule */
.scope-screen {
  background: #050505;
  border: 1px solid #333;
  border-radius: 4px;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

/* Preset buttons */
.preset-btn {
  background: #1a1a1a;
  border: 1px solid #333;
  color: var(--accent);
  padding: 6px 12px;
  font-family: 'VT323', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 2px;
  white-space: nowrap;
}

.preset-btn:hover {
  background: var(--accent);
  color: #000;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* LED display */
.led-display {
  font-family: 'VT323', monospace;
  color: var(--accent);
  background: #0a0a0a;
  border: 1px solid #222;
  padding: 4px 8px;
  border-radius: 2px;
  text-shadow: 0 0 6px var(--accent-glow);
}

/* Colorburst animation */
@keyframes colorburst {
  0% { d: path("M0,10 Q5,0 10,10 Q15,20 20,10 Q25,0 30,10"); }
  50% { d: path("M0,10 Q5,20 10,10 Q15,0 20,10 Q25,20 30,10"); }
  100% { d: path("M0,10 Q5,0 10,10 Q15,20 20,10 Q25,0 30,10"); }
}

.colorburst-wave {
  animation: colorburst-shift 0.5s ease-in-out infinite alternate;
}

@keyframes colorburst-shift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-3px); }
}

/* Panel styling */
.control-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 12px;
}

.panel-title {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

/* Tab system */
.tab-btn {
  background: #111;
  border: 1px solid #333;
  border-bottom: none;
  color: var(--text-dim);
  padding: 6px 16px;
  font-family: 'VT323', monospace;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: -1px;
}

.tab-btn.active {
  background: var(--panel);
  color: var(--accent);
  border-color: var(--accent-dim);
  border-bottom: 1px solid var(--panel);
  position: relative;
  z-index: 1;
}

/* Footer */
.app-footer {
  background: linear-gradient(180deg, #0d0d0d, #080808);
  border-top: 1px solid #222;
  padding: 12px 20px;
  font-family: 'VT323', monospace;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.app-footer a {
  color: var(--accent);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Info tooltip */
.info-tip {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #444;
  color: var(--accent);
  font-size: 10px;
  text-align: center;
  line-height: 13px;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
}

.info-tip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid var(--accent-dim);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  max-width: 280px;
  white-space: normal;
}

/* Phase error joke */
.ntsc-joke {
  font-size: 11px;
  color: #ff4444;
  font-style: italic;
  opacity: 0;
  transition: opacity 0.3s;
}

.ntsc-joke.visible {
  opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column !important;
  }
  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }
}