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

body {
  background: #000;
  font-family: 'IBM Plex Mono', monospace;
  color: #AAAAAA;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #0000AA;
}

#title-bar {
  background: #AAAAAA;
  color: #0000AA;
  padding: 2px 8px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  user-select: none;
}

#title-right {
  font-size: 12px;
}

#menu-bar {
  background: #000000;
  color: #FFFFFF;
  padding: 3px 4px;
  font-size: 13px;
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
  user-select: none;
}

.menu-item {
  padding: 1px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.menu-item:hover, .menu-item:focus {
  background: #FFFFFF;
  color: #000000;
  outline: none;
}

.menu-item.active {
  background: #55FF55;
  color: #000000;
}

.menu-sep {
  color: #555555;
  padding: 0 2px;
}

#options-bar {
  background: #0000AA;
  border-bottom: 1px solid #5555FF;
  padding: 4px 8px;
  font-size: 12px;
  flex-shrink: 0;
  user-select: none;
}

#bit-depth-row, #dither-row, #effects-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 2px;
}

.label {
  color: #55FFFF;
  font-weight: 700;
  margin-right: 4px;
  white-space: nowrap;
}

.radio-opt, .check-opt {
  color: #FFFFFF;
  cursor: pointer;
  padding: 1px 4px;
  white-space: nowrap;
}

.radio-opt:hover, .check-opt:hover {
  background: #5555FF;
}

.radio-opt.selected {
  color: #FFFF55;
  font-weight: 700;
}

.check-opt.checked {
  color: #55FF55;
}

#display-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  background: #000011;
  min-height: 0;
}

#no-source-msg {
  color: #55FFFF;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  position: absolute;
  white-space: pre;
  animation: blink-cursor 1.2s step-end infinite;
}

@keyframes blink-cursor {
  50% { opacity: 0.85; }
}

#crt-container {
  position: relative;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: none;
}

#crt-container.active {
  display: block;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

#scanline-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 1px,
    rgba(0, 0, 0, 0.25) 1px,
    rgba(0, 0, 0, 0.25) 2px
  );
  z-index: 2;
  display: none;
}

#scanline-overlay.active {
  display: block;
}

#glow-overlay {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  pointer-events: none;
  box-shadow: inset 0 0 60px rgba(100, 200, 255, 0.08),
              inset 0 0 120px rgba(100, 200, 255, 0.04);
  border-radius: 8px;
  z-index: 3;
  display: none;
}

#glow-overlay.active {
  display: block;
}

#status-bar {
  background: #AAAAAA;
  color: #000000;
  padding: 2px 8px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  user-select: none;
}

#status-bar a {
  color: #0000AA;
  text-decoration: underline;
}

#status-bar a:hover {
  color: #FF5555;
}

/* CRT flicker */
@keyframes crt-flicker {
  0% { opacity: 1; }
  3% { opacity: 0.97; }
  6% { opacity: 1; }
  50% { opacity: 1; }
  52% { opacity: 0.98; }
  54% { opacity: 1; }
}

#crt-container.active {
  animation: crt-flicker 4s infinite;
}

/* Amber monitor tint */
#crt-container.amber #canvas {
  filter: sepia(1) saturate(2) brightness(0.9) hue-rotate(-10deg);
}

/* Green monitor tint */
#crt-container.green #canvas {
  filter: sepia(1) saturate(2) brightness(0.9) hue-rotate(70deg);
}

/* Mobile adjustments */
@media (max-width: 700px) {
  #options-bar {
    font-size: 11px;
    padding: 3px 4px;
  }
  .radio-opt, .check-opt {
    padding: 2px 3px;
    font-size: 11px;
  }
  .menu-item {
    font-size: 12px;
    padding: 2px 5px;
  }
  #no-source-msg {
    font-size: 10px;
  }
  #status-bar {
    font-size: 9px;
  }
}