:root {
  --phosphor: #33ff33;
  --phosphor-dim: #1a8a1a;
  --phosphor-glow: #33ff3344;
  --amber: #ffb347;
  --bg-deep: #0d0d1a;
  --bg-panel: #141428;
  --bg-bezel: #1a1a2e;
  --crt-bg: #050508;
  --blue-accent: #4488cc;
  --red-accent: #cc4444;
}

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

body {
  background: var(--bg-deep);
  color: #c0c0d0;
  font-family: 'IBM Plex Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(30, 30, 80, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(20, 60, 20, 0.2) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

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

/* CRT Monitor Bezel */
.crt-bezel {
  background: linear-gradient(145deg, #2a2a3e 0%, #1a1a28 40%, #0f0f1a 100%);
  border-radius: 20px;
  padding: 20px;
  box-shadow:
    0 0 0 2px #333348,
    0 0 0 4px #0a0a14,
    0 8px 32px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
}

.crt-bezel::before {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.03);
  pointer-events: none;
}

/* CRT Screen */
.crt-screen {
  background: var(--crt-bg);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 80px rgba(0,0,0,0.8),
    inset 0 0 20px rgba(0,0,0,0.5),
    0 0 15px var(--phosphor-glow);
}

/* Scanlines */
.crt-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.15) 2px,
    rgba(0,0,0,0.15) 4px
  );
  pointer-events: none;
  z-index: 10;
}

/* CRT curvature overlay */
.crt-screen::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 11;
}

/* Flicker animation */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.98; }
  75% { opacity: 0.995; }
}

.crt-flicker {
  animation: flicker 0.15s infinite;
}

/* Phosphor text */
.phosphor-text {
  color: var(--phosphor);
  text-shadow:
    0 0 4px var(--phosphor),
    0 0 10px rgba(51, 255, 51, 0.3);
}

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

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

/* Panel styling */
.panel {
  background: var(--bg-panel);
  border: 1px solid #252540;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* ROM slot indicators */
.rom-status { 
  width: 10px; height: 10px; 
  border-radius: 50%; 
  display: inline-block;
}
.rom-empty { background: #cc3333; box-shadow: 0 0 4px #cc3333; }
.rom-loading { background: #ccaa33; box-shadow: 0 0 4px #ccaa33; }
.rom-loaded { background: #33cc33; box-shadow: 0 0 4px #33cc33; }

/* Button styles */
.btn-retro {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-green {
  background: #1a3a1a;
  border-color: #33aa33;
  color: #33ff33;
}
.btn-green:hover { background: #1a4a1a; box-shadow: 0 0 8px rgba(51,255,51,0.3); }

.btn-red {
  background: #3a1a1a;
  border-color: #aa3333;
  color: #ff4444;
}
.btn-red:hover { background: #4a1a1a; box-shadow: 0 0 8px rgba(255,68,68,0.3); }

.btn-amber {
  background: #3a2a1a;
  border-color: #aa8833;
  color: var(--amber);
}
.btn-amber:hover { background: #4a3a1a; box-shadow: 0 0 8px rgba(255,179,71,0.3); }

.btn-blue {
  background: #1a2a3a;
  border-color: #3388aa;
  color: #66bbff;
}
.btn-blue:hover { background: #1a3a4a; box-shadow: 0 0 8px rgba(102,187,255,0.3); }

/* Drag and drop zone */
.drop-zone {
  border: 2px dashed #333366;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.active {
  border-color: var(--phosphor);
  background: rgba(51,255,51,0.03);
}

/* Memory inspector */
.hex-dump {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* Register display */
.reg-value {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--phosphor);
  font-weight: 700;
}

.flag-set { color: var(--phosphor); font-weight: 700; }
.flag-clear { color: #444; font-weight: 300; }

/* Speed slider */
input[type="range"] {
  -webkit-appearance: none;
  background: transparent;
  width: 100%;
}
input[type="range"]::-webkit-slider-track {
  height: 4px;
  background: #252540;
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--phosphor);
  border-radius: 50%;
  margin-top: -5px;
  cursor: pointer;
  box-shadow: 0 0 6px var(--phosphor-glow);
}

/* UK101 keyboard */
.uk101-key {
  background: linear-gradient(180deg, #3a3a4e 0%, #2a2a3e 100%);
  border: 1px solid #4a4a5e;
  border-radius: 4px;
  color: #ddd;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  padding: 4px 6px;
  min-width: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}
.uk101-key:hover { background: linear-gradient(180deg, #4a4a5e 0%, #3a3a4e 100%); }
.uk101-key.pressed {
  background: var(--phosphor);
  color: #000;
  box-shadow: 0 0 8px var(--phosphor-glow);
}

/* Loading animation */
@keyframes boot-text {
  from { opacity: 0; }
  to { opacity: 1; }
}

.boot-line {
  animation: boot-text 0.3s ease-in forwards;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .crt-bezel { padding: 10px; border-radius: 12px; }
  .crt-screen { border-radius: 8px; }
}