/* ==========================================================================
   Design system — Fly or Drive
   After editing: run ./scripts/check-css.sh
   ========================================================================== */

:root {
  /* Neutral scale — clean Kayak-like canvas */
  --color-bg: #ffffff;
  --color-bg-canvas: #f5f5f5;
  --color-bg-secondary: #f0f0f0;
  --color-bg-tertiary: #e6e6e6;
  --color-bg-hover: rgba(0, 0, 0, 0.04);
  --color-bg-selected: rgba(255, 119, 1, 0.1);

  /* Text */
  --color-text: rgba(0, 0, 0, 0.9);
  --color-text-secondary: rgba(0, 0, 0, 0.55);
  --color-text-tertiary: rgba(0, 0, 0, 0.35);
  --color-text-inverse: #ffffff;

  /* Borders */
  --color-border: rgba(0, 0, 0, 0.1);
  --color-border-strong: rgba(0, 0, 0, 0.18);

  /* Brand accent (logo / Kayak-style orange) — scarce CTAs & focus only.
     Chrome, segments, and most buttons stay monochrome via neutrals. */
  --color-accent: #ff7701;
  --color-accent-hover: #e86b00;
  --color-accent-muted: rgba(255, 119, 1, 0.12);
  --color-brand: #111111;
  --color-brand-hover: #2b2b2b;
  --color-focus: var(--color-accent);
  --color-focus-ring: rgba(255, 119, 1, 0.35);

  /* Semantic mode colors (comparison / map — not chrome) */
  --color-drive: #14ae5c;
  --color-drive-bg: #e8f5ee;
  --color-fly: #1a73e8;
  --color-fly-bg: #e8f1fc;
  --color-tooltip-bg: rgba(255, 244, 232, 0.92);
  --color-tooltip-border: rgba(255, 119, 1, 0.28);
  --color-danger: #f24822;
  --color-danger-bg: #fff0ed;
  --color-warning-bg: #f5f5f5;

  /* Spacing — 8pt grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-display: "Outfit", var(--font-family);
  --font-family-highway: "Oswald", "Arial Narrow", sans-serif;
  --font-family-flap: "Share Tech Mono", ui-monospace, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 20px;
  --font-size-2xl: 32px;
  --font-size-3xl: clamp(36px, 6vw, 48px);
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.02em;
  --letter-spacing-wide: 0.04em;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-segment: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --field-height: 47px;
  --field-compact-height: 38px;

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  /* Pin collapse: edit fields fade before display:none — keep in sync with FORM_PIN_FADE_MS */
  --duration-pin: 280ms;
  /* Large map open: expand + fade; keep in sync with ROUTE_MAP_LAYOUT_SETTLE_MS in app.js */
  --duration-map: 750ms;
  /* Settings tier panel expand/collapse */
  --duration-tier: 420ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-map: cubic-bezier(0.22, 1, 0.36, 1);

  /* Liquid glass */
  --lg-blur: 18px;
  --lg-saturate: 1.55;
  --lg-bg: color-mix(in srgb, var(--color-bg) 68%, transparent);
  --lg-bg-strong: color-mix(in srgb, var(--color-bg) 88%, transparent);
  --lg-stroke: color-mix(in srgb, var(--color-text) 12%, transparent);
  --lg-highlight: rgba(255, 255, 255, 0.62);
  --lg-inset: rgba(255, 255, 255, 0.42);
  --lg-shade: rgba(0, 0, 0, 0.07);
  --lg-glow: 0 8px 28px rgba(0, 0, 0, 0.1);

  color-scheme: light;
}

[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-bg-canvas: #111111;
  --color-bg-secondary: #242424;
  --color-bg-tertiary: #333333;
  --color-bg-hover: rgba(255, 255, 255, 0.06);
  --color-bg-selected: rgba(255, 119, 1, 0.22);

  --color-text: rgba(255, 255, 255, 0.92);
  --color-text-secondary: rgba(255, 255, 255, 0.58);
  --color-text-tertiary: rgba(255, 255, 255, 0.38);
  --color-text-inverse: #111111;

  --color-border: rgba(255, 255, 255, 0.12);
  --color-border-strong: rgba(255, 255, 255, 0.22);

  --color-accent: #ff8a2b;
  --color-accent-hover: #ff9a45;
  --color-accent-muted: rgba(255, 138, 43, 0.18);
  --color-brand: #ffffff;
  --color-brand-hover: #e8e8e8;
  --color-focus: var(--color-accent);
  --color-focus-ring: rgba(255, 138, 43, 0.4);

  --color-drive: #3dd68c;
  --color-drive-bg: rgba(20, 174, 92, 0.2);
  --color-fly: #5b9cf5;
  --color-fly-bg: rgba(26, 115, 232, 0.22);
  --color-tooltip-bg: rgba(255, 119, 1, 0.16);
  --color-tooltip-border: rgba(255, 138, 43, 0.4);
  --color-danger: #ff6b4a;
  --color-danger-bg: rgba(242, 72, 34, 0.2);
  --color-warning-bg: #242424;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-segment: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);

  /* Liquid glass */
  --lg-bg: color-mix(in srgb, var(--color-bg) 58%, transparent);
  --lg-bg-strong: color-mix(in srgb, var(--color-bg) 86%, transparent);
  --lg-stroke: color-mix(in srgb, var(--color-text) 16%, transparent);
  --lg-highlight: rgba(255, 255, 255, 0.22);
  --lg-inset: rgba(255, 255, 255, 0.14);
  --lg-shade: rgba(0, 0, 0, 0.38);
  --lg-glow: 0 10px 32px rgba(0, 0, 0, 0.42);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Liquid glass (approx. kube.io liquid-glass CSS/SVG)
   -------------------------------------------------------------------------- */

.liquid-glass-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.liquid-glass {
  position: relative;
  color: var(--color-text);
  background: var(--lg-bg);
  border: 1px solid var(--lg-stroke);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--lg-glow);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
}

/* Specular rim — edge highlight only (keeps text readable) */
.liquid-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background: linear-gradient(
    145deg,
    var(--lg-highlight) 0%,
    transparent 42%,
    transparent 58%,
    color-mix(in srgb, var(--lg-highlight) 32%, transparent) 100%
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.9;
}

@supports (backdrop-filter: url(#liquid-glass)) {
  .liquid-glass {
    backdrop-filter: url(#liquid-glass);
    -webkit-backdrop-filter: url(#liquid-glass);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .liquid-glass,
  body.form-pinned .form-pin-bar.liquid-glass {
    background: var(--lg-bg-strong);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow:
      inset 0 1px 0 var(--lg-inset),
      var(--shadow-md);
  }

  .liquid-glass::after {
    opacity: 0.4;
  }
}

html {
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-family);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg-canvas);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-10) var(--space-4) var(--space-12);
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
  padding-bottom: max(var(--space-12), env(safe-area-inset-bottom, 0px));
  min-width: 0;
  overflow-x: clip;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

.header {
  width: 100%;
  text-align: center;
  margin-bottom: var(--space-10);
  transition: margin-bottom var(--duration-map) var(--ease-map);
}

.header__bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  margin-bottom: var(--space-2);
  transition: margin-bottom var(--duration-map) var(--ease-map);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    color var(--duration-fast),
    background var(--duration-fast),
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.theme-toggle:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-bg-hover);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.theme-toggle .theme-toggle__icon {
  margin: 0;
  font-size: 1.25rem;
  color: inherit;
}

.header__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  margin-top: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  border-radius: var(--radius-md);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition:
    gap var(--duration-map) var(--ease-map),
    margin-top var(--duration-map) var(--ease-map),
    height var(--duration-map) var(--ease-map),
    min-height var(--duration-map) var(--ease-map),
    padding var(--duration-map) var(--ease-map),
    background-color var(--duration-map) var(--ease-map),
    box-shadow var(--duration-map) var(--ease-map),
    border-radius var(--duration-map) var(--ease-map),
    max-width var(--duration-map) var(--ease-map);
}

.header__mascot {
  display: block;
  /* Wide pill mark — size by width */
  width: clamp(9.5rem, 32vw, 15rem);
  height: auto;
  margin: 0;
  pointer-events: none;
  user-select: none;
  transform-origin: center center;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.12));
  animation: headerMascotFloat 4.8s ease-in-out infinite;
  transition:
    width var(--duration-map) var(--ease-map),
    height var(--duration-map) var(--ease-map),
    filter var(--duration-map) var(--ease-map),
    transform-origin var(--duration-map) var(--ease-map);
}

[data-theme="dark"] .header__mascot {
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

@keyframes headerMascotFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.header__title {
  font-family: var(--font-family-display);
  font-size: clamp(2.75rem, 8vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 var(--space-3);
  color: var(--color-text);
  transform-origin: left center;
  transition:
    font-size var(--duration-map) var(--ease-map),
    margin var(--duration-map) var(--ease-map),
    line-height var(--duration-map) var(--ease-map);
}

.header__subtitle {
  margin: 0 auto;
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  white-space: nowrap;
  max-height: 3rem;
  opacity: 1;
  overflow: hidden;
  transition:
    opacity var(--duration-map) var(--ease-map),
    max-height var(--duration-map) var(--ease-map),
    margin var(--duration-map) var(--ease-map);
}

/* Compact brand lockup when route map is visible */
.header--compact {
  text-align: left;
  margin-bottom: var(--space-4);
}

.header--compact .header__bar {
  margin-bottom: 0;
}

.header--compact .header__brand {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-3);
  /* Pull up beside the 40px theme toggle (bar margin is 0 in compact) */
  margin-top: -40px;
  padding-right: calc(40px + var(--space-3));
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
}

.header--compact .header__mascot {
  width: auto;
  height: 1.65rem;
  transform-origin: left center;
  animation: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

[data-theme="dark"] .header--compact .header__mascot {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.header--compact .header__title {
  font-size: clamp(1.35rem, 4vw, 1.65rem);
  margin: 0;
  line-height: 1.1;
}

.header--compact .header__subtitle {
  opacity: 0;
  max-height: 0;
  margin: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Route map hero stage (map fills upper page; form overlays bottom)
   -------------------------------------------------------------------------- */

/* Clip 100vw breakout scrollbar overflow at the viewport, not .page
   (clipping on .page would gut the edge-to-edge map). */
body.has-route-map {
  overflow-x: clip;
  /* Viewport-edge inset for map-mode chrome (brand, theme, zoom, legend) */
  --pad: var(--space-4); /* 16px */
  --pad-top: max(var(--pad), env(safe-area-inset-top, 0px));
  --pad-left: max(var(--pad), env(safe-area-inset-left, 0px));
  --pad-right: max(var(--pad), env(safe-area-inset-right, 0px));
  /* Shared control height — logo pill + theme toggle share top & optical center */
  --map-chrome-size: 40px;
}

body.has-route-map .page {
  position: relative;
  padding-top: 0;
  /* Allow 100vw map breakout; body/html still clip scrollbar overflow */
  overflow-x: visible;
}

/* Fixed to the viewport — not constrained to .page / form-card max-width */
body.has-route-map .header.header--compact {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  z-index: 40;
  margin: 0;
  padding: var(--pad-top) var(--pad-right) 0 var(--pad-left);
  pointer-events: none;
  box-sizing: border-box;
}

/* Instantly clear bar gap so brand + toggle share the same top */
body.has-route-map .header--compact .header__bar {
  margin-bottom: 0;
  transition: none;
}

body.has-route-map .header--compact .theme-toggle {
  pointer-events: auto;
  width: var(--map-chrome-size);
  height: var(--map-chrome-size);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
}

body.has-route-map .header--compact .header-share.is-copied {
  width: auto;
  min-width: var(--map-chrome-size);
}

body.has-route-map .header--compact .header__brand {
  /* Same top as header actions: header pad + flush with the chrome bar row */
  margin-top: calc(-1 * var(--map-chrome-size));
  width: fit-content;
  max-width: calc(100% - (2 * var(--map-chrome-size)) - var(--space-2) - var(--space-4));
  height: var(--map-chrome-size);
  min-height: var(--map-chrome-size);
  /* Horizontal padding only — vertical size matches toggle for shared center */
  padding: 0 var(--space-3) 0 var(--space-1);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

body.has-route-map .header--compact .header__title {
  text-shadow:
    0 1px 0 color-mix(in srgb, var(--color-bg) 70%, transparent),
    0 0 12px color-mix(in srgb, var(--color-bg) 55%, transparent);
}

body.has-route-map .trip-planner {
  --route-map-stage-height: clamp(340px, 62vh, 720px);
  /* Fallback until JS sets exact half of .form-card height */
  --route-form-overlap: 6.5rem;
  position: relative;
  /* Do NOT isolate/z-index the whole planner: that traps the pinned
     form (z-index 60) under .results, so comparison maps paint over
     the STOP / Drive-Fly nav. Leaflet is trapped on .route-preview. */
  min-height: var(--route-map-stage-height);
  margin-top: 0;
  margin-bottom: var(--space-6);
  transition:
    min-height var(--duration-map) var(--ease-map),
    margin var(--duration-map) var(--ease-map);
}

body.has-route-map .route-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  max-width: none;
  height: var(--route-map-stage-height);
  /* Break out of centered .page max-width to true viewport edges */
  margin-left: calc(50% - 50vw);
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--color-border);
  box-shadow: none;
  /* Below .trip-form (20); isolate traps Leaflet panes here only */
  z-index: 0;
  isolation: isolate;
  overflow: hidden;
  pointer-events: none;
  transform-origin: top center;
  animation: routePreviewIn var(--duration-map) var(--ease-map) both;
}

body.has-route-map .route-preview__map,
body.has-route-map .route-preview .leaflet-control {
  pointer-events: auto;
}

body.has-route-map .route-preview__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}

body.has-route-map .route-preview__legend {
  top: calc(var(--pad-top) + var(--map-chrome-size) + var(--space-3));
  bottom: auto;
  left: var(--pad-left);
}

/* Zoom (+/−) under theme toggle — same viewport right-edge padding */
body.has-route-map .route-preview .leaflet-top.leaflet-right {
  top: calc(var(--pad-top) + var(--map-chrome-size) + var(--space-2));
  right: var(--pad-right);
}

body.has-route-map .route-preview .leaflet-top.leaflet-right .leaflet-control {
  margin-top: 0;
  margin-right: 0;
}

body.has-route-map .route-preview .leaflet-bottom.leaflet-right {
  bottom: calc(var(--route-form-overlap) + var(--space-2));
  right: var(--pad-right);
}

body.has-route-map .route-preview .leaflet-bottom.leaflet-right .leaflet-control {
  margin-right: 0;
}

body.has-route-map .route-preview .leaflet-bar {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.has-route-map .route-preview .leaflet-bar a {
  width: 40px;
  height: 40px;
  line-height: 40px;
  background: transparent;
  color: var(--color-text-secondary);
  border-bottom-color: var(--color-border);
}

body.has-route-map .route-preview .leaflet-bar a:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

body.has-route-map .route-preview .leaflet-bar a:first-child {
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

body.has-route-map .route-preview .leaflet-bar a:last-child {
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  border-bottom: none;
}

body.has-route-map .trip-form {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  /* Map band minus half-card overlap so map bottom hits card midpoint */
  padding-top: calc(var(--route-map-stage-height) - var(--route-form-overlap));
  margin-bottom: 0;
  pointer-events: none;
  transition: padding-top var(--duration-map) var(--ease-map);
}

body.has-route-map .trip-form > * {
  pointer-events: auto;
}

body.has-route-map #route-form-card {
  margin-bottom: 0;
}

body.has-route-map #route-form-card.liquid-glass {
  border-color: var(--color-border-strong);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--shadow-md),
    0 10px 28px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] body.has-route-map #route-form-card.liquid-glass {
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--shadow-md),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

body.has-route-map .trip-form > .travel-details {
  position: relative;
  z-index: 1;
}

/* Above residual route-preview overflow (z-index 0). The pinned form still
   wins because .trip-form is z-index 20 and is NOT trapped in an isolated
   .trip-planner stacking context. */
body.has-route-map .results {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Segmented control (trip type & travelers)
   -------------------------------------------------------------------------- */

.trip-planner {
  margin-bottom: var(--space-6);
  overflow: visible;
  min-height: 0;
  transition: min-height var(--duration-map) var(--ease-map);
}

.route-preview {
  position: relative;
  margin-bottom: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-sm);
}

.route-preview__map {
  height: clamp(220px, 38vh, 420px);
  width: 100%;
}

/* Hero map: #route-preview-map IS the .leaflet-container (not a child). */
.route-preview__map.leaflet-container,
.route-preview__map .leaflet-container {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  background: var(--color-bg-secondary);
}

/* Darken preview tiles on the map node (full-bleed stage is already clipped).
   Comparison maps use an overlay instead — filter on .leaflet-container
   promotes a layer that can escape overflow/clip-path. */
[data-theme="dark"] .route-preview__map.leaflet-container,
[data-theme="dark"] .route-preview__map .leaflet-container {
  filter: brightness(0.82) contrast(1.05) saturate(0.9);
}

.route-preview__legend {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  pointer-events: none;
}

.route-preview__legend-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.route-preview__swatch {
  display: block;
  width: 1.25rem;
  height: 3px;
  border-radius: 999px;
  background: var(--color-drive);
}

.route-preview__legend-item--fly .route-preview__swatch {
  background: repeating-linear-gradient(
    90deg,
    var(--color-fly) 0 6px,
    transparent 6px 10px
  );
  background-color: transparent;
  height: 3px;
}

@keyframes routePreviewIn {
  from {
    opacity: 0;
    transform: translateY(-16px);
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    clip-path: inset(0 0 0 0);
  }
}

.trip-type-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: var(--field-height);
}

.trip-type-select select {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: max-content;
  min-width: 8.75rem;
  height: 100%;
  padding: 0 calc(var(--space-5) + var(--space-2)) 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font: inherit;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
  color: var(--color-text);
  cursor: pointer;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.trip-type-select select:hover {
  border-color: var(--color-border-strong);
}

.trip-type-select select:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.trip-type-select__chevron {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--color-text-secondary);
}

.trip-type {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  min-height: 36px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 0;
  box-shadow: none;
}

.trip-type__option {
  position: relative;
  cursor: pointer;
}

.trip-type__option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.trip-type__option span {
  display: block;
  padding: 6px var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.25;
  color: var(--color-text-secondary);
  border-radius: 6px;
  transition:
    background var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default);
  user-select: none;
  white-space: nowrap;
}

.trip-type__option input:checked + span {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-segment);
}

.trip-type__option input:focus-visible + span {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.trip-type__option:hover span {
  color: var(--color-text);
}

.trip-type__option input:checked:hover + span {
  color: var(--color-text);
}

/* Traveler picker */

.traveler-group {
  position: relative;
}

.traveler-group__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.field__glyph {
  display: inline-block;
  font-family: "Material Symbols Outlined", sans-serif;
  font-weight: 400;
  font-style: normal;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-text-tertiary);
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overflow: hidden;
}

.traveler-group .traveler-picker__toggle.trip-type {
  display: flex;
  width: 100%;
  height: var(--field-compact-height);
  min-height: var(--field-compact-height);
  max-height: var(--field-compact-height);
  padding: 3px;
  gap: 2px;
  box-sizing: border-box;
  align-items: center;
  overflow: hidden;
}

.traveler-group .traveler-picker__toggle .trip-type__option {
  flex: 1 1 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  min-width: 0;
  /* Explicit height: track 38px − 3px pad×2 − 1px border×2 */
  height: calc(var(--field-compact-height) - 8px);
  margin: 0;
  padding: 0;
}

.traveler-group .traveler-picker__toggle .trip-type__option span {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  min-width: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 3px);
  box-sizing: border-box;
  background: transparent;
  box-shadow: none;
}

.traveler-group .traveler-picker__toggle .trip-type__option input:checked + span {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: none;
  border-color: var(--color-border-strong);
  outline: none;
}

.traveler-picker__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--field-compact-height);
}

.traveler-picker__toggle .trip-type__option span {
  min-width: 2rem;
  text-align: center;
}

.traveler-picker__input {
  height: var(--field-compact-height);
  width: 3.5rem;
  padding: 0 var(--space-2);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  -moz-appearance: textfield;
  appearance: textfield;
}

.traveler-picker__input::-webkit-outer-spin-button,
.traveler-picker__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.traveler-picker__input:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Mascot assistant (Clippy-style travel buddy) */

.mascot-assistant {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--space-2));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  z-index: 30;
  pointer-events: none;
  animation: mascotPop 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.mascot-assistant__bubble {
  position: relative;
  max-width: 240px;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-dropdown);
}

.mascot-assistant__text {
  margin: 0;
  font-size: var(--font-size-sm);
  font-style: italic;
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.mascot-assistant__bubble::after {
  content: "";
  position: absolute;
  bottom: -5px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: var(--color-bg);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  transform: rotate(45deg);
}

.mascot-assistant__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  font-size: 1.75rem;
  line-height: 1;
  background: linear-gradient(145deg, var(--color-fly-bg) 0%, var(--color-bg) 100%);
  border: 1px solid var(--color-tooltip-border);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  transition: transform var(--duration-fast) var(--ease-default);
}

.mascot-assistant__icon--wiggle {
  animation: mascotWiggle 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes mascotWiggle {
  0% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.15) rotate(-8deg); }
  50% { transform: scale(1.1) rotate(8deg); }
  75% { transform: scale(1.12) rotate(-4deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes mascotPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.85);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.mascot-assistant--error {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-6);
  z-index: 50;
}

.mascot-assistant--error .mascot-assistant__icon {
  background: linear-gradient(145deg, var(--color-danger-bg) 0%, var(--color-bg) 100%);
  border-color: rgba(242, 72, 34, 0.25);
}

.mascot-assistant--error .mascot-assistant__text {
  color: var(--color-text);
}

.mascot-assistant--leaving {
  animation: mascotFadeOut 0.5s ease forwards;
  pointer-events: none;
}

@keyframes mascotFadeOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.9);
  }
}

/* --------------------------------------------------------------------------
   Form card
   -------------------------------------------------------------------------- */

.trip-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: 0;
}

.form-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.form-card.liquid-glass {
  background: var(--lg-bg);
  border-color: var(--lg-stroke);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--lg-glow);
}

.form-card-pin-anchor {
  position: relative;
  height: 0;
  width: 100%;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.form-card-spacer {
  display: none;
  width: 100%;
  height: 0;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Sticky route summary bar (fixed overlay; form card stays in flow)
   -------------------------------------------------------------------------- */

.form-pin-bar {
  display: none;
  box-sizing: border-box;
}

body.form-pinned .form-pin-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  z-index: 60;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--color-border-strong);
  padding: var(--space-3) var(--space-4);
  padding-top: max(var(--space-3), env(safe-area-inset-top, 0px));
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
  padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--color-bg) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    var(--shadow-md),
    0 10px 28px rgba(0, 0, 0, 0.12);
  animation: formSummaryIn var(--duration-pin) var(--ease-default) both;
}

body.form-pinned .form-pin-bar.liquid-glass {
  background: var(--lg-bg);
  border-bottom-color: var(--color-border-strong);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    var(--shadow-md),
    0 10px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate));
}

@supports (backdrop-filter: url(#liquid-glass)) {
  body.form-pinned .form-pin-bar.liquid-glass {
    backdrop-filter: url(#liquid-glass);
    -webkit-backdrop-filter: url(#liquid-glass);
  }
}

[data-theme="dark"] body.form-pinned .form-pin-bar {
  background: color-mix(in srgb, var(--color-bg) 90%, transparent);
  box-shadow:
    var(--shadow-md),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] body.form-pinned .form-pin-bar.liquid-glass {
  background: var(--lg-bg);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    var(--shadow-md),
    0 12px 32px rgba(0, 0, 0, 0.45);
}

.form-pin-bar__logo {
  display: block;
  width: auto;
  height: 1.5rem;
  margin: 0;
  justify-self: start;
  align-self: center;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

[data-theme="dark"] .form-pin-bar__logo {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.form-pin-bar__summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  min-height: 44px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.form-pin-bar__summary:hover {
  background: var(--color-bg-hover);
}

.form-pin-bar__summary:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.form-pin-bar__summary-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--color-text-secondary);
}

.form-pin-bar__summary-chevron {
  flex-shrink: 0;
  font-size: 1.125rem;
  color: var(--color-text-tertiary);
}

.form-pin-bar__summary-route {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-pin-bar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  align-self: center;
  gap: var(--space-2);
  min-height: 44px;
}

body.form-pinned .form-pin-bar .theme-toggle {
  width: 44px;
  height: 44px;
}

body.form-pinned .form-pin-bar .header-share.is-copied {
  width: auto;
  min-width: 44px;
}

.header-share {
  position: relative;
  gap: 0;
  overflow: hidden;
  white-space: nowrap;
  transition:
    color var(--duration-fast),
    background var(--duration-fast),
    border-color var(--duration-fast),
    box-shadow var(--duration-fast),
    width var(--duration-normal) var(--ease-default),
    padding var(--duration-normal) var(--ease-default),
    gap var(--duration-normal) var(--ease-default);
}

.header-share__label {
  display: inline-block;
  max-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  transition:
    max-width var(--duration-normal) var(--ease-default),
    opacity var(--duration-fast) var(--ease-default),
    padding var(--duration-normal) var(--ease-default);
}

.header-share.is-copied {
  width: auto;
  min-width: 40px;
  padding-left: var(--space-3);
  padding-right: var(--space-2);
  gap: var(--space-2);
  border-color: var(--color-drive, #0b6b3a);
  color: var(--color-drive, #0b6b3a);
}

.header-share.is-copied .header-share__label {
  max-width: 4.5rem;
  opacity: 1;
  padding-left: 0;
}

body.has-route-map .header--compact .header-share.is-copied,
body.form-pinned .form-pin-bar .header-share.is-copied {
  width: auto;
}

@keyframes formSummaryIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

#route-form-card {
  margin-bottom: var(--space-6);
  /* Tighter bottom than .form-card’s uniform --space-6 */
  padding-bottom: var(--space-4);
  position: relative;
  z-index: 5;
  transition:
    background var(--duration-normal) var(--ease-default),
    border-radius var(--duration-normal) var(--ease-default),
    border-color var(--duration-normal) var(--ease-default),
    box-shadow var(--duration-normal) var(--ease-default),
    padding var(--duration-normal) var(--ease-default);
}

/* --------------------------------------------------------------------------
   Pinned destination bar (scroll)
   -------------------------------------------------------------------------- */

body.form-pinned {
  overflow-x: clip;
}

/* Hide floating map-mode brand/toggle while the pinned bar owns them */
body.form-pinned.has-route-map .header.header--compact {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.form-pinned:not(.has-route-map) .header__bar {
  /* Toggle relocated into the bar; keep header layout stable */
  min-height: 40px;
}

.trip-form__route {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.trip-form__locations {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-3);
  align-items: center;
  flex: 1;
  min-width: 0;
}

/* Fields */

.field label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.field__info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--color-text-tertiary);
  cursor: help;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: normal;
}

.field__info:hover,
.field__info:focus-visible {
  color: var(--color-text-secondary);
}

.field__info:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.field__info svg {
  display: block;
}

.field__info::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  line-height: 1.45;
  text-align: left;
  color: var(--color-text);
  background: var(--color-tooltip-bg);
  border: 1px solid var(--color-tooltip-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-fast) var(--ease-default),
    visibility var(--duration-fast) var(--ease-default);
  z-index: 30;
  pointer-events: none;
}

.field__info:hover::after,
.field__info:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.field--autocomplete .autocomplete input {
  padding-left: calc(var(--space-4) + 1.25rem);
  padding-right: calc(var(--space-4) + 1.75rem);
}

.autocomplete__pin {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  pointer-events: none;
  z-index: 1;
}

.field__location-btn {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  z-index: 2;
  transition:
    color var(--duration-fast),
    background var(--duration-fast);
}

.field__location-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

.field__location-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.field__location-btn--loading svg {
  animation: spin 0.7s linear infinite;
}

.field input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.field input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field--autocomplete input {
  height: var(--field-height);
}

.field input::placeholder {
  color: var(--color-text-tertiary);
}

.field input:hover {
  border-color: var(--color-border-strong);
}

.field input:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.field--currency .field__input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.field--currency .field__input-wrap:hover {
  border-color: var(--color-border-strong);
}

.field--currency:focus-within .field__input-wrap {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.field--currency .field__prefix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-left: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-regular);
  pointer-events: none;
}

.field--currency .field__suffix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: var(--space-3);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  pointer-events: none;
  white-space: nowrap;
}

.field--unit .field__input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.field--unit .field__input-wrap:hover {
  border-color: var(--color-border-strong);
}

.field--unit:focus-within .field__input-wrap {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.field--unit .field__suffix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: var(--space-3);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  pointer-events: none;
  white-space: nowrap;
}

.field--baggage .field__baggage-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) auto minmax(0, 1fr);
  gap: var(--space-1);
  align-items: center;
}

.field--baggage .field__baggage-times {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  user-select: none;
}

.field--baggage .field__input-wrap {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
  transition:
    border-color var(--duration-fast),
    box-shadow var(--duration-fast);
}

.field--baggage .field__input-wrap:hover {
  border-color: var(--color-border-strong);
}

.field--baggage:focus-within .field__input-wrap:focus-within {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.field--baggage .field__prefix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-left: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  pointer-events: none;
}

.field--baggage .field__suffix {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: 0.65rem;
  font-weight: var(--font-weight-regular);
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
}

.field--baggage input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: var(--space-2);
  padding-right: var(--space-1);
  -moz-appearance: textfield;
  appearance: textfield;
}

.field--baggage input::-webkit-outer-spin-button,
.field--baggage input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field--baggage input:hover,
.field--baggage input:focus {
  border: 0;
  box-shadow: none;
  outline: none;
}

.field--compact.field--baggage .field__input-wrap {
  min-height: 40px;
  height: 40px;
}

.field--compact.field--baggage input {
  min-height: 40px;
  height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

.field--unit input {
  border: none;
  box-shadow: none;
  flex: 1;
  min-width: 0;
}

.field--unit input:hover,
.field--unit input:focus {
  border: none;
  box-shadow: none;
}

.field--currency input {
  border: none;
  box-shadow: none;
  background: transparent;
  padding-left: var(--space-1);
  flex: 1;
  min-width: 0;
}

.field--currency input:hover,
.field--currency input:focus {
  border: none;
  box-shadow: none;
}

.field--autocomplete {
  position: relative;
}

.field--autocomplete:focus-within {
  z-index: 20;
}

/* Autocomplete dropdown */

.autocomplete {
  position: relative;
}

.autocomplete__list {
  position: absolute;
  z-index: 100;
  top: calc(100% + var(--space-1));
  left: 0;
  right: 0;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  max-height: 260px;
  overflow-y: auto;
}

.autocomplete__item {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--font-size-md);
  text-align: left;
  color: var(--color-text);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.autocomplete__item:hover,
.autocomplete__item--active {
  background: var(--color-bg-selected);
}

.autocomplete__item-primary {
  display: block;
  font-weight: var(--font-weight-medium);
}

.autocomplete__item-secondary {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.autocomplete__status {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Travel settings */

.travel-details {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: var(--space-2);
}

.travel-settings {
  position: relative;
  overflow: visible;
  text-align: center;
}

.travel-settings__heading {
  margin: 0 0 var(--space-4);
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.settings-tier-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 var(--space-5);
  padding: 0;
}

.trip-type.settings-tier {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  /* 3×120px tabs + inset padding on each side (border-box). */
  width: min(calc(360px + 2 * var(--space-2)), 100%);
  max-width: calc(360px + 2 * var(--space-2));
  box-sizing: border-box;
  flex-shrink: 1;
  gap: 0;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  /* Keep liquid-glass fill (overrides plain .trip-type background). */
  background: var(--lg-bg);
  margin: 0 auto;
  pointer-events: auto;
}

.settings-tier .trip-type__option {
  flex: 1 1 120px;
  width: 120px;
  min-width: 0;
  max-width: 120px;
}

.settings-tier .trip-type__option span {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  text-align: center;
}

.settings-tier .trip-type__option input:checked + span {
  background: var(--lg-bg-strong);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 1px 4px color-mix(in srgb, var(--color-text) 14%, transparent);
}

.travel-settings__content {
  margin-top: 0;
  width: 100%;
  text-align: left;
}

.travel-settings__content[hidden] {
  display: none;
}

.custom-costs {
  text-align: left;
}

.custom-costs__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.custom-costs__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.custom-costs__list:empty {
  display: none;
}

.custom-cost {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(5.5rem, 0.7fr) auto auto;
  gap: var(--space-2);
  align-items: end;
}

.custom-cost__field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  text-align: left;
}

.custom-cost__field label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.custom-cost__field--label input[type="text"] {
  width: 100%;
  min-height: var(--field-compact-height, 40px);
  height: var(--field-compact-height, 40px);
  margin: 0;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-md);
  line-height: 1;
  box-sizing: border-box;
}

.custom-cost__field--label input[type="text"]:hover {
  border-color: var(--color-border-strong);
}

.custom-cost__field--label input[type="text"]:focus {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

/* Reuse .field--currency chrome; keep compact row alignment */
.custom-cost__field--amount.field {
  margin: 0;
}

.custom-cost__field--amount.field label {
  display: block;
  margin-bottom: 0;
}

.custom-cost__applies {
  display: inline-flex;
  align-items: stretch;
  padding: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
}

.custom-cost__applies-option {
  position: relative;
  cursor: pointer;
}

.custom-cost__applies-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.custom-cost__applies-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 var(--space-2);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  border-radius: 6px;
  user-select: none;
  white-space: nowrap;
}

.custom-cost__applies-option input:checked + span {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-segment);
}

.custom-cost__applies-option input:focus-visible + span {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.custom-cost__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition:
    color var(--duration-fast),
    border-color var(--duration-fast),
    background var(--duration-fast);
}

.custom-cost__remove:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-bg-hover);
}

.custom-cost__remove .field__glyph {
  font-size: 1.1rem;
}

.custom-costs__add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition:
    color var(--duration-fast),
    border-color var(--duration-fast),
    background var(--duration-fast);
}

.custom-costs__add:hover {
  color: var(--color-text);
  border-color: var(--color-text-tertiary);
  background: var(--color-bg-hover);
}

.custom-costs__add-icon {
  font-size: 1.15rem;
  line-height: 1;
  font-weight: var(--font-weight-bold);
}

@media (max-width: 700px) {
  .custom-cost {
    grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 7rem) auto;
    grid-template-areas:
      "label label remove"
      "amount applies applies";
  }

  .custom-cost__field--label {
    grid-area: label;
  }

  .custom-cost__field--amount {
    grid-area: amount;
  }

  .custom-cost__applies {
    grid-area: applies;
    justify-self: stretch;
  }

  .custom-cost__applies-option {
    flex: 1;
  }

  .custom-cost__applies-option span {
    width: 100%;
  }

  .custom-cost__remove {
    grid-area: remove;
    justify-self: end;
  }
}

.travel-preference {
  margin-top: 0;
  margin-bottom: var(--space-5);
  padding-top: 0;
  width: 100%;
}

.travel-preference__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-3);
}

.travel-preference__end {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding-bottom: 0;
  user-select: none;
}

.travel-preference__end .field__glyph {
  font-size: 1.25rem;
  color: inherit;
}

.travel-preference__end--drive {
  color: var(--color-text-secondary);
}

.travel-preference__end--fly {
  color: var(--color-text-secondary);
}

.travel-preference__control {
  position: relative;
  min-width: 0;
}

.travel-preference__readout {
  position: relative;
  height: 1.25rem;
  margin-bottom: var(--space-2);
}

.travel-preference__readout-text {
  position: absolute;
  top: 0;
  left: var(--pref-pct, 50%);
  max-width: none;
  padding: 0 var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  line-height: 1.25;
  white-space: nowrap;
  color: var(--color-text);
  pointer-events: none;
  will-change: left;
  transform: translateX(-50%);
  transition:
    left 280ms cubic-bezier(0.22, 1, 0.36, 1),
    color 220ms var(--ease-default);
}

.travel-preference__control.is-dragging .travel-preference__readout-text {
  transition: color 160ms var(--ease-default);
}

.travel-preference__control[data-lean="drive"] .travel-preference__readout-text {
  color: var(--color-text);
}

.travel-preference__control[data-lean="fly"] .travel-preference__readout-text {
  color: var(--color-text);
}

.travel-preference__slider {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: var(--radius-full);
  background: linear-gradient(
    to right,
    var(--color-bg-tertiary) 0%,
    var(--color-border-strong) 50%,
    var(--color-bg-tertiary) 100%
  );
  cursor: pointer;
  touch-action: none;
}

.travel-preference__slider:focus {
  outline: none;
}

.travel-preference__slider:focus-visible {
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.travel-preference__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 44px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 55%, rgba(0, 0, 0, 0.2));
  border-radius: var(--radius-full);
  background-color: #ffffff;
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px);
  background-size: 3px 3px;
  background-position:
    calc(50% - 5px) 50%,
    50% 50%,
    calc(50% + 5px) 50%;
  background-repeat: no-repeat;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 0 0 3px var(--color-accent-muted);
  cursor: grab;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.travel-preference__slider::-moz-range-thumb {
  width: 44px;
  height: 22px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 55%, rgba(0, 0, 0, 0.2));
  border-radius: var(--radius-full);
  background-color: #ffffff;
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(0, 0, 0, 0.28) 1.1px, transparent 1.25px);
  background-size: 3px 3px;
  background-position:
    calc(50% - 5px) 50%,
    50% 50%,
    calc(50% + 5px) 50%;
  background-repeat: no-repeat;
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 0 0 3px var(--color-accent-muted);
  cursor: grab;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .travel-preference__slider::-webkit-slider-thumb,
[data-theme="dark"] .travel-preference__slider::-moz-range-thumb {
  border-color: color-mix(in srgb, var(--color-accent) 65%, rgba(255, 255, 255, 0.25));
  background-color: color-mix(in srgb, var(--color-bg) 78%, transparent);
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1.1px, transparent 1.25px),
    radial-gradient(circle, rgba(255, 255, 255, 0.45) 1.1px, transparent 1.25px);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px var(--color-accent-muted);
}

.travel-preference__control.is-dragging .travel-preference__slider::-webkit-slider-thumb,
.travel-preference__control.is-dragging .travel-preference__slider::-moz-range-thumb {
  transition: none;
  transform: scale(1.08);
}

.travel-preference__slider:active::-webkit-slider-thumb {
  cursor: grabbing;
}

.travel-preference__slider:active::-moz-range-thumb {
  cursor: grabbing;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-4);
  align-items: end;
}

.jetsetter-filters .options-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-reveal {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
  transition:
    grid-template-rows var(--duration-tier) var(--ease-map),
    opacity calc(var(--duration-tier) * 0.7) var(--ease-default),
    margin-top var(--duration-tier) var(--ease-map);
}

.settings-reveal.is-open {
  grid-template-rows: 1fr;
  margin-top: var(--space-4);
  opacity: 1;
  pointer-events: auto;
}

.settings-reveal.is-instant,
.settings-reveal.is-instant .settings-reveal__body {
  transition: none !important;
}

.settings-reveal.is-instant.is-open .settings-reveal__body .options-grid > .field,
.settings-reveal.is-instant.is-open .custom-costs__add,
.settings-reveal.is-instant.is-open .custom-cost {
  animation: none !important;
}

.settings-reveal__clip {
  overflow: hidden;
  min-height: 0;
}

.settings-reveal__body {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  transform: translateY(-6px);
  transition: transform var(--duration-tier) var(--ease-map);
}

.settings-reveal.is-open .settings-reveal__body {
  transform: translateY(0);
}

.settings-reveal.is-open .settings-reveal__body .options-grid > .field,
.settings-reveal.is-open .custom-costs__add,
.settings-reveal.is-open .custom-cost {
  animation: settingsRevealItem 360ms var(--ease-map) both;
}

.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(1),
.settings-reveal.is-open .custom-cost:nth-child(1) {
  animation-delay: 40ms;
}
.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(2),
.settings-reveal.is-open .custom-cost:nth-child(2) {
  animation-delay: 70ms;
}
.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(3),
.settings-reveal.is-open .custom-cost:nth-child(3) {
  animation-delay: 100ms;
}
.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(4),
.settings-reveal.is-open .custom-costs__add,
.settings-reveal.is-open .custom-cost:nth-child(4) {
  animation-delay: 130ms;
}
.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(5) {
  animation-delay: 160ms;
}
.settings-reveal.is-open .settings-reveal__body .options-grid > .field:nth-child(n + 6) {
  animation-delay: 190ms;
}

@keyframes settingsRevealItem {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Multi-city stops — shares the route row with trip-type (right of select) */

.trip-form__stops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.trip-form__stops[hidden] {
  display: none;
}

.stops-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.stop-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  flex: 1 1 14rem;
  min-width: min(100%, 12rem);
}

.stop-row__label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  padding-bottom: 0;
  white-space: nowrap;
}

.stop-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  line-height: 1;
  cursor: pointer;
  transition:
    color var(--duration-fast),
    border-color var(--duration-fast),
    background var(--duration-fast);
}

.stop-remove:hover {
  color: var(--color-danger);
  border-color: rgba(242, 72, 34, 0.3);
  background: var(--color-danger-bg);
}

.stop-remove:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.add-stop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: var(--field-height);
  margin-top: 0;
  padding: 0 var(--space-3);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    border-color var(--duration-fast),
    background var(--duration-fast);
}

.add-stop-btn:hover {
  border-color: var(--color-text-tertiary);
  background: var(--color-bg-hover);
}

/* Icon button */

.swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 2px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transform: rotate(90deg);
  transition:
    color var(--duration-fast),
    border-color var(--duration-fast),
    background var(--duration-fast),
    transform var(--duration-normal);
}

.swap-btn:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-bg-hover);
  transform: rotate(270deg);
}

.field--compact input {
  height: var(--field-compact-height);
  min-height: var(--field-compact-height);
  padding: 0 var(--space-3);
  font-size: var(--font-size-md);
  line-height: 1;
}

.field--compact.field--currency .field__input-wrap {
  height: var(--field-compact-height);
}

.field--compact.field--unit .field__input-wrap {
  height: var(--field-compact-height);
}

.field--compact.field--currency .field__prefix {
  padding-left: var(--space-3);
}

.field--compact.field--currency input {
  height: 100%;
  min-height: 0;
  padding: 0 var(--space-3) 0 var(--space-1);
}

.field--compact.field--unit input {
  height: 100%;
  min-height: 0;
  padding: 0 var(--space-1) 0 var(--space-3);
}

/* Results */

.results--loading .comparison {
  opacity: 0.55;
  pointer-events: none;
}

.results--loading .recommendation {
  opacity: 0.55;
}

/* Error banner */

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

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.recommendation {
  margin-bottom: var(--space-5);
  animation: fadeIn var(--duration-normal) var(--ease-default);
}

.recommendation__heading {
  margin: 0 0 var(--space-4);
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.recommendation__summary {
  margin: 0;
  text-align: left;
  font-size: var(--font-size-2xl);
  line-height: var(--line-height-tight);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-wide);
}

.recommendation__mode {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  vertical-align: baseline;
  margin-left: 0.2em;
  padding: 0.18em 0.55em 0.22em;
  font-weight: var(--font-weight-bold);
  border-radius: var(--radius-sm);
  line-height: 1.15;
}

.recommendation__mode-icon {
  font-size: 1.05em;
  color: inherit;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.recommendation__mode-label {
  letter-spacing: inherit;
}

.recommendation__mode--fly {
  font-family: var(--font-family-flap);
  color: #f0b429;
  letter-spacing: 0.14em;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 11px,
      rgba(255, 255, 255, 0.03) 11px 12px
    ),
    linear-gradient(180deg, #1a1d16 0%, #12140f 100%);
  border: 2px solid #2a2e24;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    var(--shadow-sm);
}

.recommendation__mode--drive {
  font-family: var(--font-family-highway);
  color: #f7fbf8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    linear-gradient(160deg, #0b6b3a 0%, #08522c 100%);
  border: 3px solid #f4f7f5;
  box-shadow:
    0 0 0 2px #08522c,
    var(--shadow-sm);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.recommendation__mode--tie {
  color: var(--color-text-secondary);
  letter-spacing: 0.08em;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  box-shadow: none;
}

[data-theme="dark"] .recommendation__mode--fly {
  color: #ffc94a;
}

.recommendation__style-note {
  max-width: 40rem;
  margin: var(--space-2) 0 0;
  text-align: left;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.recommendation__style-note[hidden] {
  display: none;
}

.recommendation__body {
  width: 100%;
}

.recommendation__unit {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  align-items: stretch;
  overflow: visible;
}

.recommendation__unit.liquid-glass {
  background: var(--lg-bg);
  border-color: var(--lg-stroke);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--lg-glow);
}

.recommendation__unit-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.recommendation__unit-head-main {
  min-width: 0;
  flex: 1 1 auto;
}

.recommendation__share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  flex-shrink: 0;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong, var(--color-border));
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default),
    color var(--duration-fast) var(--ease-default);
}

.recommendation__share:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.recommendation__share:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.recommendation__share-icon {
  color: inherit;
  font-size: 1.15rem;
}

.recommendation__share.is-copied .recommendation__share-label::after {
  content: none;
}

.recommendation__share.is-copied {
  border-color: var(--color-drive, #0b6b3a);
  color: var(--color-drive, #0b6b3a);
}

.recommendation__stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  overflow: visible;
}

.recommendation__impacts {
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Cost boards — Drive highway sign / Fly departure board */
.cost-boards {
  --cost-board-top-rows: 4;
  --cost-board-rows: 9;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(var(--cost-board-top-rows), auto) minmax(0.5rem, 1fr) repeat(4, auto);
  gap: 0 var(--space-3);
  flex: 1 1 auto;
  align-self: stretch;
  min-height: 100%;
  overflow: visible;
}

.cost-board {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: 1 / -1;
  align-content: start;
  position: relative;
  z-index: 0;
  min-width: 0;
  min-height: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  text-align: left;
  box-sizing: border-box;
  animation: costBoardIn var(--duration-normal) var(--ease-default) both;
}

.cost-board:hover,
.cost-board:focus-within {
  z-index: 6;
}

.cost-board--fly {
  order: 1;
}

.cost-board--drive {
  order: 2;
  animation-delay: 60ms;
}

.cost-board__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid color-mix(in srgb, currentColor 32%, transparent);
}

.cost-board__title {
  min-width: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: 1.1;
}

.cost-board__heading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35em;
}

.cost-board__glyph {
  color: inherit;
  font-size: 0.9em;
  letter-spacing: 0;
  text-shadow: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.cost-board__badge {
  flex-shrink: 0;
  padding: 0.2em 0.5em;
  font-family: var(--font-family);
  font-size: 0.65rem;
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  text-shadow: none;
}

.cost-board__line,
.cost-board__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 2px 0;
  min-height: 1.35em;
}

.cost-board__line--empty {
  visibility: hidden;
}

.cost-board__line[data-tooltip] {
  position: relative;
  cursor: help;
  border-radius: 2px;
}

.cost-board__line[data-tooltip]:hover,
.cost-board__line[data-tooltip]:focus-visible {
  background: color-mix(in srgb, currentColor 12%, transparent);
  outline: none;
}

.cost-board__line[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(260px, 70vw);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  letter-spacing: normal;
  text-transform: none;
  line-height: 1.45;
  text-align: left;
  color: var(--color-text);
  background: var(--color-tooltip-bg);
  border: 1px solid var(--color-tooltip-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--duration-fast) var(--ease-default),
    visibility var(--duration-fast) var(--ease-default);
  z-index: 40;
  pointer-events: none;
}

.cost-board__line[data-tooltip]:hover::after,
.cost-board__line[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.cost-board--fly .cost-board__line[data-tooltip]::after {
  /* Open over the fly board, not under the drive column to the right */
  left: auto;
  right: 0;
  transform: none;
}

.cost-board--drive .cost-board__line[data-tooltip]::after {
  left: auto;
  right: 0;
  transform: none;
}

.cost-board__fill {
  min-height: 0;
}

.cost-board__label {
  font-size: var(--font-size-xs);
  line-height: 1.35;
  min-width: 0;
}

.cost-board__amount {
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  padding-right: 1px; /* keep glyphs inside the board edge with letter-spacing */
}

.cost-board__line .cost-board__amount {
  white-space: normal;
}

.cost-board__total {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
}

.cost-board__total .cost-board__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.cost-board__total .cost-board__amount {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

.cost-board__scores-start {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, currentColor 28%, transparent);
}

.cost-board__overall {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid color-mix(in srgb, currentColor 28%, transparent);
}

.cost-board__overall .cost-board__label,
.cost-board__overall .cost-board__amount {
  font-weight: var(--font-weight-bold);
}

.cost-board__overall .cost-board__amount {
  font-size: var(--font-size-md);
}

@supports not (grid-template-rows: subgrid) {
  .cost-boards {
    grid-template-rows: none;
    align-items: stretch;
  }

  .cost-board {
    display: flex;
    flex-direction: column;
    grid-row: auto;
    gap: var(--space-1);
    height: 100%;
  }

  .cost-board__fill {
    flex: 1 1 auto;
    min-height: var(--space-2);
  }
}

/* Drive — highway road sign */
.cost-board--drive {
  --sign-green: #0b6b3a;
  --sign-green-deep: #08522c;
  --sign-border: #f4f7f5;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    linear-gradient(160deg, var(--sign-green) 0%, var(--sign-green-deep) 100%);
  border: 3px solid var(--sign-border);
  border-radius: var(--radius-sm);
  box-shadow:
    0 0 0 2px var(--sign-green-deep),
    var(--shadow-sm);
  color: #f7fbf8;
  font-family: var(--font-family-highway);
}

.cost-board--drive .cost-board__head {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.14em;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  border-bottom-color: rgba(255, 255, 255, 0.4);
}

.cost-board--drive .cost-board__label {
  color: rgba(255, 255, 255, 0.82);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
}

.cost-board--drive .cost-board__amount {
  color: #fff;
  font-weight: var(--font-weight-semibold);
}

.cost-board--drive .cost-board__total {
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.cost-board--drive .cost-board__total .cost-board__label,
.cost-board--drive .cost-board__total .cost-board__amount {
  color: #fff;
  letter-spacing: 0.04em;
}

.cost-board--drive .cost-board__total .cost-board__amount {
  font-size: var(--font-size-lg);
}

/* Fly — split-flap / departure board */
.cost-board--fly {
  --flap-amber: #f0b429;
  --flap-amber-dim: rgba(240, 180, 41, 0.72);
  --flap-board: #12140f;
  --flap-board-edge: #2a2e24;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 11px,
      rgba(255, 255, 255, 0.03) 11px 12px
    ),
    linear-gradient(180deg, #1a1d16 0%, var(--flap-board) 100%);
  border: 2px solid var(--flap-board-edge);
  border-radius: var(--radius-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    var(--shadow-sm);
  color: var(--flap-amber);
  font-family: var(--font-family-flap);
}

.cost-board--fly .cost-board__head {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-regular);
  letter-spacing: 0.2em;
  color: var(--flap-amber);
  border-bottom-color: rgba(240, 180, 41, 0.4);
  border-bottom-style: dashed;
}

.cost-board--fly .cost-board__label {
  color: var(--flap-amber-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cost-board--fly .cost-board__amount {
  color: var(--flap-amber);
  letter-spacing: 0.02em;
  padding-right: 2px;
}

.cost-board--fly .cost-board__total {
  border-top: 1px dashed rgba(240, 180, 41, 0.35);
}

.cost-board--fly .cost-board__total .cost-board__label {
  color: var(--flap-amber-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.cost-board--fly .cost-board__total .cost-board__amount {
  color: #ffd36a;
  letter-spacing: 0.06em;
  animation: flapSettle 480ms var(--ease-default) 120ms both;
}

.cost-board--winner {
  position: relative;
  z-index: 1;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--color-accent) 55%, transparent),
    0 8px 24px rgba(0, 0, 0, 0.22),
    var(--shadow-sm);
}

.cost-board--fly.cost-board--winner {
  box-shadow:
    0 0 0 3px color-mix(in srgb, #f0b429 55%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.28);
}

.cost-board--drive.cost-board--winner {
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0b6b3a 45%, #fff),
    0 0 0 5px #08522c,
    0 8px 24px rgba(0, 0, 0, 0.22);
}

.cost-board--fly.cost-board--winner .cost-board__badge {
  background: #f0b429;
  color: #12140f;
}

.cost-board--drive.cost-board--winner .cost-board__badge {
  background: #f4f7f5;
  color: #08522c;
}

.cost-board--runner-up {
  opacity: 0.45;
  filter: grayscale(0.4) saturate(0.65);
  box-shadow: none;
}

.cost-board--runner-up:hover,
.cost-board--runner-up:focus-within {
  opacity: 1;
  filter: none;
  z-index: 6;
}

.cost-board--tie {
  opacity: 1;
  filter: none;
}

[data-theme="dark"] .cost-board--drive {
  --sign-green: #0e7a42;
  --sign-green-deep: #0a5c32;
  --sign-border: rgba(244, 247, 245, 0.92);
  box-shadow:
    0 0 0 2px #064024,
    var(--shadow-sm);
}

[data-theme="dark"] .cost-board--fly {
  --flap-board: #0c0e0a;
  --flap-board-edge: #3a4032;
  --flap-amber: #ffc94a;
  --flap-amber-dim: rgba(255, 201, 74, 0.7);
}

.recommendation--drive .recommendation__unit.liquid-glass {
  border-color: #0b6b3a;
  border-width: 2px;
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 1px color-mix(in srgb, #0b6b3a 35%, transparent),
    var(--lg-glow);
}

.recommendation--fly .recommendation__unit.liquid-glass {
  border-color: #f0b429;
  border-width: 2px;
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 1px color-mix(in srgb, #f0b429 40%, transparent),
    var(--lg-glow);
}

[data-theme="dark"] .recommendation--fly .recommendation__unit.liquid-glass {
  border-color: #ffc94a;
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 1px color-mix(in srgb, #ffc94a 45%, transparent),
    var(--lg-glow);
}

[data-theme="dark"] .recommendation--drive .recommendation__unit.liquid-glass {
  border-color: var(--color-drive);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 1px color-mix(in srgb, var(--color-drive) 40%, transparent),
    var(--lg-glow);
}

.recommendation--tie .recommendation__unit.liquid-glass {
  border-color: var(--lg-stroke);
}

.recommendation__impact-tier + .recommendation__impact-tier {
  margin-top: var(--space-4);
}

.recommendation__subheading {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-secondary);
}

.recommendation__subheading--sentence {
  text-transform: none;
  letter-spacing: normal;
}

.recommendation__impact-tier--high .recommendation__subheading {
  color: var(--color-accent);
}

.recommendation__impact-tier--low .recommendation__subheading {
  color: var(--color-text-tertiary);
}

.recommendation__reasons {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recommendation__reasons li {
  position: relative;
  padding-left: 1rem;
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  color: var(--color-text);
}

.recommendation__impact-tier--high .recommendation__reasons li {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.recommendation__impact-tier--low .recommendation__reasons li {
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
}

.recommendation__reasons li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-text-secondary);
}

.recommendation__impact-tier--high .recommendation__reasons li::before {
  color: var(--color-accent);
}

.recommendation__fun-facts {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.recommendation__fun-facts .recommendation__subheading {
  color: var(--color-text-secondary);
}

.recommendation__fun-facts-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recommendation__fun-facts-list li {
  position: relative;
  padding-left: 1rem;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.recommendation__fun-facts-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--color-text-tertiary);
}

.recommendation__score-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.recommendation__score-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.recommendation__score-row--head {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
}

.recommendation__score-row span:first-child {
  color: var(--color-text-secondary);
}

.recommendation__score-row span:not(:first-child) {
  text-align: right;
  color: var(--color-text);
}

.recommendation__score-row--overall {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  font-weight: var(--font-weight-semibold);
}

.recommendation__score-row--cost-total {
  font-weight: var(--font-weight-semibold);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.recommendation__score-row--scores-start {
  margin-top: var(--space-3);
  padding-top: var(--space-2);
}

.recommendation__score-row--overall span:not(:first-child) {
  color: var(--color-accent);
}

.recommendation__score-row--overall span:first-child {
  color: var(--color-text);
}

.comparison {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: fadeIn var(--duration-normal) var(--ease-default);
}

.results-mode-toggle {
  display: none;
}

.results-mode-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease-default),
    background var(--duration-fast) var(--ease-default),
    border-color var(--duration-fast) var(--ease-default),
    box-shadow var(--duration-fast) var(--ease-default);
}

.results-mode-toggle__btn .field__glyph {
  font-size: 1.15em;
  color: inherit;
}

.results-mode-toggle__btn:hover {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: var(--color-bg-hover);
}

.results-mode-toggle__btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.results-mode-toggle__btn.is-active[data-mode="fly"] {
  color: var(--color-fly);
  border-color: color-mix(in srgb, var(--color-fly) 45%, var(--color-border));
  background: color-mix(in srgb, var(--color-fly) 8%, var(--color-bg));
  box-shadow: var(--shadow-sm);
}

.results-mode-toggle__btn.is-active[data-mode="drive"] {
  color: var(--color-drive);
  border-color: color-mix(in srgb, var(--color-drive) 45%, var(--color-border));
  background: color-mix(in srgb, var(--color-drive) 8%, var(--color-bg));
  box-shadow: var(--shadow-sm);
}

.comparison--drive-wins .comparison__col-header--drive,
.comparison--fly-wins .comparison__col-header--fly {
  border-color: currentColor;
}

.comparison__heading {
  margin: 0;
  text-align: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.comparison__maps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  /* Own stacking context below table labels; do not elevate above page nav */
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.comparison__map-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  position: relative;
  z-index: 0;
  isolation: isolate;
}

.comparison__map-col--winner .card__map {
  outline: 3px solid currentColor;
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

.comparison__map-col[data-mode="fly"].comparison__map-col--winner {
  color: #f0b429;
}

.comparison__map-col[data-mode="drive"].comparison__map-col--winner {
  color: #0b6b3a;
}

.comparison__map-col--runner-up {
  opacity: 0.55;
  filter: grayscale(0.25);
}

.comparison__map-col--runner-up .comparison__col-header {
  opacity: 1;
}

.comparison__col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-secondary);
  /* Keep mode labels above Leaflet tiles/controls in this column */
  position: relative;
  z-index: 2;
}

.comparison__col-header-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.comparison__col-header-label .field__glyph {
  color: inherit;
  font-size: 1.15em;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.comparison__col-header-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.comparison__col-header-score {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--letter-spacing-tight, -0.02em);
  line-height: 1;
}

.comparison__col-header-badge {
  display: inline-block;
  padding: 0.2em 0.55em;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background: currentColor;
  color: #fff;
  line-height: 1.2;
}

.comparison__col-header-badge[hidden] {
  display: none;
}

.comparison__col-header--fly {
  font-family: var(--font-family-flap);
  color: #f0b429;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 11px,
      rgba(255, 255, 255, 0.03) 11px 12px
    ),
    linear-gradient(180deg, #1a1d16 0%, #12140f 100%);
  border: 2px solid #2a2e24;
  border-radius: var(--radius-sm);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    var(--shadow-sm);
}

.comparison__col-header--drive {
  font-family: var(--font-family-highway);
  color: #f7fbf8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    linear-gradient(160deg, #0b6b3a 0%, #08522c 100%);
  border: 3px solid #f4f7f5;
  border-radius: var(--radius-sm);
  box-shadow:
    0 0 0 2px #08522c,
    var(--shadow-sm);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.comparison__col-header--winner {
  border-width: 2px;
  box-shadow:
    0 0 0 3px color-mix(in srgb, currentColor 40%, transparent),
    var(--shadow-sm);
  font-size: var(--font-size-lg);
}

.comparison__col-header--winner .comparison__col-header-score {
  font-size: var(--font-size-xl);
}

.comparison__col-header--fly.comparison__col-header--winner {
  color: #f0b429;
  border-color: #f0b429;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #f0b429 45%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.22);
}

.comparison__col-header--drive.comparison__col-header--winner {
  color: #f7fbf8;
  border-color: #f4f7f5;
  box-shadow:
    0 0 0 3px color-mix(in srgb, #0b6b3a 40%, #fff),
    0 0 0 5px #08522c,
    0 6px 18px rgba(0, 0, 0, 0.2);
}

.comparison__col-header--fly .comparison__col-header-badge {
  background: #f0b429;
  color: #12140f;
}

.comparison__col-header--drive .comparison__col-header-badge {
  background: #f4f7f5;
  color: #08522c;
  text-shadow: none;
}

.comparison__col-header--drive.comparison__col-header--winner .comparison__col-header-badge {
  background: #f4f7f5;
  color: #08522c;
}

.comparison__col-header--fly.comparison__col-header--winner .comparison__col-header-badge {
  background: #f0b429;
  color: #12140f;
}

.comparison__col-header--runner-up {
  opacity: 0.55;
  filter: grayscale(0.35);
  box-shadow: none;
  text-shadow: none;
}

.comparison__col-header--runner-up .comparison__col-header-score {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  opacity: 0.85;
}

.comparison__table-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  position: relative;
  z-index: 1;
  align-items: stretch;
}

.comparison__card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.comparison__card.liquid-glass {
  background: var(--lg-bg);
  border-color: var(--lg-stroke);
  box-shadow:
    inset 0 1px 0 var(--lg-inset),
    inset 0 -1px 0 var(--lg-shade),
    0 0 0 0.5px color-mix(in srgb, var(--lg-highlight) 40%, transparent),
    var(--lg-glow);
}

.comparison__card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.comparison__card-totals {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.comparison__row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 0.9fr) minmax(0, 1.2fr);
  column-gap: var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-4);
  border-bottom: none;
  position: relative;
}

.comparison__row:not(:last-child):not(.comparison__row--section)::after {
  content: "";
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: 0;
  height: 1px;
  background: var(--color-border);
  pointer-events: none;
}

.comparison__row:last-child {
  border-bottom: none;
}

.comparison__row--section {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  min-height: 2.5rem;
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--color-text) 18%, transparent);
  background: #1a1d21;
  color: #fff;
}

[data-theme="dark"] .comparison__row--section {
  background: #0b0d10;
  border-top-color: color-mix(in srgb, #fff 16%, transparent);
  border-bottom-color: color-mix(in srgb, #fff 16%, transparent);
}

.comparison__section-label {
  display: block;
  width: 100%;
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: #fff;
  line-height: 1;
}

.comparison__row--highlight {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .comparison__row--highlight {
  background: rgba(255, 255, 255, 0.04);
}

.comparison__row--total {
  background: var(--color-bg-secondary);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.comparison__row--total .comparison__value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
}

.comparison__label {
  padding-top: 0.15em;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.35;
}

.comparison__row--highlight .comparison__label,
.comparison__row--total .comparison__label {
  color: var(--color-text);
  font-weight: var(--font-weight-medium);
}

.comparison__row--total .comparison__label {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

.comparison__metric {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-1);
  text-align: right;
}

.comparison__value {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.comparison__value--fly {
  color: var(--color-fly);
}

.comparison__value--drive {
  color: var(--color-drive);
}

.comparison__value--muted {
  color: var(--color-text-tertiary);
  font-weight: var(--font-weight-regular);
}

.comparison__row--highlight .comparison__value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.comparison__value-primary {
  display: block;
}

.comparison__value-primary-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  max-width: 100%;
}

.comparison__value-primary-row .comparison__value-primary {
  display: inline;
}

.comparison__info {
  flex-shrink: 0;
}

.comparison__info::after {
  max-width: min(260px, 75vw);
}

.comparison__card--drive .comparison__info::after {
  left: auto;
  right: 0;
  transform: none;
}

.comparison__value-secondary {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
}

.comparison__row--highlight .comparison__value-secondary {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.comparison__calc {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-secondary);
  text-align: right;
  line-height: 1.45;
}

.comparison__calc-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  max-width: 100%;
}

.comparison__notes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  margin: 0;
}

.comparison__note-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
}

.comparison__note-card--fly {
  font-family: var(--font-family-flap);
  color: #f0b429;
  letter-spacing: 0.04em;
  background:
    repeating-linear-gradient(
      180deg,
      transparent 0 11px,
      rgba(255, 255, 255, 0.03) 11px 12px
    ),
    linear-gradient(180deg, #1a1d16 0%, #12140f 100%);
  border: 2px solid #2a2e24;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    var(--shadow-sm);
}

.comparison__note-card--drive {
  font-family: var(--font-family-highway);
  color: #f7fbf8;
  letter-spacing: 0.02em;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
    linear-gradient(160deg, #0b6b3a 0%, #08522c 100%);
  border: 3px solid #f4f7f5;
  box-shadow:
    0 0 0 2px #08522c,
    var(--shadow-sm);
}

.comparison__note-card-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
}

.comparison__note-card-title .field__glyph {
  color: inherit;
  font-size: 1.1em;
}

.comparison__note-card-text {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  letter-spacing: normal;
  text-transform: none;
  line-height: var(--line-height-normal);
}

.comparison__note-card--fly .comparison__note-card-text {
  color: rgba(240, 180, 41, 0.82);
}

.comparison__note-card--drive .comparison__note-card-text {
  color: rgba(247, 251, 248, 0.88);
  text-shadow: none;
}

.comparison__note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
}

.card__map {
  /* Outer chrome + clip — Leaflet mounts on the inner viewport.
     contain:paint is the durable clip for GPU-composited Leaflet panes;
     overflow/clip-path alone are unreliable with translate3d tiles. */
  position: relative;
  z-index: 0;
  flex-shrink: 0;
  height: 220px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round var(--radius-md));
  background: var(--color-bg-secondary);
}

.card__map-viewport,
.card__map .leaflet-container {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  border-radius: 0;
}

/* Cap Leaflet's default pane/control z-indexes (200–1000) inside cards */
.card__map-viewport .leaflet-pane,
.card__map-viewport .leaflet-map-pane {
  z-index: 1 !important;
}

.card__map-viewport .leaflet-tile-pane { z-index: 1 !important; }
.card__map-viewport .leaflet-overlay-pane { z-index: 2 !important; }
.card__map-viewport .leaflet-shadow-pane { z-index: 3 !important; }
.card__map-viewport .leaflet-marker-pane { z-index: 4 !important; }
.card__map-viewport .leaflet-tooltip-pane { z-index: 5 !important; }
.card__map-viewport .leaflet-popup-pane { z-index: 6 !important; }

.card__map-viewport .leaflet-control-container {
  z-index: 7;
}

.card__map-viewport .leaflet-top,
.card__map-viewport .leaflet-bottom {
  z-index: 7;
}

/* Darken tiles only (not the whole container) so contain:paint keeps clipping */
[data-theme="dark"] .card__map-viewport .leaflet-tile-pane {
  filter: brightness(0.82) contrast(1.05) saturate(0.9);
}

.comparison__map-col .card__map {
  margin-bottom: 0;
}

.map-marker {
  background: none;
  border: none;
}

.map-marker span {
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.disclaimer {
  margin: var(--space-5) 0 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  text-align: center;
}

.seo-content {
  margin-top: var(--space-12);
  padding-top: 0;
  border-top: none;
}

.seo-content__label {
  margin: 0 0 var(--space-8);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
  font-family: var(--font-family-display);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1.2;
}

.seo-content__heading {
  margin: 0 0 var(--space-4);
  font-family: var(--font-family-display);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.seo-content__heading + .seo-content__heading,
.seo-content__faq,
.legal-disclaimer {
  margin-top: var(--space-8);
}

.legal-disclaimer {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
}

.legal-disclaimer p {
  margin: 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.legal-disclaimer strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.footer {
  margin-top: var(--space-12);
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__legal {
  margin: 0;
  max-width: 36rem;
  margin-inline: auto;
  line-height: var(--line-height-normal);
}

.footer a {
  color: var(--color-text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer a:hover {
  color: var(--color-accent);
}

.seo-content__lead {
  margin: 0 0 var(--space-5);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

.seo-content__steps {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  color: var(--color-text);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
}

.seo-content__steps strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.seo-faq {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  padding: 0 var(--space-4);
}

.seo-faq + .seo-faq {
  margin-top: var(--space-2);
}

.seo-faq summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-4) 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

.seo-faq summary::-webkit-details-marker {
  display: none;
}

.seo-faq summary::after {
  content: "+";
  float: right;
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.seo-faq[open] summary::after {
  content: "–";
}

.seo-faq p {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-md);
  line-height: var(--line-height-normal);
  color: var(--color-text-secondary);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes costBoardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flapSettle {
  0% {
    opacity: 0.35;
    transform: translateY(-3px);
  }
  45% {
    opacity: 1;
    transform: translateY(1px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-map: 1ms;
    --duration-tier: 1ms;
  }

  .header__mascot,
  .header__brand,
  .header__title,
  .header__subtitle,
  .header,
  .header__bar,
  .route-preview,
  .trip-planner,
  body.has-route-map .trip-form,
  .cost-board,
  .cost-board--fly .cost-board__total .cost-board__amount,
  #route-form-card,
  .settings-reveal,
  .settings-reveal__body {
    animation: none !important;
    transition: none !important;
  }

  .settings-reveal.is-open .settings-reveal__body .options-grid > .field,
  .settings-reveal.is-open .custom-costs__add,
  .settings-reveal.is-open .custom-cost {
    animation: none !important;
  }

  body.has-route-map .route-preview {
    opacity: 1;
    transform: none;
    clip-path: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablet / medium — stack recommendation, light glass, softer canvas */
@media (max-width: 900px) {
  :root {
    --lg-blur: 14px;
    --lg-saturate: 1.4;
    --font-size-2xl: clamp(1.5rem, 5.5vw, 2rem);
  }

  .recommendation__unit {
    grid-template-columns: 1fr;
    padding: var(--space-5);
    gap: var(--space-3);
  }

  .recommendation__summary {
    font-size: var(--font-size-2xl);
  }

  .recommendation__share-label {
    /* Icon-only on narrow widths keeps the verdict readable */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .recommendation__share {
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-2);
  }

  .recommendation__impact-tier--high .recommendation__reasons li {
    font-size: clamp(1.125rem, 4vw, 1.25rem);
  }

  .card__map-viewport,
  .card__map .leaflet-container {
    height: clamp(180px, 28vh, 260px);
  }
}

/* Small tablet — cost boards + options, map stage */
@media (max-width: 768px) {
  :root {
    --lg-blur: 12px;
    --lg-saturate: 1.3;
  }

  .page {
    padding: var(--space-8) var(--space-4) var(--space-10);
    padding-left: max(var(--space-4), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
    padding-bottom: max(var(--space-10), env(safe-area-inset-bottom, 0px));
  }

  body.has-route-map {
    --pad: var(--space-3);
    --pad-top: max(var(--pad), env(safe-area-inset-top, 0px));
    --pad-left: max(var(--pad), env(safe-area-inset-left, 0px));
    --pad-right: max(var(--pad), env(safe-area-inset-right, 0px));
  }

  body.has-route-map .trip-planner {
    --route-map-stage-height: clamp(320px, 56vh, 640px);
    --route-form-overlap: 6rem;
  }

  body.has-route-map .header--compact .header__brand {
    max-width: calc(100% - var(--map-chrome-size) - var(--space-3));
  }

  body.has-route-map .route-preview .leaflet-bar a {
    width: 44px;
    height: 44px;
    line-height: 44px;
  }

  .cost-boards {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 var(--space-2);
  }

  .cost-board {
    padding: var(--space-2);
    min-height: 0;
  }

  .cost-board__head {
    font-size: var(--font-size-sm);
    gap: 2px;
    padding-bottom: var(--space-1);
    margin-bottom: 2px;
  }

  .cost-board__badge {
    font-size: 0.55rem;
    padding: 0.12em 0.4em;
  }

  .cost-board__line,
  .cost-board__total {
    gap: var(--space-1);
    padding: 1px 0;
    min-height: 1.2em;
  }

  .cost-board__label,
  .cost-board__amount {
    font-size: var(--font-size-xs);
  }

  .cost-board__total .cost-board__label {
    font-size: var(--font-size-xs);
  }

  .cost-board__total .cost-board__amount {
    font-size: var(--font-size-md);
  }

  .cost-board__overall .cost-board__amount {
    font-size: var(--font-size-sm);
  }

  .cost-board__fill {
    min-height: var(--space-1);
  }

  .results-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
    width: 100%;
    margin: 0 0 var(--space-4);
  }

  #results[data-mobile-mode="fly"] #comparison-map-col-drive,
  #results[data-mobile-mode="fly"] #comparison-table-drive,
  #results[data-mobile-mode="fly"] #comparison-note-drive {
    display: none !important;
  }

  #results[data-mobile-mode="drive"] #comparison-map-col-fly,
  #results[data-mobile-mode="drive"] #comparison-table-fly,
  #results[data-mobile-mode="drive"] #comparison-note-fly {
    display: none !important;
  }

  #results[data-mobile-mode] .comparison__map-col--runner-up,
  #results[data-mobile-mode] .comparison__col-header--runner-up {
    opacity: 1;
    filter: none;
  }

  #results[data-mobile-mode] .comparison__maps,
  #results[data-mobile-mode] .comparison__table-wrap,
  #results[data-mobile-mode] .comparison__notes {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
  }

  .jetsetter-filters .options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.has-route-map .trip-form > .travel-details {
    margin-top: 0;
  }

  body.has-route-map #route-form-card {
    margin-bottom: 0;
  }

  #route-form-card {
    margin-bottom: 0;
  }

  .trip-type.settings-tier {
    /* Glass chrome + padded option: comfortable touch target. */
    min-height: calc(36px + 2 * var(--space-2));
  }

  .settings-tier .trip-type__option span {
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
  }

  .travel-preference__slider {
    height: 8px;
  }

  .travel-preference__slider::-webkit-slider-thumb {
    width: 48px;
    height: 28px;
  }

  .travel-preference__slider::-moz-range-thumb {
    width: 48px;
    height: 28px;
  }

  .field--unit .field__suffix,
  .field--currency .field__suffix {
    font-size: var(--font-size-xs);
    padding-right: var(--space-2);
  }

  .field--currency .field__prefix {
    padding-left: var(--space-2);
  }

  .comparison {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  .comparison__maps {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    position: relative;
    z-index: 0;
    isolation: isolate;
  }

  .comparison__notes {
    grid-template-columns: 1fr;
  }

  .comparison__table-wrap {
    grid-template-columns: 1fr;
  }

  .comparison__row--total .comparison__value {
    font-size: clamp(1.125rem, 4.5vw, 1.25rem);
  }

  .comparison__col-header {
    position: relative;
    z-index: 2;
  }
}

/* Phone — form stack, tap targets, compact chrome */
@media (max-width: 600px) {
  .header__subtitle {
    white-space: normal;
  }

  .header__title {
    font-size: clamp(2.25rem, 11vw, 2.75rem);
  }

  .header--compact .header__brand {
    margin-top: -40px;
    padding-right: calc(40px + var(--space-2));
  }

  .header--compact .header__mascot {
    width: auto;
    height: 1.45rem;
  }

  .header--compact .header__title {
    font-size: clamp(1.2rem, 5vw, 1.45rem);
  }

  body.has-route-map .header--compact .header__brand {
    margin-top: calc(-1 * var(--map-chrome-size));
    height: var(--map-chrome-size);
    min-height: var(--map-chrome-size);
    pointer-events: auto;
  }

  .route-preview__map {
    height: clamp(200px, 32vh, 320px);
  }

  body.has-route-map {
    --pad: var(--space-3);
    --pad-top: max(var(--pad), env(safe-area-inset-top, 0px));
    --pad-left: max(var(--pad), env(safe-area-inset-left, 0px));
    --pad-right: max(var(--pad), env(safe-area-inset-right, 0px));
    --map-chrome-size: 44px;
  }

  body.has-route-map .trip-planner {
    --route-map-stage-height: clamp(280px, 52vh, 520px);
    --route-form-overlap: 5.5rem;
  }

  body.has-route-map .header.header--compact {
    padding: var(--pad-top) var(--pad-right) 0 var(--pad-left);
  }

  body.has-route-map .header--compact .theme-toggle {
    width: var(--map-chrome-size);
    height: var(--map-chrome-size);
  }

  body.has-route-map .header--compact .header-share.is-copied {
    width: auto;
    min-width: var(--map-chrome-size);
  }

  body.has-route-map .route-preview__legend {
    top: calc(var(--pad-top) + var(--map-chrome-size) + var(--space-2));
    left: var(--pad-left);
  }

  body.has-route-map .route-preview .leaflet-top.leaflet-right {
    top: calc(var(--pad-top) + var(--map-chrome-size) + var(--space-2));
    right: var(--pad-right);
  }

  body.has-route-map .route-preview .leaflet-bottom.leaflet-right {
    right: var(--pad-right);
  }

  .page {
    padding: var(--space-6) var(--space-3) var(--space-8);
    padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-3), env(safe-area-inset-right, 0px));
    padding-bottom: max(var(--space-8), env(safe-area-inset-bottom, 0px));
  }

  .header__mascot {
    width: clamp(8rem, 42vw, 11rem);
  }

  .header__bar {
    margin-bottom: var(--space-1);
  }

  .travel-preference__row {
    gap: var(--space-2);
  }

  .travel-preference__end .field__glyph {
    font-size: 1.125rem;
  }

  .travel-preference__readout-text {
    font-size: 10px;
  }

  body.has-route-map .trip-form > .travel-details {
    margin-top: 0;
  }

  body.has-route-map #route-form-card,
  #route-form-card {
    margin-bottom: 0;
  }

  .travel-preference {
    margin-top: 0;
    padding-top: 0;
  }

  .options-grid,
  .jetsetter-filters .options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trip-form__route {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .trip-type-select,
  .trip-type-select select {
    width: 100%;
  }

  .trip-type-select {
    height: 44px;
  }

  .trip-form__stops {
    width: 100%;
  }

  .stops-list {
    flex-direction: column;
    align-items: stretch;
  }

  .stop-row {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .stop-remove {
    width: 44px;
    height: 44px;
  }

  .add-stop-btn {
    width: 100%;
    height: 44px;
  }

  .traveler-picker__row {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--field-compact-height);
  }

  .traveler-picker__toggle {
    flex: 1;
    min-width: 0;
  }

  .traveler-group .traveler-picker__toggle.trip-type {
    height: 44px;
    min-height: 44px;
    max-height: 44px;
  }

  .traveler-group .traveler-picker__toggle .trip-type__option {
    height: calc(44px - 8px);
  }

  .traveler-picker__input {
    height: 44px;
  }

  .mascot-assistant {
    right: 0;
    max-width: calc(100vw - 2rem);
  }

  .mascot-assistant__bubble {
    max-width: 200px;
  }

  .mascot-assistant--error {
    right: max(var(--space-3), env(safe-area-inset-right, 0px));
    bottom: max(var(--space-4), env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 2rem);
  }

  .trip-type {
    display: flex;
    width: 100%;
    min-height: 44px;
  }

  .trip-type__option {
    flex: 1;
  }

  .trip-type__option span {
    text-align: center;
    padding: var(--space-2) var(--space-1);
    font-size: var(--font-size-xs);
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .traveler-group .traveler-picker__toggle .trip-type__option span {
    padding: 0;
    font-size: var(--font-size-md);
    min-height: 0;
  }

  .form-card {
    padding: var(--space-4);
  }

  .recommendation__unit {
    padding: var(--space-4);
  }

  .recommendation__heading,
  .comparison__heading,
  .travel-settings__heading {
    font-size: var(--font-size-md);
  }

  .recommendation__reasons li {
    font-size: var(--font-size-md);
  }

  .recommendation__impact-tier--high .recommendation__reasons li {
    font-size: var(--font-size-lg);
  }

  .recommendation__impact-tier--low .recommendation__reasons li {
    font-size: var(--font-size-sm);
  }

  body.form-pinned .form-pin-bar {
    padding: var(--space-3);
    padding-top: max(var(--space-3), env(safe-area-inset-top, 0px));
    padding-left: max(var(--space-3), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-3), env(safe-area-inset-right, 0px));
  }

  .form-pin-bar__logo {
    width: auto;
    height: 1.35rem;
  }

  .trip-form__locations {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .swap-btn {
    justify-self: center;
    margin: 0;
    width: 44px;
    height: 44px;
    /* SVG is vertical; desktop rotates 90° for side-by-side From/To.
       When stacked, keep 0° so arrows point up/down. */
    transform: rotate(0deg);
  }

  .swap-btn:hover {
    transform: rotate(180deg);
  }

  .field--autocomplete input {
    height: 48px;
    font-size: var(--font-size-lg);
  }

  .field--autocomplete .autocomplete input {
    padding-right: calc(var(--space-3) + 2.75rem);
  }

  .field__location-btn {
    width: 2.75rem;
    height: 2.75rem;
    right: var(--space-1);
  }

  .field--compact input,
  .field--compact.field--currency .field__input-wrap,
  .field--compact.field--unit .field__input-wrap,
  .field--compact.field--baggage .field__input-wrap {
    min-height: 44px;
    height: 44px;
  }

  .cost-board {
    padding: var(--space-2) var(--space-2) var(--space-2) var(--space-2);
  }

  .cost-board--drive .cost-board__total .cost-board__amount,
  .cost-board--fly .cost-board__total .cost-board__amount {
    font-size: var(--font-size-md);
  }

  .field__info::after {
    max-width: min(220px, calc(100vw - 2rem));
  }
}

/* Narrow phones — tighter type */
@media (max-width: 380px) {
  .recommendation__score-row {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
    gap: var(--space-1);
    font-size: var(--font-size-xs);
  }

  .cost-board__label,
  .cost-board__amount {
    font-size: 10px;
  }

  .cost-board__total .cost-board__label {
    font-size: var(--font-size-xs);
  }

  .cost-board__total .cost-board__amount {
    font-size: var(--font-size-md);
  }

  body.has-route-map .header--compact .header__title {
    font-size: 1.1rem;
  }

  .trip-type__option span {
    padding: var(--space-2) 2px;
    letter-spacing: -0.01em;
  }
}
