/*
 * Cutaway Finder.
 *
 * Design: the map IS the page. Every control floats over it on translucent
 * glass, so nothing competes with the terrain you are actually reading.
 * Near-black surfaces, hairline borders, one weight of chrome. The only
 * saturated colour in the entire interface is the two object hues (orange
 * for the main, blue for the freebag) -- so colour always means "gear".
 *
 * Two structural concerns:
 *
 * 1. BIDIRECTIONAL. Hebrew is right-to-left. Mirroring is done with CSS
 *    logical properties (inset-inline-start, border-inline-end,
 *    text-align: start) and flex rows that reverse under dir="rtl", so there
 *    is almost no [dir]-specific CSS.
 *
 * 2. ADAPTIVE BY VIEWPORT AND POINTER, NOT USER AGENT. Below 860px the panel
 *    becomes a bottom sheet that collapses to a peek bar; coarse pointers get
 *    44px hit areas. UA strings lie; viewport and pointer do not.
 */

:root {
  /* skydiv.ing family: navy base, white text, warm gold accent, rounded. */
  --bg: #0a1520;
  --glass: rgba(10, 21, 32, 0.78);
  --glass-solid: #0d1b29;
  --raised: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);

  --text: #f4f7fb;
  --dim: #9fb0c2;
  --faint: #6b8098;

  --accent: #ffd23f;        /* skydiv.ing gold -- brand + primary action */
  --accent-ink: #0a1520;    /* text on the gold */

  --main: #f97316;      /* main canopy -- gear hue, data meaning only */
  --freebag: #3b82f6;   /* freebag + pilot chute */
  --found: #34d399;     /* where the gear was actually recovered */

  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #4ade80;

  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans Hebrew", sans-serif;
  --font-display: "Fredoka", var(--font-body);

  --panel-width: 348px;
  --topbar-height: 54px;
  --peek: 76px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  --radius: 18px;
  --blur: saturate(150%) blur(20px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font: 15px/1.55 var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.app {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#map { position: absolute; inset: 0; background: var(--bg); z-index: 0; }

/* ======================================================================
   Top bar
   ====================================================================== */

.topbar {
  position: absolute;
  top: calc(12px + var(--safe-top));
  inset-inline: 12px;
  z-index: 1200;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 14px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding-inline-end: 4px;
}

.brand-mark {
  font-size: 18px;
  opacity: 0.95;
}
.brand-name { font-family: var(--font-display); font-size: 16px; }
.brand-word { font-weight: 600; color: var(--text); }
.brand-suffix { font-weight: 500; color: var(--dim); }

.topbar-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-end { margin-inline-start: auto; }

/* Selects and other glass controls */
.control select,
select.subtle {
  appearance: none;
  -webkit-appearance: none;
  background: var(--raised);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 26px 7px 11px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  cursor: pointer;
  max-width: 100%;
  text-overflow: ellipsis;
  /* Chevron drawn inline so there is no image request. */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%238d97a6' stroke-width='1.6'><path d='M3 4.5 6 7.5 9 4.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 11px;
}
[dir="rtl"] .control select,
[dir="rtl"] select.subtle {
  padding: 7px 11px 7px 26px;
  background-position: left 9px center;
}

.control select:hover, select.subtle:hover { border-color: var(--line-strong); }
.control select option, select.subtle option { background: var(--glass-solid); color: var(--text); }
.control select optgroup { background: var(--glass-solid); color: var(--dim); }

.dz-control select { min-width: 190px; max-width: 260px; }
.lang-control select { min-width: 82px; }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0 2px;
  border-top: 1px solid var(--line);
}
.footer-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}
/* On desktop the picker lives in the top bar, so the footer row is empty. */
.panel-footer { display: none; }

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.icon-button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); }
.icon-button:disabled { opacity: 0.5; cursor: progress; }
.icon-button.busy .icon { animation: pulse 1.1s ease-in-out infinite; }

.icon {
  width: 17px; height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
.icon .ring { opacity: 0.55; }

@keyframes pulse { 50% { opacity: 0.35; } }

/* Segmented controls */
.segmented {
  display: flex;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--dim);
  padding: 6px 11px;
  font: inherit;
  font-size: 12.5px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: #ffffff;
  color: var(--accent-ink);
  font-weight: 600;
}
.segmented.compact button { padding: 5px 10px; font-size: 12px; }

/* The confidence picker spans the panel with three equal segments. */
.segmented.confidence { width: 100%; margin-top: 4px; }
.segmented.confidence button { flex: 1; text-align: center; }

/* ======================================================================
   Panel
   ====================================================================== */

.panel {
  position: absolute;
  z-index: 1100;
  inset-inline-start: 12px;
  top: calc(var(--topbar-height) + 22px + var(--safe-top));
  bottom: 12px;
  width: var(--panel-width);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 34px rgba(0, 0, 0, 0.5);
  transition: transform 0.26s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s;
}

.app.sheet-collapsed .panel {
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  pointer-events: none;
}
[dir="rtl"] .app.sheet-collapsed .panel {
  transform: translateX(calc(100% + 20px));
}

.sheet-handle { display: none; }

.panel-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 18px calc(18px + var(--safe-bottom));
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.panel-scroll::-webkit-scrollbar { width: 8px; }
.panel-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 4px;
  border: 2px solid transparent; background-clip: content-box;
}

/* ======================================================================
   Blocks and form
   ====================================================================== */

.block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.block:last-of-type { border-bottom: 0; }

.block-title { font-family: var(--font-display); }
.block-title {
  margin: 0 0 9px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.hint {
  margin: 7px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--dim);
}
.hint strong { color: var(--text); font-weight: 600; }

input[type="number"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s;
}
input[type="number"]:hover,
input[type="datetime-local"]:hover { border-color: var(--line-strong); }

/* Coordinates, altitudes and timestamps are Latin numerals and read
   left-to-right even inside a Hebrew page. */
input[type="number"],
input[type="datetime-local"] { direction: ltr; text-align: start; }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 1px;
}

input[type="range"] { width: 100%; accent-color: #cbd5e1; padding: 0; }

.coord-row { display: flex; gap: 8px; }
.coord { flex: 1; min-width: 0; }
.coord > span {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  margin-bottom: 4px;
}
.coord input { font-size: 13px; padding: 8px 10px; }

.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row .grow { flex: 1; min-width: 0; }

select.subtle { margin-top: 10px; width: 100%; font-size: 13px; padding-block: 9px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  font-size: 13.5px;
  cursor: pointer;
}
.check input { accent-color: #e2e8f0; width: 16px; height: 16px; flex: 0 0 16px; }

.swatch { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.swatch[data-object="main"] { background: var(--main); }
.swatch[data-object="freebag"] { background: var(--freebag); }

/* --- advanced ---------------------------------------------------------- */

.advanced { padding: 14px 0; border-bottom: 1px solid var(--line); }
.advanced summary {
  cursor: pointer;
  font-size: 10.5px;
  color: var(--faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  list-style: revert;
}
.advanced summary:hover { color: var(--dim); }

.field { display: block; margin: 12px 0 10px; }
.field > span {
  display: block;
  font-size: 11.5px;
  color: var(--dim);
  margin-bottom: 5px;
}
.field em { font-style: normal; opacity: 0.65; }

.field.inline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 0 0 7px;
}
.field.inline > span { margin: 0; flex: 1; }
.field.inline input { width: 88px; flex: 0 0 88px; font-size: 13px; padding: 7px 9px; }

.subgroup {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 12px;
  margin: 12px 0 0;
  min-inline-size: 0;
}
.subgroup legend {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--faint); padding: 0 5px;
}

.wind-input { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.wind-input th {
  color: var(--faint); font-weight: 500; text-align: start;
  padding-bottom: 5px; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.wind-input td { padding: 2px 3px 2px 0; }
.wind-input input { padding: 6px 7px; font-size: 12.5px; }

.link-button {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; color: var(--dim);
  cursor: pointer; font: inherit; font-size: 12px; padding: 8px 0 0;
}
.link-button:hover { color: var(--text); }

.row-remove {
  background: none; border: 0; color: var(--faint);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 6px;
}
.row-remove:hover { color: var(--danger); }

/* --- buttons ----------------------------------------------------------- */

.compute {
  width: 100%;
  margin: 18px 0 4px;
  padding: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 6px 20px rgba(255, 210, 63, 0.22);
  transition: transform 0.12s, filter 0.15s, box-shadow 0.15s;
}
.compute:hover { filter: brightness(1.05); box-shadow: 0 8px 26px rgba(255, 210, 63, 0.3); }
.compute:active { transform: scale(0.99); }
.compute:disabled { opacity: 0.55; cursor: progress; }

button.secondary {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
button.secondary:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(11, 14, 19, 0.25);
  border-top-color: #0b0e13;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

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

/* --- messages ---------------------------------------------------------- */

.message {
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
  border-inline-start: 2px solid;
  background: rgba(255, 255, 255, 0.04);
}
.message.error { border-color: var(--danger); color: #fecdd3; }
.message.warn { border-color: var(--warn); color: #fde8b0; }
.message.info { border-color: var(--ok); color: #b7f0c8; }

/* --- results ----------------------------------------------------------- */

.result-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 9px;
}

.result-card h3 {
  margin: 0 0 10px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  color: var(--dim);
}
.result-card h3 .dot {
  width: 8px; height: 8px; flex: 0 0 8px;
  border-radius: 50%; background: var(--object-colour);
}

.big-stat { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.big-stat .value { font-family: var(--font-display); color: var(--accent); }
.big-stat .value {
  font-size: 30px; font-weight: 600; line-height: 1.05;
  letter-spacing: -0.035em; font-variant-numeric: tabular-nums;
}
.big-stat .unit { font-size: 12px; color: var(--dim); }

.bearing-line {
  font-size: 12px; color: var(--dim); margin-top: 6px;
  display: flex; align-items: center; gap: 7px;
}
.arrow {
  display: inline-block; font-size: 14px; line-height: 1;
  flex: 0 0 auto; color: var(--object-colour);
}

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px;
  margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.stat-grid dt {
  color: var(--faint); margin: 0;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
}
.stat-grid dd {
  margin: 3px 0 0; font-weight: 600; font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.footnote {
  margin: 11px 0 0; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 11.5px; line-height: 1.5; color: var(--dim);
}

.layer-toggles { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.layer-toggles .check { margin: 0; font-size: 12.5px; }

/* --- wind table -------------------------------------------------------- */

.wind-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.wind-table th {
  text-align: start; font-weight: 500; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--faint); border-bottom: 1px solid var(--line); padding-bottom: 6px;
}
.wind-table td {
  padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-variant-numeric: tabular-nums;
}
.wind-table tr:last-child td { border-bottom: 0; }
.wind-table tr.surface td { color: var(--dim); }
.wind-table .dir-cell { display: flex; align-items: center; gap: 7px; }
.wind-table .wind-arrow { color: #cbd5e1; font-size: 13px; line-height: 1; }

.speed-cell { display: flex; align-items: center; gap: 8px; }
.speed-bar {
  height: 3px; border-radius: 2px; min-width: 2px;
  background: linear-gradient(90deg, rgba(203, 213, 225, 0.35), #cbd5e1);
}

.disclaimer {
  margin: 16px 0 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.07);
  border: 1px solid rgba(251, 113, 133, 0.2);
  font-size: 11.5px;
  line-height: 1.5;
  color: #fecdd3;
}
.disclaimer strong { color: #fff1f2; }

/* ======================================================================
   Map furniture
   ====================================================================== */

.map-legend {
  position: absolute;
  inset-inline-end: 12px;
  bottom: 28px;   /* clears Leaflet's attribution bar */
  z-index: 900;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 11px;
  color: var(--text);
  max-width: 200px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
}
.map-legend h4 {
  margin: 0 0 8px; font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint);
}
.legend-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.legend-swatch { width: 14px; height: 8px; border-radius: 2px; flex: 0 0 14px; }

/* Leaflet.
   The container stays LTR so control positioning and the attribution bar
   behave identically in both directions; only our own popups and labels
   follow the page direction. */
.leaflet-container { background: var(--bg); font: inherit; direction: ltr; }

/* Push Leaflet's top-corner controls clear of the floating top bar. */
.leaflet-top { top: calc(var(--topbar-height) + 22px + var(--safe-top)); }

.leaflet-control-zoom {
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4) !important;
}
.leaflet-control-zoom a {
  background: var(--glass) !important;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  color: var(--text) !important;
  border-bottom: 1px solid var(--line) !important;
  width: 32px !important; height: 32px !important; line-height: 31px !important;
  font-size: 17px !important;
}
.leaflet-control-zoom a:hover { background: rgba(255, 255, 255, 0.1) !important; }
.leaflet-control-zoom a:last-child { border-bottom: 0 !important; }

.leaflet-control-scale-line {
  background: var(--glass) !important;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line) !important;
  border-radius: 6px;
  color: var(--dim) !important;
  font-size: 10px !important;
  padding: 1px 6px !important;
  line-height: 1.5;
}

.leaflet-control-attribution {
  background: rgba(7, 9, 13, 0.7) !important;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--faint) !important;
  font-size: 9.5px !important;
  padding: 1px 6px !important;
  border-radius: 6px 0 0 0;
}
.leaflet-control-attribution a { color: var(--dim) !important; }

.contour-label {
  background: rgba(7, 9, 13, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 2px 7px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}
.contour-label::before { display: none; }

.leaflet-popup-content-wrapper {
  background: var(--glass-solid);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-tip { background: var(--glass-solid); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 11px 13px; font-size: 12px; line-height: 1.55; }
.leaflet-popup-content b { color: #fff; font-weight: 600; }
.leaflet-popup-close-button { color: var(--faint) !important; }

[dir="rtl"] .leaflet-popup-content,
[dir="rtl"] .contour-label { direction: rtl; text-align: right; }

.cutaway-pin {
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

/* ======================================================================
   Narrow screens: the panel becomes a bottom sheet
   ====================================================================== */

@media (max-width: 860px) {
  :root { --topbar-height: 48px; }

  .topbar {
    inset-inline: 8px;
    top: calc(8px + var(--safe-top));
    padding: 0 6px 0 11px;
    gap: 7px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .brand-name { display: none; }          /* the mark alone carries it */
  .dz-control select { min-width: 132px; max-width: 168px; }
  .segmented.compact button { padding: 5px 8px; font-size: 11.5px; }

  .panel {
    inset-inline: 0;
    inset-block: auto 0;
    width: 100%;
    top: auto;
    height: 84dvh;
    max-height: 84dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;

    /* iOS WebKit will not translate an element that also has a
       backdrop-filter -- the collapse transform is silently ignored, and the
       filter can even stop the form inputs from painting (blank Altitude /
       Time). This is the bottom sheet, so it is the element that slides:
       drop the blur here and use a near-opaque background instead. The map is
       still visible around it; only the frosted effect is traded away, on
       mobile only. */
    background: rgba(11, 14, 19, 0.97);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  /* Collapsed: only the handle and its one-line summary stay on screen,
     so the map fills the phone while you walk. */
  .app.sheet-collapsed .panel,
  [dir="rtl"] .app.sheet-collapsed .panel {
    transform: translateY(calc(100% - var(--peek) - var(--safe-bottom)));
    opacity: 1;
    pointer-events: auto;
  }

  .sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: var(--peek);
    padding: 10px 16px 9px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    cursor: pointer;
    font: inherit;
  }
  .grabber {
    width: 40px; height: 4px; flex: 0 0 4px;
    border-radius: 2px; background: var(--line-strong);
  }
  .sheet-summary {
    font-size: 12px;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
    text-align: center;
    line-height: 1.4;
  }

  .panel-scroll { padding-inline: 16px; }
  .panel-footer { display: flex; }
  .lang-control select { min-width: 104px; }

  /* Anything under 16px makes iOS Safari zoom the page on focus. */
  input[type="number"],
  input[type="datetime-local"],
  select { font-size: 16px; }
  .coord input { font-size: 15px; }

  .map-legend {
    bottom: calc(var(--peek) + var(--safe-bottom) + 12px);
    font-size: 10.5px;
    padding: 9px 11px;
  }
  .leaflet-bottom.leaflet-right { bottom: calc(var(--peek) + var(--safe-bottom)); }
  .leaflet-control-attribution { display: none; }  /* credited in the README */
}

/* Touch devices get larger hit areas regardless of screen size. */
@media (pointer: coarse) {
  input[type="number"],
  input[type="datetime-local"],
  select,
  .segmented button { min-height: 42px; }
  .segmented.compact button { min-height: 34px; }
  .icon-button { width: 40px; height: 40px; flex: 0 0 40px; }
  .compute { padding: 15px; font-size: 15.5px; }
  button.secondary { padding: 13px; font-size: 13.5px; }
  .check { padding: 4px 0; }
  .check input { width: 20px; height: 20px; flex: 0 0 20px; }
  .row-remove { padding: 9px 11px; }
  .link-button { padding: 11px 0 0; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .big-stat .value { font-size: 26px; }
  .dz-control select { min-width: 108px; max-width: 130px; }
  .segmented.compact button { padding: 5px 7px; font-size: 11px; }
  .topbar { gap: 6px; padding-inline: 8px 5px; }
}

/* ======================================================================
   Guided help: the ? button and the coach-mark tour
   ====================================================================== */

/* The help button is monochrome like the rest of the chrome but a touch
   brighter, so it reads as "press me" without breaking the rule that only
   gear hues are saturated. */
.help-button {
  border-color: var(--line-strong);
  color: var(--text);
}
.help-button .ring { opacity: 0.8; }

/* A gentle one-time nudge for first-time visitors (three pulses, then still).
   prefers-reduced-motion disables it via the global rule. */
.help-button.nudge {
  animation: help-nudge 1.6s ease-in-out 3;
}
@keyframes help-nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(238, 241, 245, 0); }
  50% { box-shadow: 0 0 0 5px rgba(238, 241, 245, 0.14); }
}

.tour { position: fixed; inset: 0; z-index: 3000; }
.tour[hidden] { display: none; }

.tour-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;   /* the dimming comes from the spotlight shadow */
  cursor: pointer;
}

.tour-spot {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 2px rgba(238, 241, 245, 0.55),
              0 0 0 9999px rgba(5, 7, 11, 0.62);
  pointer-events: none;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, height 0.2s ease;
}

.tour-bubble {
  position: fixed;
  width: min(320px, calc(100vw - 20px));
  background: var(--glass-solid);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
  padding: 14px 15px 13px;
  color: var(--text);
}

.tour-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--glass-solid);
  transform: rotate(45deg);
}
.tour-arrow[hidden] { display: none; }
.tour-arrow.top {
  top: -6px;
  border-top: 1px solid var(--line-strong);
  border-inline-start: 1px solid var(--line-strong);
}
.tour-arrow.bottom {
  bottom: -6px;
  border-bottom: 1px solid var(--line-strong);
  border-inline-end: 1px solid var(--line-strong);
}

.tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tour-count {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.tour-x {
  width: 26px;
  height: 26px;
  margin: -4px -4px -4px 0;
  border: 0;
  background: transparent;
  color: var(--dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  border-radius: 7px;
}
.tour-x::before { content: "\00d7"; }
.tour-x:hover { color: var(--text); background: var(--raised); }

.tour-title {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tour-body {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--dim);
}

.tour-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tour-back {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 8px 4px;
}
.tour-back:hover { color: var(--text); }
.tour-next {
  border: 0;
  border-radius: 9px;
  background: #f2f5f9;
  color: #0b0e13;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 9px 16px;
}
.tour-next:hover { background: #ffffff; }

@media (pointer: coarse) {
  .tour-x { width: 34px; height: 34px; font-size: 22px; }
  .tour-next { padding: 11px 18px; font-size: 13.5px; }
  .tour-back { padding: 11px 6px; font-size: 13.5px; }
}

/* ======================================================================
   Recovery reports -- "found it? mark where"
   ====================================================================== */

.found-cta {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.found-cta:hover {
  border-color: var(--found);
  color: var(--text);
  background: rgba(52, 211, 153, 0.06);
}
.found-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--found);
}

.report-block { border-bottom: 1px solid var(--line); }

textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  resize: vertical;
  min-height: 66px;
}
textarea:hover { border-color: var(--line-strong); }
textarea:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 1px;
}

.privacy-note {
  border-inline-start: 2px solid var(--line-strong);
  padding-inline-start: 9px;
  margin-top: 10px;
}

.report-submit { flex: 2; margin: 0; }
.report-block .inline-row { margin-top: 12px; }
.report-block .secondary { flex: 1; }

/* The found-here pin is a distinct colour from the cutaway parachute, so the
   two can never be confused on the map. */
.found-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--found);
  border: 2px solid #06251a;
  color: #06251a;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

@media (pointer: coarse) {
  textarea { font-size: 16px; }
  .found-cta { padding: 14px 13px; font-size: 13.5px; }
}

/* Multi-select item list in the recovery report. */
.report-objects { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.report-objects .check { margin: 0; font-size: 13px; }

/* ======================================================================
   Hero -- the skydiv.ing "promise first" opening moment
   ====================================================================== */
.hero {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.hero[hidden] { display: none; }
.hero.leaving { opacity: 0; pointer-events: none; }

.hero-sky {
  position: absolute;
  inset: 0;
  background: #0a1520 url("/static/sky.jpg") center 30% / cover no-repeat;
}
/* Navy scrim so the type stays legible over the sunset. */
.hero-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 38%, rgba(10,21,32,0) 0%, rgba(10,21,32,0.35) 55%, rgba(10,21,32,0.82) 100%),
    linear-gradient(to bottom, rgba(10,21,32,0.35), rgba(10,21,32,0.15) 40%, rgba(10,21,32,0.7));
}

.hero-inner {
  position: relative;
  padding: 32px 24px calc(32px + var(--safe-bottom));
  max-width: 640px;
  animation: hero-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes hero-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.hero-brand {
  font-family: var(--font-display);
  font-size: 17px;
  margin-bottom: 26px;
  opacity: 0.95;
  text-shadow: 0 1px 10px rgba(0,0,0,0.4);
}
.hero-headline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  text-shadow: 0 2px 24px rgba(0,0,0,0.45);
}
.hero-sub {
  font-size: clamp(15px, 2.4vw, 19px);
  line-height: 1.5;
  color: rgba(255,255,255,0.9);
  margin: 0 auto 26px;
  max-width: 30ch;
  text-shadow: 0 1px 12px rgba(0,0,0,0.4);
}

.hero-steps {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 14px;
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}
.hero-steps li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  background: rgba(255,255,255,0.12);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 8px 15px 8px 8px;
}
.hero-num {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
}

.hero-cta {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 15px 34px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255,210,63,0.35);
  transition: transform 0.12s, filter 0.15s, box-shadow 0.15s;
}
.hero-cta:hover { filter: brightness(1.05); box-shadow: 0 12px 38px rgba(255,210,63,0.45); }
.hero-cta:active { transform: scale(0.98); }

.hero-free {
  margin: 16px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.75);
}

/* The wordmark becomes a way back to the hero. */
.brand { cursor: pointer; }
