@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

:root {
  --c64-blue: #40318D;
  --c64-light-blue: #6C5EB5;
  --c64-text: #A5A5FF;
  --c64-white: #FFFFFF;
  --c64-black: #000000;
  --c64-cyan: #70A4B2;
  --c64-green: #588D43;
  --c64-purple: #6F3D86;
  --c64-red: #883932;
  --c64-yellow: #B8C76F;
  --c64-orange: #A46422;
  --c64-brown: #6D5412;
  --c64-light-green: #9AE29B;
  --c64-dark-grey: #444444;
  --c64-grey: #6C6C6C;
  --c64-light-grey: #959595;
}

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

body {
  background: var(--c64-blue);
  font-family: 'Press Start 2P', monospace;
  color: var(--c64-text);
  min-height: 100vh;
  overflow-x: hidden;
}

#root {
  position: relative;
}

/* Scanline overlay */
.scanlines::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  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 vignette */
.crt-vignette::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
}

/* Blinking cursor */
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.blink-cursor {
  animation: blink 1s step-end infinite;
}

/* Retro panel */
.c64-panel {
  background: var(--c64-black);
  border: 3px solid var(--c64-light-blue);
  border-radius: 4px;
  position: relative;
}

.c64-panel-title {
  background: var(--c64-light-blue);
  color: var(--c64-black);
  padding: 4px 8px;
  font-size: 8px;
  text-align: center;
}

/* Drop zone */
.drop-zone {
  border: 3px dashed var(--c64-light-blue);
  transition: all 0.3s ease;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--c64-cyan);
  box-shadow: 0 0 20px rgba(112, 164, 178, 0.5), inset 0 0 20px rgba(112, 164, 178, 0.1);
}

/* Button styles */
.c64-btn {
  font-family: 'Press Start 2P', monospace;
  background: var(--c64-dark-grey);
  color: var(--c64-text);
  border: 2px solid var(--c64-light-blue);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 10px;
  transition: all 0.1s ease;
  user-select: none;
}

.c64-btn:hover {
  background: var(--c64-light-blue);
  color: var(--c64-black);
}

.c64-btn:active {
  transform: scale(0.95);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.c64-btn.active {
  background: var(--c64-cyan);
  color: var(--c64-black);
  box-shadow: 0 0 10px rgba(112, 164, 178, 0.5);
}

/* Volume slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: var(--c64-dark-grey);
  border: 1px solid var(--c64-light-blue);
  border-radius: 0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 20px;
  background: var(--c64-light-blue);
  cursor: pointer;
  border: 1px solid var(--c64-cyan);
}

/* Register flash */
@keyframes regFlash {
  0% { background-color: rgba(88, 141, 67, 0.6); }
  100% { background-color: transparent; }
}

.reg-flash {
  animation: regFlash 0.3s ease-out;
}

/* Loading animation */
@keyframes colorCycle {
  0% { border-color: var(--c64-red); }
  14% { border-color: var(--c64-orange); }
  28% { border-color: var(--c64-yellow); }
  42% { border-color: var(--c64-green); }
  57% { border-color: var(--c64-cyan); }
  71% { border-color: var(--c64-light-blue); }
  85% { border-color: var(--c64-purple); }
  100% { border-color: var(--c64-red); }
}

.color-cycle-border {
  animation: colorCycle 0.5s linear infinite;
  border-width: 8px;
}

/* Oscilloscope canvas */
.scope-canvas {
  background: #0a0a0a;
  border: 2px solid var(--c64-dark-grey);
  image-rendering: pixelated;
}

/* Phosphor glow effect */
.phosphor-glow {
  filter: drop-shadow(0 0 2px rgba(88, 255, 67, 0.5));
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--c64-black);
}
::-webkit-scrollbar-thumb {
  background: var(--c64-dark-grey);
  border: 1px solid var(--c64-light-blue);
}

/* LED indicator */
.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.led-on {
  background: #5f5;
  box-shadow: 0 0 4px #5f5, 0 0 8px #5f5;
}
.led-off {
  background: #333;
}

/* Info row dots */
.info-dots {
  flex-grow: 1;
  overflow: hidden;
  color: var(--c64-dark-grey);
}

/* Piano roll lane colors */
.lane-v1 { background: rgba(88, 141, 67, 0.7); }
.lane-v2 { background: rgba(112, 164, 178, 0.7); }
.lane-v3 { background: rgba(111, 61, 134, 0.7); }

/* Toast */
@keyframes toastIn {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-100%); opacity: 0; }
}
.toast-enter { animation: toastIn 0.3s ease-out; }
.toast-exit { animation: toastOut 0.3s ease-in; }

/* Mobile responsive */
@media (max-width: 768px) {
  .c64-btn {
    padding: 10px 8px;
    font-size: 8px;
  }
}