*, *::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 scanlines overlay */
#scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.08) 2px,
    rgba(0,0,0,0.08) 4px
  );
  pointer-events: none;
  z-index: 100;
}

/* Vignette */
#vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 99;
}

#container {
  width: min(90vw, 700px);
  display: flex;
  flex-direction: column;
  gap: 0;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--dim);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: rgba(0,0,0,0.4);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
}

#signal-label {
  color: var(--color);
  text-shadow: 0 0 8px var(--color);
  animation: pulse-signal 2s ease-in-out infinite;
}

#freq-label { color: var(--dim); }
#freq { color: var(--secondary); }

#screen {
  border: 1px solid var(--dim);
  background: rgba(0,0,0,0.6);
  padding: 24px;
  min-height: 280px;
  max-height: 60vh;
  overflow-y: auto;
  position: relative;
  line-height: 1.7;
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.05em;
  font-family: 'Courier New', Courier, monospace;
  scroll-behavior: smooth;
}

#screen::-webkit-scrollbar { width: 4px; }
#screen::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 2px; }

#output {
  display: inline;
  color: var(--color);
  word-break: break-word;
  white-space: pre-wrap;
}

.neon-char {
  display: inline;
  color: var(--color);
  text-shadow:
    0 0 4px var(--color),
    0 0 10px var(--color),
    0 0 22px var(--color-mid);
  animation: char-appear 0.12s ease-out forwards;
}

.neon-char.user { color: var(--accent); text-shadow: 0 0 4px var(--accent), 0 0 14px var(--accent); }
.neon-char.flicker { animation: flicker 0.18s ease-in-out; }

#cursor {
  display: inline;
  color: var(--color);
  text-shadow: 0 0 8px var(--color);
  font-family: 'Courier New', Courier, monospace;
  font-size: inherit;
  animation: blink 0.8s step-end infinite;
}

#footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--dim);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: rgba(0,0,0,0.4);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
}

#mode-label { color: var(--secondary); }
#status { color: var(--color); text-shadow: 0 0 6px var(--color); }
#type-hint { color: rgba(255,255,255,0.25); }

/* ── Animations ── */
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulse-signal {
  0%,100% { opacity: 1; }
  50% { opacity: 0.6; }
}
@keyframes char-appear {
  from { opacity: 0; transform: scale(1.15); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes flicker {
  0%   { opacity: 1; }
  20%  { opacity: 0.4; }
  40%  { opacity: 1; }
  60%  { opacity: 0.7; }
  80%  { opacity: 1; }
  100% { opacity: 1; }
}
@keyframes screen-flash {
  0%   { background: rgba(var(--color-rgb), 0.07); }
  100% { background: rgba(0,0,0,0.6); }
}

/* Color theme CSS vars set by JS */
:root {
  --color:     #00ffcc;
  --color-mid: #00cc99;
  --secondary: #0077ff;
  --dim:       rgba(0,255,204,0.2);
  --accent:    #ff88cc;
  --color-rgb: 0,255,204;
}
