:root {
  --bg: #070d1a;
  --card-bg: #0f172a;
  --input-bg: #0b1324;
  --border: #22324a;
  --border-light: #304766;
  --text: #e7edf9;
  --text-muted: #91a3bd;
  --text-heading: #c6d5ea;
  --btn-bg: #16243a;
  --btn-border: #3a5274;
  --accent-green: #c24b1a;
  --accent-yellow: #f0ad4e;
  --accent-red: #e55353;
  --control-height: 2.6rem;
  --jog-hi: #243a5b;
  --jog-lo: #14233a;
  --jog-shadow: rgba(0,0,0,0.3);
  --jog-inset: rgba(255,255,255,0.05);
  --audio-level-bg: #14263f;
  --audio-level-border: #304766;
  --audio-level-fill-start: #c24b1a;
  --audio-level-fill-end: #f0ad4e;
  --filter-bg: #13253e;
  --filter-fg: #e7edf9;
  --filter-border: #385577;
  --wavelength-fg: #8da3be;
  --spectrum-bg: #0a0f18;
  --overview-plot-height: 160px;
  --spectrum-plot-height: 160px;
  --jog-wheel-size: 83.2px;
  --header-waterfall-overlap: 0rem;
}

[data-theme="light"] {
  --bg: #edf2f7;
  --card-bg: #ffffff;
  --input-bg: #f7fafc;
  --border: #d6deea;
  --border-light: #bcc8da;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-heading: #2d3748;
  --btn-bg: #e6edf8;
  --btn-border: #a9b8cf;
  --accent-green: #b04317;
  --accent-yellow: #b57600;
  --accent-red: #cf3f3f;
  --jog-hi: #e6edf8;
  --jog-lo: #cdd9eb;
  --jog-shadow: rgba(58, 79, 110, 0.18);
  --jog-inset: rgba(255,255,255,0.75);
  --audio-level-bg: #edf2fb;
  --audio-level-border: #b8c5da;
  --audio-level-fill-start: #b04317;
  --audio-level-fill-end: #b57600;
  --filter-bg: #eef3fb;
  --filter-fg: #1f2937;
  --filter-border: #b8c5da;
  --wavelength-fg: #6b7280;
  --spectrum-bg: #eef3fb;
}

body {
  font-family: sans-serif;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: block;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
}
.card {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 0.85rem 1.25rem 1.5rem;
  background: transparent;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.label { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 6px; display: block; }
#tab-main .label > span {
  display: inline-block;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-light) 68%, transparent);
  background: color-mix(in srgb, var(--btn-bg) 58%, transparent);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.status { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.1rem 1rem; }
.controls-tray-shell {
  min-width: 0;
}
.controls-tray-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
}
.controls-tray {
  display: grid;
  gap: 0.95rem;
  width: max(100%, 58rem);
  min-width: 0;
  box-sizing: border-box;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid color-mix(in srgb, var(--border-light) 85%, transparent);
  border-radius: 1rem;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface) 88%, transparent),
      color-mix(in srgb, var(--btn-bg) 76%, transparent));
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 12%, transparent);
}
input.status-input, select.status-input { width: 100%; padding: 0.45rem 0.5rem; font-size: 1rem; border: 1px solid var(--border-light); border-radius: 6px; background: var(--input-bg); color: var(--text); }
#mode { height: var(--control-height); }
#freq { font-family: 'DSEG14 Classic', monospace; font-size: 2rem; padding: 0.5rem 0.6rem; letter-spacing: 0.05em; text-align: center; }
#freq:disabled,
#center-freq:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
}
#center-freq { color: var(--wavelength-fg); }
.controls-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.controls-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.controls-col.label-below-col {
  align-items: stretch;
}
.controls-col.label-below-col .label {
  order: 2;
  margin-top: 0.3rem;
  margin-bottom: 0;
}
.controls-col-power.label-below-col .label {
  justify-content: flex-end;
}
.controls-col.label-below-col > :not(.label) {
  order: 1;
}
.controls-col.label-below-col .inline,
.controls-col.label-below-col .btn-grid {
  align-self: stretch;
  width: 100%;
  margin-top: calc((var(--jog-wheel-size) - var(--control-height)) / 2);
}
.controls-col-center {
  justify-self: center;
  width: auto;
  align-items: center;
}
.controls-col-wfm.label-below-col .label {
  justify-content: flex-start;
}
.wfm-controls-inline {
  gap: 0.45rem;
  justify-content: flex-start;
  align-items: flex-end;
  flex-wrap: wrap;
}
.wfm-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.22rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
}
.wfm-control-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.wfm-control .status-input {
  min-width: 4.4rem;
  width: auto;
  height: 2.1rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.85rem;
  line-height: 1.2;
  box-sizing: border-box;
}
.wfm-control input.status-input {
  width: 4.25rem;
}
.wfm-gain-group {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
}
.wfm-inline-btn {
  min-width: 3rem;
  height: 2.1rem;
  padding: 0 0.6rem;
  font-size: 0.8rem;
  line-height: 1.1;
  flex-shrink: 0;
}
.wfm-st-flag-wrap {
  min-width: 0;
}
.wfm-st-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.7rem;
  min-height: 2.1rem;
  padding: 0.28rem 0.5rem;
  box-sizing: border-box;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  background: var(--input-bg);
}
.wfm-st-flag-stereo {
  color: #ff5c5c;
  border-color: color-mix(in srgb, #ff5c5c 65%, var(--border-light));
  background: color-mix(in srgb, #ff5c5c 14%, var(--input-bg));
}
.wfm-st-flag-mono {
  color: var(--text-muted);
  border-color: var(--border-light);
  background: color-mix(in srgb, var(--input-bg) 92%, var(--panel-2));
}
.controls-col-center::after {
  content: "";
  display: block;
  min-height: 1.2rem;
  margin-top: 0.3rem;
}
.controls-row .label {
  margin-bottom: 6px;
  margin-top: 0;
  min-height: 1.2rem;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.controls-col .inline,
.controls-col .btn-grid {
  align-self: stretch;
}
.controls-col .jog-container { align-self: center; }
.btn-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.btn-grid button { width: 100%; height: var(--control-height); }
.jog-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.jog-wheel {
  width: var(--jog-wheel-size);
  height: var(--jog-wheel-size);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--jog-hi), var(--jog-lo));
  border: 2px solid var(--border-light);
  position: relative;
  cursor: grab;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--jog-shadow), inset 0 1px 0 var(--jog-inset);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.jog-indicator {
  position: absolute;
  width: 6.4px;
  height: 16px;
  background: var(--accent-green);
  border-radius: 2px;
  top: 6.4px;
  left: 50%;
  transform-origin: 50% 35.2px;
  transform: translateX(-50%);
  pointer-events: none;
}
.jog-btn {
  width: 3.3rem;
  height: 3.3rem;
  font-size: 1.8rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}
.jog-step {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  height: 3.35rem;
  flex-shrink: 0;
}
.jog-step button {
  border: none;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  height: 100%;
  padding: 0 0.65rem;
  font-size: 0.92rem;
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
}
.jog-step button:last-child { border-right: none; }
.jog-step button.active {
  background: var(--btn-bg);
  color: var(--accent-green);
  font-weight: 600;
}
.vfo-picker {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}
.vfo-picker button {
  flex: 1;
  border: none;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  height: var(--control-height);
  background: var(--input-bg);
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
}
.vfo-picker button:last-child { border-right: none; }
.vfo-picker button.active {
  background: var(--btn-bg);
  font-weight: 600;
}
.signal-measure {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.4rem;
}
button { padding: 0.5rem 0.9rem; border-radius: 6px; border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--text); cursor: pointer; height: var(--control-height); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.hint { color: var(--text-muted); font-size: 0.85rem; }
.inline { display: flex; gap: 0.5rem; align-items: center; }
.freq-inline {
  gap: 0.35rem;
  align-items: flex-start;
  flex-wrap: nowrap;
}
.freq-field {
  display: grid;
  grid-template-rows: 3.35rem auto;
  align-items: start;
}
.freq-field .label {
  margin-top: 0.45rem;
  margin-bottom: 0;
}
.frequency-col {
  flex: 1 1 auto;
  min-width: 0;
}
.center-frequency-col {
  flex: 0 1 8.75rem;
  min-width: 7.75rem;
}
.frequency-col input.status-input {
  width: 100%;
  height: 3.35rem;
  box-sizing: border-box;
}
.wavelength-col {
  flex: 0 0 auto;
}
.unit-col {
  flex: 0 0 auto;
}
.unit-col .label {
  display: flex;
  justify-content: flex-end;
}
.mult-col {
  flex: 0 0 auto;
}
.mult-col .label {
  display: flex;
  justify-content: flex-end;
}
.jog-mult {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  height: 3.35rem;
  flex-shrink: 0;
  width: auto;
}
.jog-mult button {
  min-width: 3.15rem;
  border: none;
  border-right: 1px solid var(--border-light);
  border-radius: 0;
  height: 100%;
  padding: 0 0.7rem;
  font-size: 0.85rem;
  background: var(--input-bg);
  color: var(--text-muted);
  cursor: pointer;
}
.jog-mult button:last-child { border-right: none; }
.jog-mult button.active {
  background: var(--btn-bg);
  color: var(--accent-green);
  font-weight: 600;
}
.label-below-row {
  display: flex;
  flex-direction: column;
}
#tab-main .label > span {
  text-align: center;
}
.label-below-row > .label {
  order: 2;
  margin-top: 0.45rem;
  margin-bottom: 0;
}
.label-below-row > :not(.label) {
  order: 1;
}
.wavelength-display {
  min-width: 5.2rem;
  height: 3.35rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--wavelength-fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DSEG14 Classic', monospace;
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: 0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}
small { color: var(--text-muted); }
.header {
  margin-bottom: 0;
  padding: 0.25rem 0 0.15rem;
  position: relative;
  z-index: 6;
}
.header-main {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  max-width: min(100%, 46rem);
  padding: 0.35rem 0.8rem 0.4rem 0.45rem;
  margin-left: -0.3rem;
  transform: translateY(-10px);
  border-radius: 0.95rem;
  background: color-mix(in srgb, var(--card-bg) 56%, transparent);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  box-shadow:
    0 8px 20px color-mix(in srgb, #000000 18%, transparent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 10%, transparent);
}
.header-text {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
}
.title { font-size: 1.4rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.35rem; }
.title-link {
  color: inherit;
  text-decoration: none;
}
.title-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.14em;
}
.overview-strip {
  width: 100%;
  margin: 0;
  position: relative;
}
.signal-visual-block {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 0.9rem;
}
#signal-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
  z-index: 4;
}
#rds-ps-overlay {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
  color: var(--text-heading);
  padding: 0.34rem 0.9rem 0.28rem;
  border: 1px solid color-mix(in srgb, var(--border-light) 72%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-bg) 52%, transparent);
  backdrop-filter: blur(14px) saturate(135%);
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  box-shadow:
    0 8px 18px color-mix(in srgb, #000000 16%, transparent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 10%, transparent);
  text-shadow: 0 1px 10px color-mix(in srgb, var(--bg) 68%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.16rem;
  text-align: center;
  max-width: min(92vw, 24rem);
  overflow: hidden;
  text-overflow: ellipsis;
}
.rds-ps {
  cursor: pointer;
}
.rds-ps-main {
  display: block;
  font-family: 'DSEG14 Classic', monospace;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  letter-spacing: 0.08em;
  white-space: pre;
}
.rds-ps-gap {
  color: color-mix(in srgb, currentColor 34%, var(--text-muted));
}
.rds-ps-fallback {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(0.72rem, 1.4vw, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.rds-ps-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(0.58rem, 1.1vw, 0.78rem);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}
.rds-ps-meta-text {
  display: inline-block;
}
.rds-ps-flags {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.rds-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-light) 72%, transparent);
  font-size: 0.92em;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.rds-flag-active {
  color: #ffd7d7;
  background: color-mix(in srgb, #b31217 68%, transparent);
  border-color: color-mix(in srgb, #ff7b7b 46%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, #b31217 28%, transparent);
}
.rds-flag-inactive {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--card-bg) 62%, transparent);
}
#aprs-bar-overlay,
#ais-bar-overlay,
#vdes-bar-overlay {
  display: none;
  position: absolute;
  top: 50%;
  left: 0.45rem;
  right: 0.45rem;
  width: auto;
  max-width: none;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: auto;
  cursor: default;
  user-select: text;
  color: var(--text-heading);
  padding: 0.22rem 0.55rem 0.24rem;
  border: 1px solid color-mix(in srgb, var(--border-light) 72%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-bg) 68%, transparent);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow:
    0 10px 24px color-mix(in srgb, #000000 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent),
    inset 0 0 0 1px color-mix(in srgb, #ffffff 4%, transparent);
  max-height: min(58%, 9.5rem);
  overflow-y: auto;
  flex-direction: column;
  gap: 0.12rem;
}
.aprs-bar-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.32rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(0.6rem, 0.9vw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-green);
  text-transform: uppercase;
  padding: 0;
  margin-bottom: 0.02rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border-light) 22%, transparent);
  opacity: 0.9;
}
.aprs-bar-title {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  min-width: 0;
  flex: 0 0 auto;
}
.aprs-bar-title-word {
  display: inline-block;
}
.aprs-bar-window {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  white-space: nowrap;
}
.aprs-bar-clear-wrap {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 0;
  align-self: center;
}
.aprs-bar-clear {
  display: inline;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  line-height: 1;
  font-family: inherit;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.82;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity 120ms, color 120ms;
}
.aprs-bar-clear:hover {
  opacity: 1;
  color: var(--accent-green);
  text-decoration: underline;
}
.aprs-bar-clear-wrap:hover {
  color: inherit;
}
.aprs-bar-frame {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: clamp(0.56rem, 0.92vw, 0.7rem);
  line-height: 1.12;
  padding: 0.08rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-light) 18%, transparent);
  opacity: 1;
}
.aprs-bar-frame:last-child {
  border-bottom: none;
}
.aprs-bar-frame-main {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.15rem;
}
.aprs-bar-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--btn-bg) 74%, transparent);
  border: 1px solid color-mix(in srgb, var(--border-light) 28%, transparent);
  border-radius: 4px;
  padding: 0;
  margin-right: 0.28em;
  width: 1.55em;
  height: 1.55em;
  font-size: 0.72em;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  opacity: 0.82;
  transition: opacity 120ms, border-color 120ms, background 120ms;
}
.aprs-bar-pin:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--btn-bg) 92%, transparent);
  border-color: color-mix(in srgb, var(--accent-green) 28%, var(--border-light));
}
.aprs-bar-frame + .aprs-bar-frame {
  opacity: 0.78;
}
.aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame {
  opacity: 0.62;
}
.aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame {
  opacity: 0.46;
}
.aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame + .aprs-bar-frame {
  opacity: 0.34;
}
.aprs-bar-time {
  color: color-mix(in srgb, var(--text-muted) 92%, transparent);
  margin-right: 0.42em;
  font-size: 0.94em;
}
.aprs-bar-call {
  color: var(--accent-green);
  font-weight: 600;
}
.aprs-bar-crc {
  color: var(--accent-red);
  margin-left: 0.3em;
}
.overview-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 0;
  position: absolute;
  top: calc(var(--header-waterfall-overlap) + 0.2rem);
  right: 0.15rem;
  z-index: 2;
}
.overview-label {
  margin-left: auto;
  color: var(--text-heading);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.overview-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.overview-control .status-input {
  width: auto;
  min-width: 4.6rem;
  padding-top: 0.22rem;
  padding-bottom: 0.22rem;
  font-size: 0.85rem;
}
#overview-canvas {
  width: 100%;
  height: var(--overview-plot-height);
  display: block;
}
.header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  flex-shrink: 0;
}
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.header-rig-switch {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.header-rig-switch select {
  min-width: 8rem;
  height: 2rem;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.85rem;
}
.header-rig-switch button {
  height: 2rem;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
.header-bar-btn {
  height: 2rem;
  padding: 0 0.65rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
/* Theme toggle: styled to match the active theme */
#theme-toggle {
  background: #1e2a3a;
  color: #e7edf9;
  border-color: #3a5274;
}
[data-theme="light"] #theme-toggle {
  background: #dde3ed;
  color: #1a2336;
  border-color: #a0aec0;
}
.header-style-pick {
  display: flex;
  align-items: center;
}
.header-style-pick select {
  height: 2rem;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.85rem;
}
.header-logo { height: 4.6em; width: auto; flex-shrink: 0; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35)); }
.subtitle { color: var(--text-muted); font-size: 0.95rem; }
.subtitle a { color: var(--accent-green); text-decoration: none; }
.subtitle a:hover { text-decoration: underline; }
.band-tag { display: inline-block; padding: 2px 6px; border-radius: 6px; background: var(--btn-bg); color: var(--text); font-size: 0.82rem; border: 1px solid var(--border-light); margin-left: 6px; }
.signal { display: flex; gap: 0.6rem; align-items: center; }
.signal-bar { flex: 1 1 auto; height: 12px; border-radius: 999px; background: var(--btn-bg); border: 1px solid var(--border-light); overflow: hidden; }
.signal-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow), var(--accent-red)); transition: width 150ms ease; }
.signal-value { font-size: 0.95rem; color: var(--text-heading); min-width: 48px; text-align: right; }
.meter { display: flex; gap: 0.6rem; align-items: center; }
.meter-bar { flex: 1 1 auto; height: 12px; border-radius: 999px; background: var(--btn-bg); border: 1px solid var(--border-light); overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow), var(--accent-red)); transition: width 150ms ease; }
.meter-value { font-size: 0.95rem; color: var(--text-heading); min-width: 64px; text-align: right; }
#content { display: flex; flex-direction: column; gap: 1.1rem; min-height: 0; overflow: visible; }
.tab-panel { flex: 1 1 auto; min-height: 0; overflow: visible; }
.tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0 0.7rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border-light) 55%, transparent);
  position: relative;
  z-index: 2;
}
.tab-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  flex: 1 1 auto;
}
.tab-bar .header-main {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: min(100%, 24rem);
  padding: 0;
  margin-left: 0;
  transform: none;
  flex-shrink: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
.tab-bar .header-logo {
  height: 2.6rem;
}
.tab-bar .title {
  font-size: 1.05rem;
  line-height: 1.1;
}
.tab-bar .subtitle {
  font-size: 0.78rem;
  line-height: 1.15;
}
.tab-bar-nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.5rem 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  height: auto;
}
.tab.active { border-bottom-color: var(--accent-green); color: var(--accent-green); font-weight: 600; }
.tab:hover:not(.active) { color: var(--text); }
.about-table { width: 100%; border-collapse: collapse; }
.about-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
.about-table tr:last-child td { border-bottom: none; }
.about-table td:first-child { color: var(--text-muted); width: 40%; }
.plugin-item { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); color: var(--text); }
.plugin-item:last-child { border-bottom: none; }
.footer { display: flex; justify-content: space-between; align-items: baseline; margin-top: auto; padding-top: 1rem; flex-shrink: 0; }
.full-row { grid-column: 1 / -1; }
.copyright { color: var(--text-muted); font-size: 0.75rem; opacity: 0.7; }
.copyright a { color: var(--accent-green); text-decoration: none; }
.copyright a:hover { text-decoration: underline; }
.gh-link-wrap {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 0.15rem;
}
.gh-link {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-light) 72%, transparent);
  background: color-mix(in srgb, var(--btn-bg) 78%, transparent);
  color: var(--text-heading);
  line-height: 1;
  box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent);
}
.gh-link:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--accent-green) 48%, var(--border-light));
  background: color-mix(in srgb, var(--btn-bg) 90%, transparent);
}
.gh-link-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  fill: currentColor;
}

.vol-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.vol-pct {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1;
}
.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 6px;
  border-radius: 3px;
  background: var(--btn-bg);
  border: 1px solid var(--border-light);
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-green);
  border: none;
  cursor: pointer;
}
.vol-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-green);
  border: none;
  cursor: pointer;
}
#audio-level {
  flex: 1 1 auto;
  height: 12px;
  border-radius: 999px;
  background: var(--audio-level-bg);
  border: 1px solid var(--audio-level-border);
  overflow: hidden;
  min-width: 80px;
}
#audio-level-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--audio-level-fill-start), var(--audio-level-fill-end));
  transition: width 100ms ease;
}

.sub-tab-bar { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sub-tab { flex-shrink: 0; background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 0.35rem 0.75rem; color: var(--text-muted); cursor: pointer; font-size: 0.85rem; height: auto; }
.sub-tab.active { border-bottom-color: var(--accent-green); color: var(--accent-green); font-weight: 600; }
.sub-tab:hover:not(.active) { color: var(--text); }
#tab-map {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 0;
}
#aprs-map {
  flex: 0 1 auto;
  width: 100%;
  min-height: 0;
  border-radius: 6px;
}
.aprs-controls { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.75rem; }
#subtab-aprs .aprs-controls > button {
  min-height: 1.65rem;
  padding: 0.08rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--filter-border);
  background: var(--filter-bg);
  color: var(--filter-fg);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}
#subtab-aprs .aprs-controls > button:hover {
  border-color: var(--accent-green);
  color: var(--text);
}
.aprs-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.aprs-summary-card {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-bg) 84%, transparent);
}
.aprs-summary-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.aprs-summary-value {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.3;
}
.aprs-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}
.aprs-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.65rem;
  padding: 0.08rem 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--filter-border);
  background: var(--filter-bg);
  color: var(--filter-fg);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.aprs-chip.active {
  color: var(--card-bg);
  background: var(--accent-green);
  border-color: var(--accent-green);
}
.aprs-chip:hover:not(.active) {
  border-color: var(--accent-green);
  color: var(--text);
}
.ais-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.ais-summary-card {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: color-mix(in srgb, var(--card-bg) 84%, transparent);
}
.ais-summary-label {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ais-summary-value {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.3;
}
#subtab-ais {
  display: flex;
  flex-direction: column;
}
#subtab-vdes {
  display: flex;
  flex-direction: column;
}
#subtab-aprs {
  display: flex;
  flex-direction: column;
}
#aprs-packets,
#ais-messages,
#vdes-messages { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 6px; background: var(--input-bg); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
#aprs-packets {
  flex: 0 1 auto;
  height: calc(100vh - 28rem);
  min-height: 16rem;
  max-height: calc(100vh - 28rem);
}
#ais-messages {
  flex: 0 1 auto;
  height: calc(100vh - 24rem);
  min-height: 16rem;
  max-height: calc(100vh - 24rem);
}
#vdes-messages {
  flex: 0 1 auto;
  height: calc(100vh - 24rem);
  min-height: 16rem;
  max-height: calc(100vh - 24rem);
}
.aprs-packet { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.82rem; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border); line-height: 1.35; }
.aprs-packet:last-child { border-bottom: none; }
.aprs-packet-new {
  animation: aprs-row-flash 1.2s ease;
}
.aprs-packet-crc {
  opacity: 0.6;
}
.aprs-row-head,
.aprs-row-meta,
.aprs-row-detail,
.aprs-row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.aprs-row-head + .aprs-row-meta,
.aprs-row-meta + .aprs-row-detail,
.aprs-row-detail + .aprs-row-actions {
  margin-top: 0.2rem;
}
.aprs-row-detail {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.aprs-row-actions {
  margin-top: 0.28rem;
}
.aprs-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.2rem;
  padding: 0.02rem 0.38rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-light) 78%, transparent);
  background: color-mix(in srgb, var(--card-bg) 72%, transparent);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.aprs-badge-type {
  color: var(--text);
}
.aprs-badge-type-position {
  color: #77d6a5;
  border-color: color-mix(in srgb, #77d6a5 42%, transparent);
  background: color-mix(in srgb, #77d6a5 12%, transparent);
}
.aprs-badge-type-message {
  color: #8ec8ff;
  border-color: color-mix(in srgb, #8ec8ff 42%, transparent);
  background: color-mix(in srgb, #8ec8ff 12%, transparent);
}
.aprs-badge-type-weather {
  color: #ffd77a;
  border-color: color-mix(in srgb, #ffd77a 42%, transparent);
  background: color-mix(in srgb, #ffd77a 14%, transparent);
}
.aprs-badge-type-telemetry {
  color: #d4a5ff;
  border-color: color-mix(in srgb, #d4a5ff 42%, transparent);
  background: color-mix(in srgb, #d4a5ff 12%, transparent);
}
.aprs-badge-crc {
  color: #ff9a9a;
  border-color: color-mix(in srgb, #ff9a9a 42%, transparent);
  background: color-mix(in srgb, #ff9a9a 10%, transparent);
}
.aprs-meta-text {
  color: var(--text-muted);
  font-size: 0.76rem;
}
.aprs-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.7rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  border: 1px solid var(--filter-border);
  background: var(--filter-bg);
  color: var(--filter-fg);
  font: inherit;
  font-size: 0.74rem;
  cursor: pointer;
}
.aprs-inline-btn:hover {
  border-color: var(--accent-green);
  color: var(--text);
}
.aprs-details {
  width: 100%;
}
.aprs-details summary {
  cursor: pointer;
  color: var(--accent-green);
  font-size: 0.76rem;
  user-select: none;
}
.aprs-details[open] summary {
  margin-bottom: 0.35rem;
}
.aprs-details-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.aprs-detail-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.aprs-detail-value {
  color: var(--text);
  word-break: break-word;
}
.ais-message { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.82rem; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border); line-height: 1.35; }
.ais-message:last-child { border-bottom: none; }
.vdes-message { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.82rem; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--border); line-height: 1.35; }
.vdes-message:last-child { border-bottom: none; }
.aprs-call { color: var(--accent-green); font-weight: 600; }
.ais-call { color: var(--accent-red); font-weight: 600; }
.vdes-call { color: #8ec8ff; font-weight: 600; }
.aprs-time { color: var(--text-muted); margin-right: 0.5rem; }
.ais-time { color: var(--text-muted); margin-right: 0.5rem; }
.vdes-time { color: var(--text-muted); margin-right: 0.5rem; }
.ais-row-head,
.ais-row-meta,
.ais-row-detail {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.ais-row-head + .ais-row-meta,
.ais-row-meta + .ais-row-detail {
  margin-top: 0.2rem;
}
.ais-row-detail {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.ais-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.2rem;
  padding: 0.02rem 0.38rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--border-light) 78%, transparent);
  background: color-mix(in srgb, var(--card-bg) 72%, transparent);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ais-badge-channel-a {
  color: #77d6a5;
  border-color: color-mix(in srgb, #77d6a5 42%, transparent);
  background: color-mix(in srgb, #77d6a5 12%, transparent);
}
.ais-badge-channel-b {
  color: #ff9a7a;
  border-color: color-mix(in srgb, #ff9a7a 42%, transparent);
  background: color-mix(in srgb, #ff9a7a 14%, transparent);
}
.ais-badge-type {
  color: var(--text);
}
.ais-meta-text {
  color: var(--text-muted);
  font-size: 0.76rem;
}
.ais-pos-link {
  color: var(--accent-red);
  text-decoration: none;
}
.ais-pos-link:hover {
  text-decoration: underline;
}
.vdes-row-head,
.vdes-row-meta,
.vdes-row-detail {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.vdes-row-head + .vdes-row-meta,
.vdes-row-meta + .vdes-row-detail {
  margin-top: 0.2rem;
}
.vdes-row-detail {
  color: var(--text-muted);
  font-size: 0.78rem;
}
.vdes-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.2rem;
  padding: 0.02rem 0.38rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, #8ec8ff 42%, transparent);
  background: color-mix(in srgb, #8ec8ff 12%, transparent);
  color: #8ec8ff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.vdes-raw {
  color: var(--text-muted);
  font-size: 0.76rem;
  word-break: break-all;
}
.aprs-symbol { display: inline-block; width: 24px; height: 24px; background-size: 384px 192px; vertical-align: middle; margin-right: 0.3rem; }
.aprs-pos { color: var(--accent-green); text-decoration: none; margin-left: 0.3rem; font-size: 0.8rem; }
.aprs-pos:hover { text-decoration: underline; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card-bg) !important; color: var(--text) !important; box-shadow: 0 3px 14px rgba(0,0,0,0.45) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; }
.leaflet-popup-close-button:hover { color: var(--text) !important; }
.aprs-popup { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.82rem; min-width: 12rem; max-width: 22rem; }
.aprs-popup-call { font-weight: 700; font-size: 1em; color: var(--accent-green); margin-bottom: 0.18rem; }
.aprs-popup-meta { font-size: 0.85em; color: var(--text-muted); margin-bottom: 0.3rem; }
.aprs-popup-table { border-collapse: collapse; width: 100%; margin-bottom: 0.3rem; }
.aprs-popup-table td { padding: 0.06rem 0.3rem 0.06rem 0; vertical-align: top; font-size: 0.88em; }
.aprs-popup-label { color: var(--text-muted); white-space: nowrap; padding-right: 0.5rem !important; }
.aprs-popup-info { font-size: 0.85em; color: var(--text); border-top: 1px solid var(--border-light); padding-top: 0.25rem; margin-top: 0.1rem; word-break: break-word; }
.aprs-radio-path { stroke: var(--accent-green) !important; stroke-opacity: 0.8 !important; stroke-dasharray: 10 5 !important; animation: aprs-radio-path-flow 0.7s linear infinite; }
.trx-receiver-marker { stroke: var(--accent-green) !important; fill: var(--accent-green) !important; }
.receiver-popup-active { font-size: 0.75em; background: rgba(194,75,26,0.15); color: var(--accent-green); border: 1px solid rgba(194,75,26,0.3); border-radius: 3px; padding: 0 0.25rem; margin-left: 0.3rem; vertical-align: middle; }
@keyframes aprs-radio-path-flow { to { stroke-dashoffset: -15; } }
.aprs-bar-pos { background: none; border: none; padding: 0; margin-left: 0.4em; font-family: inherit; font-size: inherit; color: var(--accent-green); cursor: pointer; }
.aprs-bar-pos:hover { text-decoration: underline; }
.aprs-byte { color: var(--accent-yellow); background: rgba(255, 214, 0, 0.12); border: 1px solid rgba(255, 214, 0, 0.25); border-radius: 4px; padding: 0 0.2rem; margin: 0 0.1rem; font-size: 0.78em; }
@keyframes aprs-row-flash {
  0% { background: color-mix(in srgb, var(--accent-green) 14%, transparent); }
  100% { background: transparent; }
}
.ft8-controls { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.75rem; }
.ft8-filter {
  flex: 1;
  min-width: 10rem;
  height: var(--control-height);
  box-sizing: border-box;
  background: var(--filter-bg);
  color: var(--filter-fg);
  border: 1px solid var(--filter-border);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
}
.ft8-filter::placeholder { color: color-mix(in srgb, var(--filter-fg) 55%, transparent); }
.ft8-header { display: flex; gap: 0.6rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); padding: 0 0 0.35rem 0; margin-bottom: 0.35rem; }
#ft8-messages { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 6px; background: var(--input-bg); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.85rem; padding: 0.35rem 0.5rem; }
.ft8-row { display: flex; gap: 0.6rem; line-height: 1.4; border-bottom: 1px solid var(--border); padding: 0.25rem 0; }
.ft8-row:last-child { border-bottom: none; }
.ft8-time { color: var(--text-muted); min-width: 4.6rem; }
.ft8-snr { color: var(--accent-yellow); min-width: 3.6rem; text-align: right; }
.ft8-dt { color: var(--text-muted); min-width: 3.6rem; text-align: right; }
.ft8-freq { color: var(--accent-green); min-width: 4.6rem; text-align: right; }
.ft8-msg { flex: 1; }
.ft8-locator { color: var(--accent-green); background: rgba(0, 209, 127, 0.12); border: 1px solid rgba(0, 209, 127, 0.25); border-radius: 4px; padding: 0 0.2rem; margin: 0 0.1rem; font-weight: 600; }
.map-controls { display: flex; gap: 1rem; align-items: center; margin-bottom: 0.6rem; color: var(--text-muted); font-size: 0.82rem; }
.map-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--filter-border);
  background: var(--filter-bg);
  color: var(--filter-fg);
}
.map-controls input[type="checkbox"] { margin-right: 0.3rem; }

.rds-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; align-items: baseline; margin-bottom: 1rem; }
.rds-field { display: contents; }
.rds-label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.rds-value { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.95rem; color: var(--text); }
.rds-ps { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.08em; color: var(--accent-green); }
.rds-text { white-space: normal; overflow-wrap: anywhere; line-height: 1.35; }
.rds-af-list { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.rds-af-btn {
  height: 1.7rem;
  padding: 0 0.55rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.rds-af-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.rds-no-signal { color: var(--text-muted); }
.rds-decoding { color: var(--accent-green); }
.rds-raw-header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.3rem; }
.rds-raw-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.3rem; }
.rds-raw-header .rds-raw-label { margin-bottom: 0; }
#rds-raw-copy-btn { height: 1.65rem; padding: 0 0.55rem; font-size: 0.72rem; }
.rds-raw { background: var(--input-bg); border: 1px solid var(--border-light); border-radius: 6px; padding: 0.5rem 0.6rem; font-size: 0.8rem; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; color: var(--text); white-space: pre; overflow-x: auto; margin: 0; }

.cw-controls { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.75rem; }
.cw-config { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.cw-config label { display: flex; flex-direction: column; gap: 0.2rem; color: var(--text-muted); font-size: 0.82rem; }
.cw-config input[type="number"] { width: 5rem; padding: 0.3rem 0.4rem; font-size: 0.9rem; border: 1px solid var(--border-light); border-radius: 6px; background: var(--input-bg); color: var(--text); }
#cw-output { max-height: 360px; overflow-y: auto; border: 1px solid var(--border-light); border-radius: 6px; background: var(--input-bg); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 0.85rem; padding: 0.4rem 0.5rem; min-height: 60px; white-space: pre-wrap; word-break: break-all; }
.cw-line { line-height: 1.5; }
.cw-signal-on { width: 10px; height: 10px; border-radius: 50%; background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); flex-shrink: 0; }
.cw-signal-off { width: 10px; height: 10px; border-radius: 50%; background: var(--border-light); flex-shrink: 0; }
.cw-config .cw-auto-label { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; flex-direction: row; }
.cw-auto-label input[type="checkbox"] { margin: 0; cursor: pointer; }
.cw-config input[type="number"][readonly] { opacity: 0.6; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-green);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .card { width: 100%; padding-left: 0.9rem; padding-right: 0.9rem; }
}

@media (max-width: 760px) {
  .card {
    padding:
      calc(0.7rem + env(safe-area-inset-top))
      calc(0.7rem + env(safe-area-inset-right))
      calc(1rem + env(safe-area-inset-bottom))
      calc(0.7rem + env(safe-area-inset-left));
  }
  button { min-height: 2.8rem; font-size: 0.95rem; }
  input.status-input, select.status-input { font-size: 1.1rem; }
  :root { --header-waterfall-overlap: 0rem; }
  .controls-tray-scroll { overflow-x: visible; }
  .controls-tray { width: 100%; padding-left: 0.85rem; padding-right: 0.85rem; }
  .freq-inline { gap: 0.5rem; flex-wrap: wrap; }
  .header-text { width: auto; min-width: 0; flex: 0 1 auto; }
  .header-main {
    max-width: 100%;
    padding-right: 0.65rem;
    margin-left: -0.15rem;
    transform: translateY(-1px);
  }
  .header-left { justify-content: flex-end; }
  .tab-bar { flex-wrap: wrap; }
  .tab-bar-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.7rem;
  }
  .tab-bar .header-main {
    max-width: 100%;
    margin-left: 0;
    transform: none;
  }
  .top-bar-actions { width: 100%; justify-content: space-between; }
  .header-rig-switch { width: auto; justify-content: flex-end; }
  .header-rig-switch select { min-width: 6.5rem; }
  .overview-toolbar { top: calc(var(--header-waterfall-overlap) + 0.15rem); }
  .controls-row { grid-template-columns: 1fr auto; }
  .controls-col-wfm { grid-column: 1 / -1; }
  .controls-col-power { grid-column: 1 / -1; }
  .controls-col.label-below-col .inline,
  .controls-col.label-below-col .btn-grid { margin-top: 0; }
  .wfm-controls-inline { flex-wrap: wrap; }
  .ft8-controls { flex-wrap: wrap; }
  #ft8-decode-toggle-btn, #wspr-decode-toggle-btn { white-space: nowrap; }
  .jog-container { flex-wrap: wrap; }
  .vfo-picker { flex-direction: column; }
  .vfo-picker button { border-right: none; border-bottom: 1px solid var(--border-light); }
  .vfo-picker button:last-child { border-bottom: none; }
}

@media (max-width: 640px) {
  .card {
    padding-bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }
  .tab-bar {
    gap: 0.6rem;
    align-items: stretch;
    margin-bottom: 1rem;
    padding-bottom: 0.2rem;
    border-bottom: none;
  }
  .tab-bar-left {
    gap: 0.55rem;
    align-items: stretch;
  }
  .tab-bar .header-main {
    width: 100%;
    max-width: 100%;
  }
  .tab-bar .header-logo {
    height: 2.15rem;
  }
  .tab-bar-nav {
    position: fixed;
    left: calc(0.6rem + env(safe-area-inset-left));
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.42rem;
    border: 1px solid color-mix(in srgb, var(--border-light) 82%, transparent);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--card-bg) 90%, transparent);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
    box-shadow:
      0 12px 28px color-mix(in srgb, #000000 22%, transparent),
      inset 0 1px 0 color-mix(in srgb, #ffffff 10%, transparent);
    overflow: visible;
  }
  .tab {
    min-height: 3.1rem;
    padding: 0.45rem 0.25rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 0.75rem;
    white-space: nowrap;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.05;
    background: transparent;
    color: var(--text-muted);
  }
  .tab.active {
    border-color: color-mix(in srgb, var(--accent-green) 50%, var(--border-light));
    background: color-mix(in srgb, var(--btn-bg) 86%, transparent);
    color: var(--text);
    box-shadow: inset 0 1px 0 color-mix(in srgb, #ffffff 8%, transparent);
  }
  .top-bar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .header-rig-switch,
  .header-style-pick {
    flex: 1 1 12rem;
    min-width: 0;
  }
  .header-rig-switch select,
  .header-style-pick select {
    width: 100%;
    min-width: 0;
  }
  .header-bar-btn {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 0;
  }
  #tab-main,
  #tab-plugins,
  #tab-map,
  #tab-about {
    scroll-margin-top: 0.75rem;
  }
  .freq-inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: start;
  }
  .frequency-col {
    grid-column: 1 / -1;
  }
  .center-frequency-col {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .wavelength-col,
  .unit-col,
  .mult-col {
    min-width: 0;
  }
  .wavelength-display,
  .jog-step,
  .jog-mult {
    width: 100%;
  }
  .jog-step button,
  .jog-mult button {
    flex: 1 1 0;
  }
  .signal,
  .meter {
    flex-wrap: wrap;
  }
  .signal-value,
  .meter-value {
    min-width: 0;
    width: 100%;
    text-align: left;
  }
  .signal-measure {
    flex-wrap: wrap;
  }
  .signal-measure button {
    flex: 1 1 8rem;
  }
  .signal-measure #sig-result {
    width: 100%;
  }
  #spectrum-controls,
  #spectrum-bw-row,
  #spectrum-level-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
  #spectrum-controls {
    gap: 0.5rem;
    padding-top: 0.45rem;
  }
  .spectrum-edge-shift {
    width: 1.5rem;
    height: 2.35rem;
  }
  .spectrum-bookmark-side {
    width: 5.85rem;
    gap: 0.22rem;
  }
  .spectrum-bookmark-side-left {
    left: -7.85rem;
  }
  .spectrum-bookmark-side-right {
    right: -7.85rem;
  }
  .spectrum-bookmark-side .spectrum-bookmark-chip {
    font-size: 0.58rem;
    padding: 2px 6px;
  }
  .spectrum-edge-shift-left {
    left: -1.8rem;
  }
  .spectrum-edge-shift-right {
    right: -1.8rem;
  }
  #spectrum-bw-row,
  #spectrum-level-row {
    gap: 0.4rem;
  }
  #spectrum-bw-label,
  #spectrum-floor-label,
  #spectrum-peak-hold-label {
    width: 100%;
    justify-content: space-between;
  }
  #spectrum-bw-input,
  #spectrum-floor-input,
  #overview-peak-hold {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .aprs-controls,
  .ft8-controls,
  .cw-controls,
  .map-controls {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .ais-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .aprs-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  #subtab-ais {
    min-height: calc(100vh - 14rem);
  }
  #subtab-vdes {
    min-height: calc(100vh - 14rem);
  }
  #subtab-aprs {
    min-height: calc(100vh - 14rem);
  }
  #aprs-packets {
    min-height: calc(100vh - 26rem);
  }
  #ais-messages {
    min-height: calc(100vh - 22rem);
  }
  #vdes-messages {
    min-height: calc(100vh - 22rem);
  }
  .aprs-details-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.14rem;
  }
  .aprs-controls > button,
  .ft8-controls > button,
  .cw-controls > button {
    flex: 1 1 auto;
  }
  .ft8-filter {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }
  .map-controls label {
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
  }
  .rds-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }
  .rds-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.16rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid color-mix(in srgb, var(--border-light) 72%, transparent);
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--input-bg) 84%, transparent);
  }
  .rds-label {
    white-space: normal;
  }
  .rds-raw-header {
    flex-wrap: wrap;
  }
  #rds-raw-copy-btn {
    width: 100%;
  }
  .about-table,
  .about-table tbody,
  .about-table tr,
  .about-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }
  .about-table tr {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
  }
  .about-table tr:last-child {
    border-bottom: none;
  }
  .about-table td {
    padding: 0.15rem 0;
    border-bottom: none;
  }
  .about-table td:first-child {
    width: 100%;
  }
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
  }
}


/* ── Spectrum display ─────────────────────────────────────────────────── */
#spectrum-panel {
  margin-bottom: 0;
}
.spectrum-wrap {
  position: relative;
  width: 100%;
  user-select: none;
}
#spectrum-canvas {
  display: block;
  width: 100%;
  height: var(--spectrum-plot-height);
  background: var(--spectrum-bg);
  border-radius: 6px 6px 0 0;
  cursor: crosshair;
  touch-action: none;
}
.spectrum-edge-shift {
  position: absolute;
  top: calc(var(--spectrum-plot-height) / 2);
  transform: translateY(-50%);
  z-index: 8;
  width: 1.7rem;
  height: 2.8rem;
  border: 1px solid color-mix(in srgb, var(--border-light) 85%, transparent);
  background: color-mix(in srgb, var(--card-bg) 78%, transparent);
  color: var(--accent-yellow);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.spectrum-edge-shift::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 0.38rem solid transparent;
  border-bottom: 0.38rem solid transparent;
}
.spectrum-edge-shift-left::before {
  border-right: 0.52rem solid currentColor;
}
.spectrum-edge-shift-right::before {
  border-left: 0.52rem solid currentColor;
}
.spectrum-edge-shift:hover {
  background: color-mix(in srgb, var(--btn-bg) 84%, transparent);
  color: var(--text-heading);
  border-color: var(--accent-yellow);
}
.spectrum-edge-shift:active {
  transform: translateY(-50%) scale(0.97);
}
.spectrum-edge-shift-left {
  left: -2.05rem;
}
.spectrum-edge-shift-right {
  right: -2.05rem;
}
#spectrum-freq-axis {
  position: relative;
  height: 18px;
  width: 100%;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 0 0 6px 6px;
  border: 1px solid var(--border);
  border-top: none;
}
#spectrum-freq-axis span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
  top: 2px;
  font-weight: 700;
}
#spectrum-bookmark-axis {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  height: 0;
  overflow: hidden;
  font-size: 0.68rem;
  background: transparent;
  transition: height 80ms ease;
}
#spectrum-bookmark-axis.bm-axis-visible {
  height: 26px;
}
.spectrum-bookmark-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  top: 50%;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.66rem;
  background: var(--bm-cat-bg, var(--accent-yellow));
  color: var(--bm-cat-fg, #1a202c);
  border: 1px solid var(--bm-cat-bg, var(--accent-yellow));
  border-radius: 3px;
  padding: 2px 8px;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.spectrum-bookmark-chip:hover {
  filter: brightness(1.15);
}
.spectrum-bookmark-side {
  position: absolute;
  top: calc(var(--spectrum-plot-height) / 2);
  transform: translateY(-50%);
  z-index: 7;
  width: 7.25rem;
  display: none;
  flex-direction: column;
  gap: 0.28rem;
}
.spectrum-bookmark-side.bm-side-visible {
  display: flex;
}
.spectrum-bookmark-side-left {
  left: -10.15rem;
  align-items: flex-end;
}
.spectrum-bookmark-side-right {
  right: -10.15rem;
  align-items: flex-start;
}
.spectrum-bookmark-side .spectrum-bookmark-chip {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  max-width: 100%;
}
.spectrum-bookmark-chip-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.16rem;
  width: 100%;
  min-height: 0;
  padding: 0.38rem 0.5rem 0.42rem;
  border-radius: 0.55rem;
  white-space: normal;
  line-height: 1.1;
}
.spectrum-bookmark-side-head {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  min-width: 0;
  width: 100%;
}
.spectrum-bookmark-chip-side .bm-icon-svg {
  flex: 0 0 auto;
  width: 0.5rem;
  height: 0.72rem;
  opacity: 0.95;
}
.spectrum-bookmark-chip-side .spectrum-bookmark-freq,
.spectrum-bookmark-chip-side .spectrum-bookmark-name {
  display: block;
  max-width: 100%;
  min-width: 0;
}
.spectrum-bookmark-chip-side .spectrum-bookmark-freq {
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spectrum-bookmark-chip-side .spectrum-bookmark-name {
  width: 100%;
  font-size: 0.64rem;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.22;
}
.bm-icon-svg path {
  fill: var(--bm-cat-fg, #1a202c);
}
#spectrum-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: rgba(10,15,24,0.85);
  color: #00e676;
  font-size: 0.75rem;
  font-family: monospace;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0,230,118,0.3);
  white-space: nowrap;
  z-index: 10;
}
#spectrum-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px 0;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
#spectrum-bw-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
#spectrum-bw-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 0;
}
#spectrum-bw-input {
  width: 4.5rem;
  padding: 1px 4px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  text-align: right;
  height: 1.5rem;
}
#spectrum-bw-set-btn,
#spectrum-bw-auto-btn,
#spectrum-bw-sweet-btn {
  height: 1.5rem;
  min-height: 0;
  padding: 0 8px;
  font-size: 0.73rem;
}
#spectrum-level-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
#spectrum-floor-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
#spectrum-floor-input {
  width: 3.4rem;
  padding: 1px 4px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input-bg);
  color: var(--text);
  text-align: right;
  height: 1.5rem;
}
#spectrum-auto-btn {
  height: 1.5rem;
  min-height: 0;
  padding: 0 8px;
  font-size: 0.73rem;
}
.spectrum-hint-mouse,
.spectrum-hint-touch {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 2px;
  opacity: 0.6;
}
/* Show correct hint based on input device */
.spectrum-hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .spectrum-hint-mouse { display: none; }
  .spectrum-hint-touch { display: block; }
}

/* ── Phone layout (≤ 520px) ───────────────────────────────────────────── */
@media (max-width: 520px) {
  /* Single-column controls: jog first, then mode, then power */
  .controls-row {
    grid-template-columns: 1fr;
  }
  .controls-col-center {
    order: -1;
    justify-self: center;
    width: auto;
  }
  .controls-col-center::after { display: none; }
  .controls-col.label-below-col .inline,
  .controls-col.label-below-col .btn-grid { margin-top: 0; }

  /* Scale frequency display to fit narrow screens */
  #freq { font-size: clamp(1.3rem, 6vw, 2rem); }

  /* Wider volume sliders for touch */
  .vol-slider { width: 100%; }
  .vol-label {
    width: 100%;
    align-items: stretch;
  }
  .vol-slider::-webkit-slider-thumb { width: 20px; height: 20px; }
  .vol-slider::-moz-range-thumb     { width: 20px; height: 20px; }

  #audio-row .inline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    align-items: stretch;
  }
  #rx-audio-btn,
  #tx-audio-btn,
  #audio-level,
  #audio-status {
    grid-column: 1 / -1;
  }
  #audio-level {
    min-width: 0;
  }

  /* Spectrum control inputs and buttons: meet minimum tap-target size */
  #spectrum-bw-input,
  #spectrum-floor-input {
    height: 2.2rem;
    font-size: 0.82rem;
  }
  #spectrum-bw-set-btn,
  #spectrum-bw-auto-btn,
  #spectrum-bw-sweet-btn,
  #spectrum-auto-btn {
    height: 2.2rem;
    min-height: 0;
    padding: 0 10px;
    font-size: 0.82rem;
  }
}

/* ── Arctic style ─────────────────────────────────────────────────────── */
[data-style="arctic"] {
  --bg: #242933;
  --card-bg: #2e3440;
  --input-bg: #242933;
  --border: #3b4252;
  --border-light: #4c566a;
  --text: #d8dee9;
  --text-muted: #8a9ab0;
  --text-heading: #eceff4;
  --btn-bg: #3b4252;
  --btn-border: #5e6f88;
  --accent-green: #88c0d0;
  --accent-yellow: #ebcb8b;
  --accent-red: #bf616a;
  --jog-hi: #434c5e;
  --jog-lo: #3b4252;
  --jog-shadow: rgba(0,0,0,0.40);
  --jog-inset: rgba(255,255,255,0.06);
  --audio-level-bg: #2e3440;
  --audio-level-border: #4c566a;
  --audio-level-fill-start: #88c0d0;
  --audio-level-fill-end: #ebcb8b;
  --filter-bg: #3b4252;
  --filter-fg: #d8dee9;
  --filter-border: #5e6f88;
  --wavelength-fg: #7a8ea8;
  --spectrum-bg: #1e2530;
}
[data-style="arctic"][data-theme="light"] {
  --bg: #e5e9f0;
  --card-bg: #eceff4;
  --input-bg: #d8dee9;
  --border: #c5ccd8;
  --border-light: #a8b2c0;
  --text: #2e3440;
  --text-muted: #4c566a;
  --text-heading: #2e3440;
  --btn-bg: #d8dee9;
  --btn-border: #8fa3b8;
  --accent-green: #5e81ac;
  --accent-yellow: #c07a22;
  --accent-red: #bf616a;
  --jog-hi: #d8dee9;
  --jog-lo: #c2cbd8;
  --jog-shadow: rgba(46,52,64,0.18);
  --jog-inset: rgba(255,255,255,0.70);
  --audio-level-bg: #d0d6e0;
  --audio-level-border: #a8b2c0;
  --audio-level-fill-start: #5e81ac;
  --audio-level-fill-end: #c07a22;
  --filter-bg: #d8dee9;
  --filter-fg: #2e3440;
  --filter-border: #8fa3b8;
  --wavelength-fg: #5a6a80;
  --spectrum-bg: #dde1e9;
}

/* ── Lime style ───────────────────────────────────────────────────────── */
[data-style="lime"] {
  --bg: #1c1c17;
  --card-bg: #272822;
  --input-bg: #1c1c17;
  --border: #3e3d32;
  --border-light: #5c5c45;
  --text: #f8f8f2;
  --text-muted: #908980;
  --text-heading: #f8f8f2;
  --btn-bg: #3e3d32;
  --btn-border: #75715e;
  --accent-green: #a6e22e;
  --accent-yellow: #e6db74;
  --accent-red: #f92672;
  --jog-hi: #49483e;
  --jog-lo: #3e3d32;
  --jog-shadow: rgba(0,0,0,0.45);
  --jog-inset: rgba(255,255,255,0.05);
  --audio-level-bg: #272822;
  --audio-level-border: #5c5c45;
  --audio-level-fill-start: #a6e22e;
  --audio-level-fill-end: #e6db74;
  --filter-bg: #3e3d32;
  --filter-fg: #f8f8f2;
  --filter-border: #75715e;
  --wavelength-fg: #9c8f78;
  --spectrum-bg: #181815;
}
[data-style="lime"][data-theme="light"] {
  --bg: #f5f0e4;
  --card-bg: #fdf9f2;
  --input-bg: #ede8d8;
  --border: #d8d0bb;
  --border-light: #c0b89e;
  --text: #272822;
  --text-muted: #6e6a56;
  --text-heading: #272822;
  --btn-bg: #ede8d8;
  --btn-border: #b0a888;
  --accent-green: #5f8700;
  --accent-yellow: #9a7200;
  --accent-red: #c60052;
  --jog-hi: #ede8d8;
  --jog-lo: #ddd8c8;
  --jog-shadow: rgba(39,40,34,0.18);
  --jog-inset: rgba(255,255,255,0.75);
  --audio-level-bg: #ede8d8;
  --audio-level-border: #c0b89e;
  --audio-level-fill-start: #5f8700;
  --audio-level-fill-end: #9a7200;
  --filter-bg: #ede8d8;
  --filter-fg: #272822;
  --filter-border: #b0a888;
  --wavelength-fg: #7a7260;
  --spectrum-bg: #ede8d8;
}

/* ── Contrast style ───────────────────────────────────────────────────── */
[data-style="contrast"] {
  --bg: #000000;
  --card-bg: #0a0a0a;
  --input-bg: #111111;
  --border: #333333;
  --border-light: #555555;
  --text: #ffffff;
  --text-muted: #bbbbbb;
  --text-heading: #ffffff;
  --btn-bg: #1a1a1a;
  --btn-border: #666666;
  --accent-green: #00ff88;
  --accent-yellow: #ffcc00;
  --accent-red: #ff3344;
  --jog-hi: #2a2a2a;
  --jog-lo: #1a1a1a;
  --jog-shadow: rgba(0,0,0,0.60);
  --jog-inset: rgba(255,255,255,0.08);
  --audio-level-bg: #111111;
  --audio-level-border: #555555;
  --audio-level-fill-start: #00ff88;
  --audio-level-fill-end: #ffcc00;
  --filter-bg: #1a1a1a;
  --filter-fg: #ffffff;
  --filter-border: #666666;
  --wavelength-fg: #aaaaaa;
  --spectrum-bg: #000000;
}
[data-style="contrast"][data-theme="light"] {
  --bg: #ffffff;
  --card-bg: #f4f4f4;
  --input-bg: #e8e8e8;
  --border: #cccccc;
  --border-light: #999999;
  --text: #000000;
  --text-muted: #333333;
  --text-heading: #000000;
  --btn-bg: #e0e0e0;
  --btn-border: #777777;
  --accent-green: #005cc5;
  --accent-yellow: #cc5500;
  --accent-red: #cc0000;
  --jog-hi: #e0e0e0;
  --jog-lo: #cccccc;
  --jog-shadow: rgba(0,0,0,0.25);
  --jog-inset: rgba(255,255,255,0.80);
  --audio-level-bg: #e8e8e8;
  --audio-level-border: #999999;
  --audio-level-fill-start: #005cc5;
  --audio-level-fill-end: #cc5500;
  --filter-bg: #e8e8e8;
  --filter-fg: #000000;
  --filter-border: #999999;
  --wavelength-fg: #444444;
  --spectrum-bg: #f4f4f4;
}

/* ── Neon Disco style ─────────────────────────────────────────────────── */
[data-style="neon-disco"] {
  --bg: #0d0015;
  --card-bg: #180026;
  --input-bg: #100018;
  --border: #3d0060;
  --border-light: #7700bb;
  --text: #f5e0ff;
  --text-muted: #b070d8;
  --text-heading: #fce8ff;
  --btn-bg: #2a0042;
  --btn-border: #9900dd;
  --accent-green: #ff10e0;
  --accent-yellow: #39ff14;
  --accent-red: #ff1460;
  --jog-hi: #360058;
  --jog-lo: #280042;
  --jog-shadow: rgba(0,0,0,0.65);
  --jog-inset: rgba(255,16,224,0.08);
  --audio-level-bg: #180026;
  --audio-level-border: #7700bb;
  --audio-level-fill-start: #ff10e0;
  --audio-level-fill-end: #39ff14;
  --filter-bg: #2a0042;
  --filter-fg: #f5e0ff;
  --filter-border: #9900dd;
  --wavelength-fg: #9055b8;
  --spectrum-bg: #090010;
}
[data-style="neon-disco"][data-theme="light"] {
  --bg: #faeeff;
  --card-bg: #fff4ff;
  --input-bg: #f2e0ff;
  --border: #dda8f5;
  --border-light: #cc80e8;
  --text: #1a0030;
  --text-muted: #7a30a0;
  --text-heading: #1a0030;
  --btn-bg: #f0d8ff;
  --btn-border: #bb80dd;
  --accent-green: #cc00a8;
  --accent-yellow: #1f8800;
  --accent-red: #cc0044;
  --jog-hi: #f0d8ff;
  --jog-lo: #e2c8f5;
  --jog-shadow: rgba(60,0,100,0.18);
  --jog-inset: rgba(255,255,255,0.72);
  --audio-level-bg: #f0d8ff;
  --audio-level-border: #cc80e8;
  --audio-level-fill-start: #cc00a8;
  --audio-level-fill-end: #1f8800;
  --filter-bg: #f0d8ff;
  --filter-fg: #1a0030;
  --filter-border: #bb80dd;
  --wavelength-fg: #7030a0;
  --spectrum-bg: #f0d8ff;
}

/* ============================================================
   Bookmarks tab
   ============================================================ */

.bm-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem 0.4rem;
  flex-wrap: wrap;
}

.bm-add-btn {
  background: var(--accent-green);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.bm-add-btn:hover {
  opacity: 0.88;
}

.bm-form {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: 0.5rem;
  padding: 0.9rem 1rem;
  margin: 0 0.75rem 0.6rem;
}

.bm-form-title {
  font-weight: 700;
  margin-bottom: 0.65rem;
  font-size: 0.95rem;
  color: var(--text-heading);
}

.bm-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.5rem 0.75rem;
}

.bm-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bm-label input {
  font-size: 0.88rem;
  padding: 0.35rem 0.5rem;
}

.bm-label-wide {
  grid-column: 1 / -1;
}

.bm-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.bm-save-btn {
  background: var(--accent-green);
  color: #fff;
  border: none;
  border-radius: 0.35rem;
  padding: 0.4rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

.bm-save-btn:hover {
  opacity: 0.88;
}

.bm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 0 0 0.5rem;
}

.bm-table th {
  text-align: left;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.bm-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.bm-table tr:hover td {
  background: var(--btn-bg);
}

.bm-col-freq,
.bm-col-bw {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bm-col-mode,
.bm-col-dec {
  white-space: nowrap;
}

.bm-col-act {
  white-space: nowrap;
}

.bm-col-act button {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  margin-right: 0.25rem;
  border-radius: 0.25rem;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  cursor: pointer;
}

.bm-col-act button:hover {
  background: var(--border-light);
}

.bm-del-btn {
  color: var(--accent-red) !important;
  border-color: var(--accent-red) !important;
}

.bm-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Donald style ─────────────────────────────────────────────────────── */
[data-style="golden-rain"] {
  --bg: #100c06;
  --card-bg: #1a1209;
  --input-bg: #140f08;
  --border: #3f2d18;
  --border-light: #6d4e23;
  --text: #f3e4bf;
  --text-muted: #aa9062;
  --text-heading: #fff0ca;
  --btn-bg: #2a1c0d;
  --btn-border: #7c5928;
  --accent-green: #dfac48;
  --accent-yellow: #f4cd74;
  --accent-red: #cf7d32;
  --jog-hi: #392610;
  --jog-lo: #24170b;
  --jog-shadow: rgba(0,0,0,0.64);
  --jog-inset: rgba(255,219,138,0.06);
  --audio-level-bg: #1c130a;
  --audio-level-border: #6d4e23;
  --audio-level-fill-start: #dfac48;
  --audio-level-fill-end: #f4cd74;
  --filter-bg: #2b1d0f;
  --filter-fg: #f3e4bf;
  --filter-border: #7c5928;
  --wavelength-fg: #ab8b52;
  --spectrum-bg: #120d07;
}
[data-style="golden-rain"][data-theme="light"] {
  --bg: #f7efdd;
  --card-bg: #fff9ec;
  --input-bg: #f0e3c6;
  --border: #d4bc8a;
  --border-light: #b99243;
  --text: #3f2c10;
  --text-muted: #7f6640;
  --text-heading: #3a2609;
  --btn-bg: #f0e3c6;
  --btn-border: #b99243;
  --accent-green: #a96d00;
  --accent-yellow: #c88a16;
  --accent-red: #b65316;
  --jog-hi: #f2e5c8;
  --jog-lo: #e3d1a8;
  --jog-shadow: rgba(82,55,14,0.16);
  --jog-inset: rgba(255,255,255,0.76);
  --audio-level-bg: #f0e3c6;
  --audio-level-border: #c5a15d;
  --audio-level-fill-start: #a96d00;
  --audio-level-fill-end: #d4a13a;
  --filter-bg: #f0e3c6;
  --filter-fg: #3f2c10;
  --filter-border: #b99243;
  --wavelength-fg: #87663a;
  --spectrum-bg: #f5ecd9;
}

/* ── Amber style ──────────────────────────────────────────────────────── */
[data-style="amber"] {
  --bg: #120706;
  --card-bg: #1b0c0a;
  --input-bg: #180907;
  --border: #4c1a12;
  --border-light: #7a2e1a;
  --text: #ffe7d2;
  --text-muted: #c78361;
  --text-heading: #fff3e7;
  --btn-bg: #2c110d;
  --btn-border: #8f3a20;
  --accent-green: #ff6f1f;
  --accent-yellow: #ffb347;
  --accent-red: #ff4a24;
  --jog-hi: #381510;
  --jog-lo: #24100c;
  --jog-shadow: rgba(0,0,0,0.62);
  --jog-inset: rgba(255,164,76,0.07);
  --audio-level-bg: #1f0d0a;
  --audio-level-border: #7a2e1a;
  --audio-level-fill-start: #ff4a24;
  --audio-level-fill-end: #ffb347;
  --filter-bg: #2b120d;
  --filter-fg: #ffe7d2;
  --filter-border: #8f3a20;
  --wavelength-fg: #d38d6a;
  --spectrum-bg: #140907;
}
[data-style="amber"][data-theme="light"] {
  --bg: #fff3ea;
  --card-bg: #fff7f0;
  --input-bg: #ffe9da;
  --border: #efc7b1;
  --border-light: #d9a487;
  --text: #42180d;
  --text-muted: #8a4b31;
  --text-heading: #2f120a;
  --btn-bg: #ffe2cf;
  --btn-border: #cc8563;
  --accent-green: #d24c12;
  --accent-yellow: #d88400;
  --accent-red: #c53114;
  --jog-hi: #ffe2cf;
  --jog-lo: #ffd5bc;
  --jog-shadow: rgba(108,44,15,0.18);
  --jog-inset: rgba(255,255,255,0.72);
  --audio-level-bg: #ffe7d7;
  --audio-level-border: #d9a487;
  --audio-level-fill-start: #c53114;
  --audio-level-fill-end: #d88400;
  --filter-bg: #ffe2cf;
  --filter-fg: #42180d;
  --filter-border: #cc8563;
  --wavelength-fg: #9a5a3a;
  --spectrum-bg: #fff0e4;
}

/* ── Fire style ───────────────────────────────────────────────────────── */
[data-style="fire"] {
  --bg: #140406;
  --card-bg: #1d0708;
  --input-bg: #1a0607;
  --border: #551015;
  --border-light: #8f1f26;
  --text: #ffe6df;
  --text-muted: #cf8d82;
  --text-heading: #fff4ef;
  --btn-bg: #2d0c0d;
  --btn-border: #9d262b;
  --accent-green: #d13a32;
  --accent-yellow: #ff6a3d;
  --accent-red: #c10f1f;
  --jog-hi: #390f11;
  --jog-lo: #25090b;
  --jog-shadow: rgba(0,0,0,0.64);
  --jog-inset: rgba(255,120,100,0.06);
  --audio-level-bg: #22090b;
  --audio-level-border: #8f1f26;
  --audio-level-fill-start: #c10f1f;
  --audio-level-fill-end: #ff6a3d;
  --filter-bg: #2d0c0d;
  --filter-fg: #ffe6df;
  --filter-border: #9d262b;
  --wavelength-fg: #d78d78;
  --spectrum-bg: #150508;
}
[data-style="fire"][data-theme="light"] {
  --bg: #fdf0ea;
  --card-bg: #fff6f1;
  --input-bg: #ffe5db;
  --border: #e9b8aa;
  --border-light: #d27c66;
  --text: #4a110d;
  --text-muted: #8a493f;
  --text-heading: #340b08;
  --btn-bg: #ffd9cc;
  --btn-border: #c85b47;
  --accent-green: #ba2d24;
  --accent-yellow: #d95518;
  --accent-red: #a80f1c;
  --jog-hi: #ffd9cc;
  --jog-lo: #ffcab9;
  --jog-shadow: rgba(110,35,20,0.18);
  --jog-inset: rgba(255,255,255,0.74);
  --audio-level-bg: #ffe2d7;
  --audio-level-border: #d27c66;
  --audio-level-fill-start: #a80f1c;
  --audio-level-fill-end: #d95518;
  --filter-bg: #ffd9cc;
  --filter-fg: #4a110d;
  --filter-border: #c85b47;
  --wavelength-fg: #9d5547;
  --spectrum-bg: #ffede5;
}
