:root {
  color-scheme: dark;
  --accent: #a4ef7d;
  --bg: #060907;
  --surface: #090e0a;
  --panel-bg: color-mix(in srgb, var(--surface) 88%, transparent);
  --ink: #e0ebdf;
  --muted: #93a591;
  --line: color-mix(in srgb, var(--accent) 27%, #090e0a);
  --soft: color-mix(in srgb, var(--accent) 8%, #090e0a);
  --warn: #ebcc75;
  --mono: 'Cascadia Code', 'SFMono-Regular', Consolas, monospace;
}
[data-theme="white"] { --accent: #f0f3ef; }
[data-theme="blue"] { --accent: #9c95ff; }
[data-theme="yellow"] { --accent: #ebcc75; }
[data-theme="red"] { --accent: #ff697d; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body {
  margin: 0;
  isolation: isolate;
  border-top: 2px solid var(--accent);
  color: var(--ink);
  background: var(--bg);
  font: 13px/1.55 var(--mono);
}
body::before {
  content: '';
  position: fixed;
  z-index: -1;
  top: 64px;
  left: 50%;
  width: min(1500px, 100vw);
  height: min(86vh, 920px);
  transform: translateX(-50%);
  pointer-events: none;
  background: url('/stinkwind-ghost.webp') center 12% / cover no-repeat;
  opacity: .15;
  filter: grayscale(1);
  mask-image: radial-gradient(ellipse 70% 62% at 50% 38%, #000 22%, transparent 78%);
}
body.scanlines::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, #0002 0 1px, transparent 1px 4px);
}
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--ink); }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; }
button, select, input:not([type="checkbox"], [type="range"]), .control, nav a {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 0;
}
button, .control, nav a { cursor: pointer; text-decoration: none; }
button:hover:not(:disabled), .control:hover, nav a:hover { border-color: var(--accent); background: var(--soft); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type="range"], input[type="checkbox"] { accent-color: var(--accent); }
input[type="range"] { width: 88px; }
select { max-width: 100%; }
button, .control, nav a { font-size: 11px; white-space: nowrap; }
.skip { position: fixed; z-index: 30; top: 10px; left: 10px; padding: 8px; background: var(--bg); transform: translateY(-160%); }
.skip:focus { transform: none; }
.mast {
  min-height: 75px;
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 48px);
  padding: 14px max(3.2vw, calc((100vw - 1520px) / 2));
  border-bottom: 1px solid var(--line);
  background: #050705;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-skull {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  font: 29px/1 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  filter: drop-shadow(0 0 6px var(--accent));
  animation: skull-pulse 3.2s ease-in-out infinite;
}
@keyframes skull-pulse {
  0%, 100% { transform: scale(.96); filter: drop-shadow(0 0 5px var(--accent)); }
  50% { transform: scale(1.04); filter: drop-shadow(0 0 10px var(--accent)); }
}
.brand strong { display: block; font-size: 23px; letter-spacing: .22em; line-height: 1; }
.brand small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; letter-spacing: .25em; }
.mast-label { margin-left: auto; color: var(--muted); font-size: 10px; letter-spacing: .14em; }
nav { display: flex; flex-wrap: wrap; gap: 7px; }
nav a.selected, .solid, button.solid { background: var(--accent); color: #070b07; border-color: var(--accent); font-weight: 750; }
nav a.selected:hover, button.solid:hover:not(:disabled) { background: var(--ink); }
main { width: min(93.6%, 1520px); margin: auto; }
.hero { min-height: 176px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 23px 0; }
.eyebrow { font-size: 10px; color: var(--accent); letter-spacing: .12em; font-weight: 600; }
.kicker { margin: 8px 0 4px; font-size: 10px; letter-spacing: .14em; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; background: currentColor; color: var(--accent); }
h1 { font-size: clamp(25px, 3.3vw, 47px); line-height: 1.2; letter-spacing: -.045em; color: var(--accent); text-shadow: 0 0 18px var(--line); }
h1 span { color: var(--ink); }
.hero-copy { margin-top: 8px; color: var(--muted); }
#system { color: var(--accent); }
.clockbox { min-width: 190px; padding: 13px 17px; border: 1px solid var(--line); background: #050805dc; }
.clockbox time { display: block; font-size: clamp(22px, 3vw, 34px); line-height: 1.2; letter-spacing: .07em; color: var(--accent); font-variant-numeric: tabular-nums; }
.muted, .fine { color: var(--muted); }
.fine { font-size: 11px; }
.strip { display: grid; grid-template-columns: 1.2fr repeat(4, 1fr); border: 1px solid var(--line); background: var(--panel-bg); }
.strip div { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 10px 15px; border-right: 1px solid var(--line); }
.strip div:last-child { border-right: 0; }
.strip strong { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.strip small { font-size: 10px; color: var(--muted); }
.section-label { display: flex; justify-content: space-between; gap: 12px; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--accent); font-size: 10px; letter-spacing: .11em; }
.section-label span:last-child { color: var(--muted); text-align: right; }
.columns { display: grid; gap: 12px; }
.primary { grid-template-columns: 1fr 1fr; }
.secondary { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--panel-bg); }
.panel-head { min-height: 62px; padding: 9px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
h2 { color: var(--accent); font-size: clamp(13px, 1.5vw, 17px); letter-spacing: .055em; }
h3 { margin: 14px 0 6px; color: var(--accent); font-size: 11px; letter-spacing: .08em; }
.panel-body { padding: 13px 14px; }
.badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 4px 7px; font-size: 10px; white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.good, .good { color: var(--accent); }
.badge.warn, .warn { color: var(--warn); }
.tuner { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 8px 12px 10px; border: 1px solid var(--line); background: var(--bg); }
.dial, .station { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 11px; }
.dial strong { font-size: clamp(28px, 4.3vw, 55px); line-height: 1; letter-spacing: -.06em; color: var(--accent); text-shadow: 0 0 15px var(--line); }
.dial span, .station span { font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.station { flex-direction: column; align-items: flex-end; gap: 0; text-align: right; }
.station strong { font-size: 18px; }
.radio-controls, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 7px; }
.volume { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.radio-controls .control { margin-left: auto; }
.waterfall { margin-top: 12px; }
.waterfall-head { display: flex; justify-content: space-between; gap: 8px; padding-right: 22px; }
.waterfall-grid { display: grid; grid-template-columns: minmax(0, 1fr) 16px; gap: 6px; margin: 4px 0; }
.waterfall-screen { position: relative; min-width: 0; border: 1px solid var(--line); background: #040905; }
#spectrum { display: block; width: 100%; height: 124px; }
.waterfall-screen p { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; color: var(--muted); text-align: center; font-size: 10px; }
.frequency-axis { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 9px; line-height: 1; }
.receiver-list { margin-top: 11px; border-top: 1px solid var(--line); }
.receiver-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; font-size: 11px; }
.receiver-row:last-child { border-bottom: 0; }
.receiver-row strong { font-weight: 600; }
.receiver-row span:last-child { text-align: right; }
.receiver-presets { margin-top: 10px; border-top: 1px solid var(--line); }
.presets-head, .preset-row, .preset-links { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.presets-head, .preset-row { justify-content: space-between; padding-block: 5px; }
.presets-head h3 { margin: 0; }
.preset-row { border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .04em; }
.preset-links .control { padding: 4px 7px; }
.preset-links .control[aria-current="true"] { border-color: var(--accent); color: var(--accent); background: var(--soft); }
.message-line { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.preamble { color: var(--accent); font-size: clamp(25px, 4vw, 41px); font-weight: 750; letter-spacing: .12em; line-height: 1.15; overflow-wrap: anywhere; }
.transcript { overflow-wrap: anywhere; line-height: 1.8; margin: 10px 0; background: var(--bg); border: 1px solid var(--line); padding: 8px 10px; letter-spacing: .13em; }
.transcript .char { display: inline-block; border: 0; padding: 0 2px; background: transparent; color: inherit; font-size: inherit; }
.transcript .char.active { background: var(--accent); color: var(--bg); }
.transcript .char.unknown { color: var(--warn); }
.rail { display: grid; gap: 12px; }
#filters { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 12px; }
#filters label:not(.check), .settings-grid label:not(.check) { display: grid; gap: 4px; }
label > span { color: var(--muted); font-size: 9px; letter-spacing: .07em; }
label.search { flex: 1 1 185px; }
.check { display: flex; align-items: center; gap: 5px; min-height: 30px; font-size: 10px; color: var(--muted); }
.small-button { padding: 5px 7px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; font-size: 11px; }
th { color: var(--muted); font-size: 9px; letter-spacing: .07em; text-align: left; }
th, td { border-bottom: 1px solid var(--line); padding: 7px 6px; }
tbody tr:hover { background: var(--soft); }
.record-link { padding: 0; border: 0; color: var(--accent); background: transparent; font-weight: 650; }
.record-link:hover:not(:disabled) { text-decoration: underline; background: none; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; color: var(--muted); font-size: 11px; }
.pager button { padding: 3px 9px; font-size: 14px; }
.chart { display: block; width: 100%; min-height: 98px; max-height: 132px; color: var(--accent); background: var(--bg); border: 1px solid var(--line); }
.chart .counts { fill: currentColor; opacity: .85; }
.chart .partial { fill: var(--warn); opacity: .8; }
.chart .axis { stroke: var(--line); }
.chart-labels { display: flex; justify-content: space-between; margin: 4px 0 7px; color: var(--muted); font-size: 10px; }
.alert-row { border-bottom: 1px solid var(--line); padding: 5px 0; }
.alert-row:last-child { border-bottom: 0; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 14px 0 26px; color: var(--muted); font-size: 10px; }
dialog { max-height: calc(100dvh - 36px); width: min(680px, calc(100% - 24px)); padding: 0; border: 1px solid var(--accent); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #000c; backdrop-filter: blur(3px); }
dialog .panel-body { display: grid; gap: 10px; }
audio { width: 100%; max-width: 100%; }
.settings-grid { grid-template-columns: 1fr 1fr; align-items: end; }
.settings-rule, .settings-grid p { grid-column: 1 / -1; }
.settings-rule { border-top: 1px solid var(--line); }
.copy-pad { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.copy-pad input { flex: 1; min-width: 130px; }
@media (max-width: 900px) {
  .mast-label { display: none; }
  nav { margin-left: auto; }
  .secondary { grid-template-columns: minmax(0, 1fr); }
  .rail { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 660px) {
  body { font-size: 12px; }
  .mast { flex-wrap: wrap; gap: 12px; }
  nav { margin-left: 0; }
  .hero { flex-wrap: wrap; gap: 12px; }
  .clockbox { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 7px 9px; }
  .clockbox time { font-size: 18px; }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip div { border-bottom: 1px solid var(--line); padding: 8px; }
  .strip div:nth-child(even) { border-right: 0; }
  .strip div:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .primary, .rail { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .brand-skull { animation: none; }
}
