:root {
  --c64-blue: #4040E0;
  --c64-light-blue: #7C7CFF;
  --c64-dark-blue: #000088;
  --c64-white: #FFFFFF;
  --c64-black: #000000;
  --c64-red: #883932;
  --c64-cyan: #67B6BD;
  --c64-purple: #8B3F96;
  --c64-green: #55A049;
  --c64-dark-green: #40802E;
  --c64-yellow: #BFCE72;
  --c64-orange: #8B5429;
  --c64-brown: #574200;
  --c64-light-red: #B86962;
  --c64-dark-gray: #505050;
  --c64-medium-gray: #787878;
  --c64-light-green: #94E089;
  --c64-light-gray: #9F9F9F;
  --crt-glow: 0 0 10px rgba(124, 124, 255, 0.5);
  --phosphor-green: #33ff33;
}

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

body {
  background: #1a1a2e;
  color: var(--c64-light-blue);
  font-family: 'VT323', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

#scanlines {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

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

.crt-glow { text-shadow: 0 0 5px var(--c64-light-blue), 0 0 10px rgba(124,124,255,0.3); }
.green-glow { text-shadow: 0 0 5px var(--phosphor-green), 0 0 10px rgba(51,255,51,0.3); }

.c64-border {
  border: 16px solid var(--c64-blue);
  background: var(--c64-dark-blue);
}

.led-on {
  width: 10px; height: 10px; border-radius: 50%;
  background: #33ff33;
  box-shadow: 0 0 6px #33ff33, 0 0 12px rgba(51,255,51,0.5);
  display: inline-block;
}

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

.dip-switch {
  width: 20px; height: 36px;
  background: #333;
  border: 1px solid #555;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.dip-switch::after {
  content: '';
  position: absolute;
  width: 16px; height: 14px;
  background: #ddd;
  left: 1px;
  border-radius: 1px;
  transition: top 0.15s;
}

.dip-switch.on::after { top: 2px; }
.dip-switch.off::after { top: 18px; }

.knob-container {
  width: 60px; height: 60px;
  position: relative;
  cursor: grab;
}

.knob-outer {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #666, #222);
  border: 2px solid #444;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6), inset 0 1px 2px rgba(255,255,255,0.1);
}

.knob-indicator {
  position: absolute;
  width: 3px; height: 16px;
  background: var(--c64-light-blue);
  top: 4px; left: 50%;
  transform-origin: bottom center;
  border-radius: 1px;
  box-shadow: 0 0 4px var(--c64-light-blue);
}

.tape-reel {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid #555;
  background: radial-gradient(circle, #222 30%, #333 31%, #333 60%, #222 61%);
  position: relative;
}

.tape-reel::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: #111;
  border: 2px solid #444;
}

.tape-reel.spinning { animation: spin 1s linear infinite; }

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

@keyframes blink { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }
.blink { animation: blink 1s step-end infinite; }

.transport-btn {
  background: linear-gradient(180deg, #555 0%, #333 100%);
  border: 2px solid #666;
  color: #ddd;
  padding: 8px 14px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 18px;
  border-radius: 3px;
  transition: all 0.1s;
  user-select: none;
}

.transport-btn:hover { background: linear-gradient(180deg, #666 0%, #444 100%); }
.transport-btn:active {
  background: linear-gradient(180deg, #333 0%, #222 100%);
  border-color: #444;
  transform: translateY(1px);
}

.transport-btn.active {
  background: linear-gradient(180deg, #225522 0%, #113311 100%);
  border-color: #33aa33;
  color: #33ff33;
  box-shadow: 0 0 8px rgba(51,255,51,0.3);
}

.waveform-btn {
  background: #222;
  border: 1px solid #555;
  color: #888;
  padding: 4px 8px;
  cursor: pointer;
  font-family: 'VT323', monospace;
  font-size: 14px;
  transition: all 0.1s;
}

.waveform-btn.active {
  background: var(--c64-dark-blue);
  border-color: var(--c64-light-blue);
  color: var(--c64-light-blue);
  box-shadow: 0 0 6px rgba(124,124,255,0.4);
}

.hex-dump {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--c64-light-green);
  line-height: 1.4;
  white-space: pre;
  overflow: auto;
  max-height: 200px;
}

canvas.oscilloscope {
  image-rendering: auto;
  border: 1px solid #1a4a1a;
}

.drop-zone {
  border: 3px dashed var(--c64-light-blue);
  background: rgba(64,64,224,0.05);
  transition: all 0.2s;
}

.drop-zone.drag-over {
  border-color: var(--c64-yellow);
  background: rgba(191,206,114,0.1);
}

.slider-sid {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
}

.slider-sid::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 20px;
  background: linear-gradient(180deg, #888, #444);
  border: 1px solid #aaa;
  border-radius: 2px;
  cursor: pointer;
}

.slider-sid::-moz-range-thumb {
  width: 14px; height: 20px;
  background: linear-gradient(180deg, #888, #444);
  border: 1px solid #aaa;
  border-radius: 2px;
  cursor: pointer;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

@media (max-width: 1024px) {
  .three-panel { flex-direction: column !important; }
  .c64-border { border-width: 8px; }
}