:root {
  --bg: #08090b;
  --panel: #121417;
  --line: #262b30;
  --ink: #e8e4da;
  --muted: #8b9198;
  --teal: #55b8ac;
  --crimson: #b3453a;
  --amber: #d9a13d;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
  gap: 18px;
  transition: background 0.4s ease;
}

body.anomaly {
  background: #0d0505;
}

.radio {
  width: 100%;
  max-width: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 28px 22px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.radio.anomaly {
  border-color: var(--crimson);
  box-shadow: 0 0 40px rgba(179,69,58,0.25), 0 30px 60px rgba(0,0,0,0.5);
}

.radio-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}

.radio-top .tag {
  font-size: 0.68rem;
  color: var(--muted);
}

.scope {
  width: 100%;
  height: 100px;
  display: block;
  background: #05070a;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 18px;
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
  font-family: var(--font-display);
}

.freq {
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.radio.anomaly .freq { color: var(--crimson); }

.unit {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.signal-state {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.signal-state.locked { color: var(--teal); }
.signal-state.anomaly { color: var(--crimson); }

.dial {
  width: 100%;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--line), var(--line));
  margin-bottom: 22px;
  outline: none;
}

.dial::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid #06100f;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(85,184,172,0.6);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.radio.anomaly .dial::-webkit-slider-thumb {
  background: var(--crimson);
  box-shadow: 0 0 14px rgba(179,69,58,0.7);
}

.dial::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid #06100f;
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.power-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.power-btn:hover { border-color: var(--teal); color: var(--ink); }

.power-btn[aria-pressed="true"] { border-color: var(--teal); color: var(--ink); }

.led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3a2020;
  display: inline-block;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.power-btn[aria-pressed="true"] .led {
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--muted);
}

.volume-control input {
  width: 100px;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.credit {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.credit a { color: var(--teal); text-decoration: none; }
.credit a:hover { text-decoration: underline; }

/* Glitch state — subtle jitter, respects reduced motion */
@media (prefers-reduced-motion: no-preference) {
  .radio.glitching {
    animation: radio-jitter 0.15s steps(2, end) infinite;
  }
}

@keyframes radio-jitter {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(1px, -1px); }
  100% { transform: translate(-1px, 1px); }
}
