*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: system-ui, -apple-system, sans-serif;
  background: #0a0a0a;
  color: #fafafa;
  overflow: hidden;
}

#crt-wrapper {
  width: min(92vw, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

#screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #000d00;
  border-radius: 12px 12px 4px 4px;
  overflow: hidden;
  border: 3px solid #1a1a1a;
  box-shadow:
    inset 0 0 80px rgba(0, 255, 0, 0.04),
    0 0 0 2px #111,
    0 8px 40px rgba(0,0,0,0.8);
}

#scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.3) 2px,
    rgba(0, 0, 0, 0.3) 4px
  );
  pointer-events: none;
  z-index: 5;
  mix-blend-mode: multiply;
}

#glow-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,255,0,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 4;
  animation: flicker 8s infinite;
}

@keyframes flicker {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.85; }
  97% { opacity: 1; }
  98% { opacity: 0.9; }
}

#terminal {
  position: absolute;
  inset: 0;
  padding: 1.25rem 1.5rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.65rem, 1.5vw, 0.85rem);
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 3;
}

#output {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  line-height: 1.55;
}

.output-line {
  white-space: pre-wrap;
  word-break: break-all;
}

.output-line.command {
  color: #00ff41;
}

.output-line.response {
  color: #88ffaa;
  text-shadow: 0 0 6px rgba(136, 255, 170, 0.5);
}

.output-line.error {
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255, 68, 68, 0.7);
}

.output-line.system {
  color: #ffcc00;
  text-shadow: 0 0 8px rgba(255, 204, 0, 0.6);
}

.output-line.dim {
  color: #336633;
  text-shadow: none;
}

#input-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.prompt {
  color: #00cc33;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0, 204, 51, 0.7);
}

#input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #00ff41;
  font-family: 'Courier New', Courier, monospace;
  font-size: inherit;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
  caret-color: transparent;
}

#cursor-blink {
  animation: blink 1.1s step-end infinite;
  color: #00ff41;
  line-height: 1;
}

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

#crt-frame {
  width: calc(100% + 20px);
  height: 2.5rem;
  background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
  border-radius: 0 0 8px 8px;
  border: 3px solid #1a1a1a;
  border-top: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

#power-led {
  position: absolute;
  right: 1.5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00ff41;
  box-shadow: 0 0 8px #00ff41, 0 0 16px rgba(0,255,65,0.4);
  animation: led-pulse 3s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

#brand {
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: #333;
  text-transform: uppercase;
}
