:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  --bg: #0b1016;
  --panel: #131c25;
  --panel-raised: #1a2632;
  --line: #2a3a49;
  --text: #e7edf3;
  --muted: #91a3b3;
  --rx1: #55d9ee;
  --rx2: #e8bd68;
  --tx: #fa8f82;
  --control-text: #ffffff;
  --heading-bg: #17222c;
  --text-strong: #dce8ef;
  --text-secondary: #b8c8d4;
  --text-soft: #7c97a9;
  --line-soft: #34404a;
  --rx1-bg: #132a34;
  --rx1-border: #338496;
  --rx1-tag-bg: #203d49;
  --rx1-tag-text: #a9dbe4;
  --rx2-bg: #2b291f;
  --rx2-border: #a18a53;
  --rx2-tag-bg: #453d28;
  --rx2-tag-text: #ebd49f;
  --frequency-bg: #151e27;
  --warm-text: #bdb7a7;
  --tx-secondary: #d5b6b0;
  --sidebar-bg: #101923;
  --button-bg: #1b2834;
  --button-border: #314454;
  --accent-bg: #192f3b;
  --accent-border: #345e70;
  --accent-text: #8de0ec;
  --filter-bg: #14232e;
  --track: #091721;
  --thumb: #d8e5ee;
  --thumb-border: #eff6fa;
  --thumb-tx: #fac1ba;
  --thumb-tx-border: #ffe3df;
  --shadow: #0009;
  --shadow-soft: #0005;
  --shadow-thumb: #0007;
  --axis-bg: #17222d;
  --axis-text: #bdcdd8;
  --axis-hover: #203342;
  --footer-bg: #111b24;
  --ready: #7dd5ad;
  --offline: #708290;
  --error: #ffaaa1;
  --error-dot: #f4877c;
  --sending-dot: #ff8e80;
  --audio-off-bg: #7a2d35;
  --audio-off-border: #bd555f;
  --danger-text: #ffe9e6;
  --audio-on-bg: #215c43;
  --audio-on-border: #419a6d;
  --success-text: #d9ffeb;
  --active-bg: #18372e;
  --active-border: #46866e;
  --active-text: #95ddbd;
  --ptt-bg: #693135;
  --ptt-border: #a55252;
  --ptt-hint: #e2b9b8;
  --ptt-sending-bg: #a93740;
  --ptt-sending-border: #ff9b91;
  --mute-bg: #34242a;
  --mute-border: #824a4c;
  --mute-active-bg: #73333b;
  --message-bg: #382327;
  --message-border: #87514d;
  --message-text: #ffd3ca;
  --warning-bg: #302b20;
  --warning-border: #7a6845;
  --warning-text: #ead6a5;
  --dialog-bg: #15212c;
  --dialog-border: #425b6e;
  --backdrop: #02080ec9;
  --fieldset-border: #304758;
  --input-bg: #0e1a24;
  --input-border: #3d5365;
  --scroll-thumb: #3b5366;
  --scroll-track: #111c26;
  --monitor-bg: #111b23;
  --locked: #71ecad;
  --searching: #ebbf68;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf2f7;
  --panel: #ffffff;
  --panel-raised: #f5f8fb;
  --line: #c4d0dc;
  --text: #203244;
  --muted: #51657a;
  --rx1: #006d82;
  --rx2: #8b5b08;
  --tx: #a83d3b;
  --control-text: #24384a;
  --heading-bg: #e7eef5;
  --text-strong: #203244;
  --text-secondary: #40566b;
  --text-soft: #4f6579;
  --line-soft: #c4d0dc;
  --rx1-bg: #e0f0f4;
  --rx1-border: #5593a5;
  --rx1-tag-bg: #c8e5ec;
  --rx1-tag-text: #145e70;
  --rx2-bg: #fff0d1;
  --rx2-border: #a97e30;
  --rx2-tag-bg: #f8dfaa;
  --rx2-tag-text: #754904;
  --frequency-bg: #f5f7fa;
  --warm-text: #6c593b;
  --tx-secondary: #85504b;
  --sidebar-bg: #f8fafc;
  --button-bg: #e9eff5;
  --button-border: #aebfce;
  --accent-bg: #dcecf2;
  --accent-border: #82afbe;
  --accent-text: #145e70;
  --filter-bg: #f0f6fa;
  --track: #c7d4e0;
  --thumb: #ffffff;
  --thumb-border: #668399;
  --thumb-tx: #aa4750;
  --thumb-tx-border: #80343d;
  --shadow: #263b5133;
  --shadow-soft: #203b511a;
  --shadow-thumb: #27445c26;
  --axis-bg: #e7eef5;
  --axis-text: #354f65;
  --axis-hover: #d6e3ed;
  --footer-bg: #f0f4f8;
  --ready: #248450;
  --offline: #627789;
  --error: #b52b3a;
  --error-dot: #bd3442;
  --sending-dot: #bd3442;
  --audio-off-bg: #fbe1e4;
  --audio-off-border: #c66d78;
  --danger-text: #8a2432;
  --audio-on-bg: #d7f3e5;
  --audio-on-border: #4b9f75;
  --success-text: #175b3b;
  --active-bg: #d7f3e5;
  --active-border: #4b9f75;
  --active-text: #175b3b;
  --ptt-bg: #f5dce0;
  --ptt-border: #b76a76;
  --ptt-hint: #784550;
  --ptt-sending-bg: #b82d40;
  --ptt-sending-border: #a51f32;
  --mute-bg: #fae9eb;
  --mute-border: #b76a76;
  --mute-active-bg: #a83d3b;
  --message-bg: #fff0ee;
  --message-border: #d48b83;
  --message-text: #8e302a;
  --warning-bg: #fff6df;
  --warning-border: #bea05f;
  --warning-text: #72500c;
  --dialog-bg: #ffffff;
  --dialog-border: #aebfce;
  --backdrop: #20324466;
  --fieldset-border: #c4d0dc;
  --input-bg: #ffffff;
  --input-border: #9eafbf;
  --scroll-thumb: #99adbf;
  --scroll-track: #e9eff5;
  --monitor-bg: #f5f8fb;
  --locked: #17754b;
  --searching: #8a5a08;
}

    * { box-sizing: border-box; }
    body { margin: 0; background: var(--bg); color: var(--text); }
    button { font: inherit; color: inherit; }
    button:disabled { opacity: 1; cursor: default; -webkit-text-fill-color: currentColor; }
    svg { display: block; }
    .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
    .app { max-width: 1900px; margin: 0 auto; padding: 0 24px 16px; }
    .masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; }
    .brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 750; letter-spacing: .08em; }
    .brand .icon { color: var(--rx1); width: 24px; height: 24px; }
    .brand small { color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .12em; padding-left: 11px; border-left: 1px solid var(--line); }
    .preview-label { color: var(--warm-text); font-size: 11px; letter-spacing: .07em; display: flex; align-items: center; gap: 8px; }
    .preview-label::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--warning-text); }
    .status-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
    .status-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; background: var(--heading-bg); border-bottom: 1px solid var(--line); }
    .station-label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .13em; }
    .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ready); flex-shrink: 0; }
    .connection-status { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 18px; font-size: 11px; color: var(--text-secondary); }
    .connection-status span { display: flex; align-items: center; gap: 6px; }
    .connection-status .live-dot { width: 5px; height: 5px; }
    .role { padding-left: 15px; border-left: 1px solid var(--line-soft); color: var(--text-strong); }
    .role .icon { width: 14px; height: 14px; color: var(--muted); }
    .frequencies { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 1fr); align-items: start; padding: 15px 18px 14px; gap: 24px; }
    .frequency-button { border: 0; background: transparent; text-align: left; padding: 0; display: block; width: 100%; }
    .rx-main { padding: 10px 13px 9px; border: 1px solid var(--rx1-border); border-radius: 6px; background: var(--rx1-bg); box-shadow: inset 3px 0 var(--rx1); }
    .frequency-label { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--rx1); }
    .selected-tag { color: var(--rx1-tag-text); background: var(--rx1-tag-bg); padding: 3px 6px; border-radius: 3px; font-size: 9px; letter-spacing: .07em; }
    .frequency-value { display: flex; align-items: baseline; gap: 11px; white-space: nowrap; margin-top: 5px; font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.045em; line-height: 1.1; }
    .frequency-value strong { font-size: clamp(27px, 3.15vw, 48px); font-weight: 550; }
    .frequency-value .precision { color: var(--text-secondary); }
    .unit { font: 11px "Segoe UI", system-ui, sans-serif; letter-spacing: .04em; color: var(--muted); }
    .tx-row { padding: 12px 14px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 7px 20px; font-size: 13px; }
    .tx-uplink { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
    .tx-tag { color: var(--tx); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
    .tx-value, .downlink-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 500; letter-spacing: -.025em; }
    .tx-value { font-size: 18px; }
    .tx-return { color: var(--muted); display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; font-size: 11px; }
    .tx-return .downlink-value { font-size: 14px; color: var(--tx-secondary); }
    .cursor-frequency { color: var(--muted); font-size: 10px; display: grid; gap: 3px; }
    .cursor-frequency > div { display: grid; grid-template-columns: 90px 112px auto; align-items: baseline; gap: 5px; white-space: nowrap; }
    .cursor-value { color: var(--rx1); font: 13px var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
    .rx-secondary { padding: 11px 14px; border: 1px solid var(--line-soft); border-radius: 6px; margin-top: 0; background: var(--frequency-bg); }
    .rx-secondary .frequency-label { color: var(--rx2); }
    .rx-secondary .frequency-value { gap: 8px; margin-top: 10px; }
    .rx-secondary .frequency-value strong { font-size: clamp(22px, 2.1vw, 32px); }
    .rx-secondary .precision { color: var(--warm-text); }
    .monitor-caption { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--warm-text); font-size: 10px; }
    .monitor-caption .icon { width: 13px; height: 13px; }
    .workspace { display: grid; grid-template-columns: 194px minmax(0, 1fr); gap: 18px; margin-top: 16px; }
    .sidebar { align-self: stretch; border: 1px solid var(--line); border-radius: 8px; background: var(--sidebar-bg); overflow: hidden; }
    .sidebar-heading { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; padding: 15px 14px 11px; }
    .menu-button { display: flex; align-items: center; gap: 11px; width: calc(100% - 16px); margin: 0 8px 8px; padding: 12px 11px; background: var(--button-bg); border: 1px solid var(--button-border); border-radius: 5px; text-align: left; font-size: 12px; font-weight: 600; }
    .menu-button .icon { width: 18px; height: 18px; color: var(--text-secondary); }
    .menu-button .chevron { margin-left: auto; width: 13px; height: 13px; }
    .menu-button.active { color: var(--rx1); border-color: var(--accent-border); background: var(--accent-bg); margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
    .menu-button.active .icon { color: var(--rx1); }
    .filter-content { margin: 0 8px; padding: 14px 10px; border: 1px solid var(--accent-border); border-top: 0; border-radius: 0 0 5px 5px; background: var(--filter-bg); }
    .field-label { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
    .field-label strong { color: var(--text-secondary); font-family: var(--mono); font-size: 11px; font-weight: 500; white-space: nowrap; }
    .filter-presets { display: flex; gap: 4px; margin: 9px 0 17px; }
    .preset { flex: 1; font-family: var(--mono); font-size: 10px; border: 1px solid var(--button-border); border-radius: 3px; background: var(--button-bg); padding: 6px 0; }
    .preset.selected { color: var(--accent-text); background: var(--accent-bg); border-color: var(--accent-border); }
    .static-slider { position: relative; height: 5px; border-radius: 3px; background: var(--track); border: 1px solid var(--line-soft); margin: 13px 4px 21px; }
    .static-slider::before { content: ""; display: block; height: 100%; width: var(--value, 50%); background: var(--slider-color, var(--rx1)); border-radius: inherit; }
    .static-slider::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--thumb); border: 2px solid var(--thumb-border); left: var(--value, 50%); top: 50%; transform: translate(-50%, -50%); box-shadow: 0 1px 5px var(--shadow-thumb); }
    .filter-range { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font: 9px var(--mono); margin-top: -12px; }
    .filter-note { margin: 15px 0 0; font-size: 9px; line-height: 1.6; color: var(--text-soft); border-top: 1px solid var(--line-soft); padding-top: 9px; }
    .mobile-filter-summary, .touch-hint, .touch-mode { display: none; }
    .visuals { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
    .display { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #080f16; }
    .display-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 39px; padding: 8px 13px; background: var(--heading-bg); border-bottom: 1px solid var(--line); }
    .display-title { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
    .display-title h2 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: .06em; }
    .display-title span { color: var(--muted); font: 10px var(--mono); white-space: nowrap; }
    .display-meta { display: flex; gap: 16px; align-items: center; color: var(--muted); font-size: 10px; white-space: nowrap; }
    .legend { display: flex; align-items: center; gap: 11px; }
    .legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; }
    .legend i { display: inline-block; width: 11px; height: 2px; background: currentColor; }
    .rx1-color { color: var(--rx1); }
    .rx2-color { color: var(--rx2); }
    .tx-color { color: var(--tx); }
    .wheel-step { padding-left: 12px; border-left: 1px solid var(--line-soft); }
    .wheel-step b { color: var(--text-secondary); font-family: var(--mono); font-weight: 500; }
    .plot-body { position: relative; }
    .spectrum { display: block; width: 100%; height: clamp(88px, 10.8vh, 130px); }
    .plot-label { position: absolute; left: 9px; font: 8px var(--mono); color: #698193; pointer-events: none; }
    .plot-label.top { top: 8px; }
    .plot-label.bottom { bottom: 7px; }
    .frequency-axis { position: relative; height: 28px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--axis-bg); color: var(--axis-text); font: 10px var(--mono); font-variant-numeric: tabular-nums; }
    .frequency-axis > span { position: absolute; top: 50%; left: var(--position); transform: translate(-50%, -50%); white-space: nowrap; }
    .frequency-axis > span:first-child { left: 10px; transform: translateY(-50%); }
    .frequency-axis > span:last-of-type { left: auto; right: 10px; transform: translateY(-50%); }
    .fullband-axis-row { position: relative; }
    .fullband-frequency-axis > span:last-of-type { right: 38px; }
    .axis-switch { position: absolute; top: 0; right: 0; bottom: 0; width: 30px; padding: 0; border: 1px solid var(--line-soft); border-right: 0; border-radius: 0; background: var(--axis-bg); font: 17px system-ui, sans-serif; color: var(--rx1); cursor: pointer; touch-action: manipulation; }
    .axis-switch:hover { background: var(--axis-hover); }
    .axis-switch:focus-visible { outline: 2px solid var(--rx1); outline-offset: -2px; }
    .bandplan-axis { overflow: hidden; background: #0d1821; }
    .bandplan-segment { position: absolute; top: 0; bottom: 0; color: #fff; }
    .bandplan-label { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap; text-shadow: 0 1px 1px #0008; }
    .bandplan-beacon { background: #b7373e; }
    .bandplan-cw { background: #176f91; }
    .bandplan-nb-digital { background: #754b91; }
    .bandplan-digital { background: #a57813; }
    .bandplan-ssb { background: #467a38; }
    .bandplan-broadcast { background: #89642e; }
    .bandplan-emergency { background: #9d4433; }
    .bandplan-mixed { background: #877c19; }
    @media (max-width: 360px) { .bandplan-axis + .axis-switch { width: 24px; } }
    .axis-unit { color: var(--axis-text); font-size: 8px; }
    .waterfall { position: relative; overflow: hidden; height: clamp(100px, 14.4vh, 175px); background: #071522; }
    .waterfall > img { display: block; width: 100%; height: 100%; object-fit: fill; }
    .waterfall-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
    .display-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 11px; background: var(--footer-bg); color: var(--text-soft); font-size: 9px; border-top: 1px solid var(--line-soft); }
    .display-footer .filter-caption { color: var(--axis-text); }
    .qso-controls { margin-top: 16px; display: grid; grid-template-columns: 194px minmax(0, 1fr) minmax(0, 1fr) 154px; gap: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
    .copy-buttons { display: grid; grid-template-columns: 1fr; gap: 7px; }
    .copy-button { display: flex; align-items: center; justify-content: center; gap: 11px; padding: 10px 8px; background: var(--button-bg); border: 1px solid var(--button-border); border-radius: 5px; font-family: var(--mono); font-size: 12px; }
    .copy-button .arrow { color: var(--rx1); font-size: 18px; line-height: 1; }
    .copy-button:last-child .arrow { color: var(--tx); }
    .qso-control { min-width: 0; padding: 7px 18px 0; border-left: 1px solid var(--line-soft); }
    .control-heading { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-strong); }
    .control-heading .icon { width: 18px; height: 18px; color: var(--text-secondary); }
    .control-heading output { margin-left: auto; color: var(--text-strong); font: 12px var(--mono); white-space: nowrap; }
    .qso-control .static-slider { margin: 24px 4px 12px; height: 6px; }
    .qso-control .static-slider::after { width: 16px; height: 16px; }
    .slider-labels { display: flex; align-items: center; justify-content: space-between; color: var(--text-soft); font: 9px var(--mono); }
    .ptt { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; border: 1px solid var(--ptt-border); border-radius: 6px; background: var(--ptt-bg); color: var(--danger-text); min-height: 91px; }
    .ptt .icon { width: 24px; height: 24px; }
    .ptt strong { font-size: 23px; letter-spacing: .08em; font-weight: 650; }
    .ptt small { font-size: 9px; color: var(--ptt-hint); }
    .page-footer { display: flex; justify-content: space-between; gap: 15px; color: var(--text-soft); font-size: 10px; padding: 12px 2px 0; }
    .page-footer strong { color: var(--text-secondary); font-weight: 500; }
    .mobile-note { display: none; }
    @media (min-width: 801px) {
      .app { height: 100dvh; min-height: 700px; display: grid; grid-template-rows: 46px auto minmax(0, 1fr) auto auto; }
      .masthead { min-height: 46px; }
      .status-top { padding-top: 8px; padding-bottom: 8px; }
      .frequencies { padding: 12px 16px; }
      .frequency-value strong { font-size: clamp(27px, 2.8vw, 42px); }
      .rx-main { padding-top: 8px; padding-bottom: 8px; }
      .tx-row { padding-top: 8px; }
      .workspace { height: auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
      .visuals { min-height: 0; gap: 12px; }
      .display { display: grid; grid-template-rows: 35px minmax(30px, .78fr) 26px minmax(40px, 1fr) 22px; flex: 1; min-height: 0; }
      .display-heading { min-height: 0; padding-top: 6px; padding-bottom: 6px; }
      .plot-body { min-height: 0; }
      .spectrum, .waterfall { height: 100%; min-height: 0; }
      .frequency-axis { height: 26px; }
      .display-footer { min-height: 0; padding-top: 3px; padding-bottom: 3px; }
      .sidebar { min-height: 0; overflow: auto; }
      .qso-controls { padding-top: 12px; padding-bottom: 12px; }
      .ptt { min-height: 78px; }
      .page-footer { padding-top: 10px; font-size: 9px; }
    }
    @media (min-width: 1650px) {
      .workspace { grid-template-columns: 218px minmax(0, 1fr); }
      .qso-controls { grid-template-columns: 218px minmax(0, 1fr) minmax(0, 1fr) 175px; }
    }
    @media (max-width: 1100px) {
      .app { padding-left: 16px; padding-right: 16px; }
      .workspace { grid-template-columns: 168px minmax(0, 1fr); gap: 12px; }
      .frequencies { grid-template-columns: minmax(0, 1.45fr) minmax(265px, 1fr); gap: 16px; }
      .frequency-value strong { font-size: 33px; }
      .rx-secondary .frequency-value strong { font-size: 25px; }
      .tx-row { gap: 5px 14px; }
      .tx-value { font-size: 16px; }
      .qso-controls { grid-template-columns: 168px minmax(0, 1fr) minmax(0, 1fr) 130px; gap: 10px; padding: 12px; }
      .qso-control { padding-left: 12px; padding-right: 6px; }
      .control-heading { font-size: 11px; gap: 6px; }
      .wheel-step { padding-left: 9px; }
      .display-meta { gap: 10px; }
      .axis-optional { display: none; }
    }
    @media (max-width: 800px) {
      .app { padding-left: 12px; padding-right: 12px; }
      .brand small { display: none; }
      .frequencies { grid-template-columns: minmax(0, 1fr) minmax(220px, .85fr); padding: 12px; gap: 12px; }
      .frequency-value strong { font-size: 27px; }
      .frequency-value { gap: 7px; }
      .rx-secondary .frequency-value strong { font-size: 21px; }
      .rx-secondary { padding: 11px 10px; }
      .rx-main { padding-left: 10px; }
      .tx-row { padding-left: 2px; }
      .status-top { padding-left: 12px; padding-right: 12px; }
      .station-label { font-size: 9px; letter-spacing: .08em; }
      .connection-status { gap: 8px 10px; font-size: 10px; }
      .workspace { grid-template-columns: minmax(0, 1fr); gap: 11px; margin-top: 12px; }
      .sidebar { display: flex; align-items: center; gap: 8px; padding: 8px; }
      .sidebar-heading, .filter-content { display: none; }
      .menu-button { width: auto; margin: 0; padding: 10px 13px; }
      .menu-button.active { margin: 0; border-radius: 5px; }
      .menu-button.active .chevron { transform: rotate(-90deg); }
      .mobile-filter-summary { display: block; font: 10px var(--mono); color: var(--text-soft); margin-left: auto; padding-right: 4px; }
      .qso-controls { position: sticky; bottom: 0; z-index: 2; background: var(--heading-bg); box-shadow: 0 -5px 20px var(--shadow-soft); grid-template-columns: 155px minmax(0, 1fr) 126px; gap: 12px; margin-top: 12px; }
      .copy-buttons { grid-column: 1; grid-row: 1 / 3; align-content: center; }
      .qso-control { grid-column: 2; border-left: 1px solid var(--line-soft); padding-top: 2px; padding-bottom: 0; }
      .qso-control .static-slider { margin-top: 13px; margin-bottom: 5px; }
      .slider-labels { display: none; }
      .ptt { grid-column: 3; grid-row: 1 / 3; }
      .spectrum { height: 100px; }
      .waterfall { height: 130px; }
    }
    @media (max-width: 560px) {
      .app { padding: 0 8px 12px; }
      .masthead { min-height: 46px; gap: 6px; }
      .brand { gap: 7px; font-size: 12px; }
      .brand .icon { width: 21px; height: 21px; }
      .preview-label { font-size: 8px; letter-spacing: .025em; gap: 5px; }
      .status-panel { border-radius: 7px; }
      .status-top { padding: 8px 10px; }
      .station-label { display: none; }
      .connection-status { justify-content: space-between; width: 100%; font-size: 9px; gap: 5px; }
      .role { padding-left: 8px; }
      .frequencies { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 10px; }
      .rx-main { padding: 10px 12px; }
      .frequency-value strong { font-size: clamp(27px, 7.7vw, 40px); }
      .frequency-value { gap: 9px; }
      .frequency-label { font-size: 10px; }
      .selected-tag { font-size: 8px; }
      .tx-row { padding: 10px 3px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
      .tx-value { font-size: 18px; }
      .tx-return { padding-left: 26px; }
      .tx-return .downlink-value { font-size: 13px; }
      .rx-secondary { padding: 10px 11px; }
      .rx-secondary .frequency-value { margin-top: 5px; }
      .rx-secondary .frequency-value strong { font-size: 23px; }
      .monitor-caption { position: absolute; right: 11px; top: 0; margin-top: 10px; font-size: 9px; }
      .rx-secondary { position: relative; }
      .touch-hint { display: block; color: var(--text-soft); font-size: 8px; margin-top: 7px; letter-spacing: .015em; }
      .rx-secondary .touch-hint { color: var(--warm-text); }
      .tx-touch-hint { margin-left: 26px; margin-top: 2px; color: var(--tx-secondary); }
      .sidebar { gap: 7px; padding: 7px; border-radius: 6px; }
      .menu-button { padding: 9px 10px; gap: 7px; font-size: 11px; }
      .menu-button .icon { width: 16px; height: 16px; }
      .menu-button .chevron { display: none; }
      .mobile-filter-summary { font-size: 9px; }
      .touch-mode { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
      .touch-mode-label { color: var(--text-soft); font-size: 10px; }
      .segmented { display: flex; border: 1px solid var(--button-border); border-radius: 5px; padding: 2px; background: var(--scroll-track); }
      .segmented button { border: 0; border-radius: 3px; padding: 7px 12px; font-size: 10px; background: transparent; color: var(--text-soft); }
      .segmented .chosen { background: var(--accent-bg); color: var(--accent-text); }
      .visuals { gap: 11px; }
      .display { border-radius: 6px; }
      .display-heading { padding: 8px 9px; gap: 6px; min-height: 36px; }
      .display-title { gap: 7px; }
      .display-title h2 { font-size: 10px; }
      .display-title span { font-size: 9px; }
      .legend { gap: 7px; }
      .legend span { font-size: 8px; gap: 3px; }
      .legend i { width: 7px; }
      .wheel-step { display: none; }
      .spectrum { height: 85px; }
      .waterfall { height: 105px; }
      .frequency-axis { height: 26px; font-size: 9px; padding-left: 7px; padding-right: 7px; }
      .axis-mobile-hide { display: none; }
      .display-footer { padding: 6px 8px; font-size: 8px; }
      .desktop-note { display: none; }
      .mobile-note { display: inline; }
      .qso-controls { position: sticky; bottom: 0; z-index: 2; margin-top: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 85px; gap: 12px 9px; padding: 12px 10px max(12px, env(safe-area-inset-bottom)); border-color: var(--button-border); border-radius: 7px 7px 0 0; background: var(--heading-bg); box-shadow: 0 -5px 20px var(--shadow-soft); }
      .copy-buttons { grid-column: 1 / 3; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
      .copy-button { padding: 9px 4px; font-size: 11px; gap: 7px; }
      .copy-button .arrow { font-size: 16px; }
      .qso-control { grid-column: auto; grid-row: 2; border-left: 0; padding: 1px 2px 2px; }
      .control-heading { gap: 5px; font-size: 9px; flex-wrap: wrap; }
      .control-heading .icon { width: 14px; height: 14px; }
      .control-heading output { font-size: 10px; margin-left: auto; }
      .qso-control .static-slider { margin-top: 16px; height: 5px; }
      .qso-control .static-slider::after { width: 14px; height: 14px; }
      .ptt { grid-row: 1 / 3; grid-column: 3; min-height: 97px; gap: 5px; }
      .ptt .icon { width: 24px; height: 24px; }
      .ptt strong { font-size: 22px; }
      .ptt small { font-size: 8px; }
      .page-footer { display: block; font-size: 9px; padding: 10px 2px 0; line-height: 1.7; }
      .page-footer span { display: block; }
    }
    @media (max-width: 360px) {
      .preview-label { font-size: 7px; }
      .unit { font-size: 9px; }
      .mobile-filter-summary { font-size: 8px; }
      .qso-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 73px; padding-left: 8px; padding-right: 8px; gap: 11px 7px; }
      .control-heading output { width: 100%; margin-left: 19px; }
      .copy-button { font-size: 10px; gap: 5px; }
    }

/* Live controls share the geometry of the approved static layout. */
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .45; }
button:not(:disabled):hover { filter: brightness(1.15); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--rx1); outline-offset: 3px; }
.session-actions { display: flex; align-items: center; gap: 7px; }
.small-button, .primary-button { border: 1px solid var(--button-border); border-radius: 5px; padding: 7px 12px; background: var(--button-bg); color: var(--text); font-size: 11px; }
.primary-button { background: var(--accent-bg); border-color: var(--accent-border); }
.small-button.active { border-color: var(--active-border); color: var(--active-text); background: var(--active-bg); }
#audio { background: var(--audio-off-bg); border-color: var(--audio-off-border); color: var(--danger-text); }
#audio.active { background: var(--audio-on-bg); border-color: var(--audio-on-border); color: var(--success-text); }
.role strong { font-weight: 500; }
.live-dot.offline { background: var(--offline); }
.live-dot.error { background: var(--error-dot); }
.live-dot.sending { background: var(--sending-dot); box-shadow: 0 0 6px #ff8e8070; }
.frequency-button { touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.frequency-button:not(.selected) { background: var(--frequency-bg); border-color: var(--line-soft); box-shadow: none; }
.rx-secondary.selected { border-color: var(--rx2-border); box-shadow: inset 3px 0 var(--rx2); background: var(--rx2-bg); }
.rx-secondary .selected-tag { background: var(--rx2-tag-bg); color: var(--rx2-tag-text); }
.rx-secondary .frequency-label { min-height: 18px; }
.tx-uplink { border: 0; background: transparent; padding: 0; color: inherit; touch-action: pan-y; user-select: none; }
.frequency-button.swiping, .tx-uplink.swiping { outline: 1px solid var(--accent-border); outline-offset: 3px; }
.range { display: block; width: calc(100% - 8px); margin: 13px 4px 21px; padding: 0; height: 5px; border: 0; border-radius: 4px; appearance: none; -webkit-appearance: none; background: linear-gradient(to right, var(--range-color, var(--rx1)) 0 var(--fill, 50%), var(--track) var(--fill, 50%) 100%); cursor: pointer; }
.range::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; background: var(--thumb); border: 2px solid var(--thumb-border); border-radius: 50%; box-shadow: 0 1px 4px #0008; }
.range::-moz-range-thumb { width: 11px; height: 11px; background: var(--thumb); border: 2px solid var(--thumb-border); border-radius: 50%; }
.range:disabled { cursor: default; }
.qso-control .range { height: 6px; margin: 24px 4px 12px; }
.qso-control .range::-webkit-slider-thumb { width: 17px; height: 17px; }
#compressor { --range-color: var(--rx2); }
.volume-control .control-heading { flex-wrap: nowrap; }
.qso-control.volume-control > .range { height: 5px; margin: 6px 4px; }
.tx-volume-heading { display: flex; align-items: center; justify-content: space-between; color: var(--tx); font-size: 10px; line-height: 13px; }
.tx-volume-heading output { font: 10px var(--mono); white-space: nowrap; }
.tx-volume-slider { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 7px; height: 24px; }
.tx-listen-mute { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 3px; border: 1px solid var(--mute-border); border-radius: 4px; background: var(--mute-bg); color: var(--tx); }
.tx-listen-mute .icon { width: 16px; height: 16px; }
.tx-listen-mute .mute-tag { display: none; }
.tx-listen-mute[aria-pressed="true"] { background: var(--mute-active-bg); color: var(--danger-text); }
.qso-control.volume-control #volume-tx { --range-color: var(--tx); height: 4px; width: 100%; margin: 0; }
.qso-control.volume-control #volume-tx::-webkit-slider-thumb { width: 12px; height: 12px; background: var(--thumb-tx); border-color: var(--thumb-tx-border); }
.qso-control.volume-control #volume-tx::-moz-range-thumb { width: 9px; height: 9px; background: var(--thumb-tx); border-color: var(--thumb-tx-border); }
@media (max-width: 800px) {
  .qso-control.volume-control { display: grid; grid-template-columns: 24px minmax(0, 1fr) 28px; grid-template-rows: 20px 20px; align-content: start; align-items: center; gap: 2px 4px; }
  .volume-control .control-heading, .tx-volume-heading, .tx-volume-slider { display: contents; }
  .volume-control .control-heading > .icon, .volume-control .volume-word, .tx-volume-heading label { display: none; }
  .volume-control .control-heading > span { grid-column: 1; grid-row: 1; font-size: 9px; }
  .volume-control .control-heading output { grid-column: 3; grid-row: 1; width: auto; margin: 0; text-align: right; font-size: 10px; }
  .qso-control.volume-control > #volume { grid-column: 2; grid-row: 1; width: 100%; margin: 0; min-height: 0; height: 5px; }
  .volume-control .tx-volume-heading output { grid-column: 3; grid-row: 2; text-align: right; }
  .volume-control .tx-listen-mute { grid-column: 1; grid-row: 2; height: 20px; padding: 1px; gap: 1px; }
  .volume-control .tx-listen-mute .icon { width: 11px; height: 11px; }
  .volume-control .tx-listen-mute .mute-tag { display: inline; font-size: 7px; }
  .qso-control.volume-control #volume-tx { grid-column: 2; grid-row: 2; min-height: 0; }
}
.field-label output { color: var(--text-secondary); font: 11px var(--mono); }
.nr-label { margin-top: 21px; }
.filter-note { margin-top: 11px; }
.menu-button:not(.active) { border-radius: 5px; }
.menu-button:not(.active) .chevron { transform: rotate(-90deg); }
.sidebar .filter-content { margin-bottom: 8px; }
.display-range-heading { margin-bottom: 10px; color: var(--accent-text); font-size: 11px; font-weight: 600; }
.noise-levels { margin: 0 0 12px; font-size: 9px; line-height: 1.8; overflow-wrap: anywhere; }
.noise-levels output { font-family: var(--mono); }
.waterfall-settings .range { margin-bottom: 17px; }
.waterfall-settings .field-label output { white-space: nowrap; }
.waterfall-settings .filter-note { margin-top: 0; }
.smoothing-note { margin: 9px 0 16px; color: var(--text-soft); font-size: 9px; line-height: 1.5; }
.menu-select { width: 100%; margin: 8px 0 16px; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); padding: 8px; font-size: 12px; }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
.display [data-tune] { cursor: crosshair; touch-action: pan-y; }
.waterfall > canvas[data-waterfall] { display: block; width: 100%; height: 100%; }
.waterfall-overlay, .display-empty { pointer-events: none; }
.display-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: #7c98ac; }
#zoom-display[data-receiver="2"] #zoom-title { color: var(--rx2); }
.ptt { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ptt:disabled { opacity: .55; }
.ptt.sending { background: var(--ptt-sending-bg); border-color: var(--ptt-sending-border); box-shadow: 0 0 0 2px #e55f6140; }
.error, #status.error { color: var(--error); }
.audio-message { margin: 0 16px 12px; padding: 9px 11px; border: 1px solid var(--message-border); border-radius: 5px; background: var(--message-bg); color: var(--message-text); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.audio-message.warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning-text); }
.page-footer > span:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.page-footer > span:last-child { white-space: nowrap; }
dialog { border: 1px solid var(--dialog-border); border-radius: 9px; background: var(--dialog-bg); color: var(--text); padding: 0; box-shadow: 0 18px 80px var(--shadow); }
dialog::backdrop { background: var(--backdrop); }
.setup-dialog { width: min(780px, calc(100% - 28px)); max-height: calc(100dvh - 40px); }
.setup-dialog[open] { display: flex; flex-direction: column; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.dialog-heading h2 { margin: 0; font-size: 17px; font-weight: 600; }
.dialog-close { border: 0; background: transparent; color: var(--text-secondary); font-size: 26px; line-height: 1; padding: 0 4px; }
.dialog-scroll { padding: 8px 20px 6px; overflow-y: auto; min-height: 0; }
fieldset { min-width: 0; border: 1px solid var(--fieldset-border); border-radius: 6px; padding: 14px; margin: 14px 0; }
legend { padding: 0 7px; color: var(--accent-text); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.form-grid label, .frequency-dialog label { display: flex; flex-direction: column; gap: 7px; font-size: 11px; color: var(--text-secondary); }
.form-grid input, .form-grid select, .frequency-dialog input { width: 100%; border: 1px solid var(--input-border); border-radius: 4px; background: var(--input-bg); color: var(--text); padding: 9px 10px; font-size: 13px; }
.form-action { display: flex; align-items: flex-start; flex-direction: column; gap: 9px; font-size: 11px; color: var(--text-secondary); }
.field-help { color: var(--text-secondary); font-size: 11px; line-height: 1.7; margin-bottom: 0; }
.option-label { display: flex; align-items: flex-start; gap: 9px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; cursor: pointer; }
.option-label input { flex: 0 0 auto; margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--rx1); }
.ptt-options { display: grid; gap: 11px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--fieldset-border); }
.form-message { color: var(--text-secondary); font-size: 12px; min-height: 17px; line-height: 1.6; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 18px; }
.form-footer > span { color: var(--text-soft); font: 10px var(--mono); }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.dialog-footer a { margin-right: auto; font-size: 10px; color: var(--accent-text); }
.frequency-dialog { width: min(440px, calc(100% - 28px)); }
.frequency-dialog label { padding: 18px 20px 0; }
.frequency-dialog .form-message { padding: 0 20px; }
.frequency-dialog input { font-family: var(--mono); font-size: 22px; }
.sidebar, .sidebar *, .setup-dialog, .setup-dialog *, .frequency-dialog, .frequency-dialog * { color: var(--control-text) !important; }
@media (min-width: 801px) {
  .app { min-height: 720px; }
  .display > .waterfall { position: relative; }
  .frequency-axis { overflow: hidden; }
}
@media (max-width: 800px) {
  .sidebar { position: relative; overflow: visible; z-index: 3; }
  .filter-content { display: block; position: absolute; top: calc(100% - 2px); left: 7px; width: 246px; z-index: 4; margin: 0; box-shadow: 0 10px 30px var(--shadow); }
  .qso-control .range { margin-top: 13px; margin-bottom: 5px; }
  .range { min-height: 7px; }
}
@media (max-width: 560px) {
  .brand { font-size: 11px; }
  .session-actions { gap: 5px; }
  .session-actions .small-button { font-size: 9px; padding: 7px 8px; }
  .connection-status { gap: 4px; font-size: 9px; }
  .role { padding-left: 6px; }
  .connection-status span { gap: 4px; }
  .frequency-value strong { font-size: clamp(26px, 7.4vw, 38px); }
  .qso-control .range { height: 6px; margin-top: 16px; margin-bottom: 5px; }
  .page-footer > span:first-child { white-space: normal; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .dialog-heading, .dialog-footer { padding-left: 14px; padding-right: 14px; }
  .dialog-scroll { padding-left: 12px; padding-right: 12px; }
  .setup-dialog { max-height: calc(100dvh - 20px); width: calc(100% - 16px); }
  .monitor-caption { position: static; margin-top: 7px; }
  .rx-secondary .frequency-label { gap: 7px; }
  .page-footer span { display: block; }
}

.rx2-panel { border: 1px solid var(--line-soft); border-radius: 6px; background: var(--frequency-bg); min-width: 0; }
.rx2-panel .rx-secondary { border: 0; background: transparent; padding-bottom: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.display.zoom-tile { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.zoom-heading { gap: 8px; }
.zoom-output { position: relative; min-width: 0; min-height: 0; height: 280px; overflow: hidden; }
.zoom-plots { position: absolute; inset: 0; display: grid; grid-template-rows: minmax(30px, .78fr) 26px minmax(40px, 1fr) 22px; min-width: 0; min-height: 0; }
/* Preserve canvas dimensions and live waterfall history while a monitor covers it. */
.zoom-plots[aria-hidden="true"] { visibility: hidden; pointer-events: none; }
.zoom-plots .spectrum, .zoom-plots .waterfall { height: 100%; min-height: 0; }
.decoder-panel { position: absolute; inset: 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--monitor-bg); }
.decoder-sources { display: flex; flex: 1; align-items: center; flex-wrap: wrap; min-width: 0; gap: 5px 12px; font-size: 11px; }
.decoder-sources label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; }
.decoder-sources input { margin: 0; accent-color: var(--rx2); }
#decoder-clear { flex-shrink: 0; padding: 0 3px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.decoder-text { flex: 1; min-width: 0; min-height: 0; contain: strict; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 0 10px 4px; color: var(--text); font: 12px/1.5 var(--mono); scrollbar-width: thin; }
.decoder-text:empty::before { content: "Warte auf Decoder-Text …"; color: var(--muted); }
html[lang="en"] .decoder-text:empty::before { content: "Waiting for decoder text …"; }
#zoom-sources input:focus-visible, #decoder-clear:focus-visible, .decoder-text:focus-visible { outline: 2px solid var(--rx2); outline-offset: -2px; }
@media (min-width: 801px) { .zoom-output { height: 100%; } }
@media (max-width: 560px) { .zoom-output { height: 255px; } }
.mm-diagnostics { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 5px; padding: 6px 10px; overflow-y: auto; background: var(--monitor-bg); font-size: 10px; }
.mm-status { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 12px; }
#mm-lock[data-state="locked"] { color: var(--locked); }
#mm-lock[data-state="searching"], #mm-warning[data-warning="edge"], #mm-warning[data-warning="pilot_missing"] { color: var(--searching); }
#mm-lock[data-state="stale"], #mm-warning[data-warning="stale"] { color: var(--error); }
.mm-values { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px 8px; margin: 0; }
.mm-values dt { color: var(--text-secondary); }
.mm-values dd { margin: 1px 0 0; font: 10px var(--mono); overflow-wrap: anywhere; }
.mm-charts { flex: 1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(100px, 1fr); gap: 8px; min-height: 100px; }
.mm-chart { position: relative; min-width: 0; min-height: 100px; }
.mm-chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
@media (max-width: 800px) { .mm-values { grid-template-columns: repeat(3, minmax(0, 1fr)); } }


/* Radio plots keep their calibrated dark palettes in both page themes. */
.plot-body, .waterfall, .mm-chart { color-scheme: dark; }
.plot-body, .mm-chart { background: #080f16; }
.ptt.sending, .ptt.sending small, .tx-listen-mute[aria-pressed="true"] { color: #fff; }
.setup-dialog .error, .frequency-dialog .error { color: var(--error) !important; }

/* This preference is local to the browser and available to viewers too. */
.theme-switch { display: inline-flex; align-items: center; gap: 12px; min-height: 40px; font-size: 13px; cursor: pointer; }
.theme-switch input { appearance: none; -webkit-appearance: none; position: relative; width: 44px; height: 26px; flex: 0 0 auto; margin: 0; border: 1px solid var(--input-border); border-radius: 20px; background: var(--track); cursor: pointer; }
.theme-switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); }
.theme-switch input:checked { background: var(--rx1); border-color: var(--rx1); }
.theme-switch input:checked::before { left: 21px; background: #fff; }
