:root {
  --phosphor: #33ff33;
  --phosphor-dim: #1a8c1a;
  --phosphor-bright: #66ff66;
  --amber: #ffaa00;
  --amber-dim: #8c5e00;
  --crt-bg: #0a0a0a;
  --panel-bg: #111111;
  --bezel: #1a1a1a;
  --bezel-light: #2a2a2a;
  --bezel-border: #333333;
}

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

body {
  background: var(--crt-bg);
  color: var(--phosphor);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

/* CRT Scanline overlay */
.crt-overlay {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
  z-index: 10;
}

.crt-screen {
  position: relative;
  background: #050505;
  border: 3px solid var(--bezel-border);
  border-radius: 8px;
  box-shadow:
    inset 0 0 60px rgba(0, 255, 0, 0.03),
    0 0 15px rgba(0, 255, 0, 0.05);
}

.phosphor-glow {
  text-shadow: 0 0 5px var(--phosphor), 0 0 10px rgba(51, 255, 51, 0.3);
}

.amber-glow {
  text-shadow: 0 0 5px var(--amber), 0 0 10px rgba(255, 170, 0, 0.3);
  color: var(--amber);
}

.led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.2s;
}

.led-on {
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor), 0 0 12px rgba(51, 255, 51, 0.5);
}

.led-off {
  background: #1a3a1a;
  box-shadow: none;
}

.led-amber-on {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber), 0 0 12px rgba(255, 170, 0, 0.5);
}

.led-red-on {
  background: #ff3333;
  box-shadow: 0 0 6px #ff3333, 0 0 12px rgba(255, 51, 51, 0.5);
}

/* Panel bezel styling */
.bezel-panel {
  background: linear-gradient(180deg, #1e1e1e 0%, #141414 100%);
  border: 1px solid var(--bezel-border);
  border-top-color: #444;
  border-left-color: #3a3a3a;
  border-radius: 4px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.05),
    0 2px 8px rgba(0,0,0,0.5);
}

/* Hardware buttons */
.hw-button {
  font-family: 'Share Tech Mono', monospace;
  background: linear-gradient(180deg, #3a3a3a 0%, #222 50%, #1a1a1a 100%);
  border: 2px solid #555;
  border-bottom-color: #222;
  border-right-color: #333;
  color: var(--phosphor);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  transition: all 0.1s;
  box-shadow: 0 3px 6px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.hw-button:hover {
  background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 50%, #222 100%);
  border-color: #666;
}

.hw-button:active {
  background: linear-gradient(180deg, #1a1a1a 0%, #222 50%, #2a2a2a 100%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4), inset 0 2px 4px rgba(0,0,0,0.3);
  transform: translateY(1px);
}

.hw-button-run {
  border-color: var(--phosphor-dim);
  color: var(--phosphor);
}

.hw-button-stop {
  border-color: #8c3333;
  color: #ff5555;
}

.hw-button-amber {
  border-color: var(--amber-dim);
  color: var(--amber);
}

/* Terminal output */
.terminal-output {
  font-family: 'VT323', 'Share Tech Mono', monospace;
  font-size: 18px;
  line-height: 1.3;
  color: var(--phosphor);
  white-space: pre-wrap;
  word-break: break-all;
}

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

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

/* Power LED pulse */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px var(--phosphor), 0 0 8px rgba(51,255,51,0.3); }
  50% { box-shadow: 0 0 8px var(--phosphor), 0 0 16px rgba(51,255,51,0.6); }
}

.led-pulse {
  animation: pulse-glow 2s infinite;
}

/* Memory hex dump */
.hex-cell {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  padding: 1px 3px;
}

.hex-cell-pc {
  background: rgba(51, 255, 51, 0.2);
  border: 1px solid var(--phosphor-dim);
}

.hex-cell-sp {
  background: rgba(255, 170, 0, 0.15);
  border: 1px solid var(--amber-dim);
}

.hex-cell-rom {
  color: #6699ff;
}

.hex-cell-io {
  color: #ff6699;
}

.hex-cell-written {
  background: rgba(255, 255, 51, 0.1);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* Register editable */
.reg-value {
  cursor: pointer;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  transition: border-color 0.2s;
}

.reg-value:hover {
  border-color: var(--phosphor-dim);
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--phosphor-dim);
  border-radius: 8px;
  transition: all 0.3s;
}

.drop-zone-active {
  border-color: var(--phosphor);
  background: rgba(51, 255, 51, 0.05);
  box-shadow: inset 0 0 30px rgba(51, 255, 51, 0.05);
}

/* Speed slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
}

input[type="range"]::-webkit-slider-track {
  height: 4px;
  background: #333;
  border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--phosphor);
  border-radius: 50%;
  margin-top: -6px;
  box-shadow: 0 0 6px rgba(51, 255, 51, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: #333;
  border-radius: 2px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--phosphor);
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 6px rgba(51, 255, 51, 0.4);
}

/* Flag indicator */
.flag-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  font-size: 11px;
  font-weight: bold;
  border-radius: 3px;
  border: 1px solid #444;
  transition: all 0.15s;
}

.flag-on {
  background: rgba(51, 255, 51, 0.2);
  color: var(--phosphor);
  border-color: var(--phosphor-dim);
  text-shadow: 0 0 4px var(--phosphor);
}

.flag-off {
  background: #1a1a1a;
  color: #444;
  border-color: #333;
}

/* Instruction log */
.inst-log-entry {
  font-size: 11px;
  padding: 1px 4px;
  border-bottom: 1px solid #1a1a1a;
}

/* Responsive */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Breakpoint marker */
.breakpoint-marker {
  color: #ff3333;
  text-shadow: 0 0 4px #ff3333;
}

/* Title styling */
.main-title {
  font-family: 'VT323', monospace;
  font-size: 32px;
  letter-spacing: 4px;
}

.sub-title {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--phosphor-dim);
  letter-spacing: 1px;
}

/* Input fields */
.octal-input {
  font-family: 'Share Tech Mono', monospace;
  background: #0a0a0a;
  border: 1px solid #444;
  color: var(--phosphor);
  padding: 2px 6px;
  border-radius: 2px;
  outline: none;
}

.octal-input:focus {
  border-color: var(--phosphor);
  box-shadow: 0 0 4px rgba(51, 255, 51, 0.3);
}