:root {
  --phosphor-green: #00ff41;
  --phosphor-amber: #ffb000;
  --phosphor-white: #e0e0e0;
  --phosphor: var(--phosphor-green);
  --phosphor-dim: rgba(0, 255, 65, 0.15);
  --phosphor-glow: rgba(0, 255, 65, 0.4);
  --bg-dark: #0a0a14;
  --bg-panel: #12121e;
  --bg-control: #1a1a2e;
  --border-color: #2a2a3e;
}

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

body {
  background: var(--bg-dark);
  color: var(--phosphor);
  font-family: 'IBM Plex Mono', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* CRT Effects */
.crt-screen {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(0, 255, 65, 0.08),
    inset 0 0 80px rgba(0, 0, 0, 0.8),
    0 0 2px rgba(0, 255, 65, 0.3);
}

.crt-screen::before {
  content: '';
  position: absolute;
  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: 10;
}

.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;
}

.terminal-content {
  font-family: 'Share Tech Mono', 'IBM Plex Mono', monospace;
  font-size: 14px;
  line-height: 1.3;
  padding: 16px;
  min-height: 100%;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--phosphor);
  text-shadow: 0 0 8px var(--phosphor-glow);
}

.cursor-block {
  display: inline-block;
  width: 8px;
  height: 16px;
  background: var(--phosphor);
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes led-flash {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; box-shadow: 0 0 8px currentColor; }
}

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

.led-off { background: #333; box-shadow: none; }
.led-on { box-shadow: 0 0 6px currentColor; }
.led-flash { animation: led-flash 0.15s ease-in-out; }

/* Control bar styling */
.control-bar {
  background: linear-gradient(180deg, #2a2a3e 0%, #1a1a2e 100%);
  border-bottom: 1px solid #3a3a4e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.power-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #555;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.3);
}

.power-btn:hover { border-color: #888; }
.power-btn.on { border-color: var(--phosphor); box-shadow: 0 0 12px var(--phosphor-glow); }

/* Debug panel */
.debug-panel {
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.debug-panel::-webkit-scrollbar { width: 6px; }
.debug-panel::-webkit-scrollbar-track { background: transparent; }
.debug-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.register-box {
  background: #0d0d18;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
}

.hex-dump {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
}

/* Memory map colors */
.mem-system { background: #ff4444; }
.mem-iobyte { background: #ff8800; }
.mem-bdos-entry { background: #aa44ff; }
.mem-rst { background: #2244aa; }
.mem-fcb1 { background: #cccc00; }
.mem-fcb2 { background: #88cc00; }
.mem-dma { background: #00cccc; }
.mem-tpa { background: #00aa44; }
.mem-ccp { background: #4488ff; }
.mem-bdos { background: #8844cc; }
.mem-bios { background: #ff8800; }

/* Scrollbar for terminal */
.terminal-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.terminal-scroll::-webkit-scrollbar { width: 4px; }
.terminal-scroll::-webkit-scrollbar-track { background: transparent; }
.terminal-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* Footer */
.footer-bar {
  background: linear-gradient(180deg, #1a1a2e 0%, #12121e 100%);
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: #666;
}

.footer-bar a { color: var(--phosphor); text-decoration: none; }
.footer-bar a:hover { text-decoration: underline; }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--phosphor);
  background: rgba(0, 255, 65, 0.05);
}

/* Status badge */
.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-halted { background: #442222; color: #ff4444; }
.status-running { background: #224422; color: #44ff44; }
.status-waiting { background: #444422; color: #ffff44; }
.status-error { background: #442222; color: #ff4444; }

/* Phosphor color variants */
.phosphor-green { --phosphor: #00ff41; --phosphor-dim: rgba(0,255,65,0.15); --phosphor-glow: rgba(0,255,65,0.4); }
.phosphor-amber { --phosphor: #ffb000; --phosphor-dim: rgba(255,176,0,0.15); --phosphor-glow: rgba(255,176,0,0.4); }
.phosphor-white { --phosphor: #e0e0e0; --phosphor-dim: rgba(224,224,224,0.15); --phosphor-glow: rgba(224,224,224,0.3); }

.tooltip {
  position: absolute;
  background: #222;
  color: #ddd;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
  z-index: 100;
  white-space: pre;
}