:root {
  --bg: #0d0d0d;
  --board: #8B7355;
  --board-dark: #6b5a42;
  --led-on: #ff0000;
  --led-off: #2a0000;
  --led-glow: 0 0 8px #ff0000, 0 0 20px rgba(255,0,0,0.4);
  --key-bg: #1a1a1a;
  --key-hover: #2a2a2a;
  --key-text: #e0e0e0;
  --gold: #c4a35a;
  --green: #00ff41;
  --amber: #ffb000;
  --mono: 'IBM Plex Mono', 'Courier New', monospace;
  --display: 'Oswald', sans-serif;
}

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

body {
  background: var(--bg);
  font-family: var(--mono);
  color: #ccc;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 7-segment display styles */
.segment-display {
  position: relative;
  width: 44px;
  height: 72px;
}

.seg {
  position: absolute;
  background: var(--led-off);
  border-radius: 2px;
  transition: background 0.05s, box-shadow 0.05s;
}

.seg.on {
  background: var(--led-on);
  box-shadow: var(--led-glow);
}

/* Horizontal segments */
.seg-h {
  width: 24px;
  height: 5px;
  left: 10px;
}

/* Vertical segments */
.seg-v {
  width: 5px;
  height: 22px;
}

.seg-a { top: 2px; }
.seg-g { top: 33px; }
.seg-d { top: 64px; }

.seg-f { left: 4px; top: 8px; }
.seg-b { left: 35px; top: 8px; }
.seg-e { left: 4px; top: 40px; }
.seg-c { left: 35px; top: 40px; }

.seg-dp {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  right: -2px;
  bottom: 2px;
}

/* Key styles */
.kim-key {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--key-bg);
  color: var(--key-text);
  border: 1px solid #333;
  border-bottom: 3px solid #111;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.08s;
  min-width: 48px;
  height: 44px;
  padding: 0 6px;
}

.kim-key:hover {
  background: var(--key-hover);
  border-color: #555;
}

.kim-key:active, .kim-key.pressed {
  transform: translateY(2px);
  border-bottom-width: 1px;
  background: #111;
}

.kim-key.func-key {
  background: #2a1a0a;
  border-color: #5a3a1a;
  color: var(--gold);
}

.kim-key.func-key:hover {
  background: #3a2a1a;
}

.kim-key.go-key {
  background: #1a2a0a;
  border-color: #3a5a1a;
  color: #6f6;
}

.kim-key.rs-key {
  background: #2a0a0a;
  border-color: #5a1a1a;
  color: #f66;
}

/* Board texture */
.pcb-board {
  background: 
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.15) 0%, transparent 50%),
    linear-gradient(135deg, #8B7355 0%, #7a6548 50%, #8B7355 100%);
  position: relative;
  overflow: hidden;
}

.pcb-board::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(0deg, transparent, transparent 8px, rgba(180,140,80,0.08) 8px, rgba(180,140,80,0.08) 9px),
    repeating-linear-gradient(90deg, transparent, transparent 12px, rgba(180,140,80,0.06) 12px, rgba(180,140,80,0.06) 13px);
  pointer-events: none;
}

/* Power LED */
.power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 1px solid #333;
  transition: all 0.3s;
}

.power-led.on {
  background: #00ff41;
  box-shadow: 0 0 6px #00ff41, 0 0 15px rgba(0,255,65,0.4);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Flicker animation */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.flickering .seg.on {
  animation: flicker 0.08s ease-in-out;
}

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

@keyframes powerOn {
  0% { opacity: 0; transform: scale(0.98); }
  50% { opacity: 0.5; }
  100% { opacity: 1; transform: scale(1); }
}

.power-on-anim {
  animation: powerOn 0.5s ease-out;
}

/* Toggle switch */
.toggle-switch {
  width: 48px;
  height: 24px;
  background: #222;
  border-radius: 12px;
  border: 2px solid #444;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
}

.toggle-switch.on {
  background: #1a3a1a;
  border-color: #2a5a2a;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #666;
  border-radius: 50%;
  top: 1px;
  left: 1px;
  transition: all 0.3s;
}

.toggle-switch.on::after {
  left: 25px;
  background: #0f0;
  box-shadow: 0 0 6px #0f0;
}