/* OnAir Web: warm near-black, amber accent, thin borders, 3px corners, mono digits. Mobile first. */
:root {
  --bg: #0c0b0a; --panel: #131110; --frame: #0a0908; --edge: #2c2822; --edge2: #3c362d;
  --text: #d9d1c3; --dim: #8d8473; --accent: #dba64d; --accent-d: #8a6a2f; --bad: #d9674f; --good: #8bbf6a;
  --r: 3px; --gap: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 var(--sans); }
body { min-height: 100vh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--accent); color: #000; padding: 6px 10px; z-index: 9; }

button, select, input { font: inherit; color: var(--text); }
button, select { background: #1a1714; border: 1px solid var(--edge2); border-radius: var(--r); padding: 6px 10px; min-height: 36px; cursor: pointer; }
button:hover, select:hover { border-color: var(--accent-d); }
button.primary { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
button[aria-pressed="true"], button[aria-checked="true"] { background: #2a2113; border-color: var(--accent); color: var(--accent); }
button.primary[aria-pressed="true"] { background: #7b5d28; color: #fff; }
button:disabled { opacity: .4; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=text], input:not([type]), input[type=password] { background: var(--frame); border: 1px solid var(--edge2); border-radius: var(--r); padding: 6px 8px; min-height: 36px; width: 100%; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 28px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); padding: 8px 12px; border-bottom: 1px solid var(--edge); }
.brand { font-weight: 600; } .logo { color: var(--accent); } #srvWhere:not(:empty)::before { content: " \00b7 "; }
.status { display: flex; gap: 6px; }
.pill { border: 1px solid var(--edge2); border-radius: var(--r); padding: 2px 8px; font-family: var(--mono); font-size: 12px; }
.pill.ok { color: var(--good); border-color: #3b5a2a; } .pill.warn { color: var(--accent); border-color: var(--accent-d); } .pill.bad { color: var(--bad); border-color: #6b3326; }

.notice, .banner { margin: 8px 12px 0; padding: 8px 10px; border: 1px solid var(--accent-d); border-radius: var(--r); background: #1a140a; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.notice p, .banner { margin: 0; font-size: 13px; }
.banner { background: #1d100c; border-color: #6b3326; display: block; }

.panel { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r); padding: 10px; margin: 10px 12px; }
.login { max-width: 420px; margin: 20px auto; display: grid; gap: 10px; }
.login h2 { margin: 0; font-size: 16px; } .login label { display: grid; gap: 4px; color: var(--dim); font-size: 12px; }

.app { display: grid; gap: 0; grid-template-columns: 1fr; }
.freqrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap); justify-content: space-between; }
.freq { display: inline-flex; align-items: baseline; font-family: var(--mono); font-size: clamp(30px, 9vw, 56px); line-height: 1.1; color: var(--accent); background: var(--frame); border: 1px solid var(--edge); border-radius: var(--r); padding: 2px 10px; user-select: none; touch-action: none; }
.freq .d { display: inline-block; padding: 0 1px; cursor: ns-resize; border-radius: 2px; }
.freq .d:hover { background: #2a2113; }
.freq .d.act { background: #3a2c14; }
.freq .p { color: var(--dim); } .freq .z { color: #5a4a2a; }
.freqtools { display: flex; gap: 8px; align-items: end; }
.small { display: grid; gap: 2px; font-size: 11px; color: var(--dim); }
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; margin-top: 10px; }
.modes { display: flex; gap: 4px; flex-wrap: wrap; }
.modes button { min-width: 48px; font-family: var(--mono); }
.slider { display: grid; gap: 2px; font-size: 11px; color: var(--dim); min-width: 130px; flex: 1 1 130px; }
.slider output { color: var(--text); float: right; }
.meters { align-items: end; }
.smeter { flex: 2 1 220px; min-width: 200px; }
.sbar { position: relative; height: 14px; background: var(--frame); border: 1px solid var(--edge2); border-radius: var(--r); overflow: hidden; }
.sbar i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #6e5220, var(--accent) 60%, #f1d089); }
.sbar b { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; opacity: .7; left: 0; }
.sticks { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--dim); padding: 0 2px; }
.sread { font-size: 12px; }

.scope .scopebar { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; margin-bottom: 8px; }
.scope .scopebar select { min-height: 32px; } .scope .scopebar button { min-height: 32px; min-width: 36px; }
.scope .small input[type=range] { width: 90px; min-height: 20px; }
#viewText { margin-left: auto; font-size: 12px; }
.canvaswrap { position: relative; border: 1px solid var(--edge); border-radius: var(--r); background: var(--frame); overflow: hidden; touch-action: none; }
.canvaswrap canvas { display: block; width: 100%; }
#spec { height: 170px; } #wf { height: 260px; } .wf { margin-top: 6px; }

.tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 32px; padding: 3px 8px; font-size: 13px; }
.chips button .f { font: 11px var(--mono); color: var(--dim); display: block; }
.chips button:disabled { opacity: .35; }
.markadd { display: flex; gap: 6px; margin-bottom: 8px; }
.marks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.marks li { display: flex; gap: 6px; align-items: center; border: 1px solid var(--edge); border-radius: var(--r); padding: 2px 6px; }
.marks li .go { flex: 1; text-align: left; border: 0; background: none; padding: 4px; min-height: 32px; }
.marks li .go span { font: 12px var(--mono); color: var(--dim); margin-left: 8px; }
.marks li .del { border: 0; background: none; color: var(--dim); min-height: 32px; }
.decout { margin-top: 10px; display: grid; gap: 10px; max-height: 360px; overflow: auto; }
.decout h3 { margin: 0 0 4px; font-size: 12px; color: var(--accent); font-family: var(--mono); font-weight: 600; }
.decout table { border-collapse: collapse; width: 100%; font: 12px var(--mono); }
.decout th, .decout td { border: 1px solid var(--edge); padding: 2px 6px; text-align: left; vertical-align: top; word-break: break-word; }
.decout th { color: var(--dim); font-weight: 500; background: var(--frame); }
.foot { padding: 12px; font-size: 12px; text-align: center; }

@media (min-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .tuner, .scope { grid-column: 1; } .side { grid-column: 2; grid-row: 1 / span 2; }
  #spec { height: 200px; } #wf { height: 340px; }
}
@media (max-width: 520px) {
  .panel { margin: 8px 6px; padding: 8px; }
  .freq { width: 100%; justify-content: center; }
  .freqtools { width: 100%; justify-content: space-between; }
  #viewText { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* the host's frequency ranges (OnAir Web "ranges") */
.rangeinfo { margin: 6px 0; padding: 6px 10px; border: 1px solid var(--edge); border-left: 3px solid #60be8c; border-radius: var(--r); font-size: 12px; }
.rangeinfo p { margin: 2px 0; }
.rangeinfo p.bad b { color: #d6675c; }
.rangeinfo p.ok b { color: #60be8c; }
.modes button:disabled { opacity: .35; }

/* decoders (onair-decoders.js) */
.decout .decview { border: 1px solid var(--edge); border-radius: var(--r); padding: 8px; background: var(--panel); }
.decout .decview p { margin: 0 0 6px; }
.decout canvas.decmap { width: 100%; max-width: 480px; height: auto; aspect-ratio: 8 / 5; background: var(--frame); border: 1px solid var(--edge); display: block; margin-bottom: 6px; }
.decout canvas.decimg { max-width: 100%; height: auto; background: var(--frame); border: 1px solid var(--edge); display: block; margin-bottom: 6px; image-rendering: auto; }
.decout .dectable { max-height: 260px; overflow: auto; }
.decout pre { margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 220px; overflow: auto; }
