* { margin: 0; padding: 0; box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body, #root { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-family-base);
  font-size: 13px;
  color: var(--ui-text);
  background: #ece6d8;
  -webkit-font-smoothing: antialiased;
}

.app-shell { display: flex; flex-direction: column; height: 100%; }

/* ========== HEADER ========== */
.product-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 45px; min-height: 45px;
  border-bottom: 1px solid var(--ui-border);
  padding: 0 16px; gap: 16px;
  background: var(--ui-background);
  z-index: 90;
}
.product-header__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: #292e39; }
.product-header__title svg { color: var(--ui-interaction-primary); }
.product-header__sub { color: var(--ui-text-tertiary); font-weight: 400; font-size: 13px; margin-left: 4px; }
.product-header__right { display: flex; align-items: center; gap: 8px; }

/* ========== LAYOUT ========== */
.explorer-layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 320px; min-width: 320px;
  border-right: 1px solid var(--ui-border);
  background: var(--ui-background);
  display: flex; flex-direction: column;
  min-height: 0;
}
.main {
  flex: 1; position: relative; min-width: 0;
  background: var(--theme-paper, #ece6d8);
  display: flex; flex-direction: column;
  transition: background 0.4s ease;
}

/* ========== SIDEBAR ========== */
.sidebar__header {
  padding: 12px 16px; border-bottom: 1px solid var(--ui-border);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar__title { font-size: 13px; font-weight: 600; color: var(--ui-text); display: flex; align-items: center; justify-content: space-between; }
.sidebar__title-left { display: inline-flex; align-items: center; gap: 6px; }
.sidebar__body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.sidebar__collapse {
  display: none; /* shown only on mobile */
  flex-shrink: 0;
  width: 30px; height: 30px; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--ui-icon-secondary);
  margin: -6px -6px -6px 0; padding: 0;
  pointer-events: none;
}
.sidebar__collapse svg { width: 18px; height: 18px; transition: transform 0.2s; }
.sidebar__hint { font-size: 11px; color: var(--ui-text-tertiary); font-family: var(--font-family-mono); letter-spacing: -0.01em; }
.count-pill {
  display: inline-flex; align-items: center; gap: 4px;
  height: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--ui-interaction-secondary); color: var(--ui-interaction-primary-contrast);
  font-size: 11px; font-weight: 600; font-family: var(--font-family-mono); letter-spacing: -0.01em;
}

.flight-input {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-bottom: 1px solid var(--ui-border);
  background: var(--ui-background-secondary);
  position: relative;
}

/* Sample-routes dropdown anchored under the FROM input */
.input-dropdown {
  position: absolute; left: 16px; right: 16px; top: calc(100% - 2px);
  z-index: 60;
  background: var(--ui-background);
  border: 1px solid var(--ui-border);
  border-radius: 6px; box-shadow: var(--shadow-2);
  padding: 4px; overflow: hidden;
}
.input-dropdown__item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: none; border-radius: 4px;
  padding: 8px 10px; cursor: pointer;
  font-family: var(--font-family-base); font-size: 12px;
  color: var(--ui-text); text-align: left;
  transition: background 0.1s;
}
.input-dropdown__item:hover { background: var(--ui-interaction-secondary); }
.input-dropdown__item--active { background: var(--ui-interaction-secondary); }
.input-dropdown__item svg { width: 13px; height: 13px; color: var(--ui-interaction-primary); }
.input-dropdown__item--ac {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px;
}
.input-dropdown__item--ac .ac-code {
  font-family: var(--font-family-mono); font-weight: 600; font-size: 12px;
  letter-spacing: 0.03em; color: var(--ui-text); flex-shrink: 0; width: 30px;
}
.input-dropdown__item--ac .ac-meta {
  font-size: 11px; color: var(--ui-text-tertiary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.input-dropdown__item--ac:hover .ac-meta { color: var(--ui-text-secondary); }
.flight-input__field {
  display: flex; align-items: center;
  height: 36px; flex: 1;
  border: 1px solid var(--ui-border); border-radius: 4px;
  padding: 0 8px; gap: 6px;
  background: var(--ui-background);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--font-family-mono); letter-spacing: -0.01em;
}
.flight-input__field:focus-within { border-color: var(--ui-interaction-primary); box-shadow: 0 0 0 3px rgba(0,107,194,0.12); }
.flight-input__code {
  border: none; outline: none; background: transparent;
  font-family: var(--font-family-mono); font-size: 14px; font-weight: 600;
  color: var(--ui-text); width: 56px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.flight-input__code::placeholder { color: var(--ui-text-tertiary); font-weight: 400; letter-spacing: -0.01em; }
.flight-input__sep { color: var(--ui-text-tertiary); font-size: 14px; user-select: none; }
.btn-add {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; width: 36px; border: 1px solid var(--ui-interaction-primary-contrast);
  background: var(--ui-interaction-primary); color: white;
  border-radius: 4px; cursor: pointer; transition: background 0.15s;
}
.btn-add:hover { background: var(--ui-interaction-primary-contrast); }
.btn-add:disabled { background: var(--ui-background-tertiary); border-color: var(--ui-border); color: var(--ui-text-disabled); cursor: not-allowed; }
.btn-add svg { width: 16px; height: 16px; }

.flight-error {
  padding: 6px 16px; background: var(--ui-status-danger-soft);
  color: var(--ui-status-danger-contrast);
  font-size: 11px; border-bottom: 1px solid var(--ui-border);
  display: flex; align-items: center; gap: 6px;
}
.flight-error svg { width: 20px; height: 20px; flex-shrink: 0; }

.batch-toggle {
  padding: 4px 16px 6px;
  background: var(--ui-background-secondary);
  border-bottom: 1px solid var(--ui-border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.batch-toggle__btn {
  background: none; border: none; padding: 0;
  color: var(--ui-text-secondary); font-size: 11px;
  font-family: inherit; cursor: pointer; letter-spacing: -0.01em;
  font-weight: 500;
}
.batch-toggle__btn:hover { color: var(--ui-interaction-primary); }
.batch-toggle__btn--danger:hover { color: var(--ui-status-danger); }

.batch-input {
  padding: 8px 16px 12px;
  background: var(--ui-background-secondary);
  border-bottom: 1px solid var(--ui-border);
  display: flex; flex-direction: column; gap: 6px;
}
.batch-input__area {
  width: 100%; box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: var(--ui-background);
  font-family: var(--font-family-mono); font-size: 11px;
  font-weight: 500; letter-spacing: 0.02em;
  color: var(--ui-text);
  resize: vertical; min-height: 60px;
  outline: none;
}
.batch-input__area:focus { border-color: var(--ui-interaction-primary); box-shadow: 0 0 0 3px rgba(0,107,194,0.12); }
.batch-input__area::placeholder { color: var(--ui-text-tertiary); font-weight: 400; }
.batch-input__actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.batch-input__hint {
  font-size: 10px; color: var(--ui-text-tertiary); flex: 1;
  letter-spacing: -0.01em;
}
.btn--primary {
  background: var(--ui-interaction-primary);
  color: white; border-color: var(--ui-interaction-primary);
}
.btn--primary:hover:not(:disabled) { background: var(--ui-interaction-primary-hover, #0058a3); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }
.batch-input__msg {
  font-size: 11px; color: var(--ui-text-secondary);
  font-family: var(--font-family-mono); letter-spacing: 0;
}

.flight-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.flight-list__empty {
  padding: 32px 24px; text-align: center;
  color: var(--ui-text-tertiary); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.flight-list__empty svg { color: var(--ui-text-disabled); }
.flight-list__empty-actions { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.btn-link {
  background: transparent; border: none; color: var(--ui-interaction-primary);
  font-size: 12px; cursor: pointer; padding: 4px; font-family: inherit;
  text-decoration: none;
}
.btn-link:hover { color: var(--ui-interaction-primary-contrast); text-decoration: underline; }

.flight-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--ui-border);
  cursor: pointer; transition: background 0.1s;
  position: relative;
}
.flight-row:hover { background: var(--ui-interaction-secondary); }
.flight-row--active { background: var(--ui-interaction-secondary-contrast); }
.flight-row__color {
  width: 3px; align-self: stretch; border-radius: 1.5px;
  flex-shrink: 0;
}
.flight-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.flight-row__codes {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-family-mono); font-weight: 600;
  font-size: 13px; color: var(--ui-text); letter-spacing: 0.02em;
}
.flight-row__arrow { color: var(--ui-icon-secondary); display: inline-flex; }
.flight-row__cities { font-size: 11px; color: var(--ui-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flight-row__dist { font-size: 11px; color: var(--ui-text-tertiary); font-family: var(--font-family-mono); letter-spacing: -0.01em; }
.flight-row__remove {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px; cursor: pointer; color: var(--ui-icon-secondary);
  opacity: 0;
  transition: background 0.1s, opacity 0.1s;
}
.flight-row:hover .flight-row__remove { opacity: 1; }
.flight-row__remove:hover { background: var(--ui-status-danger-soft); color: var(--ui-status-danger); }

/* ========== MAIN / GLOBE ========== */
.globe-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--ui-border);
  background: var(--ui-background); height: 45px;
}
.globe-toolbar__spacer { flex: 1; }
.globe-toolbar__legend { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--ui-text-secondary); }
.legend-dot { display: inline-flex; align-items: center; gap: 4px; }
.legend-dot__sw { width: 8px; height: 8px; border-radius: 50%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; padding: 0 10px;
  border: 1px solid var(--ui-border); border-radius: 4px;
  background: var(--ui-background); color: var(--ui-text);
  font-family: var(--font-family-base); font-size: 12px;
  cursor: pointer; transition: box-shadow 0.15s, background 0.15s;
}
.btn:hover { box-shadow: var(--shadow-1); }
.btn:active { box-shadow: inset 0 0.1em 0.3em rgba(36,41,49,0.44); }
.btn--icon { width: 28px; padding: 0; }
.btn--active { background: var(--ui-interaction-secondary); box-shadow: var(--shadow-1); }
.btn svg.btn__chevron { width: 10px; height: 10px; transition: transform 0.15s; }
.btn--active svg.btn__chevron { transform: rotate(180deg); }

/* ========== STYLE MENU (viewer-facing style picker) ========== */
.style-menu { position: relative; }
.style-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  z-index: 200; width: 280px;
  background: var(--ui-background);
  border: 1px solid var(--ui-border);
  border-radius: 8px; box-shadow: var(--shadow-3);
  padding: 14px; display: flex; flex-direction: column; gap: 14px;
}
.style-pop__group { display: flex; flex-direction: column; gap: 7px; }
.style-pop__title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ui-text-tertiary);
}
.style-pop__opts { display: flex; flex-wrap: wrap; gap: 4px; }
.style-pop__opt {
  appearance: none; border: 1px solid var(--ui-border);
  background: var(--ui-background); color: var(--ui-text-secondary);
  border-radius: 6px; padding: 5px 11px; font-size: 12px;
  font-family: var(--font-family-base); cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.style-pop__opt:hover { background: var(--ui-interaction-secondary); color: var(--ui-text); }
.style-pop__opt--active {
  background: var(--ui-interaction-primary); color: #fff;
  border-color: var(--ui-interaction-primary);
}
.style-pop__opt--active:hover { background: var(--ui-interaction-primary); color: #fff; }
.btn svg { width: 14px; height: 14px; color: var(--ui-icon); }

.globe-stage {
  flex: 1; position: relative; overflow: hidden;
  background: var(--theme-paper, #ece6d8);
  cursor: grab;
  transition: background 0.4s ease;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.globe-stage--dragging { cursor: grabbing; }
.globe-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.globe-empty {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  text-align: center; color: var(--ui-text-tertiary);
  font-size: 12px; pointer-events: none;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
}

/* ========== PROJECTION SLIDER ========== */
.proj-slider-wrap {
  --proj-inset: 8px;
  --proj-thumb: 24px;
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(560px, calc(100% - 48px));
  background: var(--ui-background); border: 1px solid var(--ui-border);
  border-radius: 8px; box-shadow: var(--shadow-3);
  padding: 14px 18px 12px;
}
.proj-slider__labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ui-text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.proj-slider__label {
  cursor: pointer; padding: 2px 6px; border-radius: 3px;
  display: flex; align-items: center; gap: 4px;
  transition: color 0.15s, background 0.15s;
}
.proj-slider__label:hover { color: var(--ui-text); background: var(--ui-interaction-secondary); }
.proj-slider__label--active { color: var(--ui-interaction-primary-contrast); }
.proj-slider__label--center { margin-left: 18px; }
.proj-slider {
  position: relative; height: var(--proj-thumb);
}
.proj-slider__track {
  position: absolute; left: var(--proj-inset); right: var(--proj-inset);
  top: calc(var(--proj-thumb) / 2 - 1px); height: 2px;
  background: var(--ui-background-tertiary); border-radius: 1px;
}
.proj-slider__fill {
  position: absolute; left: var(--proj-inset);
  top: calc(var(--proj-thumb) / 2 - 1px); height: 2px;
  background: linear-gradient(to right, var(--ui-interaction-primary), var(--ui-status-in-progress), var(--ui-interaction-callout));
  border-radius: 1px;
}
.proj-slider__tick {
  position: absolute; top: calc(var(--proj-thumb) / 2 - 6px);
  width: 2px; height: 12px;
  background: var(--ui-background-tertiary); border-radius: 1px;
}
.proj-slider__tick--start { left: var(--proj-inset); }
.proj-slider__tick--center { left: 50%; transform: translateX(-50%); }
.proj-slider__tick--end { right: var(--proj-inset); }
.proj-slider__thumb {
  position: absolute; top: 0;
  width: var(--proj-thumb); height: var(--proj-thumb);
  background: white; border: 2px solid var(--ui-interaction-primary);
  border-radius: 50%; cursor: grab;
  box-shadow: var(--shadow-2);
  transition: border-color 0.2s;
}
.proj-slider__thumb::after {
  content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--ui-interaction-primary);
  transition: background 0.2s;
}
.proj-slider__thumb:active { cursor: grabbing; }
.proj-slider__readout {
  position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%);
  margin-bottom: 6px;
  background: #464b59; color: white;
  padding: 2px 6px; border-radius: 3px;
  font-size: 10px; font-family: var(--font-family-mono); letter-spacing: -0.01em;
  white-space: nowrap;
  opacity: 0; transition: opacity 0.15s;
  pointer-events: none;
}
.proj-slider__thumb--dragging .proj-slider__readout { opacity: 1; }

/* ========== ZOOM CONTROLS ========== */
.zoom-controls {
  position: absolute; right: 16px; top: 16px;
  display: flex; flex-direction: column; gap: 1px;
  background: var(--ui-background); border: 1px solid var(--ui-border);
  border-radius: 4px; box-shadow: var(--shadow-1);
}
.zoom-controls__btn:first-child { border-radius: 4px 4px 0 0; }
.zoom-controls__btn:last-child { border-radius: 0 0 4px 4px; }
.zoom-controls__btn {
  width: 32px; height: 32px; border: none; background: var(--ui-background);
  cursor: pointer; color: var(--ui-icon); display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
  border-bottom: 1px solid var(--ui-border);
}
.zoom-controls__btn:last-child { border-bottom: none; }
.zoom-controls__btn:hover { background: var(--ui-interaction-secondary); color: var(--ui-interaction-primary); }
.zoom-controls__btn svg { width: 14px; height: 14px; }
.zoom-controls__btn[data-tip] { position: relative; }
.zoom-controls__btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: #464b59; color: #fff;
  padding: 3px 7px; border-radius: 4px;
  font-size: 11px; line-height: 1.3; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
  z-index: 30;
}
.zoom-controls__btn[data-tip]:hover::after { opacity: 1; }

/* ========== STATS BAR ========== */
.stats-bar {
  position: absolute; left: 16px; top: 16px;
  background: var(--ui-background); border: 1px solid var(--ui-border);
  border-radius: 4px; box-shadow: var(--shadow-1);
  padding: 8px 12px; display: flex; gap: 16px;
  font-size: 11px;
}
.stat__label { color: var(--ui-text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10px; font-weight: 600; }
.stat__val { color: var(--ui-text); font-family: var(--font-family-mono); font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }

/* ========== AIRPORT TOOLTIP / LABEL ========== */
.airport-label {
  font-family: var(--font-family-mono); font-size: 10px;
  font-weight: 600; fill: #2a2620;
  letter-spacing: 0.04em; pointer-events: none;
  paint-order: stroke; stroke: rgba(235,232,223,0.95); stroke-width: 3px; stroke-linejoin: round;
}

.country-tooltip {
  position: absolute; pointer-events: none;
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 4px 20px rgba(40,30,20,0.12), 0 1px 3px rgba(40,30,20,0.08);
  color: #1a1814;
  transform: translate(12px, 12px);
  z-index: 10;
  min-width: 140px;
  letter-spacing: -0.01em;
}
.country-tooltip__name { font-size: 14px; font-weight: 700; color: #1a1814; line-height: 1.2; }
.country-tooltip__stats {
  display: flex; gap: 12px; margin-top: 6px;
  font-size: 11px; color: #6a655a; letter-spacing: 0.01em;
}
.country-tooltip__stats span { white-space: nowrap; }
.country-tooltip__stats b { color: #1a1814; font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--font-family-mono); margin-right: 3px; }
.country-tooltip__empty { font-size: 11px; color: #a8a092; margin-top: 4px; font-style: italic; }

/* Mobile pinned country: fixed top-left, same slot as the routes stats bar */
.country-tooltip--mobile-head {
  transform: none;
  pointer-events: auto;
  left: max(12px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  z-index: 20;
  max-width: calc(100% - 72px);
  min-width: 0;
}

.country-pin {
  position: absolute;
  background: #fafaf7;
  border: 1px solid #d8d2c4;
  border-radius: 14px;
  padding: 14px 36px 14px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.04);
  min-width: 200px;
  max-width: 280px;
  z-index: 10;
}
.country-pin__close {
  position: absolute; top: 8px; right: 10px;
  width: 22px; height: 22px;
  border: none; background: none;
  font-size: 18px; line-height: 1; color: #8a8276;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.country-pin__close:hover { background: #ece8df; color: #1a1814; }
.country-pin__name {
  font-size: 16px; font-weight: 700; color: #1a1814;
  line-height: 1.25; letter-spacing: -0.01em;
  padding-right: 4px;
}
.country-pin__big {
  font-size: 26px; font-weight: 500;
  color: #1a1814; margin-top: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.country-pin__sub {
  font-size: 12px; color: #6a655a;
  margin-top: 4px; letter-spacing: 0.01em;
}
.country-pin__sub--muted { color: #a8a092; font-style: italic; margin-top: 6px; }

.loading-indicator {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: #8a8276; font-size: 12px;
}
.loading-indicator__dot {
  width: 8px; height: 8px; border-radius: 50%; background: #b8af9d;
  animation: pulse-loading 1.4s ease-in-out infinite;
}
@keyframes pulse-loading { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ========== MOBILE / TOUCH LAYOUT ========== */
@media (max-width: 720px) {
  /* Stack: globe on top, flights panel below */
  .explorer-layout { flex-direction: column; overflow: hidden; }
  .main {
    order: -1; flex: none;
    height: 50dvh; min-height: 260px; max-height: 55dvh;
  }
  .sidebar {
    width: 100%; min-width: 0; flex: 1 1 auto; min-height: 0;
    border-right: none; border-top: 1px solid var(--ui-border);
  }

  /* Header tightens up; respect notched phones */
  .product-header {
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    gap: 8px;
    padding-top: env(safe-area-inset-top);
    height: auto; min-height: 45px;
  }
  .product-header__sub { display: none; }
  .product-header__title { font-size: 14px; min-width: 0; }
  .product-header__title svg { flex-shrink: 0; }

  /* Style popover never overflows the viewport */
  .style-pop { width: min(280px, calc(100vw - 24px)); }

  /* Projection slider hugs the bottom of the globe area */
  .proj-slider-wrap {
    --proj-thumb: 28px;
    bottom: max(14px, env(safe-area-inset-bottom));
    padding: 11px 14px 10px;
    width: min(560px, calc(100% - 24px));
  }
  .proj-slider__labels { font-size: 10px; gap: 4px; }

  /* Larger touch targets for zoom controls */
  .zoom-controls {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  .zoom-controls__btn { width: 38px; height: 38px; }
  .zoom-controls__btn svg { width: 16px; height: 16px; }

  /* Stats bar: compact, wraps if needed */
  .stats-bar {
    left: max(12px, env(safe-area-inset-left));
    top: max(12px, env(safe-area-inset-top));
    padding: 6px 10px; gap: 10px;
    flex-wrap: wrap; max-width: calc(100% - 72px);
  }
  .stat__label { font-size: 9px; }
  .stat__val { font-size: 12px; }

  /* Comfortable tap targets on inputs and list rows */
  .flight-input__field { height: 42px; }
  .btn-add { height: 42px; width: 42px; }
  .flight-input__code { font-size: 16px; } /* 16px avoids iOS zoom-on-focus */
  .flight-row { padding: 10px 16px; min-height: 52px; }
  .flight-row__remove { opacity: 1; width: 32px; height: 32px; }

  /* Collapsible flights panel — whole header is the tap target */
  .sidebar__collapse { display: inline-flex; }
  .sidebar__header {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  .sidebar__header:active { background: var(--ui-interaction-secondary); }
  .explorer-layout--collapsed .main {
    height: auto; flex: 1 1 auto; max-height: none;
  }
  .explorer-layout--collapsed .sidebar { flex: 0 0 auto; }
  .explorer-layout--collapsed .sidebar__body { display: none; }
  .explorer-layout--collapsed .sidebar__hint { display: none; }
  .explorer-layout--collapsed .sidebar__collapse svg { transform: rotate(180deg); }

  /* Dev tweaks panel overlaps the flights UI on phones */
  .twk-panel { display: none !important; }
}

/* On touch devices, hover-only affordances shouldn't stick */
@media (hover: none) {
  .zoom-controls__btn[data-tip]:hover::after { opacity: 0; }
  .flight-row__remove { opacity: 1; }
}
