:root {
  --phosphor: #33ff33;
  --phosphor-dim: #1a8c1a;
  --amber: #ffaa00;
  --crt-bg: #0a0a0a;
  --panel-bg: #1a1a1a;
  --bezel: #3a3632;
  --bezel-dark: #2a2622;
}

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

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

.tandy-stripe {
  height: 4px;
  background: linear-gradient(90deg, 
    #e53935 0%, #e53935 20%, 
    #ff9800 20%, #ff9800 40%, 
    #fdd835 40%, #fdd835 60%, 
    #43a047 60%, #43a047 80%, 
    #1e88e5 80%, #1e88e5 100%
  );
}

.tandy-stripe-thick {
  height: 6px;
  background: linear-gradient(90deg, 
    #e53935 0%, #e53935 20%, 
    #ff9800 20%, #ff9800 40%, 
    #fdd835 40%, #fdd835 60%, 
    #43a047 60%, #43a047 80%, 
    #1e88e5 80%, #1e88e5 100%
  );
}

.crt-bezel {
  background: linear-gradient(145deg, #4a4640, #2a2622);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 
    0 8px 32px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(255,255,255,0.05),
    inset 0 -2px 4px rgba(0,0,0,0.3);
  position: relative;
}

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

.crt-screen-container::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-screen-container::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;
}

.crt-glow {
  filter: brightness(1.05) contrast(1.1);
  image-rendering: pixelated;
}

.power-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #333;
  transition: all 0.3s;
}

.power-led.on {
  background: #ff2222;
  box-shadow: 0 0 6px #ff2222, 0 0 12px #ff000088;
}

.retro-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  padding: 8px 18px;
  border-radius: 4px;
  position: relative;
  transition: all 0.1s;
  font-size: 13px;
}

.retro-btn:active { transform: translateY(2px); }

.retro-btn-green {
  background: linear-gradient(180deg, #2d8c2d, #1a6b1a);
  color: #fff;
  box-shadow: 0 3px 0 #0d4d0d, 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.retro-btn-green:active { box-shadow: 0 1px 0 #0d4d0d; }
.retro-btn-green.glowing {
  background: linear-gradient(180deg, #44cc44, #2d8c2d);
  box-shadow: 0 3px 0 #1a6b1a, 0 0 16px rgba(51,255,51,0.3);
}

.retro-btn-red {
  background: linear-gradient(180deg, #c62828, #8e0000);
  color: #fff;
  box-shadow: 0 3px 0 #5c0000, 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.retro-btn-red:active { box-shadow: 0 1px 0 #5c0000; }

.retro-btn-amber {
  background: linear-gradient(180deg, #e6a200, #b37e00);
  color: #1a1a1a;
  box-shadow: 0 3px 0 #805a00, 0 4px 8px rgba(0,0,0,0.3);
}
.retro-btn-amber:active { box-shadow: 0 1px 0 #805a00; }

.retro-btn-dark {
  background: linear-gradient(180deg, #444, #2a2a2a);
  color: #ccc;
  box-shadow: 0 3px 0 #1a1a1a, 0 4px 8px rgba(0,0,0,0.3);
}
.retro-btn-dark:active { box-shadow: 0 1px 0 #1a1a1a; }

.retro-btn-corrupt {
  background: linear-gradient(180deg, #cc2222, #881111);
  color: #fff;
  box-shadow: 0 3px 0 #550808, 0 4px 8px rgba(0,0,0,0.3);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  letter-spacing: 0.1em;
}
.retro-btn-corrupt:hover {
  background: linear-gradient(180deg, #ee3333, #aa1818);
  box-shadow: 0 3px 0 #660a0a, 0 0 16px rgba(255,50,50,0.3);
}
.retro-btn-corrupt:active { box-shadow: 0 1px 0 #550808; transform: translateY(2px); }

.register-panel {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  color: var(--phosphor);
  padding: 8px;
}

.register-label { color: #888; font-size: 12px; }
.register-value {
  color: var(--phosphor);
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 4px rgba(51,255,51,0.3);
}

.hex-dump {
  font-family: 'VT323', monospace;
  font-size: 14px;
  line-height: 1.4;
  color: var(--phosphor);
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  overflow-x: auto;
}
.hex-addr { color: var(--amber); }
.hex-byte { color: var(--phosphor); }
.hex-byte-rom { color: #66ff66; background: rgba(51,255,51,0.08); }
.hex-byte-io { color: #ff9800; background: rgba(255,152,0,0.08); }
.hex-byte-ram-hidden { color: #bb86fc; background: rgba(187,134,252,0.08); }
.hex-ascii { color: #888; }

.mem-map-segment {
  position: relative;
  cursor: pointer;
  transition: opacity 0.2s;
}
.mem-map-segment:hover { opacity: 0.8; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

.oscilloscope {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  overflow: hidden;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
}
input[type="range"]::-webkit-slider-track {
  height: 6px;
  background: #333;
  border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 6px rgba(255,170,0,0.3);
}

.corruption-slider::-webkit-slider-track {
  height: 6px;
  background: linear-gradient(90deg, #444 0%, #cc2222 50%, #ff0000 100%);
  border-radius: 3px;
}
.corruption-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff4444;
  cursor: pointer;
  margin-top: -6px;
  box-shadow: 0 0 6px rgba(255,68,68,0.4);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #1e1e1e;
  border: 1px solid #444;
  border-radius: 8px;
  max-width: 650px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  color: #ccc;
  width: 90%;
}

.cc-flag {
  display: inline-block;
  width: 20px;
  text-align: center;
  border: 1px solid #333;
  border-radius: 2px;
  padding: 1px 0;
  font-size: 11px;
}
.cc-flag.set {
  background: var(--phosphor);
  color: #000;
  border-color: var(--phosphor);
}
.cc-flag.clear {
  background: #1a1a1a;
  color: #555;
}

.file-drop-zone {
  border: 2px dashed #444;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}
.file-drop-zone:hover {
  border-color: var(--phosphor);
  background: rgba(51,255,51,0.03);
}
.file-drop-zone.loaded {
  border-color: var(--phosphor);
  border-style: solid;
}

.coco-key {
  background: linear-gradient(180deg, #555, #3a3a3a);
  color: #fff;
  border: 1px solid #666;
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 4px 6px;
  min-width: 28px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 0 #222;
  user-select: none;
}
.coco-key:active, .coco-key.pressed {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #222;
  background: linear-gradient(180deg, #3a3a3a, #2a2a2a);
}
.coco-key.special {
  background: linear-gradient(180deg, #6a4a2a, #4a3420);
  border-color: #7a5a3a;
}

/* DIP switch styling */
.dip-switch-container {
  background: #1a1a1a;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.dip-switch {
  width: 32px;
  height: 52px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.dip-switch-knob {
  width: 26px;
  height: 22px;
  background: linear-gradient(180deg, #eee, #bbb);
  border: 1px solid #999;
  border-radius: 2px;
  position: absolute;
  left: 2px;
  transition: top 0.15s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.dip-switch-knob.up { top: 3px; }
.dip-switch-knob.down { top: 25px; }
.dip-switch-label {
  font-size: 9px;
  color: #aaa;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.sam-warning {
  background: rgba(255,152,0,0.1);
  border: 1px solid #ff9800;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 11px;
  color: #ff9800;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.blink { animation: blink 1s infinite; }

@media (max-width: 1024px) {
  .main-layout { flex-direction: column !important; }
  .right-panel { width: 100% !important; }
}