/* =========================================================================
   Between — style.css
   "Wayfinding" aesthetic: warm map-paper surfaces, a dotted A···◇···B route
   motif, amber meeting-point accent, teal places, deep-ocean structure.
   Light/dark themed via [data-theme].
   ========================================================================= */

/* ---- Design tokens ---- */
:root {
  --bg: #f6f1e7;            /* warm map paper behind everything */
  --surface: #fffdf8;       /* panel / card surface (slightly warm white) */
  --surface-2: #efe9dc;     /* recessed surfaces, hovers */
  --text: #1a2230;
  --muted: #6f6a5e;         /* warm grey */
  --border: #e6ddca;
  --border-strong: #d8ceb6;

  --primary: #1e3a5f;       /* deep ocean — structure, links, "you" */
  --primary-700: #16293f;
  --accent: #ef9d3a;        /* amber — the meeting point, the "between" */
  --accent-700: #d77f1f;
  --place: #0f9f8f;         /* teal — places */
  --ok: #1c8a5b;
  --warn: #c97a1c;
  --err: #d8473e;

  --shadow-sm: 0 1px 2px rgba(40,33,16,.10), 0 2px 6px rgba(40,33,16,.06);
  --shadow: 0 2px 6px rgba(40,33,16,.10), 0 12px 30px rgba(40,33,16,.14);
  --shadow-lg: 0 8px 22px rgba(40,33,16,.16), 0 24px 60px rgba(40,33,16,.20);

  --radius: 16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --panel-w: 384px;

  --font: 'Instrument Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-display: 'Bricolage Grotesque', var(--font);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --ring: 0 0 0 3px rgba(30,58,95,.20);
}

[data-theme="dark"] {
  --bg: #11151c;
  --surface: #1b212b;
  --surface-2: #28303c;
  --text: #ece9e1;
  --muted: #9aa0a8;
  --border: #313a47;
  --border-strong: #3d4858;

  --primary: #6ea8e6;       /* lighter ocean for contrast on dark */
  --primary-700: #5a93cf;
  --accent: #f4ab50;
  --accent-700: #e0922f;
  --place: #2cc0b0;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow: 0 2px 8px rgba(0,0,0,.45), 0 14px 34px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.55), 0 28px 64px rgba(0,0,0,.6);
  --ring: 0 0 0 3px rgba(110,168,230,.28);
}

* { box-sizing: border-box; }

/* The HTML `hidden` attribute must always win over display rules. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; color: inherit; }
a { color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---- Map ---- */
#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
  /* Contain Leaflet's high internal z-indexes so floating UI stays above. */
  z-index: 0;
}

/* ---- Dark map polish ----
   Invert the light vector tiles → clean grey land, light roads, dark water.
   Only the tile pane is filtered, so markers/patch/popups keep real colours. */
#map.map--invert .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9);
}
#map.map--imagery .leaflet-tile-pane { filter: none; }
[data-theme="dark"] .leaflet-bar a,
[data-theme="dark"] .leaflet-control-zoom a {
  background: var(--surface);
  color: var(--text);
  border-bottom-color: var(--border);
}
[data-theme="dark"] .leaflet-bar a:hover { background: var(--surface-2); }
[data-theme="dark"] .leaflet-bar { border-color: var(--border); }
[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(27,33,43,.82);
  color: var(--muted);
}
[data-theme="dark"] .leaflet-control-attribution a { color: var(--primary); }
[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); }
[data-theme="dark"] .iw__title { color: var(--text); }
[data-theme="dark"] .iw__addr,
[data-theme="dark"] .iw__meta { color: var(--muted); }
[data-theme="dark"] .iw__link { color: var(--primary); }

/* ---- Floating search panel (INPUT) ---- */
.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: var(--panel-w);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  z-index: 10;
  animation: panel-in .5s var(--ease) both;
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel__header-actions { display: flex; gap: 6px; }
.panel__tag {
  font-size: 11.5px; color: var(--muted); margin: -2px 0 14px;
  letter-spacing: .1px;
}
/* Mobile-only affordances, hidden on desktop. */
.panel__collapse { display: none; }
.panel__tag-mobile { display: none; }
.topbar { display: none; }
.panel-scrim { display: none; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand__mark { display: inline-flex; }
.brand__logo {
  width: 34px; height: 34px; border-radius: 10px; display: block;
  box-shadow: 0 2px 6px rgba(40,33,16,.18);
}
.brand__name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -.6px;
  line-height: 1;
}

/* ---- Form ---- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12px; font-weight: 600; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; letter-spacing: .1px;
}
.field__label-sub { font-weight: 400; color: var(--muted); font-size: 11px; }
.field__dot {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}
.field__dot--you    { background: var(--primary); color: var(--primary); }
.field__dot--friend { background: var(--err); color: var(--err); }
.field__row { display: flex; gap: 8px; }
.field__row .field__input { flex: 1; }
.field__input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field__input::placeholder { color: var(--muted); opacity: .7; }
.field__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--surface);
}
.field__input[readonly] { background: var(--surface-2); color: var(--muted); }
.field__hint { font-size: 11px; color: var(--muted); min-height: 14px; }

/* ---- Chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s, transform .1s var(--ease);
}
.chip:hover { background: var(--surface-2); border-color: var(--muted); }
.chip:active { transform: scale(.95); }
.chip--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1305;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ---- Middle-ground sizer ---- */
.sizer {
  border-top: 1px dashed var(--border-strong);
  padding-top: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.sizer__head {
  font-family: var(--font-display);
  font-weight: 700; font-size: 13px; color: var(--text);
  letter-spacing: -.1px;
}
.sizer__val {
  font-family: var(--font-display);
  color: var(--accent-700); font-weight: 700;
}
[data-theme="dark"] .sizer__val { color: var(--accent); }
.range {
  width: 100%;
  accent-color: var(--accent);
  height: 6px;
}

/* ---- Buttons ---- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .08s var(--ease), box-shadow .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn--primary {
  background: var(--accent);
  color: #1a1305;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn--primary:hover { background: var(--accent-700); color: #fff; }
.btn--primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn__arrow { transition: transform .2s var(--ease); }
.btn--primary:hover .btn__arrow { transform: translateX(3px); }
.btn--ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  flex: 1;
}
.btn--ghost:hover { background: var(--border); }

.icon-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 42px; height: 42px;
  font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s var(--ease), border-color .15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--muted); }
.icon-btn:active { transform: scale(.94); }

/* ---- Results sheet (OUTPUT: summary + directions + cards) ---- */
.results {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 348px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 10;
  overflow: hidden;
  animation: panel-in .5s var(--ease) .06s both;
}
.results__handle { display: none; }
.results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.results__title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.3px;
}
.results__count {
  color: var(--accent-700); font-weight: 700;
  font-family: var(--font-display);
}
[data-theme="dark"] .results__count { color: var(--accent); }
.results__filters { display: flex; align-items: center; gap: 8px; }
.results__toggle { display: none; }   /* shown on mobile only */
.select {
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--bg);
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}

/* Scroll region: summary + meet pin to the top, only this scrolls. */
.results__scroll {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
}

/* Floating pill to bring back a fully-hidden results sheet. */
.results-reopen {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: var(--accent);
  color: #1a1305;
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  font: 700 14px var(--font);
  -webkit-tap-highlight-color: transparent;
  animation: pill-in .35s var(--ease) both;
}
@keyframes pill-in { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%); } }
.results-reopen:active { transform: translateX(-50%) scale(.96); }
.results-reopen__dot {
  width: 8px; height: 8px; border-radius: 50%; background: #1a1305;
  box-shadow: 0 0 0 0 rgba(26,19,5,.5);
  animation: ping 1.6s ease-out infinite;
}
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(26,19,5,.45); } 70%,100% { box-shadow: 0 0 0 7px rgba(26,19,5,0); } }

/* ---- Summary ---- */
.summary {
  display: flex;
  justify-content: space-around;
  padding: 14px 16px;
  margin: 12px 16px 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.summary__item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.summary__num {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 800; letter-spacing: -.4px;
}
.summary__lbl { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---- Meeting point + directions links ---- */
.meet {
  margin: 14px 16px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--surface);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.meet__head { font-size: 13.5px; color: var(--text); font-weight: 500; }
.meet__head strong { color: var(--accent-700); font-family: var(--font-display); }
[data-theme="dark"] .meet__head strong { color: var(--accent); }
.meet__diamond { color: var(--accent); }
.meet__link { text-align: center; text-decoration: none; display: flex; }
.meet__friend { display: flex; gap: 8px; }
.meet__friend .meet__link { flex: 1; }
.meet__hint { font-size: 11px; color: var(--muted); }

.panel__actions { display: flex; gap: 8px; margin: 12px 16px 4px; }

.card-list { list-style: none; margin: 0; padding: 8px 10px 12px; }

/* ---- Cards ---- */
.card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .1s var(--ease);
  border: 1px solid transparent;
  animation: card-in .4s var(--ease) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.card:hover { background: var(--surface-2); }
.card:active { transform: scale(.99); }
.card--active {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: var(--accent);
}
.card__icon {
  font-size: 20px; line-height: 1; flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: 10px;
}
.card--active .card__icon { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.card__body { min-width: 0; flex: 1; }
.card__name {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__meta { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 12.5px; }
.card__addr {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; gap: 8px; }
.card__detour {
  font-size: 11px; color: var(--accent-700); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}
[data-theme="dark"] .card__detour { color: var(--accent); }
.card__dir { font-size: 12px; color: var(--primary); text-decoration: none; font-weight: 600; white-space: nowrap; }
.card__dir:hover { text-decoration: underline; }

/* ---- Empty state ---- */
.empty { padding: 36px 24px; text-align: center; color: var(--muted); }
.empty__art { margin-bottom: 14px; opacity: .9; }
.empty__title {
  font-family: var(--font-display);
  font-weight: 700; font-size: 16px; color: var(--text); margin: 0 0 6px;
}
.empty__sub { font-size: 13px; margin: 0; line-height: 1.5; }

/* ---- Info window (map popup) ---- */
.iw { font-family: var(--font); max-width: 240px; }
.iw__title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.iw__addr { font-size: 12px; color: var(--muted); margin: 4px 0; }
.iw__meta { font-size: 11px; color: var(--muted); }
.iw__link { font-size: 13px; color: var(--primary); text-decoration: none; font-weight: 600; }

/* ---- Loader ---- */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 50;
}
.loader__spinner {
  width: 46px; height: 46px;
  border: 4px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader__text { font-size: 14px; color: var(--text); font-weight: 600; }

/* ---- Toast ---- */
.toast {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #20262f;
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  opacity: 0;
  transition: opacity .25s, transform .25s var(--ease);
  max-width: 90vw;
}
.toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--ok   { background: var(--ok); }
.toast--warn { background: var(--warn); }
.toast--err  { background: var(--err); }

/* =========================================================================
   Responsive: mobile app shell
   ========================================================================= */
@media (max-width: 768px) {
  :root { --topbar-h: 54px; }

  /* --- Fixed top app bar --- */
  .topbar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 30;
  }
  .topbar__title {
    flex: 1;
    display: inline-flex; align-items: center; gap: 9px;
    font-family: var(--font-display);
    font-size: 19px; font-weight: 800; letter-spacing: -.5px;
  }
  .topbar__mark { display: inline-flex; margin-top: 1px; }
  .topbar__logo { width: 28px; height: 28px; border-radius: 8px; display: block; }
  .topbar__btn {
    border: none;
    background: transparent;
    color: var(--text);
    width: 44px; height: 44px;
    font-size: 19px;
    border-radius: var(--radius-xs);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s;
  }
  .topbar__btn:active { background: var(--surface-2); }

  #map { top: 0; }

  /* --- Scrim behind the search drawer --- */
  .panel-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    z-index: 35;
    animation: fade-in .25s ease both;
  }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

  /* --- Search panel = slide-down drawer below the top bar --- */
  .panel {
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    left: 0; right: 0;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - var(--topbar-h) - env(safe-area-inset-top));
    padding: 16px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
    border-radius: 0 0 var(--radius) var(--radius);
    border-top: none;
    overscroll-behavior: contain;
    z-index: 40;
    transform: translateY(-110%);
    transition: transform .3s var(--ease);
    box-shadow: var(--shadow-lg);
    animation: none;
  }
  .panel--open { transform: translateY(0); }

  .panel .brand { display: none; }
  .panel__header { justify-content: flex-end; margin-bottom: 6px; }
  .panel #themeToggle { display: none; }
  .panel__tag { display: none; }
  .panel__tag-mobile {
    display: block;
    font-family: var(--font-display);
    font-size: 14px; font-weight: 600; color: var(--text);
    margin: 0 0 14px;
  }
  .panel__collapse { display: inline-flex; }

  /* Bigger tap targets + 16px inputs to stop iOS zoom. */
  .field__input,
  .select { font-size: 16px; min-height: 48px; }
  .field__hint { font-size: 12px; }
  .icon-btn { width: 48px; height: 48px; }
  .btn { padding: 15px 16px; font-size: 15px; }

  /* Category chips: single horizontal scroll row — saves vertical space. */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    margin: 5px -16px 0;
    padding: 2px 16px 6px;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 10px 14px;
    font-size: 13.5px;
  }

  .range { height: 30px; }

  /* --- Results bottom sheet: 3 states (hidden / peek / full) --- */
  .results {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 86dvh;
    max-height: 86dvh;
    border-radius: 20px 20px 0 0;
    border: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(0);
    transition: transform .32s var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
    /* No entrance animation on mobile: it starts collapsed (off-screen) and
       slides in via the transform transition when revealed after a search. */
    animation: none;
  }

  /* Peek: only the summary + meet block + a card edge show; map stays usable. */
  .results--peek { transform: translateY(calc(86dvh - var(--peek-h, 46dvh))); }
  /* Hidden: slid fully off — the floating pill brings it back. */
  .results--collapsed { transform: translateY(100%); }

  .results__scroll { flex: 1; }

  .results__handle {
    display: block;
    width: 46px; height: 5px;
    background: var(--border-strong);
    border-radius: 3px;
    margin: 9px auto 3px;
    cursor: grab;
    flex-shrink: 0;
  }
  .results--peek .results__scroll { overflow-y: hidden; }
  .results__header { padding: 6px 16px 12px; }
  .results__toggle { display: inline-flex; }
  .card { padding: 14px 12px; }
  .card__name { font-size: 15px; }

  /* Pinch zoom is natural on touch; hide the zoom control, lift attribution. */
  .leaflet-control-zoom { display: none; }
  .leaflet-bottom { bottom: 8px; }

  .toast { bottom: 86px; }
}

/* Small phones: tighten a touch more. */
@media (max-width: 420px) {
  .topbar__title { font-size: 18px; }
  .summary__num { font-size: 17px; }
}

/* ---- No-JS fallback ---- */
.noscript {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}
.noscript h1 { font-family: var(--font-display); font-size: 28px; margin: 0 0 12px; }
.noscript p { color: var(--muted); }

/* =========================================================================
   Landing page + curtain-raise transition into the app
   ========================================================================= */
.landing {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(110% 80% at 12% -8%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 60%),
    radial-gradient(90% 70% at 100% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    var(--bg);
  transition: transform .9s var(--ease), opacity .7s var(--ease);
  will-change: transform;
}
/* Faint dotted "map grid" texture. */
.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 26%, transparent) 1px, transparent 1.4px);
  background-size: 26px 26px;
  opacity: .22;
  pointer-events: none;
}
/* Curtain raise: the whole landing lifts away, revealing the app beneath. */
body.launched .landing {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.brand[data-go-home], .topbar__title[data-go-home] { cursor: pointer; }

.lp {
  position: relative;
  z-index: 1;
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px 24px 56px;
}

/* ---- Nav ---- */
.lp__nav { display: flex; align-items: center; justify-content: space-between; }
.lp__brand {
  display: inline-flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--text);
  font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -.5px;
}
.lp__brand img { border-radius: 10px; box-shadow: 0 2px 8px rgba(40,33,16,.18); }
.lp__nav-cta {
  background: transparent; border: 1px solid var(--border-strong); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font: 600 13.5px var(--font);
  transition: background .15s, border-color .15s, transform .1s var(--ease);
}
.lp__nav-cta:hover { background: var(--surface-2); border-color: var(--muted); }
.lp__nav-cta:active { transform: scale(.96); }

/* ---- Hero ---- */
.lp__hero { text-align: center; padding: 64px 0 40px; }
.lp__route { display: flex; justify-content: center; margin-bottom: 26px; }
.lp__route svg { max-width: 100%; }
.lp__diamond { transform-box: fill-box; transform-origin: center; animation: lp-pulse 2.8s var(--ease) infinite; }
@keyframes lp-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.lp__dot--a { animation: lp-bob 3.4s var(--ease) infinite; }
.lp__dot--b { animation: lp-bob 3.4s var(--ease) .6s infinite; }
@keyframes lp-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.lp__line { animation: lp-flow 1.1s linear infinite; }
.lp__line--2 { animation-delay: .2s; }
@keyframes lp-flow { to { stroke-dashoffset: -15; } }

.lp__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 9vw, 84px);
  line-height: .98;
  letter-spacing: -2px;
  margin: 0 0 20px;
}
.amber { color: var(--accent-700); }
[data-theme="dark"] .amber { color: var(--accent); }
.lp__sub {
  max-width: 620px; margin: 0 auto 32px;
  font-size: clamp(16px, 2.4vw, 20px); line-height: 1.55; color: var(--muted);
}
.lp__sub strong { color: var(--text); }
.lp__cta-row { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.lp__cta { font-size: 17px; padding: 16px 30px; border-radius: 14px; }
.lp__free { font-size: 13px; color: var(--muted); letter-spacing: .2px; }

/* Staggered entrance for hero content. */
.lp__hero > * { animation: lp-in .7s var(--ease) both; }
.lp__route { animation-delay: .02s; }
.lp__title { animation-delay: .12s; }
.lp__sub { animation-delay: .22s; }
.lp__cta-row { animation-delay: .32s; }
@keyframes lp-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---- Sections ---- */
.lp__section { padding: 44px 0; }
.lp__h2 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(24px, 4vw, 34px); letter-spacing: -.6px;
  text-align: center; margin: 0 0 34px;
}

.lp__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(3, 1fr); counter-reset: none; }
.lp__step {
  position: relative;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 22px;
  box-shadow: var(--shadow-sm);
}
.lp__step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent); color: #1a1305;
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  margin-bottom: 14px;
}
.lp__step h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 6px; letter-spacing: -.2px; }
.lp__step p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.lp__step code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

.lp__grid { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.lp__feat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 22px 20px;
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s;
}
.lp__feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.lp__feat-ico { font-size: 26px; display: block; margin-bottom: 10px; }
.lp__feat h3 { font-family: var(--font-display); font-size: 16.5px; margin: 0 0 5px; }
.lp__feat p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---- Final CTA + footer ---- */
.lp__final {
  text-align: center; padding: 56px 28px;
  margin-top: 16px;
  background:
    radial-gradient(120% 120% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.lp__final h2 { font-family: var(--font-display); font-weight: 800; font-size: clamp(26px, 5vw, 40px); letter-spacing: -1px; margin: 0 0 22px; }
.lp__foot {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  margin-top: 40px; padding-top: 24px; border-top: 1px dashed var(--border-strong);
  font-size: 13px; color: var(--muted); text-align: center;
}

@media (max-width: 760px) {
  .lp__steps, .lp__grid { grid-template-columns: 1fr; }
  .lp__hero { padding: 40px 0 28px; }
  .lp__nav-cta { display: none; }   /* hero CTA is enough on phones */
  .lp { padding: 22px 18px 44px; }
}

