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

body {
  background: #1a1a1a;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  color: #c8b88a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  overflow-x: hidden;
}

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

#monitor-assembly {
  width: 100%;
  display: flex;
  justify-content: center;
}

#monitor-bezel {
  background: linear-gradient(180deg, #e8dcc8 0%, #c8b88a 40%, #b8a87a 100%);
  border-radius: 18px;
  padding: 22px 28px 16px 28px;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.3),
    inset 0 -2px 0 rgba(0,0,0,0.15),
    0 2px 4px rgba(0,0,0,0.3);
  position: relative;
  width: 100%;
  max-width: 760px;
}

#monitor-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #6b5f4a;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 10px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

#screen-frame {
  background: #111;
  border-radius: 12px;
  padding: 8px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 30px rgba(0,0,0,0.8),
    inset 0 0 5px rgba(0,0,0,0.9);
}

#crt-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 6px;
  background: #000;
}

#crt-canvas.curved {
  border-radius: 16px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
}

#scanline-overlay {
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border-radius: 6px;
  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-reflection {
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border-radius: 6px;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.04) 0%, transparent 60%);
  z-index: 3;
}

#monitor-bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  padding: 0 10px;
}

#monitor-led {
  width: 8px; height: 8px; border-radius: 50%;
  background: #333;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}
#monitor-led.led-on {
  background: #00cc00;
  box-shadow: 0 0 6px #00cc00, inset 0 1px 2px rgba(0,0,0,0.3);
}

#brightness-label, #contrast-label {
  font-size: 8px; color: #6b5f4a; letter-spacing: 1px;
}

/* Control Panel */
#control-panel {
  background: linear-gradient(180deg, #d8ccb8 0%, #c0b09a 100%);
  width: 100%;
  max-width: 760px;
  border-radius: 0 0 12px 12px;
  padding: 12px 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

#panel-vents {
  height: 12px;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px, #a89878 2px, #a89878 3px
  );
  border-radius: 4px;
  margin-bottom: 10px;
  opacity: 0.4;
}

#panel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.control-label {
  font-size: 8px; color: #5a5040; letter-spacing: 1px; text-transform: uppercase;
}

#power-btn {
  width: 48px; height: 32px;
  background: linear-gradient(180deg, #cc3333 0%, #991111 100%);
  border: 2px solid #661111; border-radius: 4px;
  color: #fff; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}
#power-btn:active, #power-btn.pressed {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4); transform: translateY(1px);
}
#power-btn.on {
  background: linear-gradient(180deg, #ff4444 0%, #cc2222 100%);
  box-shadow: 0 0 8px rgba(255,50,50,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

#reset-btn {
  width: 36px; height: 24px;
  background: linear-gradient(180deg, #888 0%, #666 100%);
  border: 2px solid #444; border-radius: 3px;
  color: #ddd; font-family: 'IBM Plex Mono', monospace;
  font-size: 8px; font-weight: 700; cursor: pointer;
}
#reset-btn:active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }

#turbo-btn {
  width: 56px; height: 28px;
  background: linear-gradient(180deg, #bbb 0%, #999 100%);
  border: 2px solid #666; border-radius: 3px;
  color: #333; font-family: 'IBM Plex Mono', monospace;
  font-size: 8px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 3px; justify-content: center;
}

.turbo-led-off {
  width: 6px; height: 6px; border-radius: 50%; background: #442; display: inline-block;
}
.turbo-led-on {
  width: 6px; height: 6px; border-radius: 50%; background: #ffcc00;
  box-shadow: 0 0 4px #ffcc00; display: inline-block;
}

#speed-display {
  background: #111; color: #ff3333; font-size: 14px; font-weight: 700;
  padding: 4px 10px; border-radius: 3px; border: 1px solid #333;
  font-family: 'IBM Plex Mono', monospace;
  text-shadow: 0 0 6px rgba(255,50,50,0.5);
  min-width: 80px; text-align: center;
}

#clock-display {
  background: #111; color: #33ff33; font-size: 12px;
  padding: 4px 8px; border-radius: 3px; border: 1px solid #333;
  font-family: 'IBM Plex Mono', monospace;
  text-shadow: 0 0 6px rgba(50,255,50,0.5);
  min-width: 70px; text-align: center;
}

/* Floppy Drive */
#floppy-drive {
  background: linear-gradient(180deg, #d0c4b0 0%, #b8a890 100%);
  border: 2px solid #8a7e6a; border-radius: 4px;
  padding: 6px 10px;
  display: flex; align-items: center; gap: 8px;
}

#floppy-slot {
  width: 80px; height: 8px; background: #222;
  border-radius: 2px; border: 1px solid #111;
  position: relative; overflow: hidden;
}

#floppy-disk-visual {
  position: absolute; top: -2px; left: 5px;
  width: 70px; height: 12px; background: #333;
  border-radius: 1px; display: flex;
  align-items: center; justify-content: center;
  transition: transform 0.5s ease;
}
#floppy-disk-visual.inserting {
  animation: insertDisk 0.6s ease forwards;
}
@keyframes insertDisk {
  0% { transform: translateY(-20px); opacity: 0; }
  50% { transform: translateY(-5px); opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

#floppy-label-text {
  font-size: 5px; color: #aaa; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 65px;
}

#floppy-led {
  width: 6px; height: 6px; border-radius: 50%; background: #332;
}
#floppy-led.led-on {
  background: #00dd00; box-shadow: 0 0 4px #00dd00;
}

#floppy-latch {
  width: 16px; height: 10px; background: #888;
  border: 1px solid #555; border-radius: 2px;
  cursor: pointer; transition: transform 0.2s;
}
#floppy-latch.latch-closed { transform: rotate(-30deg); }

.hidden { display: none !important; }

#upload-label {
  background: linear-gradient(180deg, #6688bb 0%, #446699 100%);
  color: #fff; font-size: 10px; padding: 5px 10px;
  border-radius: 4px; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  border: 1px solid #335577; white-space: nowrap;
}
#upload-label:hover { background: linear-gradient(180deg, #7799cc 0%, #5577aa 100%); }

#eject-btn, #download-btn {
  background: linear-gradient(180deg, #aa8844 0%, #886633 100%);
  color: #fff; font-size: 10px; padding: 4px 8px;
  border: 1px solid #664422; border-radius: 3px;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace;
}
#download-btn {
  background: linear-gradient(180deg, #448844 0%, #336633 100%);
  border: 1px solid #224422;
}

#volume-slider { width: 60px; height: 4px; accent-color: #c8b88a; }
#mute-btn {
  background: none; border: 1px solid #8a7e6a; border-radius: 3px;
  color: #5a5040; font-size: 14px; cursor: pointer; padding: 2px 5px; line-height: 1;
}

#uncapped-btn, #settings-btn, #screenshot-btn, #debugger-btn {
  background: linear-gradient(180deg, #bbb 0%, #999 100%);
  border: 1px solid #666; border-radius: 3px;
  color: #333; font-size: 10px; padding: 5px 8px;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace;
}
#uncapped-btn { font-weight: 700; }

/* Debugger Panel */
#debugger-panel {
  width: 100%; max-width: 760px;
  background: #0a0a0a; border: 2px solid #333;
  border-radius: 6px; margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  color: #00ff00;
}
#debugger-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; background: #1a1a2a; border-bottom: 1px solid #333;
  font-size: 12px; font-weight: 700; color: #88aaff;
}
#debugger-header button {
  background: none; border: none; color: #ff5555; cursor: pointer;
  font-size: 16px; font-weight: 700;
}
#debugger-body {
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11px;
}
#debugger-body h3 {
  font-size: 10px; color: #88aaff; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 1px;
}
#debugger-body pre {
  background: #0d0d0d; padding: 6px; border-radius: 3px;
  border: 1px solid #222; overflow-x: auto; font-size: 10px;
  line-height: 1.4; min-height: 80px;
  white-space: pre; color: #00ff00;
}
#debugger-controls {
  grid-column: 1 / -1;
  display: flex; gap: 8px; padding: 4px 0;
}
#debugger-controls button {
  background: #222; border: 1px solid #444; color: #0f0;
  padding: 4px 12px; border-radius: 3px; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
}
#debugger-controls button:hover { background: #333; }
#mem-view { grid-column: 1 / -1; }
#mem-view input {
  background: #111; color: #0f0; border: 1px solid #333;
  padding: 2px 6px; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; border-radius: 2px;
}
#mem-view button {
  background: #222; border: 1px solid #444; color: #0f0;
  padding: 2px 8px; border-radius: 2px; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
}

/* Settings Modal */
#settings-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; justify-content: center; align-items: center;
}
#settings-content {
  background: linear-gradient(180deg, #d8ccb8 0%, #c0b09a 100%);
  border: 3px solid #8a7e6a; border-radius: 8px;
  padding: 20px; max-width: 400px; width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
#settings-content h2 {
  font-size: 14px; color: #3a3020; margin-bottom: 10px;
  border-bottom: 1px solid #8a7e6a; padding-bottom: 5px;
}
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 12px; color: #4a4030;
}
.setting-row select { background: #f5f0e1; border: 1px solid #8a7e6a; border-radius: 3px; padding: 3px 5px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #333; }
#floppy-info {
  font-size: 11px; color: #4a4030; margin-bottom: 12px;
  padding: 5px; background: rgba(0,0,0,0.05); border-radius: 3px;
  white-space: pre-wrap;
}
#settings-close {
  background: linear-gradient(180deg, #888 0%, #666 100%);
  border: 1px solid #444; color: #fff; padding: 6px 16px;
  border-radius: 4px; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  display: block; margin: 0 auto;
}

/* Status Bar */
#status-bar {
  width: 100%; max-width: 760px;
  background: #222; border: 1px solid #333;
  border-radius: 0 0 6px 6px;
  padding: 4px 12px;
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 9px; color: #7a7a6a;
}
#status-ips { color: #ff8800; font-weight: 700; }
#hdd-led { display: inline-flex; align-items: center; gap: 3px; }
#hdd-led::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #332; display: inline-block;
}
#hdd-led.led-on::before { background: #ff6600; box-shadow: 0 0 3px #ff6600; }

/* Footer */
#footer { margin-top: 20px; width: 100%; max-width: 760px; }
#serial-plate {
  background: linear-gradient(180deg, #e8e0d0 0%, #d0c8b8 100%);
  border: 2px solid #a09080; border-radius: 4px;
  padding: 8px 14px; text-align: center; font-size: 9px; color: #5a5040;
}
#serial-plate a { color: #0033A0; text-decoration: none; font-weight: 700; }
#serial-plate a:hover { text-decoration: underline; }
.disclaimer { margin-top: 4px; font-size: 8px; color: #8a7e6a; }

/* CRT Effects */
.crt-off { animation: crtOff 0.5s ease forwards; }
@keyframes crtOff {
  0% { filter: brightness(1); }
  10% { filter: brightness(1.5); transform: scaleY(1); }
  30% { filter: brightness(2); transform: scaleY(0.005); }
  60% { filter: brightness(3); transform: scaleY(0.005) scaleX(0.3); }
  100% { filter: brightness(0); transform: scaleY(0.005) scaleX(0); }
}
.crt-on { animation: crtOn 0.8s ease forwards; }
@keyframes crtOn {
  0% { filter: brightness(0); transform: scaleY(0.005) scaleX(0); }
  30% { filter: brightness(2); transform: scaleY(0.005) scaleX(0.5); }
  50% { filter: brightness(1.5); transform: scaleY(0.01) scaleX(1); }
  70% { filter: brightness(1.2); transform: scaleY(0.5) scaleX(1); }
  100% { filter: brightness(1); transform: scaleY(1) scaleX(1); }
}

@media (max-width: 600px) {
  body { padding: 8px; }
  #monitor-bezel { padding: 12px 14px 10px 14px; border-radius: 10px; }
  #panel-controls { gap: 6px; justify-content: center; }
  #status-bar { font-size: 7px; gap: 6px; padding: 3px 6px; }
  #speed-display { font-size: 11px; padding: 3px 6px; }
  #debugger-body { grid-template-columns: 1fr; font-size: 9px; }
}