:root {
  --z-map: 0;
  --z-panel: 1200;
  --z-handle: 1300;
  --z-bars: 9000;
  --tab-width: 28px;
  --panel-offset: 28px;
  /* handle width */
  --panel-width-presets: 260px;
  --panel-width-info: 280px;
  --panel-width-tracks: 280px;
  --panel-width-aero: 300px;
  --panel-width-aero-config: 380px;
  --panel-width-measure: 280px;
  --panel-width-radar: 280px;
  --panel-width-video: 300px;
  /* tab stack: center-to-center = tab-height(90) + gap(16) */
  --tab-stack-offset: 106px;
}


html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior-y: none;
}

/* Map fills the screen minus the status bar */
#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 40px;
  /* the transparent status bar floats directly on top of the map */
  background: #e0e0e0;
  z-index: var(--z-map);
  /* fallback background so it's not just white */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#overlay-root {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  /* IMPORTANT */
  z-index: 1500;
}

#overlay-root>* {
  pointer-events: auto;
}



body.format-full #map {
  top: 0;
  bottom: 40px;
  left: 0;
  right: 0;
  width: auto;
  transform: none;
}

body.format-40 #map {
  top: 0;
  bottom: 40px;

  left: 50%;
  transform: translateX(-50%);

  width: calc((100vh - 40px) * 0.7737);
  /* ~2:3 */
  max-width: 100%;

  border-radius: 8px;
  overflow: hidden;
}

body.format-60 #map {
  top: 0;
  bottom: 40px;

  left: 50%;
  transform: translateX(-50%);

  width: calc((100vh - 40px) * 1.2137);
  /* square */
  max-width: 100%;

  border-radius: 8px;
  overflow: hidden;
}

.details-follow-btn.details-following {
  background: #27ae60;
  box-shadow: 0 2px 6px rgba(39, 174, 96, 0.5);
}

#followBtn {
  width: 100%;
  display: block;
  box-sizing: border-box;
  padding: 12px 14px;
  margin-top: 12px;

  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;

  border-radius: 8px;
  border: none;
  cursor: pointer;

  transition: background 0.2s ease, box-shadow 0.2s ease;
}

/* Normal (not following) */
#followBtn:not(.details-following) {
  background: #3b82f6;
  color: #fff;
}

/* Following state */
#followBtn.details-following {
  background: #27ae60;
  color: #fff;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.45);
}

.status-item.centered {
  outline: 2px solid #00cfff;
  outline-offset: 2px;
  box-shadow: 0 0 8px rgba(0, 207, 255, 0.9);
}



/*.status-bar-top,
.control-bar-bottom {
  background: linear-gradient(
    180deg,
    #2a2f36 0%,
    #1c2026 45%,
    #12161c 100%
  );

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 4px 12px rgba(0,0,0,0.4);

  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.8);
}*/






/* === BOTTOM-LEFT DETAILS CARD (CLEAN COLLAPSE) === */

.details-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;

  width: var(--panel-width-info);

  background: #fdfdfd;
  border-radius: 0 12px 12px 0;

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-info)));

  transition: transform 0.25s ease;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.details-panel.open {
  transform: translateX(0);
}


.details-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  /* cover the entire panel */
  height: 100%;
  /* FULL HEIGHT */

  background: linear-gradient(180deg,
      rgba(175, 205, 245, 0.95) 0%,
      /* strong blue at the top */
      rgba(210, 225, 245, 0.70) 35%,
      /* soft mid fade */
      rgba(245, 247, 250, 0.40) 70%,
      /* very light wash */
      rgba(253, 253, 253, 0.10) 100%
      /* almost white at bottom */
    );

  pointer-events: none;
  border-radius: inherit;
  z-index: -1;
}


.status-gray {
  background: #555;
  /* darker neutral */
  color: #bbb;
  /* muted text */

  filter: saturate(0.2);
  /* removes the "active" color feel */
}



.details-handle {
  position: fixed;
  left: var(--panel-width-info);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-info))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;

  width: var(--tab-width);
  height: 90px;
  /* a bit taller to fit icon + text */

  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;

  cursor: pointer;
  z-index: var(--z-handle);
  /* above the card */
}

/* little info icon */
.details-handle-icon {
  font-size: 16px;
  line-height: 1;
  color: #3498db;
  /* matches your blue accents */
}

.details-handle-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #333;

  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  /* so it reads top-to-bottom */
}

/* arrow at the bottom */
.details-handle-arrow {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  line-height: 1;
  pointer-events: none;
  transition: transform 0.2s ease;
}


/* Active handle: panel is currently open */
.details-handle.active .details-handle-arrow {
  transform: rotate(180deg);
}

.details-panel.open~.details-handle {
  transform: translateX(0) translateY(-50%);
}

.details-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.details-panel.open~.details-handle {
  z-index: calc(var(--z-handle) + 50);
}

/* Presets sits in the centre */



.details-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 14px 18px 14px;
}

.details-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
}



.details-icon-wrap {
  position: relative;
  flex-shrink: 0;
}

.details-icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.details-home-badge {
  /* Mirrors how the Home pin sits on the marker on the map: centered on top of the icon. */
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-start;
  gap: 2px;
}

.details-home-badge-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #b6b6c0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: background 0.15s;
}

.details-home-badge-btn:hover {
  background: #9c9ca8;
}

.details-home-badge-btn.active {
  width: 20px;
  height: 32px;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.details-home-badge-btn.active:hover {
  background: transparent;
}

.details-home-badge-clear {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: #e74c3c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  transition: background 0.15s;
}

.details-home-badge-clear:hover {
  background: #c0392b;
}

.details-header-text {
  flex: 1;
  /* take all remaining space */
  display: flex;
  flex-direction: column;
  align-items: center;
  /* horizontal centering */
  text-align: center;
  /* center the text itself */
}

.details-name {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #111;
}

.details-id {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #999;
  margin-top: 3px;
}

.details-body {
  margin-top: 12px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 10px;
}

.details-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 13px;
}

.details-label {
  min-width: 90px;
  /* keeps the column straight */
  color: #777;
}

.details-value {
  flex: 1;
  text-align: right;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  color: #222;

}

/* Wraps the Latitude/Longitude rows as one click-to-copy unit, so both keep the
   same plain look as every other row instead of one of them carrying a button.
   The hint stays visible (not hover-only) since this panel is used on touch
   screens too, where hover never fires.
   No negative margins here (unlike a tighter "hug the rows" version tried
   earlier) - .details-body has overflow-y:auto, which per spec clips overflow-x
   too even though it's left unset, so a negative top/left margin pushing the
   border outside the padding box just got silently cut off on those two sides. */
.details-coords-copy {
  padding: 6px 8px 5px;
  margin: 0 0 8px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.details-coords-copy .details-row {
  margin-bottom: 4px;
}

.details-coords-copy:hover {
  border-color: #9b59b6;
  background: rgba(155, 89, 182, 0.06);
}

.details-coords-copy-hint {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  color: #9b59b6;
  opacity: 0.55;
  transition: opacity 0.15s, color 0.15s;
}

.details-coords-copy:hover .details-coords-copy-hint {
  opacity: 0.85;
}

/* A live source with no fix yet still shows its Latitude/Longitude rows
   (as "–") - just without the copy affordance, since there's nothing real to
   copy. Only the border/hint/cursor go away; the rows themselves stay put. */
.details-coords-copy--disabled {
  border-color: transparent;
  background: none;
  cursor: default;
}

.details-coords-copy--disabled:hover {
  border-color: transparent;
  background: none;
}

.details-coords-copy--disabled .details-coords-copy-hint {
  visibility: hidden;
}

/* Briefly applied on click, matching the feedback timing/language used elsewhere
   (see .clickCoords-copied) - green flash while the hint reads "Copied!". */
.details-coords-copy.details-coords-copied {
  border-style: solid;
  border-color: #16a085;
  background: rgba(22, 160, 133, 0.08);
}

.details-coords-copy.details-coords-copied .details-coords-copy-hint {
  opacity: 1;
  color: #16a085;
}

.details-handle,
.presets-handle {
  z-index: var(--z-handle);
}

.details-handle,
.presets-handle,
.tracks-handle {
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.details-handle-icon,
.details-handle-label,
.details-handle-arrow,
.presets-handle-icon,
.presets-handle-label,
.presets-handle-arrow,
.tracks-handle-icon,
.tracks-handle-label,
.tracks-handle-arrow {
  transition: color 0.2s ease, transform 0.2s ease;
}

.details-panel,
.details-handle,
.presets-panel,
.presets-handle,
.tracks-panel,
.tracks-handle,
.measure-panel,
.measure-handle,
.aero-panel,
.aero-handle {
  user-select: none;
  -webkit-user-select: none;
}


/* PRESETS panel */


#detailsStatus {
  margin-left: auto;
}


.coords-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.garmin-field {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;

  color: #dffaff;
  background: rgba(0, 0, 0, 0.35);

  padding: 3px 8px 4px 8px;
  border-radius: 4px;

  border: 1px solid #00c6ff;
  outline: 1px solid rgba(0, 198, 255, 0.2);
  outline-offset: -2px;
}

.clickCoords-copyable {
  cursor: pointer;
  user-select: none;
}

.clickCoords-copyable:hover {
  background: rgba(0, 198, 255, 0.2);
}

.clickCoords-copied {
  color: #00ff9c;
  border-color: #00ff9c;

  box-shadow:
    0 0 6px rgba(0, 198, 255, 0.35),
    inset 0 0 4px rgba(0, 198, 255, 0.25);

  min-width: 20ch;
  text-align: center;

  /* Prevent copying, selecting, dragging */
  user-select: none;
  pointer-events: none;
}

.leaflet-control-scale {
  position: absolute;
  left: 50% !important;
  transform: translateX(-50%);
  bottom: 60px;

  background: rgba(20, 20, 20, 0.6);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;

  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s ease;
}

.scale-opacity-picker {
  position: fixed;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  padding: 4px;
  z-index: 3000;
  min-width: 90px;
}

.sop-option {
  padding: 5px 12px;
  font-size: 12px;
  font-family: "JetBrains Mono", Consolas, monospace;
  cursor: pointer;
  border-radius: 3px;
  color: #333;
  white-space: nowrap;
}

.sop-option:hover {
  background: #eef6ff;
}

.sop-option.active {
  background: #0077cc;
  color: #fff;
}

.leaflet-control-scale-line {
  border: 2px solid white;
  border-top: none;
  background: transparent;
  color: white;
  font-weight: 600;
  padding: 2px 6px;
  text-align: center;
}

.leaflet-bottom.leaflet-left {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ==== PRESETS PANEL ==== */
.presets-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  bottom: 48px;
  left: 0;

  width: var(--panel-width-presets);

  background: #fdfdfd;
  border-radius: 0 12px 12px 0;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-presets)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.presets-panel.open {
  transform: translateX(0);
}

.presets-panel.open~.presets-handle {
  transform: translateX(0) translateY(-50%);
}

.presets-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.presets-panel.open~.presets-handle {
  z-index: calc(var(--z-handle) + 50);
}

/* Handle */
.presets-handle {
  position: fixed;
  left: var(--panel-width-presets);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-presets))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;

  width: var(--tab-width);
  height: 90px;

  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
  z-index: var(--z-handle);
  cursor: pointer;
  overflow: hidden;
}

.presets-handle-icon {
  font-size: 16px;
  color: #9b59b6;
  /* purple-ish, change to taste */
}

.presets-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #333;
}

.presets-handle-arrow {
  font-size: 16px;
  color: #333;
  transition: transform 0.2s ease;
}

.presets-handle.active .presets-handle-arrow {
  transform: rotate(180deg);
}

/* Panel inner */
.presets-inner {
  height: 100%;
  min-height: 0;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.presets-header h3 {
  margin: 0;
  font-size: 16px;
}

.presets-header-actions {
  display: flex;
  gap: 4px;
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}

.presets-empty {
  color: #888;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* Each preset row */
.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}


.preset-row.preset-hidden {
  opacity: 0.45;
}

.preset-row-toggle {
  flex-shrink: 0;
  margin: 0;
}

.preset-coord-row {
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  color: #888;
  margin-top: 2px;
  line-height: 1.6;
}

.preset-flag-icon {
  width: 18px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.preset-text {
  flex: 1;
  min-width: 0;
}

.preset-name {
  font-weight: 700;
  font-size: 14px;
}

.preset-desc-text {
  font-size: 11px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-eye {
  font-size: 14px;
  color: #555;
  flex-shrink: 0;
}

/* ==== TRACKS PANEL ==== */
.tracks-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;

  width: var(--panel-width-tracks);

  background: #fdfdfd;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);
  border-radius: 0 12px 12px 0;

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-tracks)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tracks-panel.open {
  transform: translateX(0);
}

.tracks-handle {
  position: fixed;
  left: var(--panel-width-tracks);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-tracks))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;

  width: var(--tab-width);
  height: 90px;

  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
  z-index: var(--z-handle);
  cursor: pointer;
}

.tracks-handle-icon {
  font-size: 14px;
  color: #27ae60;
}

.tracks-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #333;
}

.tracks-handle-arrow {
  font-size: 16px;
  color: #333;
  transition: transform 0.2s ease;
}

.tracks-handle.active .tracks-handle-arrow {
  transform: rotate(180deg);
}

.tracks-panel.open~.tracks-handle {
  transform: translateX(0) translateY(-50%);
}

.tracks-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.tracks-panel.open~.tracks-handle {
  z-index: calc(var(--z-handle) + 50);
}


.tracks-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
}

.tracks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e4e4;
  flex-shrink: 0;
}

.tracks-header h3 {
  margin: 0;
  font-size: 15px;
}

.tracks-header-actions {
  display: flex;
  gap: 6px;
}

.tracks-btn-small {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
}

.tracks-btn-small:hover {
  background: #e8e8e8;
}

.tracks-btn-small.active {
  background: #2ecc71;
  border-color: #27ae60;
  color: #fff;
}

.tracks-btn-small.active:hover {
  background: #27ae60;
}

.tracks-btn-small:disabled {
  opacity: 0.4;
  cursor: default;
}

.tracks-flag-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  margin-left: 2px;
}

.tracks-flag-switch input[type="checkbox"] {
  display: none;
}

.tracks-switch-track {
  width: 28px;
  height: 15px;
  border-radius: 8px;
  background: #ccc;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}

.tracks-flag-switch input:checked+.tracks-switch-track {
  background: #27ae60;
}

.tracks-switch-track::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.tracks-flag-switch input:checked+.tracks-switch-track::after {
  left: 15px;
}

.tracks-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.track-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #f7f8fa;
  border: 1px solid #e2e2e2;
  transition: background 0.15s, opacity 0.15s;
  user-select: none;
}

.track-row.track-hidden {
  opacity: 0.45;
}

.track-swatch {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 14px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s;
}

.track-swatch:hover {
  transform: scale(1.1);
  border-color: rgba(0, 0, 0, 0.35);
}

.track-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 3px;
}

.track-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.track-swatch::-moz-color-swatch {
  border: none;
  border-radius: 3px;
}

.track-name {
  flex: 1;
  font-size: 13px;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-row-toggle {
  flex-shrink: 0;
  margin: 0;
}

.track-eye-btn,
.preset-eye-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.track-eye-btn:hover,
.preset-eye-btn:hover {
  opacity: 1;
  border-color: #b0c4de;
  background: rgba(52, 152, 219, 0.1);
}

.track-label {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: none;
  pointer-events: none;
}

.track-label::before {
  display: none;
}

/* Airport / navaid pin labels — same pill shape as .track-label, type-coloured text */
.aero-pin-label {
  background: rgba(0, 0, 0, 0.55);
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: none;
  pointer-events: none;
  margin-top: 2px;
}

.aero-pin-label-apt {
  color: #66bbff;
}

.aero-pin-label-vor {
  color: #cc88ff;
}

.aero-pin-label-ndb {
  color: #ff8899;
}

.aero-pin-label-dme {
  color: #55ddaa;
}

.aero-pin-label-other {
  color: #aabbcc;
}


.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;

}

/* we’ll toggle these from JS */
.status-live {
  background: #e5f7eb;
  color: #1c7c3a;
}

.status-delayed {
  background: #fff4e0;
  color: #aa6a07;
}

.status-stale {
  background: #fde5e5;
  color: #b53535;
}

.status-offline {
  background: #e6e6ed;
  color: #66667a;
}

/* ── Alert toasts ──────────────────────────── */
#alert-area {
  position: fixed;
  top: 50px;
  right: 12px;
  z-index: 8000;
}

body.format-40 #alert-area {
  right: max(12px, calc(50% - (100vh - 40px) * 0.6667 / 2 + 12px));
}

body.format-60 #alert-area {
  right: max(12px, calc(50% - (100vh - 40px) * 1.0 / 2 + 12px));
}

#alert-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
  max-width: 320px;
}

#alertClearAllBtn {
  display: none;
  pointer-events: auto;
  background: rgba(10, 18, 40, 0.78);
  border: 1px solid rgba(100, 160, 220, 0.3);
  border-radius: 6px;
  color: rgba(160, 190, 220, 0.8);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

#alertClearAllBtn:hover {
  color: #d0e8ff;
  border-color: rgba(100, 160, 220, 0.6);
}

#alert-toasts {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
  width: 100%;
}

.alert-toast {
  pointer-events: auto;
  background: rgba(10, 18, 40, 0.84);
  border: 1px solid rgba(100, 160, 220, 0.35);
  border-radius: 8px;
  padding: 9px 12px;
  color: #c8e0f8;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  animation: alert-toast-in 0.22s ease;
}

.alert-toast-text {
  flex: 1;
  line-height: 1.4;
  white-space: pre-line;
}

.alert-toast-close {
  background: none;
  border: none;
  color: rgba(160, 190, 220, 0.5);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.12s;
}

.alert-toast-close:hover {
  color: #d0e8ff;
}

@keyframes alert-toast-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Warning-variant toast (left behind after an offline-warning popup collapses) */
.alert-toast--warning {
  background: rgba(58, 12, 10, 0.88);
  border-color: rgba(255, 120, 90, 0.55);
  color: #ffdcd4;
}

.alert-toast--warning .alert-toast-close {
  color: rgba(255, 190, 175, 0.6);
}

.alert-toast--warning .alert-toast-close:hover {
  color: #fff0ec;
}

/* Success-variant toast (e.g. "position copied") */
.alert-toast--success {
  background: rgba(8, 40, 30, 0.88);
  border-color: rgba(0, 255, 156, 0.55);
  color: #d4fff0;
}

.alert-toast--success .alert-toast-close {
  color: rgba(0, 255, 156, 0.6);
}

.alert-toast--success .alert-toast-close:hover {
  color: #d4fff0;
}

/* ── Offline warning overlay (per-source, normal frontend only) ──────── */
#offline-warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#offline-warning-overlay.offline-warning-visible {
  opacity: 1;
}

.offline-warning-band {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: min(720px, 86vw);
  background: linear-gradient(135deg, rgba(122, 14, 12, 0.96), rgba(68, 6, 6, 0.98));
  border: 1.5px solid rgba(255, 120, 95, 0.65);
  border-radius: 14px;
  padding: 26px 38px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55), 0 0 60px rgba(255, 70, 45, 0.35);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}

#offline-warning-overlay.offline-warning-visible .offline-warning-band {
  transform: scale(1);
  animation: offline-warning-pulse 1.1s ease-in-out infinite;
}

.offline-warning-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(255, 100, 70, 0.8));
}

.offline-warning-text {
  color: #ffe9e4;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: clamp(1.05rem, 2.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.35;
  white-space: pre-line;
}

@keyframes offline-warning-pulse {

  0%,
  100% {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55), 0 0 60px rgba(255, 70, 45, 0.35);
  }

  50% {
    box-shadow: 0 8px 46px rgba(0, 0, 0, 0.6), 0 0 90px rgba(255, 70, 45, 0.6);
  }
}

.details-clickable {
  cursor: pointer;
  transition: opacity 0.15s;
}

.details-clickable:hover {
  opacity: 0.7;
}

/* Home-only controls (Track vector, Home pin) - sits between the header and the
   coordinate list, same look as .details-controls below but bordered/margined on
   the opposite side since it comes before its content instead of after. Hidden as
   a whole (not just its rows) so a non-Home source shows no empty gap here. */
.details-home-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0 0 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e4e4e4;
}

.details-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 10px 0 4px;
  border-top: 1px solid #e4e4e4;
  margin-top: 10px;
}

.details-toggle-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  user-select: none;
}

.details-toggle-switch input {
  display: none;
}

.details-toggle-track {
  width: 30px;
  height: 16px;
  border-radius: 9px;
  background: #d6dbe1;
  position: relative;
  flex-shrink: 0;
  transition: background 0.18s ease;
}

.details-toggle-track::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: left 0.18s ease;
}

.details-toggle-switch input:checked + .details-toggle-track {
  background: #3498db;
}

.details-toggle-switch input:checked + .details-toggle-track::after {
  left: 16px;
}

.details-toggle-switch:hover .details-toggle-track {
  filter: brightness(0.96);
}

.details-toggle-text {
  line-height: 1;
}

/* "Offline warning" toggle turns amber instead of blue when enabled, to read as a warning control */
.details-toggle-switch--warn input:checked + .details-toggle-track {
  background: #e0972d;
}

/* Toggle isn't applicable right now (e.g. Home track vector while Home isn't a live source) */
.details-toggle-switch.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.details-restore-btn {
  display: block;
  width: calc(100% - 24px);
  margin: 8px 12px 0;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #e6a817;
  background: #fff8e6;
  color: #a07010;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  box-sizing: border-box;
}

.details-restore-btn:hover {
  background: #ffefc0;
}

.details-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e4e4e4;
  display: flex;
}

.details-follow-btn {
  width: 100%;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: #3498db;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

.details-follow-btn:disabled {
  background: #c9d7e6;
  box-shadow: none;
  cursor: default;
}





/* ----- TOP STATUS BAR (names only) -----
   Transparent strip that floats directly over the map; only the pills
   themselves have a background. pointer-events is off on the bar itself
   so clicks/drags in the gaps between pills reach the map underneath. */
.status-bar-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: transparent;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 6px;
  box-sizing: border-box;
  color: #fff;
  z-index: var(--z-bars);
  overflow-x: auto;
  scrollbar-width: thin;
  pointer-events: none;

}

/* ----- BOTTOM CONTROL BAR ----- */
.control-bar-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: #111;
  display: flex;
  align-items: center;
  padding: 4px 12px;
  gap: 12px;
  box-sizing: border-box;
  color: #ccc;
  z-index: var(--z-bars);
  font-size: 11px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}


/* ----- PLANNING MODE (no live GPS sources — hide bars, map fills screen) ----- */
body.planning-mode .status-bar-top,
body.planning-mode .control-bar-bottom {
  display: none !important;
}

body.planning-mode #map {
  top: 0 !important;
  bottom: 0 !important;
}

.status-item {
  min-width: 40px;
  max-width: 100px;

  padding: 0 6px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #f5f7fa;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}




.status-green {
  background: #2ecc71;
}

.status-orange {
  background: #f39c12;
}

.status-red {
  background: #e74c3c;
}

/* =====================================================
   CONFIG PANEL — FULL-SCREEN OVERLAY
   ===================================================== */

/* Buttons in status bar (always on dark bg) */
.config-button {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: #d8e8f8;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.15s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.config-button:hover {
  background: rgba(255, 255, 255, 0.20);
}

/* =====================================================
   CONFIG PANEL — FULL-SCREEN OVERLAY
   ===================================================== */

/* --- Dark theme tokens (default) --- */
.config-panel {
  --cp-bg: #0b0f1e;
  --cp-header-bg: #0e1326;
  --cp-header-border: rgba(50, 90, 170, 0.3);
  --cp-body-bg: #0e1225;
  --cp-tile-bg: #131d38;
  --cp-tile-hover: #1a2648;
  --cp-tile-dis-bg: #0c1020;
  --cp-border: rgba(55, 95, 180, 0.4);
  --cp-border-hover: rgba(75, 140, 230, 0.75);
  --cp-border-dis: rgba(55, 95, 180, 0.15);
  --cp-text: #c8daf0;
  --cp-text-muted: #526e9a;
  --cp-id-color: #eaf3ff;
  --cp-id-shadow: 0 0 14px rgba(80, 160, 255, 0.7), 0 2px 4px rgba(0, 0, 0, 0.6);
  --cp-id-shadow-h: 0 0 22px rgba(80, 160, 255, 1), 0 2px 4px rgba(0, 0, 0, 0.6);
  --cp-desc-color: #5ba8dc;
  --cp-desc-hover: #92c8f8;
  --cp-title-color: #7ac8e8;
  --cp-btn-bg: rgba(255, 255, 255, 0.07);
  --cp-btn-border: rgba(80, 130, 200, 0.3);
  --cp-btn-text: #88b8dc;
  --cp-btn-hover: rgba(255, 255, 255, 0.15);
  --cp-icon-btn-bg: rgba(0, 0, 0, 0.38);
  --cp-icon-btn-border: rgba(80, 130, 200, 0.3);
  --cp-icon-btn-hover-bg: rgba(0, 0, 0, 0.58);
  --cp-icon-btn-hover-b: rgba(80, 145, 235, 0.75);
  --cp-accent: #3a8adc;
}

/* --- Light theme overrides --- */
.config-panel.theme-light {
  --cp-bg: #f0f4fb;
  --cp-header-bg: #e2eaf8;
  --cp-header-border: rgba(150, 185, 235, 0.6);
  --cp-body-bg: #e6ecf8;
  --cp-tile-bg: #ffffff;
  --cp-tile-hover: #f5f8ff;
  --cp-tile-dis-bg: #f2f5fb;
  --cp-border: rgba(150, 185, 235, 0.65);
  --cp-border-hover: rgba(40, 100, 215, 0.6);
  --cp-border-dis: rgba(150, 185, 235, 0.3);
  --cp-text: #1a2a48;
  --cp-text-muted: #4e68a0;
  --cp-id-color: #0e1c38;
  --cp-id-shadow: none;
  --cp-id-shadow-h: 0 0 0 3px rgba(40, 100, 210, 0.12);
  --cp-desc-color: #1a58aa;
  --cp-desc-hover: #0a3888;
  --cp-title-color: #1a4890;
  --cp-btn-bg: rgba(0, 0, 0, 0.055);
  --cp-btn-border: rgba(100, 145, 220, 0.5);
  --cp-btn-text: #1e4a90;
  --cp-btn-hover: rgba(0, 0, 0, 0.10);
  --cp-icon-btn-bg: rgba(235, 242, 255, 0.9);
  --cp-icon-btn-border: rgba(100, 145, 215, 0.45);
  --cp-icon-btn-hover-bg: #ffffff;
  --cp-icon-btn-hover-b: rgba(40, 100, 215, 0.65);
  --cp-accent: #1a5dbf;
}

/* --- Structure --- */
.config-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: var(--cp-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  color: var(--cp-text);
  visibility: hidden;
  pointer-events: none;
  transition: background 0.2s, color 0.2s;
}

.config-panel.open {
  visibility: visible;
  pointer-events: auto;
}

.config-header {
  flex-shrink: 0;
  background: var(--cp-header-bg);
  border-bottom: 1px solid var(--cp-header-border);
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: default;
  transition: background 0.2s, border-color 0.2s;
}

.config-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.config-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cp-title-color);
  transition: color 0.2s;
}

.config-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Buttons inside the panel override the status-bar defaults */
.config-panel .config-button {
  background: var(--cp-btn-bg);
  border-color: var(--cp-btn-border);
  color: var(--cp-btn-text);
}

.config-panel .config-button:hover {
  background: var(--cp-btn-hover);
}

.config-radius-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--cp-btn-border);
  background: var(--cp-btn-bg);
  color: var(--cp-btn-text);
  font-size: 12px;
  white-space: nowrap;
  user-select: none;
}

.config-radius-input {
  width: 110px;
  accent-color: var(--cp-accent);
  cursor: pointer;
}

.config-radius-value {
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--cp-text);
}

.config-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
  background: var(--cp-body-bg);
  transition: background 0.2s;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 7px;
}

/* --- Tiles --- */
.config-item {
  background: var(--cp-tile-bg);
  border: 1px solid var(--cp-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.2s;
}

.config-item:hover {
  background: var(--cp-tile-hover);
  border-color: var(--cp-border-hover);
}

.config-item.config-item--disabled {
  opacity: 0.42;
  background: var(--cp-tile-dis-bg);
  border-color: var(--cp-border-dis);
}

.config-item.status-live {
  border-color: #2ecc71;
  border-width: 2px;
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.55);
}

.config-item.status-stale {
  border-color: #f39c12;
  border-width: 2px;
  box-shadow: 0 0 12px rgba(243, 156, 18, 0.55);
}

.config-item.status-dead {
  border-color: #e74c3c;
  border-width: 2px;
  box-shadow: 0 0 12px rgba(231, 76, 60, 0.55);
}

.config-status-pill {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 10px;
  padding: 2px 7px;
}

/* --- Tile contents --- */
.config-item-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-item-id {
  font-size: 30px;
  font-weight: 900;
  color: var(--cp-id-color);
  letter-spacing: -0.02em;
  min-width: 46px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: var(--cp-id-shadow);
  user-select: none;
  transition: text-shadow 0.15s, color 0.2s;
}

/* Per-source enable/disable pill — deliberately a solid text pill (not a
   track+knob switch like the toggles below) since flipping it kills the
   source entirely rather than tweaking a display option. */
.config-enable-btn {
  flex-shrink: 0;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.config-enable-btn.is-on {
  background: rgba(46, 204, 113, 0.16);
  border: 1px solid rgba(46, 204, 113, 0.65);
  color: #2ecc71;
}

.config-enable-btn.is-on:hover {
  background: rgba(46, 204, 113, 0.28);
}

.config-enable-btn.is-off {
  background: rgba(231, 76, 60, 0.14);
  border: 1px solid rgba(231, 76, 60, 0.55);
  color: #e74c3c;
}

.config-enable-btn.is-off:hover {
  background: rgba(231, 76, 60, 0.24);
}

.config-item-icon-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.config-icon-btn {
  width: 36px;
  height: 36px;
  background: var(--cp-icon-btn-bg);
  border: 1px solid var(--cp-icon-btn-border);
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.config-icon-btn:hover {
  background: var(--cp-icon-btn-hover-bg);
  border-color: var(--cp-icon-btn-hover-b);
}

.config-icon-btn .marker-symbol {
  zoom: 0.75;
  pointer-events: none;
}

.config-item-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.config-toggle-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--cp-text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.config-toggle-group input {
  display: none;
}

.config-toggle-track {
  width: 26px;
  height: 14px;
  border-radius: 8px;
  background: var(--cp-btn-bg);
  border: 1px solid var(--cp-btn-border);
  position: relative;
  flex-shrink: 0;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.config-toggle-track::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cp-text-muted);
  top: 1px;
  left: 1px;
  transition: left 0.18s ease, background 0.18s ease;
}

.config-toggle-group input:checked + .config-toggle-track {
  background: var(--cp-accent);
  border-color: var(--cp-accent);
}

.config-toggle-group input:checked + .config-toggle-track::after {
  left: 13px;
  background: #fff;
}

.config-toggle-group:hover .config-toggle-track {
  border-color: var(--cp-border-hover);
}

/* "Offline warning" toggle reads as a warning control (amber), not a generic on/off */
.config-toggle-group--warn input:checked + .config-toggle-track {
  background: #e0972d;
  border-color: #e0972d;
}

.config-desc-label {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--cp-desc-color);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.config-desc-label:hover {
  color: var(--cp-desc-hover);
}

/* --- Label edit modal (always dark) --- */
.label-prompt-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.label-prompt-dialog {
  background: #1a2140;
  border: 1px solid rgba(100, 150, 220, 0.45);
  border-radius: 12px;
  padding: 22px 20px 18px;
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.label-prompt-input {
  width: 100%;
  box-sizing: border-box;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 12px 14px;
  border-radius: 7px;
  border: 1px solid rgba(100, 150, 220, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: #e0e0e0;
  outline: none;
}

.label-prompt-input:focus {
  border-color: rgba(100, 160, 230, 0.85);
}

.label-prompt-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.label-prompt-btn {
  padding: 11px 24px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-width: 80px;
}

.label-prompt-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #9ab0c8;
}

.label-prompt-ok {
  background: #1a4a8a;
  color: #e8f0ff;
}

/* --- Icon + color modal (always dark) --- */
.icm-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.icm-modal {
  background: #141828;
  border: 1px solid rgba(100, 150, 220, 0.4);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 540px;
  width: 100%;
  max-height: calc(100dvh - 32px - env(safe-area-inset-bottom, 0px));
  overflow: hidden;
}

.icm-body {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  overflow-y: auto;
  min-height: 0;
}

.icm-left {
  flex-shrink: 0;
}

.icm-icon-grid {
  display: grid;
  grid-template-columns: repeat(2, 72px);
  gap: 8px;
}

.icm-icon-opt {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(100, 150, 220, 0.22);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background 0.12s, border-color 0.12s;
}

.icm-icon-opt:hover:not(.selected) {
  background: rgba(100, 150, 220, 0.13);
  border-color: rgba(100, 160, 230, 0.45);
}

.icm-icon-opt.selected {
  border-color: #4a9edd;
  background: rgba(52, 152, 219, 0.22);
  box-shadow: 0 0 0 2px rgba(74, 158, 221, 0.28);
}

.icm-icon-opt .marker-symbol {
  zoom: 1.2;
  pointer-events: none;
}

/* Per-icon vertical centering in the picker (visual center != box center for most icons) */
.icm-icon-opt .marker-symbol.marker-type-arrow {
  margin-top: 20px;
}

.icm-icon-opt .marker-symbol.marker-type-plane {
  margin-top: -3px;
}

.icm-icon-opt .marker-symbol.marker-type-helicopter {
  margin-top: -6px;
}

.icm-icon-opt .marker-symbol.marker-type-boat {
  margin-top: 0px;
}

.icm-icon-opt .marker-symbol.marker-type-truck {
  margin-top: 14px;
}

.icm-icon-opt .marker-symbol.marker-type-moto {
  margin-top: 2px;
}

.icm-right {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.icm-sv-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: crosshair;
}

.icm-hue-canvas {
  display: block;
  width: 100%;
  height: 22px;
  border-radius: 5px;
  cursor: ew-resize;
}

.icm-preview {
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(100, 150, 220, 0.3);
}

.icm-footer {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.icm-btn {
  padding: 11px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-width: 90px;
}

.icm-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #9ab0c8;
}

.icm-cancel:hover {
  background: rgba(255, 255, 255, 0.13);
}

.icm-ok {
  background: #1a4a8a;
  color: #e8f0ff;
}

.icm-ok:hover {
  background: #2060b0;
}

.icm-dyntrace {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.05);
  color: #7a9ab8;
  border: 1px solid rgba(100, 150, 220, 0.25);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.icm-dyntrace:hover {
  background: rgba(100, 150, 220, 0.13);
  color: #9ab8d8;
  border-color: rgba(100, 160, 230, 0.4);
}

.icm-dyntrace--on {
  background: rgba(20, 80, 180, 0.4);
  color: #a8d4ff;
  border-color: rgba(74, 158, 221, 0.7);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), 0 0 8px rgba(74, 158, 221, 0.2);
}

.icm-dyntrace--on:hover {
  background: rgba(20, 80, 180, 0.55);
}

@media (max-width: 480px) {
  .icm-footer {
    flex-wrap: wrap;
  }
  .icm-dyntrace {
    width: 100%;
    margin-right: 0;
  }
}

/* Custom map markers (icon + small label) */
.custom-src-marker .marker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateZ(0);
  position: relative;
}

.marker-wrapper.marker-beacon::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(52, 152, 219, 0.55);
  animation: beacon-pulse 0.9s ease-out infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes beacon-pulse {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0.8;
  }

  100% {
    transform: translate(-50%, -50%) scale(3);
    opacity: 0;
  }
}

/* Symbol container */
.marker-symbol {
  position: relative;
  width: 40px;
  height: 40px;
  transform-origin: 50% 50%;
  transform-origin: 50% 50%;
  /* base rotation (for how the art is drawn) + live heading from JS */
  transform: rotate(calc(var(--base-rot, 0deg) + var(--heading-rot, 0deg)));
}

.marker-symbol {
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000);
}


/* Small direction arrow container (for non-arrow types) */
.direction-arrow {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 10px;
  height: 16px;
  margin-left: -5px;
  transform-origin: 50% 14px;
  /* pivot near the base */
  filter: drop-shadow(0 0 1px #000);
  z-index: 10;
  /*  make sure it’s above the icon */
  pointer-events: none;
  /* so clicks pass through to the marker */
}

/* Triangle head */
.direction-arrow-head {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 8px solid var(--status-color, #2ecc71);
}

/* Little tail to make direction obvious */
.direction-arrow-tail {
  position: absolute;
  top: 8px;
  left: 4px;
  width: 2px;
  height: 6px;
  background: var(--status-color, #2ecc71);
  border-radius: 2px;
}

/* Hide the tail for all icons except boat */
.marker-symbol:not(.marker-type-boat) .direction-arrow-tail {
  display: none;
}


.marker-label {
  font-size: 12px;
  font-weight: 700;
  color: #000;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.9);
  line-height: 1;
  margin-top: 2px;
}

/* ---------- Arrow icon (uses icon color = status color) ---------- */
.marker-symbol.marker-type-arrow .arrow-body {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  background: var(--icon-color, #2ecc71);
  border-radius: 2px;
}

.marker-symbol.marker-type-arrow .arrow-head {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: -6px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid var(--status-color, #2ecc71);
}

/* ---------- Plane icon (upright, main color = icon color) ---------- */
.marker-symbol.marker-type-plane .plane-body {
  position: absolute;
  top: 6px;
  /* moved a bit up */
  left: 50%;
  width: 7px;
  /* was 5 */
  height: 24px;
  /* was 18 */
  margin-left: -3.5px;
  /* half of width */
  background: var(--icon-color, #3498db);
  border-radius: 4px;
}

.marker-symbol.marker-type-plane .plane-wing {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 24px;
  /* was 18 */
  height: 5px;
  /* was 4 */
  margin-left: -12px;
  /* half of width */
  background: var(--icon-color, #3498db);
  border-radius: 4px;
}

.marker-symbol.marker-type-plane .plane-tail {
  position: absolute;
  top: 4px;
  /* a bit higher */
  left: 50%;
  width: 14px;
  /* was 10 */
  height: 4px;
  /* was 3 */
  margin-left: -7px;
  /* half of width */
  background: var(--icon-color, #3498db);
  border-radius: 3px;
}

/* ---------- Helicopter top-down (upright) ---------- */
.marker-symbol.marker-type-helicopter .heli-body {
  position: absolute;
  top: 15px;
  left: 50%;
  width: 10px;
  height: 12px;
  margin-left: -5px;
  background: var(--icon-color, #e67e22);
  border-radius: 3px;
}

.marker-symbol.marker-type-helicopter .heli-tail {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  background: var(--icon-color, #e67e22);
  border-radius: 2px;
}

.marker-symbol.marker-type-helicopter .heli-tail-rotor {
  position: absolute;
  top: 8px;
  left: 50%;
  margin-left: -5px;
  width: 10px;
  height: 2px;
  background: var(--icon-color, #e67e22);
  border-radius: 1px;
}



.marker-symbol.marker-type-helicopter .heli-rotor-cross {
  position: absolute;
  top: 0;
  left: 50%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
}

.marker-symbol.marker-type-helicopter .heli-rotor-cross::before,
.marker-symbol.marker-type-helicopter .heli-rotor-cross::after {
  content: "";
  position: absolute;
  background: var(--icon-color, #e67e22);
  opacity: 0.9;
}

.marker-symbol.marker-type-helicopter .heli-rotor-cross::before {
  top: 13px;
  left: 0;
  width: 28px;
  height: 2px;
}

.marker-symbol.marker-type-helicopter .heli-rotor-cross::after {
  top: 0;
  left: 13px;
  width: 2px;
  height: 28px;
}

/* Plane + heli art is drawn "nose down", so we rotate 180° as a base */
.marker-symbol.marker-type-plane,
.marker-symbol.marker-type-helicopter {
  --base-rot: 180deg;
}

/* Move the small status arrow a bit in front of the nose for plane & heli */
.marker-symbol.marker-type-plane .direction-arrow,
.marker-symbol.marker-type-helicopter .direction-arrow {
  top: +6px;
  /* try -16 / -18 / -20px to taste */
}

/* ---------- Moto icon (upright, thicker) ---------- */
.marker-symbol.marker-type-moto .moto-body {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 12px;
  height: 22px;
  margin-left: -6px;
  background: var(--icon-color, #e91e63);
  border-radius: 6px;
}

/* Helmet / rider bump on top of the body */
.marker-symbol.marker-type-moto .moto-body::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--icon-color, #e91e63);
  border-radius: 50%;
}

/* Front & rear wheels */
.marker-symbol.marker-type-moto .moto-wheel-front,
.marker-symbol.marker-type-moto .moto-wheel-rear {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #111;
  border-radius: 50%;
}

.marker-symbol.marker-type-moto .moto-wheel-front {
  top: 2px;
  left: 50%;
  margin-left: -3px;
}

.marker-symbol.marker-type-moto .moto-wheel-rear {
  top: 28px;
  left: 50%;
  margin-left: -3px;
}

/* Seat */
.marker-symbol.marker-type-moto .moto-seat {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 10px;
  height: 4px;
  margin-left: -5px;
  background: var(--icon-color, #e91e63);
  border-radius: 2px;
}

/* Handlebars */
.marker-symbol.marker-type-moto .moto-handle {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  background: var(--icon-color, #e91e63);
  border-radius: 1px;
}

/* Moto: center the little heading arrow */
.marker-symbol.marker-type-moto .direction-arrow,
.marker-symbol.marker-type-racecar .direction-arrow {
  top: 8px;
  /* vertical centering */
  left: 50%;
  margin-left: -5px;
  /* center horizontally (arrow width = 10px) */
}

/* ---------- Racecar top-down (upright) ---------- */
.marker-symbol.marker-type-racecar .race-body {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 16px;
  /* overall width of car */
  height: 26px;
  /* overall length of car */
  margin-left: -8px;
  /* half of width */
  background: var(--icon-color, #e91e63);
  border-radius: 9px;
  /* capsule shape */
}


body.config-open {
  /* intentionally empty — overflow:hidden on body breaks position:fixed on Android */
}

@media (max-width: 500px) {
  .config-grid {
    grid-template-columns: 1fr 1fr;
  }

  .config-body {
    padding: 10px;
  }

  .config-actions {
    gap: 4px;
  }

  .config-button {
    font-size: 11px;
    padding: 4px 8px;
  }
}

@media (max-width: 360px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* =====================================================
   AERONAUTICAL PANEL — RIGHT SIDE
   ===================================================== */

/* --- Handle --- */
.aero-handle {
  position: fixed;
  left: var(--panel-width-aero);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-aero))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;

  width: var(--tab-width);
  height: 90px;

  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  overflow: hidden;

  cursor: pointer;
  z-index: var(--z-handle);
}

.aero-handle-icon {
  font-size: 14px;
  color: #0077cc;
  transition: color 0.2s;
}

.aero-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #333;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transition: color 0.2s;
}

.aero-handle-arrow {
  font-size: 14px;
  color: #333;
  transition: color 0.2s, transform 0.2s ease;
}

.aero-handle.active .aero-handle-arrow {
  transform: rotate(180deg);
}

.aero-panel.open~.aero-handle,
.aero-config-panel.open~.aero-handle {
  transform: translateX(0) translateY(-50%);
}

.aero-panel.open,
.aero-config-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.aero-panel.open~.aero-handle {
  z-index: calc(var(--z-handle) + 50);
}

.aero-config-panel.open~.aero-handle {
  z-index: calc(var(--z-panel) - 1);
}

/* --- Aero panel --- */
.aero-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;

  width: var(--panel-width-aero);

  background: #fdfdfd;
  border-radius: 0 12px 12px 0;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-aero)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);
}

.aero-panel.open {
  transform: translateX(0);
}

.aero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(195, 225, 255, 0.75) 0%,
      rgba(218, 238, 255, 0.45) 40%,
      rgba(245, 250, 255, 0.15) 100%);
  pointer-events: none;
  border-radius: inherit;
  z-index: -1;
}

.aero-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #d8e8f4;
  flex-shrink: 0;
}

.aero-title {
  font-size: 14px;
  font-weight: 700;
  color: #0077cc;
  letter-spacing: 0.04em;
}

.aero-btn-small {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid #bbd0e8;
  background: #eef6ff;
  color: #005599;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.aero-btn-small:hover {
  background: #d8ecff;
}

.aero-btn-small.active {
  background: #0077cc;
  color: #fff;
  border-color: #0055aa;
}

.aero-btn-small.active:hover {
  background: #0066bb;
}

.aero-btn-small.active-green {
  background: #229944;
  color: #fff;
  border-color: #116622;
}

.aero-btn-small.active-green:hover {
  background: #1a7a33;
}

.aero-btn-small.active-none {
  background: #3a1a1a;
  color: #e08080;
  border-color: #7a3333;
}

.aero-btn-small.active-none:hover {
  background: #4a2222;
}

.aero-btn-small.active-vor {
  background: #2a0055;
  color: #cc99ff;
  border-color: #6600aa;
}

.aero-btn-small.active-vor:hover {
  background: #3a0077;
}

#aeroViewAirportsBtn,
#aeroNavaidsViewBtn {
  min-width: 110px;
  text-align: center;
}

.aero-btn-small.dim {
  color: #b0c8dd;
  border-color: #ddeaf4;
  background: #f7fbff;
}

.aero-btn-small.dim:hover {
  background: #eef6ff;
  color: #005599;
  border-color: #bbd0e8;
}

.aero-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.aero-section+.aero-section {
  border-top: 1px solid #dceaf5;
}

.aero-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px 4px;
  flex-shrink: 0;
}

.aero-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5588aa;
  cursor: pointer;
}

.aero-section-title:hover {
  color: #0077cc;
}

.aero-master-btns {
  display: flex;
  gap: 3px;
}

.aero-master-toggle {
  background: none;
  border: 1px solid #bbd0e8;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #0077cc;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.aero-master-toggle:hover {
  background: #e0f0ff;
}

.aero-list {
  flex: 1;
  overflow-y: auto;
  padding: 3px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.aero-empty {
  color: #aaa;
  font-size: 11px;
  text-align: center;
  padding: 10px 0;
  font-style: italic;
}

.aero-add-link {
  color: #0077cc;
  cursor: pointer;
  text-decoration: underline;
  font-style: normal;
}

.aero-add-link:hover {
  color: #005599;
}

/* Each item row */
.aero-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid #d0e4f4;
  font-size: 12px;
  transition: background 0.12s;
}

.aero-item:hover {
  background: rgba(230, 245, 255, 0.9);
}

.aero-item.pin-hidden {
  opacity: 0.45;
}

.aero-item-ident {
  font-weight: 800;
  font-size: 13px;
  color: #004488;
  min-width: 42px;
  font-family: "JetBrains Mono", monospace;
}

.aero-item-name {
  flex: 1;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.aero-item-type-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.aero-type-apt {
  background: #dbeeff;
  color: #003f99;
}

.aero-type-vor {
  background: #ecdeff;
  color: #6600aa;
}

.aero-type-ndb {
  background: #ffdde8;
  color: #aa0044;
}

.aero-type-dme {
  background: #d8ffee;
  color: #005533;
}

.aero-type-other {
  background: #eee;
  color: #555;
}

.aero-item-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.aero-icon-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #bbd0e8;
  border-radius: 4px;
  background: #f2f8ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #0077cc;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s;
}

.aero-icon-btn:hover {
  background: #d8ecff;
  border-color: #88bbdd;
}

.aero-icon-btn.pin-off {
  color: #bbb;
  border-color: #ddd;
  background: #f8f8f8;
}

.aero-icon-btn.danger {
  color: #cc2200;
  border-color: #ffcccc;
  background: #fff5f5;
}

.aero-icon-btn.danger:hover {
  background: #ffe0e0;
  border-color: #ff9999;
  color: #aa1800;
}

/* --- Configure panel --- */
.aero-config-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;

  width: var(--panel-width-aero-config);

  background: #fdfdfd;
  border-radius: 0 12px 12px 0;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.22);

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-aero-config)));
  transition: transform 0.25s ease;
  z-index: calc(var(--z-panel) + 5);

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.aero-config-panel.open {
  transform: translateX(0);
}

.aero-config-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.aero-config-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid #d8e8f4;
  flex-shrink: 0;
}

.aero-btn-back {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 4px;
  border: 1px solid #bbd0e8;
  background: #eef6ff;
  color: #005599;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.aero-btn-back:hover {
  background: #d8ecff;
}

.aero-config-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: #0077cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aero-config-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.aero-search-row {
  padding: 8px 12px 6px;
  flex-shrink: 0;
  border-bottom: 1px solid #e8f0f8;
}

.aero-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border: 1px solid #c0d4e8;
  border-radius: 6px;
  font-size: 13px;
  color: #222;
  background: #fff;
  outline: none;
  margin-bottom: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.aero-search-input:focus {
  border-color: #0077cc;
  box-shadow: 0 0 0 2px rgba(0, 119, 204, 0.18);
}

.aero-filter-checks {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.aero-filter-check {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: 1px solid #bbd0e8;
  border-radius: 4px;
  background: #eef6ff;
  color: #005599;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.aero-filter-check input[type="checkbox"] {
  display: none;
}

.aero-filter-check:has(input:checked) {
  background: #0077cc;
  color: #fff;
  border-color: #0077cc;
}

.aero-filter-check:hover {
  background: #d8ecff;
}

.aero-filter-check:has(input:checked):hover {
  background: #0066bb;
}

.aero-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
}

.aero-search-hint {
  color: #bbb;
  font-size: 12px;
  text-align: center;
  padding: 24px 0;
  font-style: italic;
}

.aero-result-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid #e0ecf8;
  background: #f8fbff;
  margin-bottom: 3px;
  font-size: 12px;
  transition: background 0.12s;
}

.aero-result-row:hover {
  background: #eaf4ff;
  border-color: #b8d4ec;
}

.aero-result-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}

.aero-result-ident {
  font-weight: 800;
  font-size: 13px;
  color: #111;
  min-width: 40px;
  font-family: "JetBrains Mono", monospace;
}

.aero-result-name {
  flex: 1;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aero-result-sub {
  font-size: 10px;
  color: #999;
  flex-shrink: 0;
  white-space: nowrap;
}

.aero-result-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.aero-result-add {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid #0077cc;
  background: #e4f1ff;
  color: #0077cc;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

.aero-result-add:hover {
  background: #c0dfff;
}

.aero-result-add.is-added {
  background: #0077cc;
  color: #fff;
}

.aero-result-add.is-added:hover {
  background: #cc2200;
  border-color: #cc2200;
}

.aero-result-goto {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid #bbd0e8;
  background: #f2f8ff;
  color: #0077cc;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.12s;
}

.aero-result-goto:hover {
  background: #d8ecff;
}

/* --- Info panel: aeronautical mode --- */
.details-aero-content {
  overflow-y: auto;
}

.aero-info-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.aero-info-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e4e4e4;
}

.aero-info-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
  margin-bottom: 5px;
}

.aero-info-row {
  display: flex;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 12px;
}

.aero-info-label {
  min-width: 90px;
  color: #777;
  font-size: 12px;
}

.aero-info-value {
  flex: 1;
  text-align: right;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  color: #222;
  font-size: 12px;
}

.aero-runway-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 3px 0;
  border-bottom: 1px solid #f0f0f0;
  color: #333;
}

.aero-runway-row:last-child {
  border-bottom: none;
}

.aero-runway-ident {
  font-weight: 800;
  color: #0044aa;
  font-family: monospace;
  min-width: 64px;
}

.aero-runway-len {
  color: #555;
  min-width: 48px;
}

.aero-runway-surface {
  color: #888;
  font-size: 10px;
}

.aero-runway-lit {
  margin-left: auto;
  color: #f39c12;
  font-size: 11px;
}

.aero-freq-row {
  display: flex;
  align-items: center;
  padding: 2px 0;
  font-size: 11px;
  border-bottom: 1px solid #f0f0f0;
}

.aero-freq-row:last-child {
  border-bottom: none;
}

.aero-freq-type {
  color: #777;
  font-weight: 600;
  min-width: 64px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.aero-freq-mhz {
  margin-left: auto;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: #0044aa;
  font-size: 12px;
}

.aero-info-spinner {
  text-align: center;
  color: #aaa;
  font-size: 12px;
  padding: 16px 0;
}

.aero-info-add-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid #0077cc;
  background: #e4f1ff;
  color: #0055aa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  box-sizing: border-box;
}

.aero-info-add-btn:hover {
  background: #c0dfff;
}

.aero-info-remove-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid #cc2200;
  background: #ffeae6;
  color: #aa1100;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  box-sizing: border-box;
}

.aero-info-remove-btn:hover {
  background: #ffd0c8;
}

/* dark cockpit in the middle */
.marker-symbol.marker-type-racecar .race-cockpit {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 10px;
  height: 12px;
  margin-left: -5px;
  background: #111;
  border-radius: 6px;
  opacity: 0.85;
}

/* white center stripe */
.marker-symbol.marker-type-racecar .race-stripe {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 26px;
  margin-left: -1.5px;
  background: #fff;
  border-radius: 3px;
  opacity: 0.95;
}

/* put the small direction arrow roughly in the middle of the car */
.marker-symbol.marker-type-racecar .direction-arrow {
  top: 11px;
  /* vertical center of the body */
  left: 50%;
  margin-left: -5px;
  /* center horizontally */
}

/* ---------- Truck top-down ---------- */
.marker-symbol.marker-type-truck .truck-body {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 22px;
  height: 18px;
  margin-left: -11px;
  background: var(--icon-color, #9b59b6);
  border-radius: 3px;
}

.marker-symbol.marker-type-truck .truck-cab {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 16px;
  height: 10px;
  margin-left: -8px;
  background: var(--icon-color, #9b59b6);
  border-radius: 3px;
}

.marker-symbol.marker-type-truck .truck-wheel {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #111;
  border-radius: 50%;
}

.marker-symbol.marker-type-truck .wheel-front-left {
  top: 6px;
  left: 6px;
}

.marker-symbol.marker-type-truck .wheel-front-right {
  top: 6px;
  right: 6px;
}

.marker-symbol.marker-type-truck .wheel-rear-left {
  bottom: 10px;
  left: 6px;
}

.marker-symbol.marker-type-truck .wheel-rear-right {
  bottom: 10px;
  right: 6px;
}


/* ----- Truck: parabolic dish + feedhorn (OUTWARD) ----- */
.marker-symbol.marker-type-truck .truck-dish {
  position: absolute;
  top: -6px;
  /* lift it above the roof */
  left: 28px;
  /* push it outside the body */
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid var(--status-color, #9b59b6);
  border-right-color: transparent;
  /* OPEN outward */
  border-top-color: transparent;
  background: transparent;
  transform: rotate(0deg);
  filter: drop-shadow(0 0 1px #000);
}







/* ---------- Boat icon (upright) ---------- */
.marker-symbol.marker-type-boat .boat-hull {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 20px;
  height: 8px;
  background: var(--icon-color, #16a085);
  border-radius: 0 0 10px 10px;
}

.marker-symbol.marker-type-boat .boat-bow {
  display: none;
}

.marker-symbol.marker-type-boat .boat-mast {
  position: absolute;
  bottom: 14px;
  left: 10px;
  width: 2px;
  height: 10px;
  background: var(--icon-color, #16a085);
}

.marker-symbol.marker-type-boat .boat-sail {
  position: absolute;
  bottom: 16px;
  left: 12px;
  width: 0;
  height: 0;
  border-left: 8px solid var(--icon-color, #16a085);
  border-top: 9px solid transparent;
  border-bottom: 0 solid transparent;
}

/* Boat: center the small arrow on the hull */
.marker-symbol.marker-type-boat .direction-arrow {
  top: 0px;
  /* roughly vertical center of boat hull */
  left: 50%;
  width: 10px;
  height: 16px;
  margin-left: -5px;
  /* true horizontal centering */
}

/* ---------- Plain circle (no facing) ---------- */
.marker-symbol.marker-type-circle .circle-body {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  background: var(--icon-color, #3498db);
  border-radius: 50%;
  border: 2px solid #fff;
}


.config-close {
  background: transparent;
  border: 1px solid var(--cp-btn-border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--cp-text-muted);
  cursor: pointer;
  padding: 4px 10px;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.config-close:hover {
  background: var(--cp-btn-bg);
  color: var(--cp-text);
}

/* Clean color picker styling (bottom bar) */
.control-bar-bottom input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #555;
  background: transparent;
  cursor: pointer;
  box-sizing: border-box;
}

/* Remove the ugly inner frame in Chrome/Safari */
.control-bar-bottom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 4px;
}



.control-bar-bottom input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

/* Firefox */
.control-bar-bottom input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}


/* wrapper */
.own-gps-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
}

/* pulsing circle */
.own-gps-pulse {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.35);
  animation: gpsPulse 1.6s infinite;
}

/* main body */
.own-gps-body {
  position: absolute;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* arrow */
.own-gps-arrow {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 18px solid #00c8ff;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8));
}

/* animation */
@keyframes gpsPulse {
  0% {
    transform: scale(0.5);
    opacity: 0.9;
  }

  70% {
    transform: scale(1.8);
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

/* =====================================================
   MEASURE PANEL
   ===================================================== */

.measure-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;
  width: var(--panel-width-measure);
  background: #fdfdfd;
  border-radius: 0 12px 12px 0;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-measure)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.measure-panel.open {
  transform: translateX(0);
}

.measure-panel.open~.measure-handle {
  transform: translateX(0) translateY(-50%);
}

.measure-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.measure-panel.open~.measure-handle {
  z-index: calc(var(--z-handle) + 50);
}

.measure-handle {
  position: fixed;
  left: var(--panel-width-measure);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-measure))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
  width: var(--tab-width);
  height: 90px;
  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
  z-index: var(--z-handle);
  cursor: pointer;
}

.measure-handle-icon {
  font-size: 15px;
  color: #e67e22;
}

.measure-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #333;
}

.measure-handle-arrow {
  font-size: 16px;
  color: #333;
  transition: transform 0.2s ease;
}

.measure-handle.active .measure-handle-arrow {
  transform: rotate(180deg);
}

.measure-inner {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.measure-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e4e4;
}

.measure-title {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  flex: 1;
}

.measure-icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f0f0f0;
  color: #444;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
}

.measure-icon-btn:hover {
  background: #dde8f5;
  border-color: #99b8d8;
  color: #003366;
}

.measure-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.measure-icon-btn:disabled:hover {
  background: #f0f0f0;
  border-color: #ccc;
  color: #444;
}

.measure-reset-all-btn {
  width: auto;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
}

.measure-clear-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #888;
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.measure-clear-btn:hover {
  background: #fde0e0;
  border-color: #e2b8b8;
  color: #b03030;
}

.measure-edit-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.measure-edit-btn:hover {
  background: #e0eeff;
  border-color: #a8c8f0;
  color: #2060b0;
}

.details-measure-footer {
  padding: 8px 0 10px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.details-measure-label {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.details-measure-label--clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.15s, color 0.15s;
}

.details-measure-label--clickable:hover {
  background: #f0f0f0;
  color: #555;
}

.details-measure-edit {
  background: #7f8c8d;
  flex: 0 0 auto;
  padding: 6px 10px;
}

.details-measure-edit:hover {
  opacity: 0.85;
}

.details-measure-btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: 10px;
  border: none;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  font-family: inherit;
  transition: opacity 0.15s;
}

.details-measure-btn:hover {
  opacity: 0.85;
}

.details-measure-from {
  background: #3498db;
}

.details-measure-to {
  background: #e67e22;
}

.measure-swap-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin: -2px 0;
}

.measure-swap-row::before,
.measure-swap-row::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #ddd;
}

.measure-swap-row button {
  margin: 0 8px;
}

.measure-pick-hint {
  display: none;
}

.measure-point-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 10px;
  min-height: 76px;
  background: #f7f8fa;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
}

.measure-point-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
}

.measure-point-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.measure-pt-icon-clickable {
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.measure-pt-icon-clickable:hover {
  background: rgba(0, 0, 0, 0.05);
}

.measure-pt-icon-clickable:active {
  background: rgba(0, 0, 0, 0.10);
}

.measure-pt-icon {
  flex-shrink: 0;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: visible;
  border-left: 1px solid #e2e2e2;
  margin-left: 10px;
  padding-left: 4px;
}

.measure-point-badge {
  padding: 4px 9px;
  border-radius: 10px;
  background: #3498db;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
}

.measure-point-badge:hover {
  opacity: 0.85;
}

.measure-point-badge.badge-b {
  background: #e67e22;
}

.measure-point-badge.picking {
  background: #e74c3c;
}

.measure-point-badge.picking:hover {
  background: #c0392b;
}

.measure-point-name {
  font-size: 12px;
  font-weight: 600;
  color: #444;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
}

.measure-point-coords {
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  color: #888;
  line-height: 1.6;
  padding-left: 0;
}

.measure-results {
  padding: 10px;
  background: #f0f5ff;
  border: 1px solid #c4d8f0;
  border-radius: 8px;
}

.measure-result-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 3px 0;
}

.measure-result-row+.measure-result-row {
  border-top: 1px solid #d8e8f8;
  margin-top: 4px;
  padding-top: 7px;
}

.measure-result-label {
  color: #5588aa;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.measure-result-value {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: #003366;
  font-size: 13px;
  text-align: right;
}

.measure-result-empty .measure-result-value {
  color: #bbb;
  font-weight: 400;
}

/* Crosshair cursor during pick mode */
body.measure-picking .leaflet-container {
  cursor: crosshair !important;
}

/* Empty state: badge spans the full row */
.measure-point-row--empty {
  padding: 0;
}

.measure-point-row--empty .measure-pt-icon {
  display: none;
}

.measure-point-row--empty .measure-point-top {
  flex: 1;
  align-items: stretch;
}

.measure-point-row--empty .measure-point-badge {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  min-height: 52px;
}

/* Measure pick bar (slides up from bottom) */
.measure-pick-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--z-bars) + 100);
  transform: translateY(100%);
  transition: transform 0.25s ease;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}

.measure-pick-bar.visible {
  transform: translateY(0);
}

.measure-pick-bar-label {
  font-size: 14px;
  font-weight: 500;
  color: #e0e0e0;
  flex: 1;
}

.measure-pick-bar-cancel {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  flex-shrink: 0;
  margin-left: 12px;
}

.measure-pick-bar-cancel:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Map context menu (right-click / long-press) */
.map-ctx-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  min-width: 220px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22), 0 1px 4px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 30000;
  animation: ctx-pop 0.12s ease;
}

.map-ctx-menu.open {
  display: flex;
}

@keyframes ctx-pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.map-ctx-title {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  border-bottom: 1px solid #f0f0f0;
}

.map-ctx-title:empty {
  display: none;
}

.map-ctx-btns {
  display: flex;
}

.map-ctx-btn {
  flex: 1;
  border: none;
  padding: 11px 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.12s;
  color: #fff;
}

.map-ctx-btn:hover {
  opacity: 0.85;
}

.map-ctx-from {
  background: #3498db;
  border-radius: 0 0 0 10px;
}

.map-ctx-to {
  background: #e67e22;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.map-ctx-home {
  background: #16a085;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.map-ctx-copy {
  background: #9b59b6;
  border-radius: 0 0 10px 0;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* Map line labels */
.measure-map-lbl-wrap {
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
}

.measure-map-lbl {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #c05000;
  text-shadow: -1px -1px 2px rgba(255, 255, 255, 0.95),
    1px -1px 2px rgba(255, 255, 255, 0.95),
    -1px 1px 2px rgba(255, 255, 255, 0.95),
    1px 1px 2px rgba(255, 255, 255, 0.95);
  pointer-events: none;
  transform-origin: 0 0;
  line-height: 1;
}

/* Measure line close button */
.measure-map-close-wrap {
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
}

.measure-map-close-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(192, 80, 0, 0.8);
  background: rgba(255, 255, 255, 0.92);
  color: #c05000;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  padding: 0;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.measure-map-close-btn:hover {
  background: #c05000;
  color: #fff;
}

/* ==== RADAR PANEL ==== */
.radar-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;

  width: var(--panel-width-radar);

  background: #fdfdfd;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);
  border-radius: 0 12px 12px 0;

  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-radar)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.radar-panel.open {
  transform: translateX(0);
}

.radar-handle {
  position: fixed;
  left: var(--panel-width-radar);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-radar))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;

  width: var(--tab-width);
  height: 90px;

  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  gap: 4px;
  z-index: var(--z-handle);
  cursor: pointer;
}

.radar-handle-icon {
  font-size: 14px;
  color: #16a085;
}

.radar-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #333;
}

.radar-handle-arrow {
  font-size: 16px;
  color: #333;
  transition: transform 0.2s ease;
}

.radar-handle.active .radar-handle-arrow {
  transform: rotate(180deg);
}

.radar-panel.open~.radar-handle {
  transform: translateX(0) translateY(-50%);
}

.radar-panel.open {
  z-index: calc(var(--z-handle) + 50);
}

.radar-panel.open~.radar-handle {
  z-index: calc(var(--z-handle) + 50);
}

.radar-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
}

.radar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e4e4;
  flex-shrink: 0;
}

.radar-header h3 {
  margin: 0;
  font-size: 15px;
}

.radar-header-actions {
  display: flex;
  gap: 6px;
}

.radar-toggle-row {
  padding: 4px 0;
  flex-shrink: 0;
}

.radar-vector-tiles {
  display: flex;
  gap: 6px;
  padding: 2px 0 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #e4e4e4;
  transition: opacity 0.15s;
}

.radar-vector-tiles.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.radar-vector-tile {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 0;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #f5f5f5;
  color: #333;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.radar-vector-tile:hover {
  background: #e8e8e8;
}

.radar-vector-tile.active {
  background: #16a085;
  border-color: #128a72;
  color: #fff;
}

.radar-vector-tile.active:hover {
  background: #148a72;
}

.radar-home-box {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: #eef6f2;
  border: 1px solid #cfe8dc;
  font-size: 12px;
  color: #1d6b4d;
  line-height: 1.5;
  flex-shrink: 0;
}

.radar-home-box--empty {
  background: #f5f5f5;
  border-color: #e0e0e0;
  color: #888;
}

.radar-home-box-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.radar-home-box-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.radar-home-box-icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

.radar-home-box-text {
  flex: 1;
  min-width: 0;
}

.radar-home-box-name {
  font-weight: 700;
  font-size: 13px;
  color: #145c40;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-home-box--empty .radar-home-box-name {
  color: #777;
}

.radar-home-box-coords {
  font-size: 11px;
  color: #4a8770;
}

.radar-home-box--empty .radar-home-box-coords {
  color: #999;
}

.radar-home-box-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.radar-home-box-actions .tracks-btn-small:disabled {
  opacity: 0.4;
  cursor: default;
}

.radar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 4px;
  padding-right: 10px;
}

.radar-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin: 12px 0 6px;
}

.radar-section-title:first-child {
  margin-top: 6px;
}

/* Sits right under the vector tiles' own divider, which already separates the
   groups - no need for the usual section title's full top margin on top of that. */
.radar-section-title--home {
  margin-top: 6px;
}

.radar-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.radar-empty {
  font-size: 12px;
  color: #999;
  text-align: center;
  padding: 12px 0;
}

.radar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  background: #f7f8fa;
  border: 1px solid transparent;
}

.radar-row--live {
  border-color: #2ecc71;
  box-shadow: 0 0 8px rgba(46, 204, 113, 0.35);
}

.radar-row--stale {
  border-color: #f39c12;
  box-shadow: 0 0 8px rgba(243, 156, 18, 0.35);
}

.radar-row--dead {
  border-color: #e74c3c;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.35);
}

.radar-row--gray {
  border-color: #bbb;
}

.radar-row-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}

.radar-row-icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

.radar-row-text {
  flex: 1;
  min-width: 0;
}

.radar-row-name {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-row-meta {
  font-size: 10.5px;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-row-rel {
  flex-shrink: 0;
  text-align: right;
  font-size: 11px;
  line-height: 1.45;
}

.radar-row-track {
  font-weight: 700;
  color: #333;
}

.radar-row-dist {
  color: #666;
  white-space: nowrap;
}

.radar-row-speed {
  color: #888;
  white-space: nowrap;
}

/* =====================================================
   MOBILE UI IMPROVEMENTS (DROP-IN)
   ===================================================== */

@media (max-width: 900px) {

  /* ---- SCALE ALL MARKERS ---- */
  .leaflet-marker-icon {
    transform: scale(2);
    transform-origin: center bottom;
  }

  /* label text under marker */
  .marker-label {
    font-size: 18px;
    margin-top: 6px;
  }

  /* ---- TOP STATUS BAR ---- */
  .status-bar-top {
    height: 50px;
    padding: 6px 10px;
  }

  .status-item {
    min-width: 80px;
    height: 34px;
    font-size: 16px;
    padding: 4px 12px;
  }

  /* ---- BOTTOM BAR ---- */
  .control-bar-bottom {
    height: 50px;
    font-size: 14px;
  }

  /* adjust map offset */
  #map {
    top: 0;
    bottom: 50px;
  }

  /* ---- SIDE HANDLES ---- */
  :root {
    --tab-stack-offset: 136px;
  }

  /* tab-height(120) + gap(16) */
  .details-handle,
  .presets-handle,
  .tracks-handle,
  .aero-handle,
  .measure-handle,
  .radar-handle,
  .video-handle {
    width: 40px;
    height: 120px;
  }

  .details-handle-label,
  .presets-handle-label,
  .tracks-handle-label,
  .aero-handle-label,
  .measure-handle-label,
  .radar-handle-label,
  .video-handle-label {
    font-size: 14px;
  }

  /* ---- PANELS WIDER ---- */
  :root {
    --panel-width-info: 340px;
    --panel-width-presets: 320px;
  }


  /* ---- DETAILS PANEL TEXT ---- */
  .details-name {
    font-size: 26px;
  }

  .details-row {
    font-size: 16px;
  }

  .details-value {
    font-size: 16px;
  }

  /* ---- FOLLOW BUTTON ---- */
  #followBtn {
    font-size: 18px;
    padding: 16px;
  }

}

/* end @media (max-width: 900px) */

/* ── Timing bar ── */
#timing-bar {
  position: fixed;
  bottom: 40px;
  left: 0;
  right: 0;
  z-index: 9980;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#timing-bar.tbar-on {
  opacity: 1;
}

body.format-40 #timing-bar {
  left: max(0px, calc(50% - (100vh - 40px) * 0.6667 / 2));
  right: max(0px, calc(50% - (100vh - 40px) * 0.6667 / 2));
}

body.format-60 #timing-bar {
  left: max(0px, calc(50% - (100vh - 40px) * 1.0 / 2));
  right: max(0px, calc(50% - (100vh - 40px) * 1.0 / 2));
}

#tbar-inner {
  background: linear-gradient(180deg,
      rgba(4, 10, 28, 0.0) 0%,
      rgba(5, 12, 34, 0.80) 28%,
      rgba(5, 12, 34, 0.88) 100%);
  border-top: 1px solid rgba(70, 125, 200, 0.22);
  padding: 10px 28px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

#tbar-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  overflow: hidden;
  line-height: 1;
  position: relative;
}

#tbar-clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 1;
}

.tbar-phase {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.15em;
  padding: 6px 10px;
  border-radius: 3px;
  flex-shrink: 0;
  text-transform: uppercase;
  position: absolute;
  left: 0;
}

.tbar-upcoming {
  background: rgba(50, 90, 170, 0.38);
  color: #7ab0e8;
  border: 1px solid rgba(60, 110, 200, 0.35);
}

.tbar-active {
  background: rgba(30, 130, 55, 0.38);
  color: #72d888;
  border: 1px solid rgba(40, 160, 75, 0.35);
}

.tbar-transit {
  background: rgba(150, 110, 20, 0.38);
  color: #e8c855;
  border: 1px solid rgba(170, 130, 30, 0.35);
}

.tbar-done {
  background: rgba(70, 50, 115, 0.38);
  color: #b898e8;
  border: 1px solid rgba(90, 70, 140, 0.35);
}

#tbar-label {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 22px;
  font-weight: 600;
  color: #d8ecff;
  flex-shrink: 0;
}

.tbar-sep {
  color: #2a4460;
  font-size: 22px;
  flex-shrink: 0;
}

#tbar-detail {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 20px;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


#tbar-clock {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 22px;
  color: #c8e8ff;
  letter-spacing: 0.1em;
  text-shadow: 0 0 14px rgba(100, 200, 255, 0.55), 0 0 4px rgba(100, 200, 255, 0.35);
}

.sched-zone-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 18px 20px 18px 28px;
  border-left: 2px solid rgba(100, 160, 220, 0.25);
  margin-left: 20px;
  flex-wrap: wrap;
}

.sched-zone-name {
  font-family: 'Courier New', monospace;
  font-size: 24px;
  font-weight: 700;
  color: #2a3a5a;
  flex-shrink: 0;
  min-width: 50px;
}

.sched-zone-times {
  font-family: 'Courier New', monospace;
  font-size: 24px;
  color: #2a3a5a;
  flex-shrink: 0;
}

.sched-zone-arrow {
  font-size: 20px;
  color: #4a7a9a;
  flex-shrink: 0;
}

.sched-zone-comment {
  font-size: 24px;
  color: #6a8a9a;
  font-style: italic;
  flex-shrink: 1;
  min-width: 0;
}

.sched-back-row {
  color: #4a7aa8;
  cursor: pointer;
}

.sched-back-row:hover {
  background: rgba(70, 120, 200, 0.1);
}

.sched-back-label {
  font-size: 15px;
  font-style: italic;
}

.sched-day-row {
  cursor: pointer;
}

.sched-day-row:hover {
  background: rgba(70, 120, 200, 0.08);
}

@keyframes tbarFlash {
  0% {
    background: linear-gradient(180deg, rgba(4, 10, 28, 0) 0%, rgba(5, 12, 34, 0.80) 28%, rgba(5, 12, 34, 0.88) 100%);
    border-top-color: rgba(70, 125, 200, 0.22);
    box-shadow: none;
  }

  10% {
    background: linear-gradient(180deg, rgba(60, 160, 255, 0.28) 0%, rgba(15, 45, 110, 0.92) 35%, rgba(5, 12, 34, 0.92) 100%);
    border-top-color: rgba(120, 210, 255, 0.95);
    box-shadow: 0 -10px 48px rgba(60, 160, 255, 0.5), 0 2px 16px rgba(60, 160, 255, 0.18);
  }

  100% {
    background: linear-gradient(180deg, rgba(4, 10, 28, 0) 0%, rgba(5, 12, 34, 0.80) 28%, rgba(5, 12, 34, 0.88) 100%);
    border-top-color: rgba(70, 125, 200, 0.22);
    box-shadow: none;
  }
}

#timing-bar.tbar-flash #tbar-inner {
  animation: tbarFlash 3s cubic-bezier(0.1, 0, 0.9, 1) forwards;
}

/* ── Schedule overlay ── */
#sched-overlay {
  position: fixed;
  top: 40px;
  bottom: 40px;
  left: 0;
  right: 0;
  z-index: 9990;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

#sched-overlay.sched-active {
  display: flex;
}

body.format-40 #sched-overlay {
  left: max(0px, calc(50% - (100vh - 40px) * 0.6667 / 2));
  right: max(0px, calc(50% - (100vh - 40px) * 0.6667 / 2));
}

body.format-60 #sched-overlay {
  left: max(0px, calc(50% - (100vh - 40px) * 1.0 / 2));
  right: max(0px, calc(50% - (100vh - 40px) * 1.0 / 2));
}

#sched-card {
  width: calc(100% - 24px);
  max-width: none;
  max-height: calc(100% - 8px);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(60, 120, 200, 0.25);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 16px 56px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
}

#sched-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid rgba(60, 120, 200, 0.15);
  flex-shrink: 0;
}

#sched-title {
  display: none;
}

#sched-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#sched-name {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #1a1a2e;
}

#sched-logo {
  max-height: 36px;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}

#sched-breadcrumb {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  color: #3a6a9a;
  margin-top: 3px;
  min-height: 1em;
  letter-spacing: 0.03em;
}

#sched-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.sched-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 20px 24px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 26px;
  color: #2a3a5a;
  transition: background 0.08s;
}

.sched-item.sched-selected {
  background: rgba(40, 100, 200, 0.1);
  color: #0a2050;
}

.sched-sel-arrow {
  width: 14px;
  flex-shrink: 0;
  font-size: 11px;
  color: #2a6ab8;
}

.sched-item-main {
  flex: 1;
  font-weight: 500;
}

.sched-item-sub {
  font-size: 20px;
  color: #5a7aa0;
  flex-shrink: 0;
}

.sched-item.sched-selected .sched-item-sub {
  color: #3a5a80;
}

.sched-empty {
  padding: 28px 24px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  color: #5a7a9a;
  text-align: center;
  line-height: 1.7;
}

.sched-day-header {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a4a7a;
  padding: 16px 20px 6px;
  border-top: 1px solid rgba(60, 120, 200, 0.12);
}

.sched-day-header:first-child {
  border-top: none;
  padding-top: 10px;
}

/* ── Calibration overlay ── */
#calib-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

#calib-overlay.active {
  display: block;
}

.calib-hline {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ff2222;
  opacity: 0.85;
}

.calib-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff2222;
  opacity: 0.85;
}

.calib-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #ff2222;
  border-style: solid;
  opacity: 0.95;
}

.calib-corner.tl {
  border-width: 3px 0 0 3px;
  top: 0;
  left: 0;
  transform: translate(-1px, -1px);
}

.calib-corner.tr {
  border-width: 3px 3px 0 0;
  top: 0;
  right: 0;
  transform: translate(1px, -1px);
}

.calib-corner.bl {
  border-width: 0 0 3px 3px;
  bottom: 0;
  left: 0;
  transform: translate(-1px, 1px);
}

.calib-corner.br {
  border-width: 0 3px 3px 0;
  bottom: 0;
  right: 0;
  transform: translate(1px, 1px);
}

.calib-corner-wrap {
  position: absolute;
  width: 0;
  height: 0;
}

.calib-readout {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 7px;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 34, 34, 0.4);
  line-height: 1.6;
}

.calib-readout .calib-ratio-big {
  display: block;
  font-size: 17px;
  color: #ff6666;
  margin-bottom: 1px;
}

}

/* ── Kiosk video overlay (remote controlled) ─────────────── */
#video-kiosk {
  display: none;
  position: fixed;
  background: #000;
  overflow: hidden;
}

#video-kiosk.vk-full {
  display: flex;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99990;
  align-items: center;
  justify-content: center;
  transform: translateZ(0);
}

#video-kiosk.vk-pip {
  position: absolute;
  /* relative to #map (its parent in PiP mode) */
  display: block;
  z-index: 9965;
  width: 320px;
  height: 180px;
  top: 16px;
  left: 16px;
  border: 1px solid rgba(70, 125, 200, 0.3);
  border-radius: 4px;
}

#video-kiosk img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ── Video panel ─────────────────────────────────────────── */
#video-panel {
  display: none;
  position: fixed;
  bottom: 52px;
  right: 16px;
  width: 360px;
  height: 260px;
  z-index: 9970;
  border: 1px solid rgba(70, 125, 200, 0.35);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
  background: #000;
  flex-direction: column;
}

#video-panel.vid-open {
  display: flex;
}

#video-panel-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: rgba(5, 12, 34, 0.96);
  border-bottom: 1px solid rgba(70, 125, 200, 0.2);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 12px;
  color: #7090b8;
}

#video-panel-hdr:active {
  cursor: grabbing;
}

.vid-hdr-btn {
  background: #1a2a4a;
  color: #8ab0d8;
  border: 1px solid #2a4a7a;
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 11px;
  cursor: pointer;
}

.vid-hdr-btn:hover {
  background: #2a3a5a;
}

#videoFrame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

/* ── Video sidebar panel + handle ──────────────────────── */

.video-panel,
.video-handle {
  user-select: none;
  -webkit-user-select: none;
}

.video-handle {
  position: fixed;
  left: var(--panel-width-video);
  top: 50%;
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-video))) translateY(-50%);
  transition: transform 0.25s ease, background 0.2s ease, box-shadow 0.2s ease;
  width: var(--tab-width);
  height: 90px;
  background: #fdfdfd;
  border-radius: 0 8px 8px 0;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  overflow: hidden;
  cursor: pointer;
  z-index: var(--z-handle);
}

.video-handle-icon {
  font-size: 14px;
  color: #0077cc;
}

.video-handle-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #333;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.video-handle-arrow {
  font-size: 14px;
  color: #333;
  transition: color 0.2s, transform 0.2s ease;
}

.video-handle.active .video-handle-arrow {
  transform: rotate(180deg);
}

.video-panel.open~.video-handle {
  transform: translateX(0) translateY(-50%);
}

.video-panel.open {
  transform: translateX(0);
  z-index: calc(var(--z-handle) + 50);
}

.video-panel {
  position: fixed;
  top: max(56px, calc(env(safe-area-inset-top) + 16px));
  left: 0;
  bottom: 48px;
  width: var(--panel-width-video);
  background: #fdfdfd;
  border-radius: 0 12px 12px 0;
  box-shadow: 8px 0 18px rgba(0, 0, 0, 0.18);
  transform: translateX(calc(var(--slide-dir, -1) * var(--panel-width-video)));
  transition: transform 0.25s ease;
  z-index: var(--z-panel);
}

.video-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(195, 225, 255, 0.75) 0%,
      rgba(218, 238, 255, 0.45) 40%,
      rgba(245, 250, 255, 0.15) 100%);
  pointer-events: none;
  border-radius: inherit;
  z-index: -1;
}

.video-panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
  gap: 10px;
  overflow: hidden;
}

.video-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.video-panel-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1a2a3a;
}

.video-panel-fullscreen-btn {
  background: none;
  border: 1px solid #c0d0e0;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 14px;
  cursor: pointer;
  color: #3a5a7a;
  line-height: 1;
}

.video-panel-fullscreen-btn:hover {
  background: #e8f0f8;
}

.video-panel-view {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.video-panel-view img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* iPad override — must come AFTER the base .video-handle rule above */
@media (max-width: 900px) {
  .video-handle {
    width: 40px;
    height: 120px;
  }

  .video-handle-label {
    font-size: 14px;
  }
}