:root {
  --neon-green: #00ff41;
  --neon-amber: #ffb000;
  --neon-cyan: #00e5ff;
  --bg-dark: #0a0a0a;
  --bg-panel: #111111;
  --bg-card: #1a1a1a;
}

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

body {
  background: var(--bg-dark);
  color: #e0e0e0;
  font-family: 'IBM Plex Sans', sans-serif;
  overflow-x: hidden;
}

.pixel-font {
  font-family: 'Press Start 2P', monospace;
}

.mono-font {
  font-family: 'IBM Plex Mono', monospace;
}

/* Scanline overlay */
.scanlines::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;
}

/* Control panel glow */
.panel-glow {
  border: 1px solid rgba(0, 255, 65, 0.2);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.05), inset 0 0 20px rgba(0, 0, 0, 0.3);
}

/* Toggle switch */
.toggle-track {
  width: 56px;
  height: 28px;
  border-radius: 14px;
  background: #333;
  position: relative;
  cursor: pointer;
  transition: background 0.3s ease;
}

.toggle-track.active {
  background: #00ff41;
  box-shadow: 0 0 12px rgba(0, 255, 65, 0.5);
}

.toggle-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
}

.toggle-track.active .toggle-thumb {
  transform: translateX(28px);
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-green);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--neon-green);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

/* Color swatch grid */
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  transition: transform 0.2s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

/* Gradient blocks */
.gradient-block {
  height: 80px;
  border-radius: 8px;
  width: 100%;
}

/* Pixel button */
.pixel-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 10px 20px;
  background: transparent;
  border: 2px solid var(--neon-green);
  color: var(--neon-green);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.5);
}

.pixel-btn:hover {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
}

/* Active matrix button */
.matrix-btn {
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid #444;
  background: #222;
  color: #aaa;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  transition: all 0.2s;
}

.matrix-btn.active {
  border-color: var(--neon-green);
  color: var(--neon-green);
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.2);
}

/* Keyboard hint */
.kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #999;
  background: #222;
  border: 1px solid #444;
  border-radius: 3px;
  margin-left: 6px;
}

/* Mobile drawer */
@media (max-width: 768px) {
  .control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    overflow-y: auto;
    z-index: 100;
    border-radius: 16px 16px 0 0;
    transform: translateY(calc(100% - 48px));
    transition: transform 0.35s ease;
  }

  .control-panel.open {
    transform: translateY(0);
  }

  .drawer-handle {
    display: flex;
    justify-content: center;
    padding: 12px;
    cursor: pointer;
  }

  .drawer-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #555;
  }
}

@media (min-width: 769px) {
  .drawer-handle { display: none; }
}

/* Filter transition */
.filter-container {
  transition: filter 0.4s ease;
}

/* Flicker animation for CRT feel */
@keyframes crt-flicker {
  0% { opacity: 0.97; }
  5% { opacity: 1; }
  10% { opacity: 0.98; }
  15% { opacity: 1; }
  100% { opacity: 1; }
}

.crt-header {
  animation: crt-flicker 3s infinite;
}