:root {
  --cga-black: #000000;
  --cga-blue: #0000AA;
  --cga-green: #00AA00;
  --cga-cyan: #00AAAA;
  --cga-red: #AA0000;
  --cga-magenta: #AA00AA;
  --cga-brown: #AA5500;
  --cga-light-gray: #AAAAAA;
  --cga-dark-gray: #555555;
  --cga-light-blue: #5555FF;
  --cga-light-green: #55FF55;
  --cga-light-cyan: #55FFFF;
  --cga-light-red: #FF5555;
  --cga-light-magenta: #FF55FF;
  --cga-yellow: #FFFF55;
  --cga-white: #FFFFFF;
  --bezel-dark: #1a1a1a;
  --bezel-mid: #2d2d2d;
  --bezel-light: #3a3a3a;
  --chassis-top: #8a8a8a;
  --chassis-bot: #5a5a5a;
}

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

body {
  background: #111;
  font-family: 'IBM Plex Mono', monospace;
  color: #ccc;
  overflow-x: hidden;
}

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

/* CRT Monitor Effect */
.crt-monitor {
  position: relative;
  background: #0a0a0a;
  border-radius: 18px;
  padding: 20px;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,0.8),
    0 0 20px rgba(0,170,170,0.1),
    0 4px 20px rgba(0,0,0,0.6);
}

.crt-bezel {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 30%, #1a1a1a 100%);
  border-radius: 16px;
  padding: 16px;
  border: 2px solid #444;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.crt-screen-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.9);
}

.crt-screen-wrap::after {
  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: 2;
}

.crt-screen-wrap::before {
  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: 3;
}

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

/* Phosphor glow */
.phosphor-glow {
  filter: contrast(1.1) brightness(1.05);
}

/* LED indicators */
.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.5);
}
.led-green {
  background: #00ff00;
  box-shadow: 0 0 6px #00ff00, 0 0 12px rgba(0,255,0,0.3);
}
.led-green-off {
  background: #003300;
}
.led-red {
  background: #ff0000;
  box-shadow: 0 0 6px #ff0000, 0 0 12px rgba(255,0,0,0.3);
}
.led-red-off {
  background: #330000;
}

/* Retro beveled buttons */
.btn-retro {
  background: linear-gradient(180deg, #d4d0c8 0%, #c0bcb4 100%);
  color: #000;
  border: 2px outset #d4d0c8;
  padding: 4px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-retro:active {
  border-style: inset;
  background: linear-gradient(180deg, #b0acA4 0%, #c0bcb4 100%);
}
.btn-retro:hover {
  background: linear-gradient(180deg, #e4e0d8 0%, #d0ccc4 100%);
}
.btn-retro.active {
  border-style: inset;
  background: linear-gradient(180deg, #a0a8b0 0%, #90989f 100%);
  color: #000;
}

/* Tab styling */
.tab-retro {
  background: linear-gradient(180deg, #c8c4bc 0%, #b8b4ac 100%);
  border: 2px outset #c8c4bc;
  border-bottom: none;
  padding: 4px 14px;
  font-size: 11px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  color: #333;
  margin-right: 1px;
}
.tab-retro.active {
  background: #d4d0c8;
  border-bottom: 2px solid #d4d0c8;
  margin-bottom: -2px;
  position: relative;
  z-index: 1;
  color: #000;
  font-weight: bold;
}

/* Register panel */
.reg-panel {
  background: #1a1a2e;
  border: 2px inset #555;
  font-family: 'IBM Plex Mono', monospace;
}

.reg-changed {
  animation: regFlash 0.5s ease;
}

@keyframes regFlash {
  0%, 100% { color: inherit; }
  50% { color: #ffff55; background: rgba(255,255,85,0.15); }
}

/* Floppy drive slot */
.floppy-slot {
  background: linear-gradient(180deg, #888 0%, #666 50%, #888 100%);
  border: 2px inset #999;
  border-radius: 2px;
  height: 10px;
  position: relative;
  overflow: hidden;
}

.floppy-slot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: #333;
}

/* Floppy drive area */
.floppy-drive-area {
  animation: floppyPulse 3s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes floppyPulse {
  0%, 100% { border-color: #444; }
  50% { border-color: #00AAAA55; }
}

.floppy-drive-area:has(.drag-over) {
  animation: none;
  border-color: var(--cga-cyan) !important;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #555;
  transition: all 0.3s;
  border-radius: 6px;
}
.drop-zone:hover {
  border-color: var(--cga-cyan);
  background: rgba(0,170,170,0.03) !important;
}
.drop-zone.drag-over {
  border-color: var(--cga-cyan);
  background: rgba(0,170,170,0.08) !important;
  box-shadow: inset 0 0 30px rgba(0,170,170,0.15), 0 0 15px rgba(0,170,170,0.1);
}

/* Status bar */
.status-bar {
  background: linear-gradient(180deg, #c8c4bc 0%, #b8b4ac 100%);
  border: 2px inset #aaa;
  font-size: 10px;
  color: #333;
}

/* Scrollbar styling */
.retro-scroll::-webkit-scrollbar { width: 14px; }
.retro-scroll::-webkit-scrollbar-track { background: #c0c0c0; border: 1px solid #808080; }
.retro-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #dfdfdf, #bfbfbf);
  border: 2px outset #dfdfdf;
}

/* Chassis header */
.chassis-header {
  background: linear-gradient(180deg, #9a9a9a 0%, #7a7a7a 20%, #6a6a6a 80%, #5a5a5a 100%);
  border-bottom: 2px solid #444;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Boot screen */
.boot-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot-text {
  font-family: 'IBM Plex Mono', monospace;
  color: #33ff33;
  font-size: 14px;
  white-space: pre;
  line-height: 1.4;
}

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

.blink-cursor::after {
  content: '█';
  animation: blink 1s infinite;
}

/* Hex dump */
.hex-row:hover {
  background: rgba(0,170,170,0.1);
}

.hex-current {
  background: rgba(170,170,0,0.2) !important;
  border-left: 2px solid var(--cga-yellow);
}

/* Disassembly current line */
.disasm-current {
  background: rgba(0,170,0,0.2);
  border-left: 3px solid var(--cga-light-green);
}

/* Breakpoint */
.breakpoint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff0000;
  display: inline-block;
  box-shadow: 0 0 4px rgba(255,0,0,0.5);
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
  .main-layout {
    flex-direction: column !important;
  }
  .crt-monitor {
    padding: 12px;
  }
}

/* Monitor label */
.monitor-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #888;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Power button effect */
.power-btn {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle, #444 30%, #222 100%);
  border-radius: 50%;
  border: 2px outset #555;
  cursor: pointer;
}
.power-btn:active {
  border-style: inset;
}

/* Noise texture overlay */
.noise-texture {
  position: relative;
}
.noise-texture::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}