/* Tracker controls and map overlays share the space between the viewer toolbars. */
.hud-topbar {
  z-index: 42;
  justify-content: flex-start;
  column-gap: 8px;
  row-gap: 4px;
}

.hud-topbar > *, .hud-tool-group > * {
  pointer-events: auto;
}

.hud-topbar > .camera-navigation {
  margin-left: auto;
}

.tracker-brand-icon {
  flex: none;
}

.tab-btn, .phase-pill, .metric-label, .stat-chip span {
  font-size: 11px;
}

.flight-telemetry, .flight-sub {
  font-size: 11.5px;
}

.sheet-action, #feed-status-text {
  display: none;
}

#feed-status-short {
  font: 700 12px var(--font-mono);
}

#hud-menu-btn[aria-expanded="true"] {
  border-color: var(--accent-cyan);
}

.hud-conditions-summary {
  color: #c4d4e4;
  font: 600 12px var(--font-mono);
}

.hud-conditions-summary strong {
  color: #f1f5f9;
  font-size: 12px;
}

.fps-pill {
  gap: 5px;
  color: #f1f5f9;
  font: 700 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

.fps-pill .fps-unit {
  color: #a5b4c7;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hud-tools .hud-btn {
  padding-inline: 9px;
}

.hud-tools .seg-btn {
  padding-inline: 7px;
}

#app {
  --viewer-footer-height: calc(36px + env(safe-area-inset-bottom, 0px));
  --footer-clearance: calc(var(--viewer-footer-height) + 8px);
}

.replay-bar, .cockpit-hud, .traffic-panel:not(.collapsed), .inspector-card {
  bottom: var(--footer-clearance);
}

.inspector-card {
  max-height: calc(100dvh - var(--topbar-bottom, 64px) - var(--footer-clearance));
  overflow-y: auto;
}

.hud-tools {
  display: none;
  position: fixed;
  top: var(--topbar-bottom, 96px);
  left: var(--tools-left, 8px);
  width: min(372px, calc(100vw - 16px));
  max-height: calc(100dvh - var(--topbar-bottom, 96px) - 8px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #0e1d2f;
  color: var(--text-primary);
  border: 1px solid #38516a;
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-hud);
}

.hud-topbar:has(#hud-menu-btn[aria-expanded="true"]) .hud-tools {
  display: grid;
  gap: 12px;
}

.hud-tool-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  order: 0;
  margin: 0;
}

.tool-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.tool-group-title {
  display: block;
  width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: #d7e5f4;
}

.tool-group-head .tool-group-title {
  width: auto;
}

.tool-group-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-group-desc {
  width: 100%;
  font-size: 11px;
  line-height: 1.4;
  color: #8ba0b8;
  min-height: 15px;
}

.hud-conditions {
  order: 1;
}

.hud-tools :is(.seg-btn, .hud-btn, .hud-select) {
  min-height: 36px;
}

.hud-tools .plan-pill {
  display: inline-flex;
}

.hud-tools .sky-selector {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  background: #081322;
  border-color: rgba(148, 184, 228, 0.18);
  box-shadow: none;
}

.hud-tools .sky-selector .seg-btn {
  padding-inline: 4px;
  text-align: center;
  white-space: nowrap;
}

@media (max-width: 360px) {
  .hud-tools .sky-selector {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.preset-select-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.hud-select {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 184, 228, 0.28);
  background: #081322;
  color: var(--text-primary);
  font: 600 12px var(--font-sans);
  cursor: pointer;
}

.camera-preset-reset {
  flex-shrink: 0;
  background: #0b1829;
  border-color: rgba(148, 184, 228, 0.18);
  color: #d7e5f4;
}

.layer-switch-list {
  width: 100%;
  background: #0b1829;
  border: 1px solid rgba(148, 184, 228, 0.16);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.layer-switch-row {
  appearance: none;
  border: 0;
  border-bottom: 1px solid rgba(148, 184, 228, 0.1);
  background: transparent;
  color: var(--text-primary);
  font: 600 12px var(--font-sans);
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  transition: background 0.14s ease;
}

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

.layer-switch-row:hover {
  background: rgba(148, 184, 228, 0.08);
}

.layer-switch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.layer-switch-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #1b2f45;
  border: 1px solid rgba(148, 184, 228, 0.25);
  padding: 2px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.layer-switch-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #94a3b8;
  transform: translateX(0);
  transition: transform 0.16s ease, background 0.16s ease;
}

.layer-switch-row[aria-checked="true"] .layer-switch-track {
  background: #0284c7;
  border-color: var(--accent-cyan);
}

.layer-switch-row[aria-checked="true"] .layer-switch-thumb {
  background: #f8fafc;
  transform: translateX(14px);
}

#receiver-modal .mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  width: 100%;
  background: #081322;
  border-color: rgba(148, 184, 228, 0.18);
  box-shadow: none;
  backdrop-filter: none;
}

#receiver-modal .mode-switch .seg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  font: 500 14px var(--font-sans);
}

.source-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #475569;
  flex-shrink: 0;
}

.mode-switch [data-mode="live"][aria-checked="true"] .source-dot {
  background: var(--accent-emerald);
  box-shadow: 0 0 7px rgba(16, 185, 129, 0.8);
}

.mode-switch [data-mode="demo"][aria-checked="true"] .source-dot {
  background: var(--accent-amber);
  box-shadow: 0 0 7px rgba(245, 158, 11, 0.75);
}

.receiver-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.12);
}

.receiver-status-pill.connected {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.16);
}

.receiver-status-pill.degraded {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
}

.receiver-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

html:not([data-tracker-state="ready"]) .hud-topbar > :not(.topbar-left, .tracker-guide) {
  visibility: hidden;
}

#app :is(button, summary, a, input, select):focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

.hud-popover {
  position: fixed;
  top: var(--popover-top, var(--topbar-bottom, 64px));
  left: var(--popover-left, 12px);
  right: auto;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - var(--popover-top, var(--topbar-bottom, 64px)) - 12px);
  overflow: auto;
  overscroll-behavior: contain;
}

.hud-popover .airport-roster-list {
  max-height: none;
  overflow: visible;
}

.popover-close {
  float: right;
  order: -1;
  align-self: flex-end;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  background: #15263a;
  border: 1px solid var(--glass-border);
  border-radius: 7px;
}

.sfo-zones-popover .popover-close, .atc-popover .popover-close {
  position: absolute;
  right: 9px;
  top: 7px;
}

#airport-roster-section > .popover-header, .atc-popover > .popover-header {
  min-height: 26px;
  padding-right: 36px;
}

.replay-ticks {
  display: flex;
  justify-content: space-between;
  color: #c0cedd;
  font: 10px var(--font-mono);
}

.replay-gap-key {
  font: 11px var(--font-sans);
  color: #fecaca;
}

#app:has(.replay-bar:not(.hidden)) .cockpit-hud {
  bottom: calc(var(--footer-clearance) + var(--replay-height, 86px) + 8px);
}

html[data-camera-mode="cockpit"] .inspector-card {
  display: none;
}

.service-notice-banner {
  width: max-content;
  max-width: min(640px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  padding: 9px 12px;
  pointer-events: auto;
}

.service-notice-tag {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.service-notice-dismiss {
  grid-column: 2;
  grid-row: 1;
  min-width: 28px;
  min-height: 28px;
}

.service-notice-text {
  grid-column: 1 / -1;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.service-notice-link {
  grid-column: 1 / -1;
  justify-self: start;
}

.hud-topbar:has(.hud-popover:not(.hidden), .tracker-guide[open], #hud-menu-btn[aria-expanded="true"]) {
  z-index: 48;
}

@media (max-width: 900px), (max-height: 520px) {
  #app {
    --sheet-bottom: var(--footer-clearance);
  }
  #app:has(#replay-bar:not(.hidden)) {
    --sheet-bottom: calc(var(--footer-clearance) + var(--replay-height, 118px) + 8px);
  }
  .hud-topbar {
    inset: max(6px, env(safe-area-inset-top)) 8px auto;
    gap: 4px;
  }
  .hud-tools {
    left: auto;
    right: 8px;
  }
  .hud-conditions-summary {
    display: none;
  }
  .topbar-left {
    width: 100%;
    gap: 4px;
  }
  .brand-lockup, .airport-pill, #feed-status-pill, #topbar-atc-toggle-btn, #fps-pill, #replay-toggle-btn, #hud-menu-btn, #analytics-btn {
    min-height: 36px;
    padding: 5px 7px;
    border-radius: 8px;
    gap: 4px;
  }
  .brand-title {
    font-size: 13px;
  }
  .tracker-brand-icon {
    width: 16px;
    height: 16px;
  }
  .airport-code {
    font-size: 12px;
    padding: 2px 3px;
  }
  .airport-meta, .tracker-guide-label, #feed-status-text {
    display: none;
  }
  #feed-status-short {
    display: inline;
    font-size: 10px;
  }
  #feed-status-pill {
    min-width: 0;
  }
  #feed-status-pill .status-dot {
    flex: none;
    width: 6px;
    height: 6px;
  }
  #hud-menu-btn {
    display: inline-flex;
    margin-left: auto;
  }
  #hud-menu-btn[aria-expanded="true"] {
    border-color: var(--accent-cyan);
  }
  .hud-topbar > .camera-navigation {
    order: 1;
    margin-left: 0;
    gap: 2px;
    padding: 3px;
    max-width: 100%;
    flex-wrap: wrap;
  }
  .camera-navigation button {
    min-height: 34px;
    padding: 5px 6px;
  }
  .camera-navigation .camera-icon-button {
    min-width: 26px;
    padding: 5px 4px;
  }
  .view-mode-switch {
    padding-right: 2px;
  }
  .camera-utility-buttons {
    padding-left: 2px;
  }
  .camera-navigation kbd, .camera-button-label {
    display: none;
  }
  .camera-navigation-help {
    right: auto;
    left: 0;
    max-height: calc(100dvh - 110px);
    overflow: auto;
  }
  .hud-popover {
    left: 8px;
    right: auto;
    top: var(--topbar-bottom, 96px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - var(--topbar-bottom, 96px) - 8px);
  }
  .atc-popover {
    width: min(360px, calc(100vw - 16px));
  }
  #app .traffic-panel, #app .inspector-card {
    inset: auto 8px var(--sheet-bottom);
    width: auto;
    max-width: 540px;
    margin-inline: auto;
    max-height: calc(100dvh - var(--topbar-bottom, 96px) - var(--sheet-bottom) - 8px);
  }
  #app:has(.replay-bar:not(.hidden)) :is(.traffic-panel, .inspector-card) {
    bottom: var(--sheet-bottom);
  }
  #app:has(.replay-bar:not(.hidden)) .traffic-panel:not(.collapsed) .stats-strip {
    display: none;
  }
  #app .traffic-panel {
    height: min(46dvh, 430px);
  }
  #app .traffic-panel.collapsed {
    height: auto;
  }
  #app .traffic-panel.collapsed .panel-head {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }
  .traffic-panel.collapsed .panel-title-row {
    flex: 1;
    gap: 5px;
  }
  .panel-head {
    padding: 6px 8px;
    gap: 5px;
  }
  .panel-toggle-btn {
    min-width: 50px;
    min-height: 34px;
  }
  .panel-head .tab-btn {
    min-height: 30px;
  }
  .panel-head .stat-chip {
    padding: 2px 4px;
  }
  .panel-head .stat-chip strong, .panel-head .stat-chip span {
    display: inline;
  }
  .panel-head .stat-chip span {
    margin-left: 3px;
  }
  .sheet-action {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 4px 8px;
    border: 1px solid #33516a;
    border-radius: 7px;
    color: #b9e9ff;
    background: #142c42;
    font: 600 12px var(--font-sans);
    cursor: pointer;
  }
  #flight-peek-btn {
    display: none;
  }
  .traffic-panel.collapsed #flight-peek-btn:not([hidden]) {
    display: block;
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #flight-back-btn {
    align-self: flex-start;
    margin-bottom: 4px;
  }
  #app .inspector-card {
    display: none;
    overflow-y: auto;
  }
  #app[data-flight-sheet="details"] .inspector-card:not(.hidden) {
    display: block;
  }
  #app[data-flight-sheet="details"]:has(.inspector-card:not(.hidden)) .traffic-panel {
    display: none;
  }
  html:is([data-camera-mode="fly"],[data-camera-mode="cockpit"]) #app .inspector-card {
    display: none;
  }
  html:is([data-camera-mode="fly"],[data-camera-mode="cockpit"]) #app .traffic-panel {
    display: flex;
  }
  #app .replay-bar {
    inset: auto 8px var(--footer-clearance);
    width: auto;
    max-width: 540px;
    margin-inline: auto;
    transform: none;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 8px;
    padding: 6px 8px;
  }
  .replay-scrubber-col {
    grid-row: 2;
    grid-column: 1 / -1;
  }
  .speed-pill {
    min-height: 28px;
  }
  #app #cockpit-hud {
    inset: auto 8px var(--sheet-bottom);
    width: auto;
    max-width: 540px;
    margin-inline: auto;
    transform: none;
  }
  html[data-camera-mode="cockpit"] #app .traffic-panel,
  html[data-camera-mode="cockpit"] #app:has(.replay-bar:not(.hidden)) .traffic-panel {
    bottom: calc(var(--sheet-bottom) + var(--cockpit-height, 48px) + 6px);
  }
  .cockpit-tag {
    display: none;
  }
  .camera-fly-controls {
    bottom: calc(var(--sheet-bottom) + 64px);
  }
  .service-notice-banner {
    width: min(420px, calc(100vw - 16px));
    max-height: calc(100dvh - var(--topbar-bottom, 96px) - var(--footer-clearance));
    overflow-y: auto;
  }
  .tracker-guide-panel {
    width: min(410px, calc(100vw - 16px));
  }
}

@media (max-width: 370px) {
  .topbar-left {
    gap: 3px;
  }
  .camera-button-label, .airport-pill .caret {
    display: none;
  }
  .brand-lockup, .airport-pill, #feed-status-pill, #topbar-atc-toggle-btn, #fps-pill, #replay-toggle-btn, #hud-menu-btn, #analytics-btn {
    padding-inline: 4px;
  }
  .brand-title {
    font-size: 12px;
  }
  .camera-navigation button {
    padding-inline: 5px;
  }
}

@media (max-height: 520px) and (min-width: 550px) {
  .hud-topbar {
    justify-content: space-between;
  }
  .topbar-left {
    width: auto;
  }
  #app .traffic-panel, #app .inspector-card {
    right: 8px;
    left: auto;
    width: min(360px, 48vw);
  }
  #app .traffic-panel:not(.collapsed) {
    height: calc(100dvh - var(--topbar-bottom, 64px) - var(--sheet-bottom) - 12px);
  }
  #app .traffic-panel:not(.collapsed) .stats-strip {
    display: none;
  }
}

.replay-ticks[hidden] {
  display: none;
}

@media (min-width: 901px) and (max-width: 1430px) and (min-height: 521px) {
  #app:has(#replay-bar:not(.hidden)) :is(.traffic-panel:not(.collapsed), .inspector-card) {
    bottom: calc(var(--footer-clearance) + var(--replay-height, 86px) + 8px);
  }
  #app:has(#replay-bar:not(.hidden)) .inspector-card {
    max-height: calc(100dvh - var(--topbar-bottom, 64px) - var(--footer-clearance) - var(--replay-height, 86px) - 8px);
  }
}

@media (max-width: 900px), (max-height: 520px) {
  #hud-menu-btn {
    white-space: nowrap;
  }
}

.hud-topbar:has(#atc-popover:not(.hidden)) .hud-tools {
  visibility: hidden;
}

/* The footer stays available while the tracker loads or offers its 2D fallback. */
.viewer-footer {
  position: fixed;
  inset: auto 0 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--viewer-footer-height);
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  background: rgba(12, 25, 41, 0.95);
  border-top: 1px solid rgba(148, 184, 228, 0.22);
  color: #a9b9cc;
}

.viewer-footer-links { display: flex; align-items: center; gap: 8px; }
.viewer-footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding-inline: 6px;
  color: #c6d3e2;
  font-size: 13px;
  text-decoration: none;
}
.viewer-footer-links a:hover { color: #e7f5ff; text-decoration: underline; }
.viewer-footer-links .viewer-support-link {
  gap: 6px;
  color: #ffdd00;
  white-space: nowrap;
}
.viewer-support-link img {
  flex: none;
  width: 20px;
  height: 24px;
  padding: 2px;
  object-fit: contain;
  border-radius: 4px;
  background: #fff3a6;
}
.viewer-footer-version { display: flex; gap: 6px; font: 12px var(--font-mono); white-space: nowrap; }

@media (max-width: 560px) {
  .viewer-footer { padding-inline: max(8px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-right)); }
  .viewer-footer-links { gap: 2px; }
  .viewer-footer-links a { padding-inline: 4px; font-size: 12px; }
  .viewer-support-name { display: none; }
  .viewer-footer .app-version-label { display: none; }
}

@media (max-width: 400px) {
  .viewer-footer { padding-inline: max(6px, env(safe-area-inset-left)) max(6px, env(safe-area-inset-right)); }
  .viewer-footer-links { gap: 1px; }
  .viewer-footer-links a { padding-inline: 3px; font-size: 11px; }
  .viewer-support-text { display: none; }
  .viewer-footer-version { font-size: 11px; }
}

/* One row of controls, with viewport-positioned popovers below it. */
.hud-topbar.toolbar-refined {
  inset: max(10px, env(safe-area-inset-top)) 14px auto;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px 10px;
  color: #e7eef7;
}

/* Keep blur off the header itself so fixed popovers use viewport coordinates. */
.toolbar-refined::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(12, 25, 41, 0.95);
  border: 1px solid rgba(148, 184, 228, 0.22);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(16px);
}

.toolbar-refined [hidden] { display: none !important; }

.toolbar-refined .topbar-left {
  display: block;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.toolbar-refined .toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  min-width: 100%;
  padding: 4px;
}

.toolbar-scroll-button {
  flex: none;
  width: 32px;
  height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c6d3e2;
  cursor: pointer;
}
.toolbar-scroll-button::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
  transform: rotate(45deg);
}
.toolbar-scroll-button[data-direction="previous"]::before { transform: rotate(-135deg); }
.toolbar-scroll-button:hover { background: rgba(148, 184, 228, 0.1); }
.toolbar-scroll-button[aria-disabled="true"] { opacity: 0.35; cursor: default; }

html:not([data-tracker-state="ready"]) .toolbar-refined :is(.topbar-left, .toolbar-scroll-button) {
  display: none;
}

.toolbar-refined .toolbar-brand,
.toolbar-refined .airport-pill {
  min-height: 44px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.toolbar-refined .toolbar-brand {
  padding: 6px 0;
  border: 0;
  gap: 8px;
  text-decoration: none;
}

.toolbar-refined .tracker-brand-icon {
  width: 22px;
  height: 22px;
}

.toolbar-refined .brand-title {
  font-size: 15px;
}

.toolbar-refined .airport-pill {
  padding: 5px 7px;
  border-color: transparent;
  gap: 6px;
}

.toolbar-refined .airport-pill:hover,
.toolbar-refined .airport-pill[aria-expanded="true"] {
  background: rgba(148, 184, 228, 0.08);
  border-color: rgba(148, 184, 228, 0.18);
}

.toolbar-refined .airport-code {
  padding: 3px 0;
  background: none;
  color: #e7eef7;
  font-size: 14px;
}

.toolbar-refined .airport-meta strong { font-size: 13px; font-weight: 500; }
.toolbar-refined .airport-meta small { font-size: 11px; }
.toolbar-refined .airport-pill .caret { display: inline; }

html[data-tracker-state="ready"] .toolbar-refined #tracker-guide,
html:not([data-tracker-state="ready"]) .toolbar-refined .toolbar-brand {
  display: none;
}

.toolbar-refined .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

#app .toolbar-refined .toolbar-action {
  min-height: 44px;
  padding: 8px 6px;
  gap: 4px;
  border-color: transparent;
  background: transparent;
  color: #a9b9cc;
  border-radius: 8px;
  font: 500 14px var(--font-sans);
  box-shadow: none;
  margin: 0;
}

.toolbar-refined .toolbar-action-icon {
  width: 17px;
  height: 17px;
  flex: none;
}

#app .toolbar-refined .toolbar-action:hover:not(:disabled) {
  background: rgba(148, 184, 228, 0.08);
  color: #f1f5f9;
  border-color: transparent;
}

#app .toolbar-refined .toolbar-action[aria-expanded="true"],
#app .toolbar-refined .toolbar-action.active {
  color: #c2e9ff;
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.24);
}

#app .toolbar-refined .toolbar-action:is(.playing, .atc-live-active) {
  color: #8ee5c1;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.24);
}

#app .toolbar-refined .toolbar-action.connecting { color: #fde68a; }

.toolbar-refined .camera-navigation {
  flex: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 4px;
  z-index: auto;
  border: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
}

.toolbar-refined .camera-navigation button {
  min-height: 44px;
  min-width: 40px;
  padding: 8px 8px;
  border-radius: 8px;
  font: 500 14px var(--font-sans);
}

.toolbar-refined .view-mode-switch {
  flex: none;
  padding: 2px;
  gap: 0;
  border: 1px solid rgba(148, 184, 228, 0.14);
  border-radius: 10px;
  background: rgba(5, 15, 27, 0.45);
}

.toolbar-refined .view-mode-switch button {
  min-width: 40px;
  min-height: 44px;
  padding: 7px 7px;
  border-radius: 7px;
}

.camera-navigation #view-radar-btn.active {
  color: #86efac;
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(74, 222, 128, 0.36);
}

.toolbar-refined .camera-navigation .camera-picker-trigger {
  min-width: 0;
  justify-content: flex-start;
  gap: 8px;
  border-color: rgba(148, 184, 228, 0.2);
  background: rgba(5, 15, 27, 0.35);
  color: #e7eef7;
}

.toolbar-refined .camera-picker-kicker {
  color: #8fa4bd;
  font-size: 12px;
}

.toolbar-refined #camera-preset-readout {
  color: inherit;
  font: inherit;
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-refined .camera-picker-trigger .caret { margin-left: auto; }

.toolbar-refined .camera-navigation .airport-places-trigger {
  flex: none;
  gap: 7px;
  border-color: rgba(148, 184, 228, 0.2);
  background: rgba(5, 15, 27, 0.35);
  color: #d9e4f2;
}

.toolbar-refined .airport-places-trigger svg { flex: none; }

.toolbar-refined .camera-utility-buttons {
  flex: none;
  padding-left: 0;
  gap: 2px;
  border-left: 0;
}

.toolbar-refined .camera-navigation .camera-icon-button { min-width: 40px; padding: 8px 6px; }
.toolbar-refined .camera-navigation .camera-behind-button { font-size: 12px; }
.toolbar-refined .camera-button-label { display: inline; }

.toolbar-refined .toolbar-presence {
  display: flex;
  align-items: center;
  flex: none;
  padding-left: 6px;
  border-left: 1px solid rgba(148, 184, 228, 0.2);
}

.toolbar-refined .toolbar-presence #analytics-btn {
  min-height: 44px;
  padding: 8px;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #b5c6d9;
  font: 500 12px var(--font-sans);
  box-shadow: none;
  white-space: nowrap;
  opacity: 1;
}

.toolbar-refined .toolbar-presence #analytics-btn:hover:not(:disabled) {
  background: rgba(148, 184, 228, 0.08);
  color: #e7eef7;
}

.toolbar-refined .toolbar-presence svg { width: 16px; height: 16px; flex: none; color: #8fa4bd; }
.toolbar-refined #live-visitor-label { font-variant-numeric: tabular-nums; }

.toolbar-refined .toolbar-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-left: 0;
}

#app .toolbar-refined .toolbar-status :is(.hud-pill, .feed-pill) {
  min-height: 44px;
  padding: 7px 9px;
  gap: 6px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
  color: #d9e4f2;
  font: 500 12px var(--font-sans);
  cursor: pointer;
  white-space: nowrap;
}

.toolbar-refined .toolbar-status button:hover,
.toolbar-refined .toolbar-status button[aria-expanded="true"] {
  border-color: rgba(148, 184, 228, 0.16);
  background: rgba(148, 184, 228, 0.06);
}

.toolbar-refined #feed-status-short { font: 500 12px var(--font-sans); }
#app .toolbar-refined #feed-status-pill:is(.live, .local, .hybrid) { color: #89dfbb; }
#app .toolbar-refined #feed-status-pill:is(.demo, .degraded) { color: #efd28c; }
#app .toolbar-refined .toolbar-status #latency-pill {
  gap: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
#latency-value {
  font: 700 12px var(--font-mono);
  color: #c4d4e4;
}
#latency-pill[data-tone="fresh"] #latency-value { color: #89dfbb; }
#latency-pill[data-tone="moderate"] #latency-value { color: #fde68a; }
#latency-pill[data-tone="high"] #latency-value { color: #fca5a5; }
#latency-pill[data-tone="demo"] #latency-value,
#latency-pill[data-tone="replay"] #latency-value { color: #efd28c; }
#latency-pill .latency-unit {
  color: #a5b4c7;
  font: 600 10px var(--font-mono);
  letter-spacing: 0.04em;
}
.toolbar-refined #hud-conditions-summary { display: inline-flex; }
.toolbar-refined #hud-weather { font: 500 12px var(--font-sans); }
.toolbar-refined #hud-flow { color: #8fa4bd; }
#app .toolbar-refined .toolbar-status #fps-pill {
  display: grid;
  grid-template-columns: 3ch auto 32px;
  padding-block: 0;
  gap: 4px;
  cursor: default;
  font-variant-numeric: tabular-nums;
}
#fps-value { grid-column: 1; text-align: right; }
#fps-pill .fps-unit { grid-column: 2; }
.toolbar-fps-toggle {
  grid-column: 3;
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.toolbar-fps-toggle::before {
  content: "";
  width: 26px;
  height: 14px;
  border: 1px solid #70859a;
  border-radius: 999px;
  background: #1c2e40;
}
.toolbar-fps-toggle::after {
  content: "";
  position: absolute;
  left: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4d4e4;
}
.toolbar-fps-toggle[aria-checked="true"]::before { border-color: #38bdf8; background: #16435e; }
.toolbar-fps-toggle[aria-checked="true"]::after { transform: translateX(10px); background: #7dd3fc; }
.toolbar-refined .toolbar-fps-toggle:hover { background: rgba(148, 184, 228, 0.08); }
.toolbar-refined #topbar-atc-toggle-btn { min-height: 44px; padding: 8px 10px; font-size: 12px; }

/* Shared popover surface and spacing. Sections do not need nested cards. */
.toolbar-refined :is(.toolbar-popover, #hud-tools, .camera-navigation-help) {
  position: fixed;
  top: var(--popover-top, var(--topbar-bottom, 120px));
  left: var(--popover-left, var(--tools-left, 14px));
  right: auto;
  width: min(344px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - var(--popover-top, var(--topbar-bottom, 120px)) - 12px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
  color: #e7eef7;
  background: #101f31;
  border: 1px solid #30445d;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: none;
  z-index: 50;
}

.toolbar-refined #hud-tools { gap: 20px; }

/* Airport search stays in place while grouped results scroll independently. */
.toolbar-refined #airport-popover {
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 24px));
  max-height: min(700px, calc(100dvh - var(--popover-top, var(--topbar-bottom, 120px)) - 12px));
  overflow: hidden;
}

.toolbar-refined #airport-popover > .toolbar-popover-header { flex: none; }
.toolbar-refined #airport-roster-section { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.toolbar-refined .airport-search-field { display: flex; flex-direction: column; gap: 7px; flex: none; }
.toolbar-refined .airport-search-field label { color: #b5c6d9; font: 500 12px var(--font-sans); }
.toolbar-refined .airport-search-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #3b536d;
  border-radius: 8px;
  background: #0a1828;
  color: #e7eef7;
  font: 400 14px var(--font-sans);
}
.toolbar-refined .airport-search-input::placeholder { color: #8fa4bd; opacity: 1; }
.toolbar-refined .airport-search-summary { flex: none; margin: 0; color: #9eafc5; font-size: 12px; line-height: 1.5; }
.toolbar-refined #airport-switcher-results {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 360px;
  padding: 2px;
  margin-inline: -2px;
  gap: 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #415b76 transparent;
}
.toolbar-refined .airport-result-group { display: flex; flex-direction: column; gap: 4px; }
.toolbar-refined .airport-result-heading { margin: 0; padding: 2px 10px 4px; color: #a5b8cf; font: 600 12px var(--font-sans); }
.toolbar-refined .airport-result-link {
  justify-content: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 10px;
  background: transparent;
}
.toolbar-refined .airport-result-link.active { background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.3); }
.toolbar-refined .airport-result-code { flex: 0 0 36px; color: #e7eef7; font: 600 14px var(--font-mono); }
.toolbar-refined .airport-result-details { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.toolbar-refined .airport-result-name { color: #e0e9f3; font: 500 13px/1.4 var(--font-sans); overflow-wrap: anywhere; }
.toolbar-refined .airport-result-meta { color: #9eafc5; font: 400 12px/1.4 var(--font-sans); }
.toolbar-refined .airport-result-state { flex: none; color: #9bdcfb; font-size: 11px; }
.toolbar-refined .airport-search-empty { margin: 0; padding: 16px 10px; color: #b5c6d9; font-size: 14px; line-height: 1.5; }
.toolbar-refined .airport-search-empty p { margin: 0 0 12px; }
.toolbar-refined #airport-search-clear { margin: 0; }
.toolbar-refined .airport-switcher-controls { flex: none; flex-wrap: wrap; margin: 0; padding-top: 10px; border-top: 1px solid rgba(148, 184, 228, 0.13); }
.toolbar-refined .default-airport-option { flex: 1; min-width: 0; min-height: 44px; padding: 4px 0; font-size: 12px; }
.toolbar-refined .default-airport-option input { flex: none; width: 18px; height: 18px; }
.toolbar-refined #airport-roster-section > .browse-airports { display: inline-flex; align-items: center; flex: none; min-height: 44px; font-size: 13px; text-underline-offset: 3px; }

.toolbar-refined #airport-places-popover .sub-header { margin: 0 0 8px; padding: 0 0 8px; gap: 8px; flex-wrap: wrap; }
.toolbar-refined #airport-places-popover .zone-jump-item { min-height: 54px; padding: 10px; }
.toolbar-refined #airport-places-popover .zone-jump-title { font-size: 13px; line-height: 1.4; }
.toolbar-refined #airport-places-popover .zone-jump-note { margin-top: 3px; font-size: 12px; line-height: 1.4; }
.toolbar-refined .airport-guides-heading { margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid rgba(148, 184, 228, 0.13); color: #a5b8cf; font: 500 12px var(--font-sans); }

.toolbar-refined .toolbar-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 12px;
}

.toolbar-refined #hud-tools > .toolbar-popover-header { margin-bottom: 0; }
.toolbar-refined .toolbar-popover-header strong { font-size: 16px; font-weight: 600; }
.toolbar-refined .toolbar-popover-header .popover-close {
  position: static;
  float: none;
  flex: none;
  order: 0;
  align-self: auto;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #9eafc5;
  font-size: 24px;
}

.toolbar-refined .toolbar-popover-header .popover-close:hover { background: rgba(148, 184, 228, 0.08); color: #f1f5f9; }
.toolbar-refined .toolbar-popover .hud-btn { min-height: 44px; }
.toolbar-refined .hud-tool-group { gap: 8px; }
.toolbar-refined .tool-group-title { font-size: 12px; font-weight: 500; color: #9eafc5; }
.toolbar-refined :is(.tool-group-meta, .tool-group-desc) { font-size: 12px; }
.toolbar-refined .tool-group-desc { line-height: 1.5; color: #9eafc5; }
.toolbar-refined .hud-select { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 14px; font-weight: 500; }
.toolbar-refined .layer-switch-list { border: 0; border-radius: 0; background: transparent; overflow: visible; }
.toolbar-refined .layer-switch-row { min-height: 48px; border: 0; border-radius: 8px; padding: 8px 0; }
.toolbar-refined .layer-switch-row:hover { background: rgba(148, 184, 228, 0.04); }
.toolbar-refined .layer-switch-label { font-size: 14px; font-weight: 500; }
.toolbar-refined .layer-switch-track { width: 38px; height: 24px; padding: 3px; }
.toolbar-refined .layer-switch-thumb { width: 16px; height: 16px; }
.toolbar-refined .layer-switch-row[aria-checked="true"] .layer-switch-thumb { transform: translateX(14px); }

.toolbar-refined #camera-options { display: grid; gap: 4px; }
.toolbar-refined .camera-navigation .camera-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  padding: 11px 12px;
  text-align: left;
  white-space: normal;
}

.toolbar-refined .camera-option[hidden] { display: none !important; }
.toolbar-refined .camera-option-label { font-size: 14px; line-height: 1.3; }
.toolbar-refined .camera-option-description { color: #9eafc5; font-size: 12px; line-height: 1.45; }
.toolbar-refined .camera-option[aria-pressed="true"] .camera-option-label { color: #d8f1ff; }
.toolbar-refined #camera-preset-desc { padding-top: 14px; margin-top: 12px; border-top: 1px solid rgba(148, 184, 228, 0.13); }
.toolbar-refined #camera-navigation-help { width: min(400px, calc(100vw - 24px)); }
.toolbar-refined .camera-help-list { padding-inline-start: 20px; list-style: disc; font-size: 14px; line-height: 1.45; }
.toolbar-refined .camera-help-list li + li { margin-top: 6px; }
.toolbar-refined .camera-mode-shortcuts {
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.toolbar-refined .camera-navigation-help kbd { display: inline; font-size: 13px; color: var(--text-primary); }
.toolbar-refined #camera-navigation-hint { font-size: 14px; line-height: 1.45; }
html:is([data-view-mode="2d"], [data-view-mode="radar"]) .camera-shortcut-3d { display: none; }

.toolbar-refined .receiver-status-pill { font-size: 11px; }

.latency-popover-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(5, 15, 27, 0.52);
  border: 1px solid rgba(148, 184, 228, 0.16);
}
.latency-popover-value {
  font: 700 22px/1.2 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #e7eef7;
}
#latency-popover[data-tone="fresh"] .latency-popover-value { color: #89dfbb; }
#latency-popover[data-tone="moderate"] .latency-popover-value { color: #fde68a; }
#latency-popover[data-tone="high"] .latency-popover-value { color: #fca5a5; }
#latency-popover[data-tone="demo"] .latency-popover-value,
#latency-popover[data-tone="replay"] .latency-popover-value { color: #efd28c; }
.latency-popover-summary {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #c4d4e4;
}
.latency-breakdown {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 0 2px;
}
.latency-metric-label {
  font-size: 12px;
  color: #9eafc5;
}
.latency-metric-value {
  margin: 0;
  text-align: right;
  font: 600 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: #e7eef7;
}
.latency-popover-note {
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 184, 228, 0.13);
}

.toolbar-refined #conditions-popover .hud-conditions { display: grid; gap: 16px; }
.toolbar-refined #conditions-popover .hud-pill { display: flex; flex-wrap: wrap; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; font-size: 14px; }
.toolbar-refined #conditions-popover .runway-badges { width: 100%; padding: 8px 0; background: none; font-size: 12px; line-height: 1.5; }
.toolbar-refined #conditions-popover :is(.qnh-tag, .flt-cat) { font-size: 12px; }

.flight-category-guide {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.flight-category-guide > summary {
  padding-block: 6px;
  color: var(--text-primary);
  cursor: pointer;
}

.flight-category-guide > p {
  margin: 6px 0 10px;
}

.flight-category-guide > dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0 0 8px;
}

.flight-category-guide dt {
  color: var(--text-primary);
  font-weight: 700;
}

.flight-category-guide dd {
  margin: 0;
}

.toolbar-refined #receiver-modal { width: min(420px, calc(100vw - 24px)); }

#receiver-modal .feeder-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

#receiver-modal .toolbar-popover-header { margin-bottom: 0; }
#receiver-modal .toolbar-popover-header > div { min-width: 0; overflow-wrap: anywhere; }
#receiver-modal-airport { display: block; color: #9eafc5; line-height: 1.35; }
#receiver-modal #receiver-modal-title { font-size: 16px; font-weight: 600; }

#receiver-modal :is(.surface-snap-row, .section-head-row, .inline-field-row, .modal-actions) {
  flex-wrap: wrap;
  gap: 8px;
}

#receiver-modal .surface-snap-row > div { flex: 1 1 175px; min-width: 0; }
#receiver-modal .surface-snap-row .switch-label { min-height: 36px; }
#receiver-modal :is(.provider-health-grid, .feeder-keys-grid) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
}

#receiver-modal .provider-card { align-items: flex-start; flex-wrap: wrap; gap: 4px 8px; }
#receiver-modal .provider-card > div { flex: 1 1 94px; min-width: 0; overflow-wrap: anywhere; }
#receiver-modal .provider-role { color: var(--text-secondary); }
#receiver-modal .inline-field-row .text-input { flex: 1 1 200px; min-width: 0; }
#receiver-modal .inline-field-row .hud-btn { flex: 1 0 auto; }
#receiver-modal .modal-actions { margin-top: 0; }
#receiver-modal .modal-actions .osm-attr { flex: 0 0 100%; }
#receiver-modal .modal-actions .hud-btn { flex: 1 1 145px; }

#app:has(.toolbar-popover.hide-flight-panels:not([hidden])) :is(.traffic-panel, .inspector-card) {
  visibility: hidden;
}

.toolbar-refined .toolbar-airport-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.toolbar-refined .toolbar-airport-links a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  width: 100%;
  margin: 0;
  padding: 10px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d9e4f2;
  text-decoration: none;
  font: 500 14px var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.toolbar-refined .toolbar-airport-links a:hover { background: rgba(148, 184, 228, 0.08); }
.toolbar-refined .toolbar-airport-links a { justify-content: center; border: 1px solid rgba(148, 184, 228, 0.16); background: rgba(5, 15, 27, 0.35); }
.toolbar-refined .toolbar-airport-links a:last-child { grid-column: 1 / -1; }
.toolbar-refined #analytics-btn { min-height: 44px; font-size: 12px; font-weight: 500; }

@media (max-width: 1980px) {
  .toolbar-refined .toolbar-row { gap: 6px; }
  .toolbar-refined .camera-navigation { gap: 4px; }
  .toolbar-refined .camera-picker-kicker, .toolbar-refined .camera-button-label { display: none; }
  .toolbar-refined #camera-preset-readout { max-width: 9em; }
  .toolbar-refined .toolbar-actions { gap: 0; }
  #app .toolbar-refined .toolbar-action { padding-inline: 6px; }
  #app .toolbar-refined .toolbar-status :is(.hud-pill, .feed-pill) { padding-inline: 5px; }
}

@media (max-width: 1740px) {
  .toolbar-refined .airport-meta { display: none; }
  .toolbar-refined #camera-preset-readout { max-width: 7.5em; }
  .toolbar-refined .toolbar-presence #analytics-btn { padding-inline: 6px; }
}

@media (min-width: 1621px) and (max-width: 1860px) {
  .toolbar-refined .toolbar-action-icon { display: none; }
}

@media (max-width: 1620px) {
  .hud-topbar.toolbar-refined { inset-inline: 10px; padding-inline: 8px; }
  .toolbar-refined .toolbar-row { gap: 4px; }
  .toolbar-refined .camera-navigation button { min-width: 36px; padding-inline: 6px; }
  .toolbar-refined .camera-navigation .camera-icon-button { min-width: 34px; padding-inline: 5px; }
  #app .toolbar-refined .toolbar-action { width: 40px; justify-content: center; }
  #app .toolbar-refined .toolbar-status :is(.hud-pill, .feed-pill) { padding-inline: 4px; gap: 4px; }
  .toolbar-refined .toolbar-action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (max-width: 1320px) {
  .toolbar-refined .toolbar-brand .brand-title { display: none; }
}

@media (max-width: 760px) {
  .hud-topbar.toolbar-refined { inset-inline: 8px; padding: 4px; gap: 2px; }
  .toolbar-refined .airport-pill { padding-inline: 6px; }
  .toolbar-refined :is(.toolbar-popover, #hud-tools, .camera-navigation-help) { width: min(344px, calc(100vw - 16px)); max-width: calc(100vw - 16px); padding: 14px; }
  .toolbar-refined :is(#airport-popover, #receiver-modal) { width: min(420px, calc(100vw - 16px)); }
  .toolbar-refined #camera-navigation-help { width: min(400px, calc(100vw - 16px)); }
  .toolbar-refined #topbar-atc-toggle-btn .topbar-atc-label { display: none; }
}

/* Use the actual visible space, including an open phone keyboard, rather than
   a layout-viewport media query that may ignore the keyboard. */
.toolbar-refined #airport-popover.airport-picker-compact { overflow-y: auto; }
.toolbar-refined .airport-picker-compact #airport-roster-section { flex: none; }
.toolbar-refined .airport-picker-compact #airport-switcher-results { flex: none; max-height: 300px; }

/* On a short phone, let the whole flight drawer scroll above Replay. Keeping
   its header fixed would leave less space than a complete flight row. */
@media (max-width: 560px) and (max-height: 650px) {
  #app:has(.toolbar-refined):has(.replay-bar:not(.hidden)) .traffic-panel:not(.collapsed) {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #app:has(.toolbar-refined):has(.replay-bar:not(.hidden)) .traffic-panel:not(.collapsed) :is(.panel-head, .flight-list) {
    flex: none;
  }
  #app:has(.toolbar-refined):has(.replay-bar:not(.hidden)) .traffic-panel:not(.collapsed) .flight-list {
    overflow: visible;
  }
}

@media (max-height: 520px) and (min-width: 701px) {
  .hud-topbar.toolbar-refined { inset-block-start: max(6px, env(safe-area-inset-top)); padding-block: 4px; }
}
