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

body {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  background: #000080;
  color: #ffffff;
  min-height: 100vh;
}

/* CRT Scanline overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.08) 0px,
    rgba(0, 0, 0, 0.08) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}
::-webkit-scrollbar-track {
  background: #000080;
  border: 1px solid #00aaaa;
}
::-webkit-scrollbar-thumb {
  background: #00aaaa;
  border: 1px solid #000080;
}

/* Box drawing borders */
.dos-box {
  border: 2px solid #00aaaa;
  position: relative;
}
.dos-box::before {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(0, 170, 170, 0.3);
  pointer-events: none;
}

.dos-box-double {
  border: 3px double #00aaaa;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed #00ffff;
  transition: all 0.2s;
  cursor: pointer;
}
.drop-zone:hover,
.drop-zone.drag-over {
  background: rgba(0, 255, 255, 0.08);
  border-color: #ffff00;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
}

/* Bit depth buttons */
.bit-btn {
  background: #000055;
  border: 2px solid #555555;
  color: #aaaaaa;
  transition: all 0.15s;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
}
.bit-btn:hover {
  border-color: #00aaaa;
  color: #ffffff;
}
.bit-btn.active {
  background: #aaaa00;
  border-color: #ffff55;
  color: #000000;
}
.bit-btn.active::after {
  content: '█';
  animation: blink 0.8s step-end infinite;
  margin-left: 4px;
  font-size: 10px;
}

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

/* Terminal panel */
.terminal {
  background: #0a0a0a;
  color: #33ff33;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.terminal.amber {
  color: #ffaa00;
}

/* DOS button style */
.dos-btn {
  background: #555555;
  border: 2px outset #aaaaaa;
  color: #ffffff;
  font-family: 'IBM Plex Mono', monospace;
  cursor: pointer;
  padding: 6px 16px;
  font-size: 13px;
  transition: all 0.1s;
}
.dos-btn:hover {
  background: #666666;
}
.dos-btn:active {
  border-style: inset;
  background: #444444;
}
.dos-btn-primary {
  background: #000080;
  border-color: #00aaaa;
  color: #00ffff;
}
.dos-btn-primary:hover {
  background: #0000aa;
}

/* Tab styles */
.tab-btn {
  background: #000044;
  border: 1px solid #333366;
  border-bottom: none;
  color: #8888aa;
  padding: 4px 14px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  margin-right: 2px;
  position: relative;
  top: 1px;
}
.tab-btn.active {
  background: #0a0a0a;
  border-color: #00aaaa;
  color: #33ff33;
  z-index: 1;
}

/* Palette swatch */
.swatch {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(255,255,255,0.3);
  display: inline-block;
  cursor: pointer;
  position: relative;
}
.swatch:hover {
  border-color: #ffff00;
  z-index: 1;
  transform: scale(1.5);
}

/* Screen mode button */
.screen-mode-btn {
  background: #000044;
  border: 1px solid #333366;
  color: #aaaacc;
  padding: 4px 10px;
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  transition: all 0.15s;
}
.screen-mode-btn:hover {
  border-color: #00aaaa;
  color: #00ffff;
  background: #000066;
}

/* Canvas pixel-perfect */
canvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Collapsible section */
.collapse-header {
  cursor: pointer;
  user-select: none;
}
.collapse-header:hover {
  color: #ffff55;
}

/* Select / input styling */
.dos-select, .dos-input {
  background: #000033;
  border: 2px inset #555555;
  color: #00ffff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  padding: 4px 8px;
}
.dos-select:focus, .dos-input:focus {
  outline: none;
  border-color: #00aaaa;
}

.dos-range {
  -webkit-appearance: none;
  height: 6px;
  background: #000033;
  border: 1px solid #555555;
  outline: none;
}
.dos-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 20px;
  background: #00aaaa;
  border: 1px solid #00ffff;
  cursor: pointer;
}

/* Tooltip */
.tooltip-content {
  display: none;
  position: absolute;
  background: #000000;
  border: 1px solid #00aaaa;
  color: #ffffff;
  padding: 2px 6px;
  font-size: 10px;
  z-index: 100;
  white-space: nowrap;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
}
.swatch:hover .tooltip-content {
  display: block;
}

/* Warning bar */
.warning-bar {
  background: #aaaa00;
  color: #000000;
  padding: 4px 10px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .preview-grid {
    grid-template-columns: 1fr !important;
  }
  .bit-depth-row {
    flex-wrap: wrap;
  }
}