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

:root {
  --phosphor: #33ff33;
  --phosphor-dim: #22cc22;
  --phosphor-dark: #0a5a0a;
  --bg: #0a0a0a;
  --bezel: #d4c5a9;
  --bezel-dark: #8a7d65;
  --amber: #ff8800;
  --red: #cc2222;
}

body {
  background: #111;
  background-image: 
    radial-gradient(ellipse at center, #1a1a1a 0%, #050505 100%);
  color: var(--phosphor);
  font-family: 'VT323', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px;
}

.header {
  text-align: center;
  padding: 20px 10px 10px;
}

.header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--phosphor);
  text-shadow: 0 0 10px var(--phosphor), 0 0 20px var(--phosphor-dark);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.header .subtitle {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--phosphor-dim);
  opacity: 0.7;
}

.header .apple-art {
  font-size: 14px;
  color: var(--phosphor);
  opacity: 0.5;
  margin-bottom: 4px;
}

/* CRT Monitor */
.monitor-bezel {
  background: linear-gradient(145deg, #c4b596, #a89a7a);
  border-radius: 20px;
  padding: 20px;
  margin: 10px auto;
  max-width: 720px;
  box-shadow: 
    0 4px 20px rgba(0,0,0,0.8),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.2);
  position: relative;
}

.monitor-bezel::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border-radius: 16px;
  border: 2px solid rgba(0,0,0,0.15);
  pointer-events: none;
}

.monitor-inner {
  background: #000;
  border-radius: 12px;
  padding: 3px;
  box-shadow: inset 0 0 30px rgba(0,0,0,1);
}

.crt-screen {
  position: relative;
  background: #020802;
  border-radius: 10px;
  overflow: hidden;
  cursor: text;
}

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

/* Scanline overlay */
.crt-screen::after {
  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: 2;
}

/* Vignette */
.crt-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0,0,0,0.5) 100%
  );
  pointer-events: none;
  z-index: 3;
}

/* Screen glow */
.screen-glow {
  box-shadow: 
    inset 0 0 60px rgba(51, 255, 51, 0.05),
    0 0 20px rgba(51, 255, 51, 0.1);
}

/* Control Panel */
.control-panel {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 1px solid #333;
  border-radius: 12px;
  padding: 16px;
  margin: 12px auto;
  max-width: 720px;
}

.panel-section {
  margin-bottom: 14px;
}

.panel-section:last-child {
  margin-bottom: 0;
}

.panel-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--amber);
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.controls-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Retro buttons */
.btn-retro {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.1s;
  position: relative;
}

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

.btn-action {
  background: linear-gradient(180deg, #444, #2a2a2a);
  color: var(--phosphor);
  border: 1px solid #555;
  box-shadow: 0 3px 0 #111, 0 4px 6px rgba(0,0,0,0.3);
}

.btn-action:hover {
  background: linear-gradient(180deg, #555, #333);
}

.btn-action:active {
  box-shadow: 0 1px 0 #111;
}

.btn-reset {
  background: linear-gradient(180deg, #cc3333, #882222);
  color: #fff;
  border: 1px solid #dd4444;
  box-shadow: 0 3px 0 #551111, 0 4px 6px rgba(0,0,0,0.3);
}

.btn-reset:hover {
  background: linear-gradient(180deg, #dd4444, #993333);
}

.btn-reset:active {
  box-shadow: 0 1px 0 #551111;
}

.btn-load {
  background: linear-gradient(180deg, #cc8800, #885500);
  color: #fff;
  border: 1px solid #dd9900;
  box-shadow: 0 3px 0 #553300, 0 4px 6px rgba(0,0,0,0.3);
}

.btn-load:hover {
  background: linear-gradient(180deg, #dd9900, #996600);
}

.btn-power-on {
  background: linear-gradient(180deg, #22aa22, #116611);
  color: #fff;
  border: 1px solid #33bb33;
  box-shadow: 0 3px 0 #0a440a, 0 4px 6px rgba(0,0,0,0.3);
}

.btn-power-off {
  background: linear-gradient(180deg, #444, #222);
  color: #888;
  border: 1px solid #555;
  box-shadow: 0 3px 0 #111, 0 4px 6px rgba(0,0,0,0.3);
}

/* Input fields */
.hex-input {
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: #111;
  border: 1px solid #444;
  color: var(--phosphor);
  padding: 6px 10px;
  border-radius: 4px;
  width: 80px;
  text-transform: uppercase;
}

.hex-input:focus {
  outline: none;
  border-color: var(--phosphor);
  box-shadow: 0 0 6px rgba(51,255,51,0.3);
}

.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* Status display */
.status-panel {
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 10px 14px;
  font-family: 'VT323', monospace;
  font-size: 16px;
}

.register-display {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--phosphor-dim);
}

.register-display span {
  white-space: nowrap;
}

.register-display .reg-label {
  color: var(--amber);
  font-size: 14px;
}

.register-display .reg-value {
  color: var(--phosphor);
}

/* LEDs */
.led {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,0.1);
}

.led-off {
  background: #333;
  box-shadow: none;
}

.led-green {
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
}

.led-red {
  background: #ff3333;
  box-shadow: 0 0 6px #ff3333;
}

.led-amber {
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
}

.led-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #888;
  margin-right: 12px;
  vertical-align: middle;
}

/* Speed slider */
.speed-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.speed-control input[type="range"] {
  width: 100px;
  accent-color: var(--phosphor);
}

.speed-label {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--phosphor-dim);
  min-width: 60px;
}

/* File info */
.file-info {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--phosphor-dim);
  margin-top: 6px;
}

/* Help panel */
.help-toggle {
  text-align: center;
  margin: 10px 0;
}

.help-panel {
  background: rgba(10,10,10,0.95);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 16px;
  margin: 10px auto;
  max-width: 720px;
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: var(--phosphor-dim);
  line-height: 1.5;
}

.help-panel h3 {
  color: var(--amber);
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  margin: 12px 0 6px;
}

.help-panel h3:first-child {
  margin-top: 0;
}

.help-panel code {
  background: #1a1a1a;
  padding: 1px 5px;
  border-radius: 2px;
  color: var(--phosphor);
}

.help-panel ul {
  padding-left: 20px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 16px;
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: #555;
}

.footer a {
  color: var(--phosphor-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--phosphor);
  text-shadow: 0 0 6px var(--phosphor-dark);
}

/* Responsive */
@media (max-width: 600px) {
  .header h1 { font-size: 12px; }
  .monitor-bezel { padding: 10px; margin: 6px; border-radius: 12px; }
  .control-panel { margin: 8px; padding: 10px; }
  .controls-row { gap: 6px; }
  .btn-retro { font-size: 7px; padding: 6px 10px; }
  .register-display { font-size: 13px; gap: 8px; }
}