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

body {
  background: #000088;
  color: #AAAAAA;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Boot Screen */
#boot-screen {
  position: fixed;
  inset: 0;
  background: #000;
  color: #AAAAAA;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  padding: 20px;
  z-index: 9999;
  overflow: hidden;
}

#boot-text {
  white-space: pre-wrap;
  line-height: 1.4;
}

#boot-text .cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #AAAAAA;
  animation: blink-cursor 0.5s step-end infinite;
}

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

/* Title Bar */
#title-bar {
  background: #0000AA;
  color: #FFFFFF;
  text-align: center;
  padding: 2px 0;
  font-size: 14px;
  line-height: 1.3;
  border-bottom: 2px solid #5555FF;
  letter-spacing: 0px;
}

#title-bar span {
  display: block;
}

/* Main Layout */
#main-container {
  display: flex;
  gap: 8px;
  padding: 8px;
  min-height: calc(100vh - 120px);
}

#left-panel {
  width: 320px;
  min-width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* DOS Box */
.dos-box {
  background: #000000;
  border: 1px solid #555555;
  padding: 8px;
  position: relative;
}

.dos-box-title {
  color: #FFFF55;
  font-size: 12px;
  position: absolute;
  top: -8px;
  left: 8px;
  background: #000;
  padding: 0 4px;
}

/* Drop Zone */
#drop-zone {
  border: 2px dashed #00AA00;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

#drop-zone:hover, #drop-zone.drag-over {
  background: #002200;
  border-color: #55FF55;
}

#drop-text {
  color: #55FF55;
  font-size: 13px;
  line-height: 1.8;
}

.blink {
  animation: blink-char 1s step-end infinite;
}

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

#file-info {
  color: #00AAAA;
  font-size: 11px;
  margin-top: 6px;
  padding: 4px;
  border-top: 1px solid #333;
}

/* Radio Buttons */
.dos-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 0;
  color: #FFFFFF;
  font-size: 12px;
}

.dos-radio:hover {
  color: #55FFFF;
}

.dos-radio input[type="radio"],
.dos-radio input[type="checkbox"] {
  display: none;
}

.radio-dot {
  display: inline-block;
  width: 16px;
  height: 14px;
  text-align: center;
  line-height: 14px;
  color: #AAAAAA;
  flex-shrink: 0;
}

.radio-dot::before {
  content: '[ ]';
  font-size: 12px;
}

.dos-radio input:checked + .radio-dot::before {
  content: '[●]';
  color: #55FF55;
}

.dos-radio input[type="checkbox"] + .radio-dot::before {
  content: '[ ]';
}

.dos-radio input[type="checkbox"]:checked + .radio-dot::before {
  content: '[×]';
  color: #55FF55;
}

/* Setting Group */
.setting-group {
  margin-top: 10px;
}

/* Palette Previews */
.palette-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin: 3px 0 6px 22px;
}

.palette-preview .swatch {
  width: 10px;
  height: 10px;
  border: 1px solid #333;
}

/* Resolution */
.res-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 8px;
}

.res-btn {
  font-size: 10px !important;
  padding: 4px !important;
  line-height: 1.3;
}

.res-btn small {
  color: #00AAAA;
}

.res-btn.active {
  background: #0000AA;
  color: #FFFF55;
}

.res-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.res-custom label {
  color: #AAAAAA;
  font-size: 12px;
}

.res-custom input[type="number"] {
  background: #111;
  border: 1px solid #555;
  color: #55FF55;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  width: 60px;
  padding: 2px 4px;
  text-align: right;
}

/* DOS Button */
.dos-btn {
  background: #333;
  color: #FFFFFF;
  border: 1px solid #777;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  text-align: center;
}

.dos-btn:hover {
  background: #0000AA;
  color: #FFFF55;
  border-color: #5555FF;
}

.dos-btn:active {
  background: #000088;
}

.dos-btn.big {
  font-size: 14px;
  padding: 8px 16px;
  width: 100%;
  background: #005500;
  color: #55FF55;
  border-color: #00AA00;
}

.dos-btn.big:hover {
  background: #007700;
  color: #FFFFFF;
}

.dos-btn.small {
  font-size: 10px;
  padding: 2px 6px;
}

/* Sliders */
.slider-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #AAAAAA;
  font-size: 12px;
  margin: 4px 0;
}

.dos-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #333;
  border: 1px solid #555;
  flex: 1;
  max-width: 150px;
}

.dos-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 14px;
  background: #AAAAAA;
  border: 1px solid #FFF;
  cursor: pointer;
}

.dos-slider::-moz-range-thumb {
  width: 10px;
  height: 14px;
  background: #AAAAAA;
  border: 1px solid #FFF;
  cursor: pointer;
}

/* Preview Area */
#preview-box {
  flex: 1;
  display: flex;
  flex-direction: column;
}

#preview-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

#preview-area {
  flex: 1;
  overflow: auto;
  background: #111;
  border: 1px solid #333;
  min-height: 200px;
  position: relative;
}

#preview-wrapper {
  display: flex;
  gap: 8px;
  padding: 8px;
  justify-content: center;
  align-items: flex-start;
}

.canvas-container {
  text-align: center;
}

.canvas-label {
  color: #FFFF55;
  font-size: 10px;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

.crt-wrapper {
  position: relative;
  display: inline-block;
  border: 2px solid #444;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 170, 0, 0.15), inset 0 0 60px rgba(0,0,0,0.3);
}

.crt-wrapper canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.scanlines {
  position: absolute;
  inset: 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;
}

/* Active Palette */
#active-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 10px;
  max-height: 120px;
  overflow-y: auto;
}

#active-palette .swatch {
  width: 14px;
  height: 14px;
  border: 1px solid #333;
  cursor: default;
  position: relative;
}

#active-palette .swatch.used {
  border-color: #FFF;
  box-shadow: 0 0 3px #FFF;
}

#active-palette .swatch .tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #55FF55;
  border: 1px solid #555;
  padding: 2px 4px;
  font-size: 9px;
  white-space: nowrap;
  z-index: 100;
}

#active-palette .swatch:hover .tooltip {
  display: block;
}

/* Export */
.export-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

#code-preview {
  margin-top: 8px;
  position: relative;
  background: #0000AA;
  border: 1px solid #5555FF;
  padding: 8px;
  padding-top: 14px;
}

#qbasic-code {
  color: #FFFF55;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre;
  overflow-x: auto;
}

/* Info text */
.info-text {
  color: #00AAAA;
  font-size: 10px;
  margin-top: 4px;
  font-style: italic;
}

/* Status Bar */
#status-bar {
  display: flex;
  justify-content: space-between;
  background: #0000AA;
  color: #FFFFFF;
  padding: 3px 8px;
  font-size: 11px;
  border-top: 1px solid #5555FF;
  flex-wrap: wrap;
  gap: 4px;
}

/* Footer */
#footer {
  text-align: center;
  padding: 4px;
  font-size: 11px;
  color: #555;
  background: #000;
  border-top: 1px solid #333;
}

#footer a {
  color: #00AAAA;
  text-decoration: none;
}

#footer a:hover {
  color: #55FFFF;
}

/* Easter Egg */
#run-easter-egg {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#run-text {
  color: #55FF55;
  font-size: 16px;
  text-align: center;
  line-height: 1.6;
}

/* Used colors info */
#used-colors-info {
  margin-top: 4px;
}

/* Responsive */
@media (max-width: 900px) {
  #main-container {
    flex-direction: column;
  }
  #left-panel {
    width: 100%;
    min-width: 0;
  }
  #preview-wrapper {
    flex-direction: column;
    align-items: center;
  }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #111;
}

::-webkit-scrollbar-thumb {
  background: #555;
  border: 1px solid #777;
}

::-webkit-scrollbar-thumb:hover {
  background: #777;
}