:root {
  color-scheme: dark;
  --bg: #121212;
  --panel: #1f1f1f;
  --panel-2: #2b2b2b;
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --line: #3a3a3a;
  --accent: #e14b3d;
  --talking-border: #8f312c;
  --relay: #f0a020;
  --client: #65a7ff;
  --ok: #4fd37a;
  --permanent-lamp: #ff78b8;
  --permanent-lamp-core: #fff1f8;
  --shadow: 0 6px 18px rgba(0, 0, 0, .32);
  --station-list-width: 366px;
  /* 滚动条通道：需覆盖 Windows 经典滚动条(17px)，避免任何浏览器下压住卡片内容。 */
  --list-scroll-lane: 18px;
  --site-footer-height: 36px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f4;
  --panel: #ffffff;
  --panel-2: #f0f0f0;
  --text: #161616;
  --muted: #666666;
  --line: #d7d7d7;
  --accent: #df4638;
  --talking-border: #a5352f;
  --relay: #c87b00;
  --client: #1f67c7;
  --ok: #168542;
  --permanent-lamp: #e44391;
  --permanent-lamp-core: #ffffff;
  --shadow: 0 5px 15px rgba(0, 0, 0, .16);
}

@property --permanent-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  height: 100%;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) var(--site-footer-height);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 48px;
  padding: 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 5;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

.theme-icon {
  font-size: 22px;
  line-height: 1;
}

.direct-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--text);
  background: color-mix(in srgb, var(--relay), var(--panel) 88%);
  border: 1px solid color-mix(in srgb, var(--relay), transparent 35%);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.direct-btn.configured {
  color: var(--relay);
  border-color: var(--relay);
}

.direct-btn.connected {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok), var(--panel) 90%);
  border-color: var(--ok);
}

.direct-btn-dot,
.direct-callout-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--relay);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--relay), transparent 78%);
}

.direct-btn.connected .direct-btn-dot,
.direct-callout.connected .direct-callout-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok), transparent 78%);
}

.direct-data-tabs {
  height: 34px;
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.direct-data-tabs[hidden] {
  display: none;
}

.direct-data-tab {
  min-width: 46px;
  padding: 0 9px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.direct-data-tab[hidden] {
  display: none;
}

.direct-data-tab:hover {
  color: var(--text);
}

.direct-data-tab.active {
  color: #092614;
  background: var(--ok);
}

.app-download-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--client);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.app-download-btn:hover {
  color: #fff;
  background: color-mix(in srgb, var(--client), var(--panel) 72%);
}

.group-entry-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px 0 8px;
  color: #102017;
  background: #66d39a;
  border: 1px solid #85e4b2;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

.group-entry-btn:hover {
  color: #07140d;
  background: #83e3b0;
  border-color: #a0edc4;
}

.group-entry-btn.expiring {
  color: #291c07;
  background: #f0ad3d;
  border-color: #ffc15d;
}

.group-entry-btn.expiring:hover {
  color: #1c1203;
  background: #ffc05c;
  border-color: #ffd182;
}

.group-entry-btn.expired,
.group-entry-btn.expired:hover {
  color: #a5a8ad;
  background: #303237;
  border-color: #4b4e54;
  cursor: not-allowed;
}

.group-entry-mark {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #dff8ea;
  background: #176c43;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1;
}

.group-entry-btn.expiring .group-entry-mark {
  color: #fff5e1;
  background: #9c5c08;
}

.group-entry-btn.expired .group-entry-mark {
  color: #d1d3d6;
  background: #55585e;
}

.live-caller-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 850;
}

.live-caller-btn img {
  width: 17px;
  height: 17px;
  opacity: .72;
}

.live-caller-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.live-caller-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.live-caller-btn.active img {
  opacity: 1;
  filter: brightness(0) invert(1);
}

.apple-mark {
  width: 1em;
  height: 1em;
  display: inline-block;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask-image: url("/assets/apple-mark.svg?v=202607311100");
  mask-image: url("/assets/apple-mark.svg?v=202607311100");
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  font-size: 18px;
  line-height: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.brand-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.connection-badge {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.connection-badge.connected { color: var(--ok); }
.connection-badge.error { color: var(--accent); }

.stat-strip {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.stat-strip b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.last-update {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.workspace {
  min-height: 0;
  padding: 8px;
  overflow: hidden;
}

.site-footer {
  height: var(--site-footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: color-mix(in srgb, var(--panel), var(--bg) 28%);
  border-top: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  z-index: 21;
}

.filing-links {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  transition: color .15s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--relay);
  text-decoration: underline;
}

.filing-divider {
  width: 1px;
  height: 14px;
  flex: 0 0 auto;
  background: var(--line);
}

.public-security-filing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.public-security-filing img {
  width: 18px;
  height: 20px;
  flex: 0 0 auto;
  object-fit: contain;
}

.live-caller-overlay {
  position: fixed;
  inset: 48px 0 var(--site-footer-height);
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, .74);
  pointer-events: none;
}

.live-caller-overlay[hidden] {
  display: none;
}

.live-caller-stage {
  width: min(1600px, calc(100vw - 24px));
}

.live-caller-stage .contact-card {
  height: min(900px, calc(100dvh - 64px));
  min-height: min(900px, calc(100dvh - 64px));
  border-width: 2px;
  border-radius: 8px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, .56), inset 0 0 0 1px rgba(184, 62, 53, .48);
}

.live-caller-stage .contact-identity {
  padding: 50px 60px 42px;
}

.live-caller-stage .contact-heading {
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 50px;
}

.live-caller-stage .contact-call {
  font-size: 92px;
}

.live-caller-stage .contact-facts {
  gap: 13px;
  margin-top: 30px;
}

.live-caller-stage .contact-facts div {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 24px;
}

.live-caller-stage .contact-facts dt {
  font-size: 24px;
}

.live-caller-stage .contact-facts dd {
  font-size: 34px;
}

.live-caller-stage .contact-bearing {
  width: 240px;
  height: 224px;
  grid-template-rows: 156px 38px 18px;
}

.live-caller-stage .bearing-dial {
  width: 140px;
  height: 140px;
}

.live-caller-stage .bearing-north {
  font-size: 15px;
}

.live-caller-stage .bearing-arrow {
  width: 72px;
  height: 72px;
}

.live-caller-stage .contact-bearing figcaption {
  max-width: 232px;
  font-size: 22px;
}

.live-caller-stage .contact-bearing a {
  font-size: 10px;
}

.live-caller-stage .contact-status {
  min-height: 124px;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  gap: 38px;
  padding: 22px 60px;
}

.live-caller-stage .contact-state {
  gap: 12px;
}

.live-caller-stage .role-dot {
  width: 18px;
  height: 18px;
}

.live-caller-stage .contact-state strong,
.live-caller-stage .contact-relay strong,
.live-caller-stage .contact-updated strong {
  font-size: 27px;
}

.live-caller-stage .contact-relay small,
.live-caller-stage .contact-updated small {
  font-size: 15px;
}

.control-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--station-list-width) minmax(320px, 430px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 0;
  background: var(--bg);
  overflow: hidden;
}

.control-panel.direct-data-mode {
  grid-template-columns: var(--station-list-width) minmax(0, 1fr);
}

.direct-data-view {
  min-width: 0;
  min-height: 0;
  grid-column: 2 / -1;
  grid-row: 1;
  padding: 18px 20px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  scrollbar-gutter: stable;
}

.direct-data-view[hidden] {
  display: none;
}

.direct-data-view.map-data-mode {
  padding: 0;
  overflow: hidden;
}

.aprs-map-view {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--panel);
}

.aprs-map-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(180px, 300px) auto 36px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  z-index: 3;
}

.aprs-map-title {
  min-width: 0;
}

.aprs-map-title h2,
.aprs-map-title p {
  margin: 0;
}

.aprs-map-title h2 {
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.aprs-map-title p {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aprs-map-search {
  min-width: 0;
  height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.aprs-map-search:focus-within {
  border-color: var(--client);
}

.aprs-map-search input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 11px;
}

.aprs-map-filters {
  height: 34px;
  display: inline-flex;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.aprs-map-filters button {
  min-width: 46px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.aprs-map-filters button:hover {
  color: var(--text);
}

.aprs-map-filters button.active {
  color: #111214;
  background: var(--relay);
}

.aprs-map-fit {
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 21px;
  line-height: 1;
}

.aprs-map-fit:hover {
  border-color: var(--client);
}

.aprs-map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel-2), var(--bg) 35%);
}

.aprs-map-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #20252a;
}

:root[data-theme="dark"] .aprs-map-canvas .leaflet-tile-pane {
  filter: grayscale(.5) invert(.84) contrast(1.12) hue-rotate(178deg) brightness(.66);
}

.aprs-map-canvas .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.aprs-map-canvas .leaflet-control-zoom a {
  color: var(--text);
  background: var(--panel);
  border-bottom-color: var(--line);
}

.aprs-map-canvas .leaflet-control-zoom a:hover {
  color: var(--client);
  background: var(--panel-2);
}

.aprs-map-canvas .leaflet-control-attribution {
  padding: 3px 6px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel), transparent 12%);
  font-size: 9px;
}

.aprs-map-canvas .leaflet-control-attribution a {
  color: var(--client);
}

.aprs-map-summary {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 500;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel), transparent 8%);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 10px;
  pointer-events: none;
}

.aprs-map-summary span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.aprs-map-summary strong {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.aprs-map-summary i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 50%;
  background: var(--client);
}

.aprs-map-summary i.relay {
  border-radius: 2px;
  background: var(--relay);
}

.aprs-map-summary i.talking {
  background: var(--accent);
}

.aprs-map-status {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 500;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 16px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-size: 12px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.aprs-map-status:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.aprs-map-status.error {
  color: var(--text);
  border-color: color-mix(in srgb, var(--relay), var(--line) 44%);
}

.aprs-map-loading-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--client), transparent 68%);
  border-top-color: var(--client);
  border-radius: 50%;
  animation: aprs-map-loading 800ms linear infinite;
}

@keyframes aprs-map-loading {
  to { transform: rotate(360deg); }
}

.aprs-map-status[hidden] {
  display: none;
}

.aprs-map-marker,
.aprs-map-cluster-marker {
  background: transparent;
  border: 0;
}

.aprs-map-point {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, .92);
  border-radius: 50%;
  background: var(--client);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--client), transparent 76%), 0 4px 12px rgba(0, 0, 0, .38);
}

.aprs-map-point.server {
  border-radius: 6px;
  background: var(--relay);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--relay), transparent 76%), 0 4px 12px rgba(0, 0, 0, .38);
  transform: rotate(45deg);
}

.aprs-map-point i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.aprs-map-point.server i {
  border-radius: 1px;
}

.aprs-map-point.talking {
  background: var(--accent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent), transparent 65%), 0 4px 12px rgba(0, 0, 0, .42);
  animation: aprs-map-talking 1s ease-in-out infinite;
}

.aprs-map-point.selected {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

@keyframes aprs-map-talking {
  50% { box-shadow: 0 0 0 11px color-mix(in srgb, var(--accent), transparent 88%), 0 4px 12px rgba(0, 0, 0, .42); }
}

.aprs-map-cluster {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: #111214;
  background: var(--client);
  border: 3px solid rgba(255, 255, 255, .78);
  border-radius: 50%;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--client), transparent 70%), var(--shadow);
}

.aprs-map-cluster.relay {
  background: var(--relay);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--relay), transparent 70%), var(--shadow);
}

.aprs-map-cluster.mixed {
  color: var(--text);
  background: var(--ok);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok), transparent 72%), var(--shadow);
}

.aprs-map-cluster.talking {
  border-color: color-mix(in srgb, var(--accent), #fff 45%);
}

.aprs-map-cluster strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.aprs-map-popup .leaflet-popup-content-wrapper,
.aprs-map-popup .leaflet-popup-tip {
  color: var(--text);
  background: var(--panel);
}

.aprs-map-popup .leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.aprs-map-popup .leaflet-popup-content {
  margin: 16px;
}

.aprs-map-popup .leaflet-popup-close-button {
  color: var(--muted);
  font-size: 20px;
}

.aprs-map-popup-card {
  min-width: 280px;
  display: grid;
  gap: 11px;
}

.aprs-map-popup-card > strong {
  padding-right: 16px;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 20px;
  line-height: 1.25;
}

.aprs-map-popup-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.aprs-map-popup-card .aprs-map-popup-description {
  max-height: 110px;
  overflow: auto;
  padding: 9px 10px;
  color: var(--text);
  background: var(--panel-2);
  border-left: 2px solid var(--relay);
  font-size: 13px;
  line-height: 1.5;
}

.aprs-map-popup-kind {
  width: max-content;
  padding: 4px 7px;
  color: var(--client);
  background: color-mix(in srgb, var(--client), var(--panel) 90%);
  border: 1px solid color-mix(in srgb, var(--client), transparent 48%);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 900;
}

.aprs-map-popup-kind.server {
  color: var(--relay);
  background: color-mix(in srgb, var(--relay), var(--panel) 90%);
  border-color: color-mix(in srgb, var(--relay), transparent 48%);
}

.aprs-map-popup-kind.talking {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--panel) 91%);
  border-color: color-mix(in srgb, var(--accent), transparent 48%);
}

.aprs-map-popup-card dl {
  margin: 0;
  display: grid;
  gap: 6px;
}

.aprs-map-popup-card dl div {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
}

.aprs-map-popup-card dt,
.aprs-map-popup-card dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.aprs-map-popup-card dt {
  color: var(--muted);
}

.aprs-map-popup-card dd {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.aprs-map-popup-card button {
  height: 36px;
  color: #111214;
  background: var(--relay);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.direct-data-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.direct-data-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--ok);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.direct-data-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
}

.direct-data-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.qso-refresh-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.qso-refresh-btn:hover {
  border-color: var(--ok);
}

.qso-refresh-btn.loading {
  color: var(--ok);
}

.qso-refresh-btn.loading:not(.refresh-feedback) span {
  display: block;
  animation: qso-spin .85s linear infinite;
}

.qso-refresh-btn.refresh-feedback span {
  display: block;
  animation: cluster-refresh-feedback-spin .56s ease-out 1;
}

@keyframes qso-spin {
  to { transform: rotate(360deg); }
}

@keyframes cluster-refresh-feedback-spin {
  to { transform: rotate(360deg); }
}

.qso-filter-bar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.qso-date-tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--panel-2);
  border-radius: 4px;
}

.qso-date-tabs button {
  height: 29px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.qso-date-tabs button.active {
  color: #111214;
  background: var(--relay);
}

.qso-search {
  width: min(300px, 42%);
  min-width: 190px;
  height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 11px;
}

.qso-search:focus-within {
  border-color: var(--client);
}

.qso-search input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 12px;
}

.qso-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 180px));
  gap: 8px;
  margin-bottom: 12px;
}

.qso-summary div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel-2);
  border-left: 3px solid var(--relay);
  border-radius: 3px;
}

.qso-summary strong,
.qso-summary span {
  display: block;
}

.qso-summary strong {
  color: var(--text);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.qso-summary span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.qso-log-list {
  min-width: 660px;
  border-top: 1px solid var(--line);
}

.qso-log-header,
.qso-log-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(140px, 1.4fr) minmax(100px, .8fr) minmax(120px, 1fr) 92px;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
}

.qso-log-header {
  height: 34px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2), transparent 30%);
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  font-weight: 800;
}

.qso-log-row {
  min-height: 48px;
  color: var(--muted);
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 35%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.qso-log-row:hover {
  background: color-mix(in srgb, var(--client), transparent 94%);
}

.qso-log-row strong {
  color: var(--text);
  font-size: 14px;
}

.qso-index {
  color: var(--muted);
  font-size: 10px;
}

.qso-pagination {
  min-width: 660px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.qso-pagination div {
  display: flex;
  gap: 5px;
}

.qso-pagination button {
  width: 34px;
  height: 30px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 20px;
}

.qso-pagination button:disabled {
  opacity: .35;
  cursor: default;
}

.qso-ranking-list {
  max-width: 1000px;
  margin: 2px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.qso-ranking-list li {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 4px;
}

.qso-ranking-list li.rank-1,
.qso-ranking-list li.rank-2,
.qso-ranking-list li.rank-3 {
  border-color: color-mix(in srgb, var(--relay), transparent 48%);
  background: color-mix(in srgb, var(--relay), var(--panel) 91%);
}

.qso-rank {
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.rank-1 .qso-rank {
  color: var(--relay);
  font-size: 23px;
}

.qso-rank-call {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.qso-rank-call strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qso-rank-call span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qso-rank-count {
  min-width: 78px;
  display: grid;
  text-align: right;
}

.qso-rank-count strong {
  color: var(--relay);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.qso-rank-count span {
  color: var(--muted);
  font-size: 9px;
}

.direct-data-view.stream-data-mode {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.stream-data-head {
  align-items: center;
}

.stream-live-status {
  min-width: 122px;
  display: grid;
  grid-template-columns: 10px auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.stream-live-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.stream-live-status.live i {
  background: var(--ok);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok), transparent 82%);
  animation: stream-live-pulse 1.7s ease-in-out infinite;
}

.stream-live-status.paused i {
  background: var(--relay);
}

@keyframes stream-live-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

.stream-live-status div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.stream-live-status strong {
  color: var(--text);
  font-size: 11px;
  white-space: nowrap;
}

.stream-live-status span {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.stream-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
}

.stream-filter-tabs,
.stream-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}

.stream-filter-tabs {
  padding: 2px;
  background: var(--panel-2);
  border-radius: 4px;
}

.stream-filter-tabs button,
.stream-actions button {
  height: 30px;
  padding: 0 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.stream-filter-tabs button.active {
  color: #111214;
  background: var(--relay);
}

.stream-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

.stream-actions button:hover {
  border-color: var(--client);
}

.stream-actions button span {
  width: 12px;
  color: var(--client);
  font-size: 13px;
  line-height: 1;
  text-align: center;
}

.stream-feed {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg), var(--panel) 35%);
  scrollbar-gutter: stable;
}

.stream-row {
  min-width: 720px;
  min-height: 44px;
  display: grid;
  grid-template-columns: 70px 68px minmax(110px, 150px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line), transparent 32%);
  border-left: 3px solid var(--muted);
}

.stream-row:hover {
  background: color-mix(in srgb, var(--client), transparent 95%);
}

.stream-row.stream-featured-relay {
  border-left-color: var(--accent);
  background: color-mix(in srgb, var(--accent), var(--panel) 90%);
  box-shadow:
    inset 0 1px color-mix(in srgb, var(--accent), transparent 46%),
    inset 0 -1px color-mix(in srgb, var(--accent), transparent 60%);
}

.stream-row.stream-featured-relay:hover {
  background: color-mix(in srgb, var(--accent), var(--panel) 84%);
}

.stream-row.stream-featured-relay .stream-callsign,
.stream-row.stream-featured-relay p {
  color: var(--text);
  font-weight: 800;
}

.stream-row:last-child {
  border-bottom: 0;
}

.stream-row time {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.stream-type {
  width: fit-content;
  min-width: 52px;
  padding: 3px 6px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 900;
  text-align: center;
}

.stream-callsign {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-row p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stream-row.stream-voice {
  border-left-color: var(--accent);
}

.stream-row.stream-voice .stream-type {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent), transparent 45%);
  background: color-mix(in srgb, var(--accent), var(--panel) 91%);
}

.stream-row.stream-online {
  border-left-color: var(--ok);
}

.stream-row.stream-online .stream-type {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok), transparent 45%);
  background: color-mix(in srgb, var(--ok), var(--panel) 91%);
}

.stream-row.stream-station {
  border-left-color: var(--relay);
}

.stream-row.stream-station .stream-type {
  color: var(--relay);
  border-color: color-mix(in srgb, var(--relay), transparent 45%);
  background: color-mix(in srgb, var(--relay), var(--panel) 91%);
}

.stream-row.stream-device {
  border-left-color: var(--client);
}

.stream-row.stream-device .stream-type {
  color: var(--client);
  border-color: color-mix(in srgb, var(--client), transparent 45%);
  background: color-mix(in srgb, var(--client), var(--panel) 91%);
}

.stream-row.stream-event {
  border-left-color: var(--permanent-lamp);
}

.stream-row.stream-event .stream-type {
  color: var(--permanent-lamp);
  border-color: color-mix(in srgb, var(--permanent-lamp), transparent 45%);
  background: color-mix(in srgb, var(--permanent-lamp), var(--panel) 92%);
}

.stream-empty {
  min-height: 220px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.stream-empty strong {
  color: var(--text);
  font-size: 15px;
}

.stream-empty span {
  font-size: 11px;
}

.cluster-head-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.cluster-updated {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.cluster-updated i,
.cluster-live-mark::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok), transparent 78%);
  content: "";
}

.cluster-updated.stale i {
  background: var(--relay);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--relay), transparent 78%);
}

.cluster-health {
  min-height: 58px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 14px 0 10px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--ok), var(--panel) 92%);
  border: 1px solid color-mix(in srgb, var(--ok), transparent 55%);
  border-left-width: 3px;
  border-radius: 4px;
}

.cluster-health.warning {
  background: color-mix(in srgb, var(--relay), var(--panel) 92%);
  border-color: color-mix(in srgb, var(--relay), transparent 55%);
}

.cluster-health-icon {
  width: 12px;
  height: 12px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok), transparent 84%);
}

.cluster-health.warning .cluster-health-icon {
  background: var(--relay);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--relay), transparent 84%);
}

.cluster-health.healthy .cluster-health-icon {
  animation: cluster-online-pulse 1.1s ease-in-out infinite;
}

.cluster-node.online .cluster-node-state {
  animation-name: cluster-node-blink;
  animation-duration: 0.2s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
}

.cluster-node-grid .cluster-node:nth-of-type(1) .cluster-node-state { animation-duration: 0.2s; animation-delay: 0.2s; }
.cluster-node-grid .cluster-node:nth-of-type(2) .cluster-node-state { animation-duration: 0.2s; animation-delay: 0.2s; }
.cluster-node-grid .cluster-node:nth-of-type(3) .cluster-node-state { animation-duration: 0.1s; animation-delay: 0.1s; }
.cluster-node-grid .cluster-node:nth-of-type(4) .cluster-node-state { animation-duration: 0.3s; animation-delay: 0.3s; }
.cluster-node-grid .cluster-node:nth-of-type(5) .cluster-node-state { animation-duration: 0.3s; animation-delay: 0.3s; }
.cluster-node-grid .cluster-node:nth-of-type(6) .cluster-node-state { animation-duration: 0.1s; animation-delay: 0.1s; }
.cluster-node-grid .cluster-node:nth-of-type(7) .cluster-node-state { animation-duration: 0.1s; animation-delay: 0.1s; }
.cluster-node-grid .cluster-node:nth-of-type(8) .cluster-node-state { animation-duration: 0.2s; animation-delay: 0.2s; }
.cluster-node-grid .cluster-node:nth-of-type(9) .cluster-node-state { animation-duration: 0.5s; animation-delay: 0.5s; }
.cluster-node-grid .cluster-node:nth-of-type(10) .cluster-node-state { animation-duration: 0.1s; animation-delay: 0.1s; }
.cluster-node-grid .cluster-node:nth-of-type(11) .cluster-node-state { animation-duration: 0.1s; animation-delay: 0.1s; }

@keyframes cluster-node-blink {
  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

@keyframes cluster-online-pulse {
  0%,
  100% {
    opacity: 0.42;
    transform: scale(0.82);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok), transparent 88%);
  }

  50% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--ok), transparent 76%);
  }
}

.cluster-health div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cluster-health strong {
  color: var(--text);
  font-size: 14px;
}

.cluster-health span,
.cluster-health time {
  color: var(--muted);
  font-size: 10px;
}

.cluster-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.cluster-summary > div {
  min-width: 0;
  padding: 10px 13px;
  border-right: 1px solid var(--line);
}

.cluster-summary > div:last-child {
  border-right: 0;
}

.cluster-summary span,
.cluster-summary strong,
.cluster-summary small {
  display: block;
}

.cluster-summary span {
  color: var(--muted);
  font-size: 10px;
}

.cluster-summary strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.cluster-summary small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-content {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(480px, 1fr) minmax(260px, 320px);
  align-items: start;
  gap: 12px;
}

.cluster-node-list {
  min-width: 0;
}

.cluster-node-list > header,
.cluster-roster > header {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.cluster-node-list > header > span,
.cluster-roster > header span {
  font-size: 13px;
  font-weight: 850;
}

.cluster-node-list > header small,
.cluster-roster > header strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.cluster-node-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 8px;
  padding-top: 8px;
}

.cluster-node {
  min-width: 0;
  padding: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-top: 2px solid var(--ok);
  border-radius: 4px;
}

.cluster-node.offline {
  border-top-color: var(--accent);
}

.cluster-node-head {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.cluster-node-state,
.cluster-client-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.cluster-node.offline .cluster-node-state {
  background: var(--accent);
}

.cluster-node-head div {
  min-width: 0;
}

.cluster-node-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-node-head strong {
  color: var(--text);
  font-size: 13px;
}

.cluster-node-head em {
  color: var(--ok);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.cluster-node.offline .cluster-node-head em {
  color: var(--accent);
}

.cluster-node-metrics {
  margin: 10px 0 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.cluster-node-metrics div {
  min-width: 0;
  padding: 7px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cluster-node-metrics dt {
  color: var(--muted);
  font-size: 9px;
}

.cluster-node-metrics dd {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-node-clients {
  min-height: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.cluster-node-clients span {
  padding: 3px 6px;
  color: var(--text);
  background: transparent;
  border-left: 2px solid var(--client);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.cluster-node-clients small {
  color: var(--muted);
  font-size: 9px;
}

.cluster-roster {
  min-width: 0;
  padding: 0 10px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.cluster-roster > header div {
  min-width: 0;
  display: grid;
}

.cluster-live-mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

.cluster-roster-list {
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cluster-roster-list article {
  min-width: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.cluster-roster-list article > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cluster-roster-list article strong,
.cluster-roster-list article small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-roster-list article strong {
  color: var(--text);
  font-size: 13px;
}

.cluster-roster-list article small {
  color: var(--muted);
  font-size: 9px;
}

.cluster-roster-empty {
  min-height: 150px;
  display: grid;
  place-content: center;
  gap: 3px;
  color: var(--muted);
  text-align: center;
  font-size: 10px;
}

.cluster-roster-empty strong {
  color: var(--text);
  font-size: 13px;
}

.direct-data-empty {
  min-height: 260px;
  display: grid;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.direct-data-empty strong {
  color: var(--text);
  font-size: 16px;
}

.direct-data-empty span {
  font-size: 12px;
}

.direct-data-empty.error strong {
  color: var(--accent);
}

.left-rail {
  min-height: 0;
  min-width: 0;
  width: var(--station-list-width);
  max-width: var(--station-list-width);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.filter-card {
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px;
  background: var(--panel);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.direct-callout {
  margin-bottom: 13px;
  padding: 10px;
  background: color-mix(in srgb, var(--relay), var(--panel) 91%);
  border: 1px solid color-mix(in srgb, var(--relay), transparent 35%);
  border-radius: 6px;
}

.direct-callout.connected {
  background: color-mix(in srgb, var(--ok), var(--panel) 92%);
  border-color: color-mix(in srgb, var(--ok), transparent 25%);
}

.direct-callout-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.direct-callout-head div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.direct-callout-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.direct-callout-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--relay);
  font-size: 10px;
}

.direct-callout.connected .direct-callout-head small {
  color: var(--ok);
}

.direct-callout-head button {
  height: 28px;
  padding: 0 8px;
  color: #fff;
  background: var(--relay);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.direct-callout.connected .direct-callout-head button {
  background: var(--ok);
  color: #092614;
}

.direct-callout p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.relay-picker {
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 8px;
  background: var(--panel);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.relay-detail {
  min-height: 0;
  min-width: 0;
  overflow: auto;
}

.relay-detail[hidden],
.list-column[hidden] {
  display: none;
}

.relay-card {
  min-height: 100%;
  padding: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.relay-card.empty {
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.relay-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.relay-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 15px;
  font-weight: 850;
}

.relay-sub {
  margin-top: 3px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.relay-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.relay-metric {
  min-width: 0;
  padding: 7px 6px;
  background: var(--panel-2);
  border-radius: 4px;
  text-align: center;
}

.relay-metric b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 16px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.relay-metric em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.relay-kv {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 4px 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.relay-kv b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 650;
}

.detail-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.detail-title {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.detail-title b {
  min-width: 22px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.activity-list {
  display: grid;
  gap: 6px;
}

.activity-entry {
  min-width: 0;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.activity-entry.talking {
  background: color-mix(in srgb, var(--panel-2), var(--talking-border) 7%);
  border-color: var(--talking-border);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--talking-border), transparent 58%);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--client);
}

.activity-entry.talking .activity-dot {
  background: var(--talking-border);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--talking-border), transparent 78%);
}

.activity-entry-content,
.activity-entry-top,
.activity-entry-bottom,
.activity-entry b,
.activity-entry span {
  min-width: 0;
}

.activity-entry-content {
  display: grid;
  gap: 4px;
}

.activity-entry-top,
.activity-entry-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.activity-entry b,
.activity-entry span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-entry b {
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.activity-entry time,
.activity-entry em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.activity-entry span {
  color: var(--muted);
  font-size: 10px;
}

.activity-entry.talking b,
.activity-entry.talking em {
  color: var(--talking-border);
}

.detail-empty {
  padding: 8px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  margin-bottom: 2px;
}

.select-control {
  width: 100%;
  height: 34px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
}

.search-row {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.search-input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
}

.direct-dialog {
  width: min(440px, calc(100vw - 24px));
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.direct-dialog::backdrop {
  background: rgba(0, 0, 0, .68);
}

.direct-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.direct-dialog-note {
  margin: 0;
  padding: 9px 10px;
  color: var(--muted);
  background: var(--panel-2);
  border-left: 3px solid var(--relay);
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.55;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.dialog-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dialog-head p.connected { color: var(--ok); }
.dialog-head p.error { color: var(--accent); }

.dialog-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  color: var(--text);
  background: var(--panel-2);
}

.direct-form-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
}

.protocol-select {
  height: 34px;
  padding: 0 8px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}

.protocol-select:focus {
  border-color: var(--accent);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.primary-btn,
.secondary-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 4px;
  cursor: pointer;
}

.primary-btn {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.secondary-btn {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}

.app-promo-dialog {
  width: min(820px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.app-promo-dialog::backdrop {
  background: rgba(0, 0, 0, .78);
}

.group-join-dialog {
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  color: #fff;
  background: #1b1b1b;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .58);
  overflow: auto;
}

.group-join-dialog::backdrop {
  background: rgba(0, 0, 0, .78);
}

.group-join-head {
  padding: 18px 52px 4px 24px;
}

.group-join-head h2 {
  margin: 0;
  color: #f4f4f4;
  font-size: 24px;
  line-height: 1.25;
}

.group-join-head p {
  margin: 8px 0 0;
  color: #b7b7b7;
  font-size: 15px;
  line-height: 1.4;
}

.group-join-expiry {
  display: block;
  min-height: 17px;
  margin-top: 7px;
  color: #8d939a;
  font-size: 12px;
  line-height: 1.4;
}

.group-join-expiry.expiring {
  color: #ffc15d;
}

.group-join-expiry.expired {
  color: #f28b82;
}

.group-join-image-frame {
  width: 100%;
  aspect-ratio: 650 / 690;
  overflow: hidden;
}

.group-join-image-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: bottom;
}

.group-join-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  color: #fff;
  background: rgba(0, 0, 0, .68);
  border: 1px solid rgba(255, 255, 255, .2);
}

.group-join-close:hover {
  color: #fff;
  background: rgba(0, 0, 0, .86);
}

.app-promo-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  color: #fff;
  background: rgba(0, 0, 0, .62);
}

.app-promo-layout {
  min-height: 510px;
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
}

.app-video-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #090909;
}

.app-video-wrap video {
  display: block;
  width: 100%;
  max-width: 290px;
  max-height: min(74vh, 620px);
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}

.app-promo-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 42px;
}

.app-promo-kicker {
  color: var(--client);
  font-size: 12px;
  font-weight: 800;
}

.app-promo-copy h2 {
  margin: 10px 0 12px;
  font-size: 28px;
  line-height: 1.15;
}

.app-promo-copy > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.app-release-info {
  width: 100%;
  margin-top: 22px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.app-release-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.app-release-summary span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.app-release-info small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.app-release-summary strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-release-notes {
  margin-top: 13px;
}

.app-release-notes p {
  max-height: 112px;
  margin: 6px 0 0;
  overflow-y: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
}

.app-feature-list {
  width: 100%;
  display: grid;
  gap: 9px;
  margin: 18px 0 22px;
}

.app-feature-list span {
  padding: 9px 0 9px 22px;
  position: relative;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.app-feature-list span::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ok);
  font-weight: 800;
}

.app-download-guide {
  width: 100%;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  margin: 0 0 10px;
  padding: 10px 12px;
  color: var(--text);
  background: color-mix(in srgb, #0a84ff, transparent 88%);
  border-left: 3px solid #0a84ff;
}

.app-download-guide-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #0a84ff;
  border-radius: 50%;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
}

.app-download-guide div {
  min-width: 0;
}

.app-download-guide strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
}

.app-download-guide p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.app-store-link {
  width: 100%;
  min-height: 64px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: #fff;
  background: #087af0;
  border: 1px solid #4aa3ff;
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(10, 132, 255, .25);
  text-decoration: none;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.app-store-link:hover {
  color: #fff;
  background: #0a84ff;
  box-shadow: 0 10px 28px rgba(10, 132, 255, .36);
  transform: translateY(-1px);
}

.app-store-link:focus-visible {
  outline: 3px solid color-mix(in srgb, #0a84ff, #fff 42%);
  outline-offset: 3px;
}

.app-store-link .apple-mark {
  flex: 0 0 auto;
  font-size: 34px;
}

.app-store-copy {
  min-width: 0;
  display: grid;
  flex: 1 1 auto;
}

.app-store-link small {
  color: rgba(255, 255, 255, .82);
  font-size: 10px;
  font-weight: 750;
}

.app-store-link strong {
  font-size: 19px;
  line-height: 1.1;
}

.app-store-action {
  flex: 0 0 auto;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}

.list-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 5px 3px 8px;
  color: var(--muted);
  font-size: 13px;
}

.list-header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-header strong {
  min-width: 30px;
  color: var(--text);
  text-align: right;
}

.list-action {
  height: 24px;
  padding: 0 8px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.list-action[hidden] {
  display: none;
}

.station-list {
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  display: grid;
  align-content: start;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* 右侧固定留出滚动条通道：无论浏览器用经典滚动条(占位)还是覆盖式滚动条(悬浮)，
     滚动条都落在这条通道内，永远压不到置顶按钮和在线徽标，且出现/消失时不引起布局跳动。 */
  padding-right: var(--list-scroll-lane);
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

.station-list:hover,
.station-list.is-scrolling,
.station-list:focus-within {
  scrollbar-color: var(--line) transparent;
}

.station-list::-webkit-scrollbar {
  width: 8px;
}

.station-list::-webkit-scrollbar-track {
  background: transparent;
}

.station-list::-webkit-scrollbar-thumb {
  background: transparent;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
  transition: background-color .18s ease;
}

.station-list:hover::-webkit-scrollbar-thumb,
.station-list.is-scrolling::-webkit-scrollbar-thumb,
.station-list:focus-within::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--muted), transparent 45%);
}

.station-list::-webkit-scrollbar-thumb:hover {
  background-color: color-mix(in srgb, var(--muted), transparent 15%);
}

#clientList.station-list {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.list-column {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.station-list.compact {
  grid-template-columns: 1fr;
}

.station-list.compact .station-card:not(.permanent) {
  contain: layout paint style;
}

.station-list.compact.is-scrolling .station-card.permanent-pink .permanent-lamp-edge,
.station-list.compact.is-scrolling .station-card.permanent-spectrum {
  animation-play-state: paused;
}

.station-list.compact .relay-load-more {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.station-list.compact .relay-load-more:hover {
  border-color: color-mix(in srgb, var(--relay), transparent 30%);
  background: color-mix(in srgb, var(--panel-2), var(--relay) 8%);
}

.station-list.compact .relay-load-more:focus-visible {
  outline: 2px solid var(--client);
  outline-offset: -2px;
}

.station-list.compact .relay-load-more span {
  font-weight: 700;
}

.station-list.compact .relay-load-more small {
  color: var(--muted);
  font-size: 11px;
}

.station-list.compact .station-card {
  min-height: 112px;
  padding: 9px;
  display: grid;
  grid-template-rows: auto minmax(37.5px, 1fr) auto;
  overflow: hidden;
}

.station-card.pinned {
  border-color: color-mix(in srgb, var(--relay), transparent 42%);
  background: color-mix(in srgb, var(--panel), var(--relay) 7%);
}

.station-list.compact .card-name {
  height: auto;
  min-height: 37.5px;
  max-height: 37.5px;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.station-list.compact .card-meta {
  align-self: end;
}

.station-card {
  min-width: 0;
  min-height: 106px;
  padding: 9px 9px 8px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: 4px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.station-card.active {
  border-color: color-mix(in srgb, var(--client), transparent 18%);
}

.station-list.compact .station-card.active {
  border-color: var(--talking-border);
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--talking-border), transparent 35%);
}

.station-card.hot:not(.talking-card) {
  background: color-mix(in srgb, var(--panel), var(--panel-2) 28%);
}

.station-card.talking-card {
  border-color: var(--talking-border);
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--talking-border), transparent 35%);
}

.station-card:hover {
  border-color: color-mix(in srgb, var(--client), transparent 35%);
}

.station-card.talking-card:hover {
  border-color: var(--talking-border);
}

.station-list.compact .station-card.active:hover {
  border-color: var(--talking-border);
}

.station-list.compact .station-card.permanent-pink,
.station-list.compact .station-card.permanent-pink:hover,
.station-list.compact .station-card.permanent-pink.active,
.station-list.compact .station-card.permanent-pink.active:hover {
  --permanent-fill: color-mix(in srgb, var(--panel), var(--permanent-lamp) 5%);
  position: relative;
  border: 1px solid transparent;
  background: var(--permanent-fill);
  box-shadow: var(--shadow);
}

.station-list.compact .station-card.permanent-pink .permanent-lamps {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  contain: paint;
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge {
  position: absolute;
  display: block;
  backface-visibility: hidden;
  will-change: transform;
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.top,
.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.bottom {
  left: -16px;
  width: calc(100% + 32px);
  height: 8px;
  background:
    radial-gradient(circle, var(--permanent-lamp-core) 0 1px, var(--permanent-lamp) 1.5px 2.8px, color-mix(in srgb, var(--permanent-lamp), transparent 68%) 3.2px, transparent 4.2px)
    0 center / 16px 8px repeat-x;
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.right,
.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.left {
  top: -16px;
  width: 8px;
  height: calc(100% + 32px);
  background:
    radial-gradient(circle, var(--permanent-lamp-core) 0 1px, var(--permanent-lamp) 1.5px 2.8px, color-mix(in srgb, var(--permanent-lamp), transparent 68%) 3.2px, transparent 4.2px)
    center 0 / 8px 16px repeat-y;
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.top {
  top: -1px;
  animation: permanent-lamps-x-forward .9s linear infinite;
  animation-delay: var(--permanent-lamp-delay, 0ms);
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.right {
  right: -1px;
  animation: permanent-lamps-y-forward .9s linear infinite;
  animation-delay: var(--permanent-lamp-delay, 0ms);
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.bottom {
  bottom: -1px;
  animation: permanent-lamps-x-reverse .9s linear infinite;
  animation-delay: var(--permanent-lamp-delay, 0ms);
}

.station-list.compact .station-card.permanent-pink .permanent-lamp-edge.left {
  left: -1px;
  animation: permanent-lamps-y-reverse .9s linear infinite;
  animation-delay: var(--permanent-lamp-delay, 0ms);
}

@keyframes permanent-lamps-x-forward {
  to {
    transform: translate3d(16px, 0, 0);
  }
}

@keyframes permanent-lamps-x-reverse {
  to {
    transform: translate3d(-16px, 0, 0);
  }
}

@keyframes permanent-lamps-y-forward {
  to {
    transform: translate3d(0, 16px, 0);
  }
}

@keyframes permanent-lamps-y-reverse {
  to {
    transform: translate3d(0, -16px, 0);
  }
}

.station-list.compact .station-card.permanent-spectrum,
.station-list.compact .station-card.permanent-spectrum:hover,
.station-list.compact .station-card.permanent-spectrum.active,
.station-list.compact .station-card.permanent-spectrum.active:hover {
  --permanent-fill: color-mix(in srgb, var(--panel), var(--relay) 7%);
  border: 2px solid transparent;
  background:
    linear-gradient(var(--permanent-fill), var(--permanent-fill)) padding-box,
    conic-gradient(
      from var(--permanent-border-angle),
      var(--relay) 0deg,
      #ffe28a 52deg,
      var(--accent) 108deg,
      var(--client) 178deg,
      var(--relay) 242deg,
      #fff4cb 308deg,
      var(--relay) 360deg
    ) border-box;
  animation: permanent-station-marquee 2.8s linear infinite;
  animation-delay: var(--permanent-spectrum-delay, 0ms);
}

.station-list.compact .station-card.permanent-spectrum.active,
.station-list.compact .station-card.permanent-spectrum.active:hover {
  --permanent-fill: color-mix(in srgb, var(--panel), var(--accent) 9%);
  box-shadow:
    var(--shadow),
    inset 0 0 0 2px color-mix(in srgb, var(--talking-border), transparent 22%);
}

.station-list.compact .station-card.permanent-art {
  position: relative;
  isolation: isolate;
}

.station-list.compact .station-card.permanent-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("/assets/permanent-station-silhouette-v2.png?v=202607311130");
  background-repeat: no-repeat;
  background-size: auto 232px;
  mix-blend-mode: screen;
  opacity: .3;
}

.station-list.compact .station-card.permanent-art-mirrored::after {
  transform: scaleX(-1);
}

.station-list.compact .station-card.permanent-art-upper {
  overflow: visible;
}

.station-list.compact .station-card.permanent-art-upper::after {
  height: calc(100% + 12px);
  bottom: auto;
  background-position: right -6px top 0;
}

.station-list.compact .station-card.permanent-art-lower::after {
  background-position: right -6px top -120px;
}

.station-list.compact .station-card.permanent-art > .card-top,
.station-list.compact .station-card.permanent-art > .card-name,
.station-list.compact .station-card.permanent-art > .card-meta {
  position: relative;
  z-index: 1;
}

:root[data-theme="light"] .station-list.compact .station-card.permanent-art::after {
  filter: invert(1);
  mix-blend-mode: multiply;
  opacity: .14;
}

@keyframes permanent-station-marquee {
  to {
    --permanent-border-angle: 360deg;
  }
}

.activity-card {
  cursor: default;
}

.activity-card:hover {
  border-color: transparent;
}

.activity-card.talking-card:hover {
  border-color: var(--talking-border);
}

.contact-card {
  min-height: 218px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #111214;
  background: #282d33;
  border-color: #3d434a;
  border-radius: 6px;
}

.contact-card.active,
.contact-card:hover {
  border-color: #e19a17;
}

.contact-card.talking-card,
.contact-card.talking-card:hover {
  border-color: #b83e35;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(184, 62, 53, .45);
}

.contact-identity {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 14px 10px;
  background: #d99519;
}

.contact-card.talking-card .contact-identity {
  background: #ffab0a;
}

.contact-heading {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  align-items: start;
  gap: 12px;
}

.contact-heading-copy {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 0;
}

.contact-call {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #111214;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.contact-bearing {
  width: 92px;
  height: 82px;
  margin: 0;
  display: grid;
  grid-template-rows: 55px 14px 8px;
  justify-items: center;
  align-items: center;
  overflow: hidden;
  color: #f2cc7c;
  background: rgba(40, 45, 51, .94);
  border: 1px solid rgba(255, 225, 164, .32);
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .12);
}

.bearing-dial {
  position: relative;
  width: 50px;
  height: 50px;
  margin-top: 3px;
  border: 2px solid rgba(242, 194, 99, .62);
  border-radius: 50%;
}

.bearing-north {
  position: absolute;
  top: -2px;
  left: 50%;
  padding: 0 2px;
  color: #f5d894;
  background: #282d33;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.bearing-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 25px;
  height: 25px;
  transform: translate(-50%, -50%) rotate(calc(var(--bearing-angle) - 45deg));
  transform-origin: 50% 50%;
  transition: transform .25s ease;
}

.contact-bearing figcaption {
  max-width: 88px;
  overflow: hidden;
  color: #f2cc7c;
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-bearing a {
  color: rgba(255, 232, 184, .55);
  font-size: 6px;
  line-height: 1;
  text-decoration: none;
}

.contact-bearing.unknown {
  opacity: .58;
}

.contact-bearing.unknown .bearing-arrow {
  opacity: .56;
}

.contact-facts {
  display: grid;
  gap: 2px;
  margin: 5px 0 0;
}

.contact-facts div {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
}

.contact-facts dt,
.contact-facts dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-facts dt {
  color: rgba(17, 18, 20, .58);
  font-size: 10px;
  font-weight: 750;
}

.contact-facts dd {
  color: #111214;
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.contact-facts .contact-fact-location,
.contact-facts .contact-fact-call-area {
  align-items: start;
}

.contact-facts .contact-province-city,
.contact-facts .contact-fact-call-area dd {
  overflow: visible;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.contact-status {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(92px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  color: #f7f7f7;
  background: #282d33;
}

.contact-state {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.contact-state strong,
.contact-relay strong,
.contact-updated strong {
  color: #f7f7f7;
  font-size: 12px;
  font-weight: 850;
}

.contact-relay,
.contact-updated {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.contact-relay small,
.contact-updated small {
  color: #969da5;
  font-size: 9px;
  line-height: 1;
}

.contact-relay strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-updated {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.pin-btn {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
}

.pin-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel-2);
}

.pin-btn.active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.pin-btn:disabled {
  opacity: 1;
  cursor: default;
}

@media (prefers-reduced-motion: reduce) {
  .cluster-health.healthy .cluster-health-icon,
  .cluster-node.online .cluster-node-state,
  .aprs-map-point.talking,
  .station-list.compact .station-card.permanent-pink .permanent-lamp-edge,
  .station-list.compact .station-card.permanent-spectrum {
    animation: none;
  }
}

.role-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--client);
}

.role-dot.server {
  background: var(--relay);
}

.role-dot.talking-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 78%);
}

.card-call {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.card-online-count {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: var(--text);
  background: color-mix(in srgb, var(--client), transparent 84%);
  border: 1px solid color-mix(in srgb, var(--client), transparent 55%);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.card-time {
  color: var(--text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-name {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  height: 30px;
  overflow: hidden;
}

.card-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  color: var(--text);
  font-size: 13px;
}

.card-sub {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-id {
  font-variant-numeric: tabular-nums;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px 14px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border-radius: 4px;
}


/* 小屏笔记本：顶栏元素多且不换行，需逐级收缩，避免横向溢出屏幕。 */
@media (max-width: 1440px) {
  .topbar {
    gap: 10px;
    padding: 0 10px;
  }

  .topbar > * {
    flex-shrink: 1;
    min-width: 0;
  }

  .direct-data-tabs,
  .icon-btn,
  .live-caller-btn {
    flex-shrink: 0;
  }

  .brand {
    overflow: hidden;
  }

  .brand-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .group-entry-label {
    max-width: 150px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .stat-strip {
    gap: 8px;
    overflow: hidden;
  }

  .stat-strip span {
    white-space: nowrap;
  }

  .topbar {
    overflow: hidden;
  }

  .direct-btn span:not(.direct-btn-dot) {
    max-width: 108px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

@media (max-width: 1320px) {
  .connection-badge {
    display: none;
  }

  .app-download-btn span:not(.apple-mark) {
    display: none;
  }

  .app-download-btn {
    padding-inline: 10px;
  }
}

@media (max-width: 1260px) {
  .live-caller-label {
    display: none;
  }

  .live-caller-btn {
    padding-inline: 10px;
  }

  .group-entry-label {
    max-width: 96px;
  }
}

@media (max-width: 1180px) {
  :root {
    --station-list-width: 330px;
  }

  .topbar {
    gap: 8px;
  }

  .stat-strip,
  .last-update {
    display: none;
  }

  .group-entry-label {
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cluster-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .cluster-roster-list {
    max-height: none;
  }
}

@media (max-width: 920px) {
  .control-panel {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 430px) minmax(0, 230px) minmax(0, 1fr);
  }

  .control-panel.direct-data-mode {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 430px) minmax(0, 1fr);
  }

  .control-panel.direct-data-mode.aprs-map-mode {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .direct-data-view {
    grid-column: 1;
    grid-row: 2;
  }

  .aprs-map-mode .direct-data-view {
    grid-column: 2;
    grid-row: 1;
  }

  .aprs-map-toolbar {
    grid-template-columns: minmax(0, 1fr) auto 36px;
  }

  .aprs-map-title {
    grid-column: 1 / -1;
  }

  .aprs-map-title p {
    display: none;
  }

  .aprs-map-search {
    grid-column: 1;
  }

  .left-rail {
    width: 100%;
    max-width: none;
  }

  .aprs-map-mode .left-rail {
    min-width: 0;
  }

  .group-entry-btn {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .group-entry-label {
    display: none;
  }

  .station-list {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  #clientList.station-list {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .relay-card {
    min-height: auto;
  }

  .relay-kv {
    display: none;
  }

  .stat-strip {
    display: none;
  }

  .group-entry-label {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-promo-layout {
    grid-template-columns: minmax(230px, 290px) minmax(0, 1fr);
  }

  .app-promo-copy {
    padding: 32px 28px;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 6px;
    padding: 0 6px;
  }

  .brand-title {
    display: none;
  }

  .direct-btn {
    width: 58px;
    justify-content: center;
    padding: 0 7px;
  }

  .direct-btn #fmoDirectButtonLabel {
    display: none;
  }

  .direct-btn::after {
    content: "FMO";
  }

  .direct-data-tabs {
    position: fixed;
    right: 6px;
    bottom: calc(var(--site-footer-height) + 8px);
    z-index: 18;
    height: 38px;
    box-shadow: var(--shadow);
  }

  .direct-data-tab {
    min-width: 55px;
    padding: 0 7px;
  }

  .app-download-btn {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .app-download-btn span:last-child,
  .last-update {
    display: none;
  }

  .group-entry-btn {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .group-entry-label {
    display: none;
  }

  .live-caller-btn {
    width: 40px;
    justify-content: center;
    padding: 0;
  }

  .live-caller-label {
    display: none;
  }

  .connection-badge {
    max-width: 118px;
  }

  .workspace {
    padding: 6px;
  }

  .direct-data-view {
    padding: 14px 12px 62px;
  }

  .direct-data-head h2 {
    font-size: 20px;
  }

  .cluster-data-head {
    align-items: center;
  }

  .cluster-updated {
    display: none;
  }

  .cluster-health {
    grid-template-columns: 18px minmax(0, 1fr);
    padding: 8px 10px;
  }

  .cluster-health time {
    display: none;
  }

  .cluster-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cluster-summary > div:nth-child(2) {
    border-right: 0;
  }

  .cluster-summary > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .cluster-summary strong {
    font-size: 21px;
  }

  .cluster-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .cluster-node-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cluster-roster-list {
    max-height: none;
  }

  .qso-filter-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .qso-date-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .qso-date-tabs button {
    padding: 0 6px;
  }

  .qso-search {
    width: 100%;
    min-width: 0;
  }

  .qso-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .qso-summary div {
    padding: 8px;
  }

  .qso-summary strong {
    font-size: 17px;
  }

  .qso-log-list,
  .qso-pagination {
    min-width: 0;
  }

  .qso-log-header {
    display: none;
  }

  .qso-log-row {
    min-height: 58px;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 3px 8px;
    padding: 7px 6px;
  }

  .qso-log-row .qso-index {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: center;
  }

  .qso-log-row strong {
    grid-column: 2;
    grid-row: 1;
  }

  .qso-log-row > span:not(.qso-index) {
    grid-column: 2;
    grid-row: 2;
  }

  .qso-log-row time:first-of-type {
    grid-column: 3;
    grid-row: 1;
  }

  .qso-log-row time:last-of-type {
    grid-column: 3;
    grid-row: 2;
    text-align: right;
  }

  .qso-ranking-list li {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 8px;
  }

  .qso-rank-call strong {
    font-size: 15px;
  }

  .qso-rank-count {
    min-width: 58px;
  }

  .qso-rank-count strong {
    font-size: 18px;
  }

  .site-footer {
    padding: 0 6px;
    font-size: 11px;
  }

  .filing-links {
    gap: 7px;
  }

  .public-security-filing {
    gap: 4px;
  }

  .station-list {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  #clientList.station-list {
    grid-template-columns: 1fr;
  }

  .contact-heading {
    grid-template-columns: minmax(0, 1fr) 80px;
  }

  .contact-bearing {
    width: 80px;
    height: 76px;
    grid-template-rows: 51px 13px 8px;
  }

  .contact-bearing .bearing-dial {
    width: 46px;
    height: 46px;
  }

  .contact-call {
    font-size: 26px;
  }

  .live-caller-overlay {
    padding: 8px;
  }

  .live-caller-stage {
    width: calc(100vw - 16px);
  }

  .live-caller-stage .contact-card {
    height: min(540px, calc(100dvh - 72px));
    min-height: min(540px, calc(100dvh - 72px));
  }

  .live-caller-stage .contact-identity {
    padding: 28px 22px 20px;
  }

  .live-caller-stage .contact-heading {
    grid-template-columns: minmax(0, 1fr) 110px;
    gap: 14px;
  }

  .live-caller-stage .contact-call {
    font-size: 48px;
  }

  .live-caller-stage .contact-facts {
    gap: 6px;
    margin-top: 16px;
  }

  .live-caller-stage .contact-facts div {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .live-caller-stage .contact-facts dt {
    font-size: 11px;
  }

  .live-caller-stage .contact-facts dd {
    font-size: 15px;
  }

  .live-caller-stage .contact-bearing {
    width: 110px;
    height: 108px;
    grid-template-rows: 74px 22px 10px;
  }

  .live-caller-stage .bearing-dial {
    width: 68px;
    height: 68px;
  }

  .live-caller-stage .bearing-arrow {
    width: 35px;
    height: 35px;
  }

  .live-caller-stage .contact-bearing figcaption {
    max-width: 106px;
    font-size: 12px;
  }

  .live-caller-stage .contact-status {
    min-height: 82px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 13px 22px;
  }

  .live-caller-stage .contact-state strong,
  .live-caller-stage .contact-relay strong,
  .live-caller-stage .contact-updated strong {
    font-size: 15px;
  }

  .live-caller-stage .contact-relay small,
  .live-caller-stage .contact-updated small {
    font-size: 13px;
  }

  .live-caller-stage .role-dot {
    width: 16px;
    height: 16px;
  }

  .app-promo-dialog {
    width: min(360px, calc(100vw - 20px));
  }

  .app-promo-layout {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .app-video-wrap {
    padding: 14px;
  }

  .app-video-wrap video {
    max-width: 210px;
    max-height: 52vh;
  }

  .app-promo-copy {
    padding: 24px 20px 28px;
  }

  .app-promo-copy h2 {
    font-size: 22px;
  }

  .app-feature-list {
    margin: 17px 0 20px;
  }
}


/* ============================================================
   SSTV 图像接收
   ============================================================ */

.sstv-view {
  min-width: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.sstv-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sstv-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.sstv-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sstv-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.sstv-actions button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.sstv-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sstv-status strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
}

.sstv-status small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.sstv-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 auto;
}

.sstv-status.active .sstv-status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok), transparent 78%);
}

.sstv-meter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sstv-meter-item {
  min-width: 0;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sstv-meter-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.sstv-meter-item i {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--ok) 0 var(--sstv-level, 0%),
    color-mix(in srgb, var(--line), transparent 30%) var(--sstv-level, 0%) 100%
  );
}

.sstv-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 12px;
  align-items: start;
}

.sstv-canvas-wrap {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  background: color-mix(in srgb, var(--bg), var(--panel) 35%);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sstv-canvas-wrap.receiving {
  border-color: color-mix(in srgb, var(--ok), var(--line) 50%);
}

.sstv-canvas-wrap canvas,
.sstv-canvas-wrap .sstv-still {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  image-rendering: pixelated;
  border-radius: 3px;
}

.sstv-canvas-wrap .sstv-still {
  position: absolute;
  inset: 10px;
  margin: auto;
  width: calc(100% - 20px);
  max-width: 480px;
  object-fit: contain;
}

.sstv-empty {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.sstv-empty strong {
  color: var(--text);
  font-size: 14px;
}

.sstv-empty span {
  font-size: 12px;
}

.sstv-info {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.sstv-info > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sstv-info dt {
  color: var(--muted);
  font-size: 11px;
}

.sstv-info dd {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.sstv-history > header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sstv-history > header strong {
  color: var(--text);
}

.sstv-history > header .list-action {
  margin-left: auto;
}

.sstv-history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}

.sstv-thumb {
  position: relative;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}

.sstv-thumb.active {
  border-color: var(--ok);
}

.sstv-thumb img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  image-rendering: pixelated;
}

.sstv-thumb figcaption {
  padding: 6px 8px;
}

.sstv-thumb figcaption strong {
  display: block;
  font-size: 12px;
  font-weight: 800;
}

.sstv-thumb figcaption small {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.sstv-save {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: color-mix(in srgb, var(--panel), transparent 15%);
  border: 1px solid var(--line);
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.sstv-save:hover {
  color: var(--ok);
  border-color: var(--ok);
}

/* ============================================================
   手机端单栏布局
   桌面为「台站 | 详情 | 通联 / 数据」多栏 grid；手机改为单栏，
   由底部标签栏在「台站 / 详情 / 数据」三个面板间切换。
   ============================================================ */

.mobile-tabs {
  display: none;
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  :root {
    --station-list-width: 100%;
    /* 触摸端滚动条是悬浮的且更窄，通道相应收窄，把宽度让给内容。 */
    --list-scroll-lane: 4px;
    --site-footer-height: 0px;
    --mobile-tabs-height: 54px;
  }

  html,
  body {
    overflow-x: hidden;
    /* 避免 iOS 双击缩放与点击高亮，让点按更跟手。 */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
  }

  button,
  .station-card,
  .direct-data-tab,
  .mobile-tab {
    touch-action: manipulation;
  }

  .app-shell {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  /* ---------- 顶栏：两行紧凑排布，页签横向可滑 ---------- */
  .topbar {
    height: auto;
    gap: 8px;
    padding: 6px 8px calc(6px + env(safe-area-inset-top, 0px));
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "theme direct brand live"
      "tabs  tabs   tabs  tabs";
    align-items: center;
  }

  .topbar > .icon-btn { grid-area: theme; }
  .direct-btn { grid-area: direct; }
  .brand { grid-area: brand; justify-self: end; text-align: right; }
  .live-caller-btn { grid-area: live; }
  .direct-data-tabs { grid-area: tabs; }

  /* 手机端隐藏次要入口，留给核心操作 */
  .app-download-btn,
  .group-entry-btn,
  .last-update,
  .stat-strip,
  .brand-title {
    display: none;
  }

  .direct-data-tabs {
    /* 覆盖窄屏旧规则里的 fixed 悬浮定位，回到顶栏第二行 */
    position: static;
    display: flex;
    gap: 6px;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px;
    box-shadow: none;
  }

  .direct-data-tabs::-webkit-scrollbar {
    display: none;
  }

  .direct-data-tab {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .direct-btn {
    width: auto;
    max-width: 132px;
    padding: 0 10px;
  }

  .connection-badge {
    font-size: 10px;
  }

  /* ---------- 工作区：单栏，一次只显示一个面板 ---------- */
  .workspace {
    padding: 6px;
  }

  .control-panel,
  .control-panel.direct-data-mode,
  .control-panel.direct-data-mode.aprs-map-mode {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
  }

  .control-panel > .left-rail,
  .control-panel > .relay-detail,
  .control-panel > .list-column,
  .control-panel > .direct-data-view,
  .aprs-map-mode .direct-data-view {
    grid-column: 1;
    grid-row: 1;
  }

  /* 面板可见性由 body[data-mobile-pane] 控制 */
  body[data-mobile-pane] .left-rail,
  body[data-mobile-pane] .relay-detail,
  body[data-mobile-pane] .list-column,
  body[data-mobile-pane] .direct-data-view {
    display: none;
  }

  body[data-mobile-pane="stations"] .left-rail {
    display: grid;
  }

  body[data-mobile-pane="detail"] .relay-detail,
  body[data-mobile-pane="detail"] .list-column {
    display: grid;
  }

  /* 详情面板内上下排布：详情在上（高度随内容，最多 46vh），最近通联占剩余空间 */
  body[data-mobile-pane="detail"] .control-panel {
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
    gap: 6px;
  }

  body[data-mobile-pane="detail"] .relay-detail {
    grid-row: 1;
    align-self: start;
    max-height: 46vh;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body[data-mobile-pane="detail"] .list-column {
    grid-row: 2;
  }

  body[data-mobile-pane="data"] .direct-data-view:not([hidden]) {
    display: block;
  }

  body[data-mobile-pane="data"] .direct-data-view.map-data-mode {
    display: flex;
  }

  .left-rail {
    width: 100%;
    max-width: none;
    gap: 6px;
  }

  .direct-data-view {
    padding: 12px 12px 14px;
  }

  /* ---------- 列表与卡片：单列、加大点按区 ---------- */
  .station-list,
  #clientList.station-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .station-list.compact .station-card {
    padding: 10px 12px;
  }

  .station-card {
    /* 屏外卡片跳过渲染，长列表滚动明显更顺 */
    content-visibility: auto;
    contain-intrinsic-size: auto 84px;
  }

  .pin-btn {
    width: 34px;
    height: 34px;
  }

  .card-online-count {
    font-size: 11px;
  }

  .search-input {
    /* iOS 上字号小于 16px 会触发聚焦缩放 */
    font-size: 16px;
    min-height: 42px;
  }

  .filter-card {
    padding: 8px;
  }

  /* 直连提示在手机端占位过大，收起说明文字 */
  .direct-callout > p {
    display: none;
  }

  /* ---------- APRS 地图 ---------- */
  /* 地图工具栏压缩成两行：搜索+定位一行，筛选一行，把高度让给地图 */
  .aprs-map-toolbar {
    grid-template-columns: minmax(0, 1fr) 38px;
    grid-template-rows: auto auto;
    gap: 6px;
    padding: 8px 10px;
  }

  .aprs-map-title {
    display: none;
  }

  .aprs-map-search {
    grid-column: 1;
    grid-row: 1;
  }

  .aprs-map-search input {
    font-size: 16px;
  }

  .aprs-map-fit {
    grid-column: 2;
    grid-row: 1;
    width: 38px;
    height: 38px;
  }

  .aprs-map-filters {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 6px;
  }

  .aprs-map-filters button {
    flex: 1;
    min-height: 34px;
  }

  .aprs-map-canvas .leaflet-control-zoom {
    display: none;
  }

  /* ---------- SSTV：单列堆叠 ---------- */
  .sstv-stage {
    grid-template-columns: 1fr;
  }

  .sstv-title p {
    display: none;
  }

  .sstv-head {
    gap: 8px;
  }

  .sstv-actions {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .sstv-actions button {
    flex: 1;
    min-height: 40px;
  }

  .sstv-meter {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .sstv-meter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
  }

  .sstv-meter-item span {
    margin: 0;
    flex: 0 0 92px;
  }

  .sstv-meter-item i {
    flex: 1;
  }

  .sstv-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sstv-history-list {
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  }

  .sstv-thumb img {
    height: 76px;
  }

  /* ---------- 信息流：取消横向滚动，改为两行卡片 ---------- */
  .stream-filter-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .stream-filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .stream-filter-tabs button,
  .stream-actions button {
    flex: 0 0 auto;
    padding: 0 9px;
    white-space: nowrap;
  }

  .stream-row {
    /* 桌面靠 min-width 撑出表格列；手机改为自适应两行，正文不再被截断 */
    min-width: 0;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "time kind call"
      "text text text";
    gap: 4px 8px;
    padding: 8px 10px;
  }

  .stream-row > :nth-child(1) { grid-area: time; }
  .stream-row > :nth-child(2) { grid-area: kind; }
  .stream-row > :nth-child(3) { grid-area: call; }
  .stream-row > :nth-child(4) {
    grid-area: text;
    white-space: normal;
    word-break: break-word;
  }

  .stream-feed {
    overflow-x: hidden;
  }

  .aprs-map-summary {
    left: 8px;
    bottom: 8px;
    font-size: 11px;
  }

  /* ---------- 底部标签栏 ---------- */
  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: calc(var(--mobile-tabs-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--panel);
    border-top: 1px solid var(--line);
    z-index: 6;
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    background: transparent;
    border: 0;
    border-top: 2px solid transparent;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobile-tab-mark {
    font-size: 16px;
    line-height: 1;
  }

  .mobile-tab.active {
    color: var(--accent);
    border-top-color: var(--accent);
    background: color-mix(in srgb, var(--accent), transparent 92%);
  }

  .site-footer {
    display: none;
  }

  /* ---------- 性能：关闭持续动画与重滤镜 ---------- */
  .station-card.permanent-pink .permanent-lamps,
  .permanent-lamp-edge {
    display: none;
  }

  .station-card.permanent-spectrum {
    animation: none;
  }

  .live-caller-overlay {
    padding: 12px;
  }

  .dialog-head h2 {
    font-size: 18px;
  }

  .direct-dialog,
  .app-promo-dialog,
  .group-join-dialog {
    width: calc(100vw - 24px);
    max-width: none;
    margin: auto;
  }

  .app-promo-layout {
    grid-template-columns: 1fr;
  }

  .app-video-wrap {
    display: none;
  }
}

@media (max-width: 380px) {
  .direct-btn {
    max-width: 104px;
  }

  .direct-data-tab {
    padding: 0 10px;
    font-size: 12px;
  }
}

/* HTTPS 页面下的直连提示：引导到 HTTP 入口 */
.direct-http-hint {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--accent), transparent 90%);
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 40%);
  border-radius: 4px;
}

.direct-http-hint[hidden] {
  display: none;
}

.direct-http-hint strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.direct-http-hint small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.direct-http-hint .primary-btn {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  height: 36px;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 720px), (hover: none) and (pointer: coarse) {
  .direct-http-hint {
    flex-direction: column;
    align-items: stretch;
  }
}

.sstv-audio-stat:empty {
  display: none;
}

.sstv-audio-stat {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.sstv-sound-btn[aria-pressed="true"] {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok), var(--line) 45%);
}

.sstv-still-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  padding: 3px 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel), transparent 10%);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
}

.sstv-manual select {
  min-height: 34px;
  padding: 0 8px;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.sstv-manual select:disabled {
  opacity: .45;
  cursor: not-allowed;
}
