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

body {
  background: #0a0a1a;
  font-family: 'VT323', monospace;
  overflow-x: hidden;
  min-height: 100vh;
}

@keyframes crtOn {
  0% { transform: scaleY(0.005) scaleX(0.5); opacity: 0.5; filter: brightness(30); }
  20% { transform: scaleY(0.005) scaleX(1); opacity: 0.8; }
  40% { transform: scaleY(1) scaleX(1); opacity: 1; filter: brightness(1.5); }
  100% { transform: scaleY(1) scaleX(1); opacity: 1; filter: brightness(1); }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.9; }
  94% { opacity: 1; }
}

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

@keyframes tape-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes border-cycle {
  0% { border-color: #ffffff; }
  6.25% { border-color: #880000; }
  12.5% { border-color: #aaffee; }
  18.75% { border-color: #cc44cc; }
  25% { border-color: #00cc55; }
  31.25% { border-color: #0000aa; }
  37.5% { border-color: #eeee77; }
  43.75% { border-color: #dd8855; }
  50% { border-color: #664400; }
  56.25% { border-color: #ff7777; }
  62.5% { border-color: #333333; }
  68.75% { border-color: #777777; }
  75% { border-color: #aaff66; }
  81.25% { border-color: #0088ff; }
  87.5% { border-color: #bbbbbb; }
  100% { border-color: #ffffff; }
}

.crt-container {
  animation: crtOn 1.2s ease-out forwards;
  position: relative;
}

.crt-screen {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  animation: flicker 8s infinite;
}

.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 50%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 11;
}

.screen-glow {
  box-shadow:
    0 0 60px rgba(64, 64, 224, 0.3),
    0 0 120px rgba(64, 64, 224, 0.15),
    inset 0 0 40px rgba(64, 64, 224, 0.1);
}

.cursor-block {
  display: inline-block;
  width: 0.62em;
  height: 1em;
  background: #7070FF;
  animation: cursor-blink 0.5s step-end infinite;
  vertical-align: bottom;
}

.loading-border {
  animation: border-cycle 0.3s linear infinite;
}

.tape-spinning {
  animation: tape-spin 0.8s linear infinite;
}

.monitor-bezel {
  background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 30%, #1a1a1a 70%, #2a2a2a 100%);
  border: 3px solid #444;
  border-radius: 24px;
  padding: 20px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.1);
}

.c64-key {
  background: linear-gradient(180deg, #8B7355 0%, #6B5335 100%);
  border: 1px solid #4a3a20;
  border-radius: 4px;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: 6px 8px;
  min-width: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.05s;
  box-shadow: 0 3px 0 #3a2a10, 0 4px 4px rgba(0,0,0,0.3);
  user-select: none;
}

.c64-key:active, .c64-key.pressed {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #3a2a10, 0 2px 2px rgba(0,0,0,0.3);
}

.c64-key-special {
  background: linear-gradient(180deg, #5a4a3a 0%, #3a2a1a 100%);
}

.c64-key-fn {
  background: linear-gradient(180deg, #7a6a5a 0%, #5a4a3a 100%);
  color: #ffd700;
}

.tape-deck {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  border: 2px solid #444;
  border-radius: 8px;
  padding: 16px;
}

.tape-reel {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #666;
  background: radial-gradient(circle, #333 30%, #1a1a1a 70%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tape-reel-inner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #888;
  background: #444;
}

.hex-viewer {
  font-family: 'VT323', monospace;
  font-size: 14px;
  line-height: 1.4;
  color: #00ff88;
  background: #0a0a0a;
}

.hex-addr { color: #ffaa00; }
.hex-byte { color: #00ff88; }
.hex-ascii { color: #ff6688; }
.hex-keyword { color: #ffff00; background: rgba(255,255,0,0.1); }

.hw-panel {
  background: linear-gradient(180deg, #1a1a2e 0%, #0f0f1e 100%);
  border: 1px solid #333;
  border-radius: 8px;
}

.register-display {
  font-family: 'VT323', monospace;
  color: #00ffaa;
  background: #0a0a0a;
  border: 1px solid #333;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 16px;
}

.volume-knob {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #555, #222);
  border: 2px solid #666;
  cursor: pointer;
  position: relative;
}

.volume-knob::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 10px;
  background: #fff;
  border-radius: 1px;
}

.panel-tab {
  cursor: pointer;
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  color: #888;
}

.panel-tab.active {
  color: #7070FF;
  border-bottom-color: #7070FF;
}

.panel-tab:hover {
  color: #aaa;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }