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

:root {
  --bg: #0d0d0d;
  --bezel: #d4c5a9;
  --bezel-dark: #b8a88a;
  --bezel-shadow: #8a7d66;
  --dos-green: #33ff33;
  --amber: #ffb000;
  --lcd-bg: #1a2a1a;
  --lcd-text: #33ff33;
  --led-green: #00ff44;
  --led-red: #ff2222;
  --panel-bg: #2a2a2a;
  --text: #cccccc;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 900px;
  padding: 10px;
}

/* Monitor Frame */
#monitor-frame {
  width: 100%;
  perspective: 800px;
}

#bezel {
  background: linear-gradient(180deg, #ddd0b8 0%, var(--bezel) 15%, var(--bezel-dark) 90%, var(--bezel-shadow) 100%);
  border-radius: 18px;
  padding: 18px 24px 14px 24px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.7),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.2);
  position: relative;
}

#bezel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}

.ibm-logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 4px;
  color: #1a1a6e;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.model-label {
  font-size: 10px;
  color: #666;
  letter-spacing: 1px;
}

#screen-container {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.8),
    inset 0 0 80px rgba(0,0,0,0.4);
  aspect-ratio: 4/3;
  width: 100%;
}

#cga-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

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

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

#bezel-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 0 4px;
}

.bezel-text {
  font-size: 9px;
  color: #777;
  letter-spacing: 2px;
}

.led-off {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #333;
  border: 1px solid #222;
}

.led-on-green {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--led-green);
  border: 1px solid #009922;
  box-shadow: 0 0 6px var(--led-green), 0 0 12px rgba(0,255,68,0.3);
}

.led-on-red {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--led-red);
  border: 1px solid #aa0000;
  box-shadow: 0 0 6px var(--led-red);
}

.led-blink {
  animation: blink-led 0.15s ease-in-out;
}

@keyframes blink-led {
  0% { background: var(--led-green); box-shadow: 0 0 6px var(--led-green); }
  50% { background: #ffaa00; box-shadow: 0 0 10px #ffaa00; }
  100% { background: var(--led-green); box-shadow: 0 0 6px var(--led-green); }
}

/* Control Bar */
#control-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin-top: 8px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  flex-wrap: wrap;
  justify-content: center;
}

#control-bar button {
  font-family: 'IBM Plex Mono', monospace;
  background: linear-gradient(180deg, #555 0%, #333 100%);
  color: #ddd;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s;
  font-size: 10px;
}

#control-bar button:hover {
  background: linear-gradient(180deg, #666 0%, #444 100%);
}

#control-bar button:active {
  transform: scale(0.96);
}

#control-bar button.active {
  background: linear-gradient(180deg, #446644 0%, #335533 100%);
  border-color: var(--dos-green);
  color: var(--dos-green);
}

.btn-icon { font-size: 16px; }
.btn-label { font-size: 9px; letter-spacing: 1px; }

#power-btn.powered-on {
  background: linear-gradient(180deg, #335533 0%, #224422 100%);
  border-color: var(--led-green);
  color: var(--led-green);
  box-shadow: 0 0 8px rgba(0,255,68,0.2);
}

/* Floppy Drive */
#floppy-drive {
  display: flex;
  align-items: center;
  gap: 6px;
}

#floppy-slot {
  width: 60px;
  height: 6px;
  background: #111;
  border: 1px solid #444;
  border-radius: 1px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

#floppy-slit {
  width: 40px;
  height: 2px;
  background: #000;
}

#floppy-led {
  width: 4px !important;
  height: 4px !important;
}

/* Speed Display */
#speed-display {
  display: flex;
  align-items: center;
}

.lcd-readout {
  background: var(--lcd-bg);
  color: var(--lcd-text);
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid #0a1a0a;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
  min-width: 80px;
  text-align: center;
  letter-spacing: 1px;
}

#turbo-btn.turbo-active {
  background: linear-gradient(180deg, #664422 0%, #553311 100%);
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 8px rgba(255,176,0,0.3);
}

/* Volume */
#volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-label {
  font-size: 9px;
  color: #888;
  letter-spacing: 1px;
}

#volume-slider {
  width: 60px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #444;
  border-radius: 2px;
  outline: none;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: #aaa;
  border-radius: 50%;
  cursor: pointer;
}

/* Status Bar */
#status-bar {
  width: 100%;
  display: flex;
  gap: 16px;
  padding: 6px 16px;
  margin-top: 4px;
  background: #1a1a1a;
  border-radius: 4px;
  font-size: 10px;
  color: #666;
  flex-wrap: wrap;
  justify-content: center;
}

#status-bar span {
  white-space: nowrap;
}

/* Settings Panel */
#settings-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  background: #1e1e1e;
  border-left: 2px solid #333;
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

#settings-panel.hidden {
  transform: translateX(100%);
}

#settings-panel h3 {
  color: var(--dos-green);
  margin-bottom: 16px;
  font-size: 14px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 12px;
}

.setting-row label { color: #aaa; }

.setting-row select {
  background: #333;
  color: #ddd;
  border: 1px solid #555;
  padding: 3px 6px;
  border-radius: 3px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}

.setting-row input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--dos-green);
}

#settings-close {
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  background: #333;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
}

/* Footer */
#app-footer {
  margin-top: 12px;
  font-size: 10px;
  color: #444;
  text-align: center;
}

#app-footer a {
  color: var(--dos-green);
  text-decoration: none;
}

#app-footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 600px) {
  #app { padding: 4px; }
  #bezel { padding: 10px 12px 8px 12px; border-radius: 10px; }
  #control-bar { gap: 4px; padding: 8px; }
  #control-bar button { padding: 4px 8px; }
  .btn-icon { font-size: 14px; }
  #volume-slider { width: 40px; }
  #status-bar { font-size: 8px; gap: 8px; }
}