:root {
  --apple-green: #33FF33;
  --apple-amber: #FFB000;
  --apple-red: #FF4444;
  --bg-dark: #0a0a14;
  --bg-panel: #141420;
  --bg-surface: #1a1a2e;
  --border-color: #2a2a3e;
  --text-primary: #c8c8d8;
  --text-dim: #6a6a7a;
  --phosphor-green: #33FF33;
  --phosphor-white: #d4d4d4;
  --phosphor-amber: #FFB000;
}

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

body {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', '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 50% 0%, rgba(30,30,60,0.4) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

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

.crt-container {
  position: relative;
  border-radius: 20px;
  padding: 20px;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  box-shadow:
    0 0 0 3px #333,
    0 0 0 6px #222,
    inset 0 0 30px rgba(0,0,0,0.5),
    0 20px 60px rgba(0,0,0,0.8);
}

.crt-inner {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}

.crt-canvas {
  display: block;
  image-rendering: pixelated;
  width: 100%;
  height: auto;
}

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

.crt-glow {
  position: absolute;
  top: -5px; left: -5px; right: -5px; bottom: -5px;
  border-radius: 16px;
  pointer-events: none;
  z-index: 1;
}

.glow-green { box-shadow: inset 0 0 60px rgba(51,255,51,0.05), 0 0 20px rgba(51,255,51,0.03); }
.glow-white { box-shadow: inset 0 0 60px rgba(200,200,200,0.04), 0 0 20px rgba(200,200,200,0.02); }
.glow-amber { box-shadow: inset 0 0 60px rgba(255,176,0,0.05), 0 0 20px rgba(255,176,0,0.03); }

.curvature {
  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: 3;
}

.btn-power {
  background: linear-gradient(180deg, #2a5a2a, #1a3a1a);
  border: 2px solid #3a7a3a;
  color: var(--apple-green);
  padding: 8px 20px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.btn-power:hover:not(:disabled) { background: linear-gradient(180deg, #3a7a3a, #2a5a2a); box-shadow: 0 0 15px rgba(51,255,51,0.2); }
.btn-power:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-reset {
  background: linear-gradient(180deg, #5a5a2a, #3a3a1a);
  border: 2px solid #7a7a3a;
  color: var(--apple-amber);
  padding: 8px 20px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.btn-reset:hover:not(:disabled) { background: linear-gradient(180deg, #7a7a3a, #5a5a2a); }
.btn-reset:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-halt {
  background: linear-gradient(180deg, #5a2a2a, #3a1a1a);
  border: 2px solid #7a3a3a;
  color: var(--apple-red);
  padding: 8px 20px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}
.btn-halt:hover:not(:disabled) { background: linear-gradient(180deg, #7a3a3a, #5a2a2a); }
.btn-halt:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-small {
  background: linear-gradient(180deg, #2a2a3a, #1a1a2a);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 5px 12px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-small:hover:not(:disabled) { background: linear-gradient(180deg, #3a3a4a, #2a2a3a); }
.btn-small:disabled { opacity: 0.4; cursor: not-allowed; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.panel-header {
  background: var(--bg-surface);
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.panel-header:hover { background: #1e1e32; }

.panel-body { padding: 16px; }

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 30px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: rgba(0,0,0,0.2);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--apple-green);
  background: rgba(51,255,51,0.03);
}

.rom-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: rgba(0,0,0,0.2);
  margin-bottom: 4px;
}

.rom-loaded { color: var(--apple-green); }
.rom-missing { color: var(--text-dim); }

.register-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  min-width: 60px;
}
.register-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.register-value { font-size: 14px; color: var(--apple-green); font-weight: 700; }

.flag-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}
.flag-set { background: rgba(51,255,51,0.15); color: var(--apple-green); border-color: rgba(51,255,51,0.3); }
.flag-clear { background: rgba(0,0,0,0.3); color: var(--text-dim); }

.hex-dump {
  font-size: 11px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-dim);
  max-height: 300px;
  overflow-y: auto;
}
.hex-dump .addr { color: var(--apple-amber); }
.hex-dump .byte { color: var(--text-primary); }
.hex-dump .ascii { color: #6a8a6a; }

.disasm-line {
  font-size: 12px;
  padding: 2px 8px;
  display: flex;
  gap: 12px;
}
.disasm-line.current { background: rgba(51,255,51,0.08); border-left: 2px solid var(--apple-green); }
.disasm-addr { color: var(--apple-amber); min-width: 50px; }
.disasm-bytes { color: var(--text-dim); min-width: 90px; }
.disasm-mnem { color: var(--apple-green); font-weight: 700; }
.disasm-operand { color: var(--text-primary); }

select, input[type="text"], input[type="number"] {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  outline: none;
}
select:focus, input:focus { border-color: var(--apple-green); }

input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--apple-green);
  cursor: pointer;
}

.tab-btn {
  padding: 8px 16px;
  font-family: inherit;
  font-size: 12px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-weight: 500;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--apple-green); border-bottom-color: var(--apple-green); }

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 8px;
}

.indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.indicator-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: var(--apple-green); box-shadow: 0 0 6px var(--apple-green); }
.dot-red { background: var(--apple-red); box-shadow: 0 0 6px var(--apple-red); }
.dot-amber { background: var(--apple-amber); box-shadow: 0 0 6px var(--apple-amber); }
.dot-dim { background: var(--text-dim); }

@media (max-width: 768px) {
  .crt-container { padding: 10px; border-radius: 12px; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a4e; }