@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Press+Start+2P&display=swap');

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

body {
  background: #0a0a14;
  color: #e0e0e0;
  font-family: 'Share Tech Mono', monospace;
  overflow-x: hidden;
}

:root {
  --atari-orange: #FF6600;
  --atari-amber: #FFB347;
  --atari-blue: #2040A0;
  --atari-screen-blue: #4060C0;
  --panel-bg: #151525;
  --panel-border: #2a2a4a;
  --charcoal: #1a1a2e;
}

/* Scanline overlay */
.scanlines {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0,0,0,0.15) 1px,
    rgba(0,0,0,0.15) 2px
  );
  z-index: 2;
}

.crt-screen {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(64,96,192,0.3),
    0 0 120px rgba(64,96,192,0.1),
    inset 0 0 40px rgba(0,0,0,0.5);
  background: #000;
}

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

.crt-vignette {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.6) 100%);
}

.crt-bezel {
  padding: 12px;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border-radius: 24px;
  border: 2px solid #333;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.05),
    0 8px 32px rgba(0,0,0,0.8);
}

/* Power LED */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px 2px rgba(0,255,0,0.4); }
  50% { box-shadow: 0 0 8px 4px rgba(0,255,0,0.7); }
}

.led-on {
  background: #00ff00;
  animation: pulse-glow 2s ease-in-out infinite;
}
.led-off { background: #333; }
.led-paused {
  background: #ffaa00;
  animation: pulse-glow 1s ease-in-out infinite;
}

/* Buttons */
.atari-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s;
  position: relative;
  box-shadow: 0 4px 0 rgba(0,0,0,0.4), 0 6px 12px rgba(0,0,0,0.3);
}
.atari-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 3px 6px rgba(0,0,0,0.3);
}
.atari-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-run { background: #2d8a4e; color: #fff; }
.btn-run:hover:not(:disabled) { background: #35a05a; }
.btn-step { background: #c9a227; color: #1a1a1a; }
.btn-step:hover:not(:disabled) { background: #dbb52f; }
.btn-pause { background: #d4762c; color: #fff; }
.btn-pause:hover:not(:disabled) { background: #e08535; }
.btn-reset { background: #b33a3a; color: #fff; }
.btn-reset:hover:not(:disabled) { background: #cc4444; }
.btn-load { background: #8b6914; color: #fff; }
.btn-load:hover:not(:disabled) { background: #a07a1a; }

/* Panels */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
}
.panel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--atari-orange);
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--panel-border);
}

/* Flag indicators */
.flag-on {
  background: var(--atari-amber);
  color: #1a1a1a;
  font-weight: bold;
}
.flag-off {
  background: #222;
  color: #555;
}

/* Hex viewer */
.hex-row {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  white-space: nowrap;
}
.hex-addr { color: var(--atari-orange); }
.hex-byte { color: #aaa; }
.hex-byte-highlight { color: var(--atari-amber); background: rgba(255,179,71,0.15); }
.hex-ascii { color: #666; }

/* File drop zone */
.drop-zone {
  border: 2px dashed var(--panel-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--atari-orange);
  background: rgba(255,102,0,0.05);
}

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

/* Noise static effect */
@keyframes static-noise {
  0% { transform: translate(0,0); }
  10% { transform: translate(-1px,1px); }
  20% { transform: translate(1px,-1px); }
  30% { transform: translate(-1px,0); }
  40% { transform: translate(0,1px); }
  50% { transform: translate(1px,0); }
  60% { transform: translate(-1px,-1px); }
  70% { transform: translate(0,-1px); }
  80% { transform: translate(1px,1px); }
  90% { transform: translate(-1px,0); }
  100% { transform: translate(0,0); }
}

/* Virtual keyboard keys */
.vk-key {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  padding: 4px 6px;
  min-width: 28px;
  background: linear-gradient(180deg, #8a7b5e, #6b5d42);
  color: #f0e8d8;
  border: 1px solid #5a4e38;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 0 #3d3425, inset 0 1px 0 rgba(255,255,255,0.1);
  transition: all 0.05s;
  user-select: none;
}
.vk-key:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 #3d3425, inset 0 1px 0 rgba(255,255,255,0.05);
  background: linear-gradient(180deg, #6b5d42, #5a4e38);
}
.vk-key-special {
  background: linear-gradient(180deg, #5a5a6e, #404055);
  border-color: #3a3a4e;
  color: #c0c0d0;
  box-shadow: 0 2px 0 #2a2a35, inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Responsive */
@media (max-width: 1024px) {
  .main-layout { flex-direction: column !important; }
  .sidebar { width: 100% !important; max-width: 100% !important; }
}

/* Background pattern */
.bg-pattern {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255,102,0,0.02) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(64,96,192,0.02) 0%, transparent 50%);
}