* { margin:0; padding:0; box-sizing:border-box; }
body { background: #0a0a0a; font-family: 'VT323', monospace; color: #c9d1d9; overflow-x: hidden; }

.woodgrain {
  background: repeating-linear-gradient(
    90deg,
    #6B3410 0px, #7B4420 2px, #8B5430 4px, #6B3410 6px,
    #5B2400 8px, #7B4420 10px, #9B6440 12px, #6B3410 14px
  );
  background-size: 14px 100%;
  position: relative;
}
.woodgrain::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    87deg,
    transparent 0px, rgba(0,0,0,0.05) 20px, transparent 40px
  );
}

.chrome-ridge {
  background: linear-gradient(180deg, #999 0%, #ddd 30%, #fff 50%, #ddd 70%, #999 100%);
  height: 4px;
}

.crt-screen {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 0 30px rgba(0,100,255,0.15),
    inset 0 0 60px rgba(0,0,0,0.5);
}
.crt-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 10;
}
.crt-screen::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 11;
}

.tv-bezel {
  background: linear-gradient(145deg, #555 0%, #777 20%, #666 50%, #555 80%, #444 100%);
  border-radius: 20px;
  padding: 20px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.switch-track {
  width: 40px; height: 20px;
  background: #333;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  border: 2px solid #555;
  transition: background 0.2s;
}
.switch-track.on { background: #1a472a; border-color: #00ff41; }
.switch-knob {
  width: 16px; height: 16px;
  background: linear-gradient(145deg, #ddd, #999);
  border-radius: 50%;
  position: absolute;
  top: 0px; left: 0px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.switch-track.on .switch-knob { left: 20px; }

.btn-console {
  background: linear-gradient(145deg, #444, #222);
  border: 2px solid #555;
  color: #ccc;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.1s;
  text-transform: uppercase;
}
.btn-console:hover { background: linear-gradient(145deg, #555, #333); }
.btn-console:active { transform: scale(0.95); box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }

.power-led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #333;
  transition: all 0.3s;
}
.power-led.on {
  background: #00ff41;
  box-shadow: 0 0 8px #00ff41, 0 0 16px rgba(0,255,65,0.4);
  animation: pulse-led 2s infinite;
}
@keyframes pulse-led {
  0%,100% { box-shadow: 0 0 8px #00ff41, 0 0 16px rgba(0,255,65,0.4); }
  50% { box-shadow: 0 0 12px #00ff41, 0 0 24px rgba(0,255,65,0.6); }
}

.cartridge-slot {
  background: #111;
  border: 3px solid #333;
  border-radius: 4px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.8), inset 0 0 4px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.cartridge-label {
  background: linear-gradient(135deg, #e8d5a3, #d4c08a);
  color: #333;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 6px 10px;
  border-radius: 3px;
  border: 1px solid #bba870;
  text-align: center;
  max-width: 200px;
  word-break: break-all;
}

@keyframes cartridge-insert {
  0% { transform: translateY(-60px); opacity: 0; }
  60% { transform: translateY(4px); opacity: 1; }
  80% { transform: translateY(-2px); }
  100% { transform: translateY(0); }
}
.cartridge-inserted { animation: cartridge-insert 0.5s ease-out; }

.dpad-btn {
  width: 36px; height: 36px;
  background: linear-gradient(145deg, #333, #1a1a1a);
  border: 2px solid #444;
  color: #888;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s;
}
.dpad-btn:active, .dpad-btn.pressed {
  background: linear-gradient(145deg, #1a1a1a, #111);
  border-color: #00ff41;
  color: #00ff41;
}
.fire-btn {
  width: 56px; height: 56px;
  background: radial-gradient(circle, #cc2222, #881111);
  border: 3px solid #dd3333;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 -2px 4px rgba(0,0,0,0.3);
  transition: all 0.1s;
  user-select: none;
  -webkit-user-select: none;
}
.fire-btn:active, .fire-btn.pressed {
  transform: scale(0.93);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4), inset 0 2px 4px rgba(0,0,0,0.3);
}

.debug-panel {
  background: #0d1117;
  border-left: 2px solid #21262d;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: #c9d1d9;
  overflow-y: auto;
}
.debug-panel .reg-val { color: #00ff41; font-weight: bold; }
.debug-panel .reg-label { color: #8b949e; }
.debug-panel .section-title {
  color: #58a6ff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-bottom: 1px solid #21262d;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.flag-led {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 24px; height: 20px;
  border: 1px solid #333;
  border-radius: 3px;
  font-size: 9px;
  font-weight: bold;
  transition: all 0.15s;
}
.flag-led.on { background: #1a3a1a; color: #00ff41; border-color: #00ff41; box-shadow: 0 0 4px rgba(0,255,65,0.3); }
.flag-led.off { background: #1a1a1a; color: #555; }

.tab-btn {
  padding: 4px 10px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  cursor: pointer;
  border: 1px solid #333;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  transition: all 0.15s;
}
.tab-btn.active { background: #0d1117; color: #58a6ff; border-color: #58a6ff; }
.tab-btn:not(.active) { background: #161b22; color: #8b949e; }

.hex-dump {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.6;
}
.hex-dump .addr { color: #58a6ff; }
.hex-dump .ram { color: #ffa657; }
.hex-dump .rom { color: #a5d6ff; }
.hex-dump .tia { color: #d2a8ff; }
.hex-dump .riot { color: #7ee787; }

.status-bar {
  background: #161b22;
  border-top: 1px solid #21262d;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }