:root {
  --crt-color: #33ff33;
  --crt-dim: #0a3a0a;
  --crt-bg: #0a0a0a;
  --crt-panel: #111111;
  --crt-border: #1a3a1a;
  --crt-glow: 0 0 4px #33ff3366, 0 0 8px #33ff3322;
  --crt-text-glow: 0 0 3px #33ff3388;
}

[data-theme="amber"] {
  --crt-color: #ffaa00;
  --crt-dim: #3a2a00;
  --crt-bg: #0a0a0a;
  --crt-panel: #111111;
  --crt-border: #3a2a00;
  --crt-glow: 0 0 4px #ffaa0066, 0 0 8px #ffaa0022;
  --crt-text-glow: 0 0 3px #ffaa0088;
}

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

body {
  background: var(--crt-bg);
  color: var(--crt-color);
  font-family: 'Fira Code', 'Courier New', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

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

.crt-panel {
  background: var(--crt-panel);
  border: 1px solid var(--crt-border);
  box-shadow: var(--crt-glow);
  border-radius: 2px;
}

.crt-text {
  color: var(--crt-color);
  text-shadow: var(--crt-text-glow);
}

.crt-btn {
  background: #1a1a1a;
  color: var(--crt-color);
  border: 1px solid var(--crt-border);
  font-family: 'Fira Code', monospace;
  cursor: pointer;
  padding: 4px 10px;
  font-size: 12px;
  transition: all 0.15s;
  text-shadow: var(--crt-text-glow);
}

.crt-btn:hover {
  background: #2a2a2a;
  box-shadow: var(--crt-glow);
}

.crt-btn:active {
  background: var(--crt-color);
  color: #000;
  text-shadow: none;
}

.crt-btn.active {
  background: var(--crt-color);
  color: #000;
  text-shadow: none;
}

textarea.crt-input {
  background: #0d0d0d;
  color: var(--crt-color);
  border: 1px solid var(--crt-border);
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  resize: none;
  outline: none;
  text-shadow: var(--crt-text-glow);
  width: 100%;
  padding: 6px;
}

textarea.crt-input:focus {
  border-color: var(--crt-color);
  box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}

select.crt-select {
  background: #1a1a1a;
  color: var(--crt-color);
  border: 1px solid var(--crt-border);
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  outline: none;
  padding: 3px 6px;
  cursor: pointer;
}

.led-on {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--crt-color);
  box-shadow: 0 0 6px var(--crt-color), 0 0 12px var(--crt-color);
  display: inline-block;
}

.led-off {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #222;
  border: 1px solid #333;
  display: inline-block;
}

@keyframes regPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); text-shadow: 0 0 8px var(--crt-color); }
  100% { transform: scale(1); }
}

.reg-changed {
  animation: regPulse 0.3s ease;
  background: rgba(51, 255, 51, 0.1) !important;
}

[data-theme="amber"] .reg-changed {
  background: rgba(255, 170, 0, 0.1) !important;
}

.scrollbar-crt::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-crt::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.scrollbar-crt::-webkit-scrollbar-thumb {
  background: var(--crt-border);
  border-radius: 3px;
}

.scrollbar-crt::-webkit-scrollbar-thumb:hover {
  background: var(--crt-color);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: #1a1a1a;
  height: 4px;
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--crt-color);
  cursor: pointer;
  box-shadow: 0 0 4px var(--crt-color);
}

.hex-highlight {
  background: rgba(51, 255, 51, 0.2);
}

[data-theme="amber"] .hex-highlight {
  background: rgba(255, 170, 0, 0.2);
}

.section-title {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--crt-border);
  padding-bottom: 3px;
  margin-bottom: 6px;
  opacity: 0.8;
}

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr !important;
  }
}