:root {
  --bg: #071018;
  --panel: rgba(10, 18, 27, 0.88);
  --panel-strong: rgba(8, 14, 22, 0.96);
  --line: rgba(255,255,255,.13);
  --text: #f5f8fb;
  --muted: #aab7c4;
  --accent: #ffb21a;
  --good: #35d07f;
  --maybe: #ffd45d;
  --bad: #ff6b6b;
  --rain: #4bb3fd;
  --wind: #b77cff;
  --shadow: 0 20px 70px rgba(0,0,0,.35);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select { font: inherit; }
#app { width: 100vw; height: 100vh; position: relative; overflow: hidden; }
.map { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; overflow: hidden; background: #d7ded4; touch-action: none; overscroll-behavior: contain; }
.leaflet-container { width: 100%; height: 100%; background: #d7ded4 !important; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: contain; }
.leaflet-tile { max-width: none !important; width: 256px !important; height: 256px !important; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-marker-pane { z-index: 600; }
.wind-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 430; pointer-events: none; mix-blend-mode: normal; opacity: .92; filter: drop-shadow(0 0 2px rgba(255,255,255,.35)); }
.topbar { position: absolute; z-index: 900; top: 16px; left: 16px; right: 16px; display: flex; gap: 12px; align-items: center; pointer-events: none; }
.brand, .searchbox { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 18px; background: var(--panel-strong); box-shadow: var(--shadow); border: 1px solid var(--line); min-width: max-content; }
.logo { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #ffb21a, #ff5b5b); font-size: 22px; }
.brand h1 { margin: 0; font-size: 16px; line-height: 1; letter-spacing: -.02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.searchbox { flex: 1; max-width: 440px; display: flex; background: var(--panel-strong); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }
.searchbox input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); padding: 0 14px; min-width: 0; }
.searchbox button, .iconbtn { border: 0; color: var(--text); background: rgba(255,255,255,.09); padding: 11px 14px; cursor: pointer; transition: .15s; }
.searchbox button:hover, .iconbtn:hover { background: rgba(255,255,255,.16); }
.sidepanel { position: absolute; z-index: 850; top: 88px; left: 16px; width: min(410px, calc(100vw - 32px)); max-height: calc(100vh - 120px); display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.card { pointer-events: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px); overflow: hidden; }
.hero { padding: 18px; }
.hero-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.hero h2 { margin: 4px 0 6px; font-size: 28px; letter-spacing: -.04em; }
.hero .sub { color: var(--muted); font-size: 14px; line-height: 1.45; }
.scorebubble { width: 74px; height: 74px; flex: 0 0 74px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 24px; background: conic-gradient(var(--good) calc(var(--score) * 1%), rgba(255,255,255,.12) 0); position: relative; }
.scorebubble:after { content:""; position: absolute; inset: 7px; background: #101924; border-radius: 50%; }
.scorebubble span { position: relative; z-index: 1; }
.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 16px; }
.metric { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 12px; }
.metric label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.metric strong { display: block; margin-top: 5px; font-size: 18px; }
.controls { padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.selectrow { display: flex; flex-direction: column; gap: 6px; }
.selectrow label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.selectrow select { color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; outline: none; }
.selectrow select option { color: #101924; background: #f5f8fb; }
.selectrow select option:checked { color: #071018; background: #d8dde4; font-weight: 800; }
.windows { overflow: auto; max-height: 42vh; }
.window-day { border-top: 1px solid rgba(255,255,255,.08); }
.window-row { width: 100%; display: grid; grid-template-columns: 70px 1fr auto; gap: 11px; align-items: center; padding: 12px 14px; border: 0; color: var(--text); background: transparent; text-align: left; cursor: pointer; transition: .15s; }
.window-row:hover, .window-row.selected { background: rgba(255,255,255,.08); }
.day { font-weight: 800; }
.date { color: var(--muted); font-size: 12px; }
.bar { height: 9px; background: rgba(255,255,255,.11); border-radius: 99px; overflow: hidden; margin-top: 7px; }
.fill { height: 100%; border-radius: inherit; background: var(--good); }
.fill.maybe { background: var(--maybe); }
.fill.bad { background: var(--bad); }
.row-title { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.row-title span:last-child { color: var(--muted); }
.day-weather-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.day-weather-meta span { color: var(--text); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 999px; padding: 4px 7px; font-size: 11px; font-weight: 750; }
.grade { min-width: 58px; text-align: center; border-radius: 999px; padding: 7px 9px; font-size: 12px; font-weight: 900; color: #071018; background: var(--good); }
.grade.maybe { background: var(--maybe); }
.grade.bad { background: var(--bad); color: #fff; }

.hourly-panel { padding: 0 14px 14px 95px; background: rgba(0,0,0,.12); }
.hourly-head { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.hourly-list { display: grid; gap: 6px; max-height: 235px; overflow: auto; padding-right: 4px; }
.hour-row { display: grid; grid-template-columns: 48px minmax(70px, 1fr) 42px 52px; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.hour-row strong { color: var(--text); font-size: 12px; text-align: right; }
.hour-time { color: var(--text); font-weight: 800; }
.hour-rainbar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.11); overflow: hidden; }
.hour-rainbar i { display: block; height: 100%; border-radius: inherit; background: var(--rain); }

.bottompanel { position: absolute; z-index: 860; left: 445px; right: 16px; bottom: 16px; display: grid; grid-template-columns: minmax(260px, 1.2fr) minmax(240px, .8fr); gap: 12px; pointer-events: none; }
.detail, .legend { pointer-events: auto; padding: 16px; }
.detail h3, .legend h3 { margin: 0 0 12px; font-size: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.pill { padding: 10px; border-radius: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); }
.pill span { color: var(--muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.pill strong { margin-top: 5px; display: block; font-size: 15px; }
.legend-items { display: grid; gap: 9px; font-size: 13px; color: var(--muted); }
.legend-line { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); }
.dot.maybe { background: var(--maybe); }.dot.bad{background:var(--bad)}.dot.rain{background:var(--rain)}.dot.wind{background:var(--wind)}
.status { position: absolute; z-index: 920; right: 16px; top: 88px; max-width: 360px; padding: 12px 14px; background: var(--panel-strong); border: 1px solid var(--line); border-radius: 16px; color: var(--muted); box-shadow: var(--shadow); display: none; }
.status.show { display: block; }
.leaflet-control-attribution { font-size: 10px; }
.zone-marker { background: rgba(255,178,26,.9); border: 2px solid white; width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 0 7px rgba(255,178,26,.22); }
.route-tip { margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(255,178,26,.11); border: 1px solid rgba(255,178,26,.24); color: #ffe1a2; font-size: 13px; line-height: 1.45; }
@media (max-width: 980px) {
  body { overflow: auto; }
  #app { min-height: 100vh; height: auto; display: flex; flex-direction: column; }
  .map { position: relative; height: 58svh; min-height: 410px; max-height: 560px; flex: 0 0 auto; }
  .wind-canvas { height: 100%; }
  .topbar { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 900; padding: 0; flex-direction: column; align-items: stretch; gap: 8px; background: transparent; }
  .searchbox { order: 1; width: 100%; max-width: none; }
  .brand { order: 2; align-self: flex-start; padding: 10px 12px; }
  .brand h1 { font-size: 14px; }
  .brand p { display: none; }
  .sidepanel { position: relative; top: auto; left: auto; width: auto; max-height: none; padding: 12px; z-index: 4; }
  .windows { max-height: none; }
  .bottompanel { position: relative; left: auto; right: auto; bottom: auto; grid-template-columns: 1fr; padding: 0 12px 12px; z-index: 4; }
  .detail-grid { grid-template-columns: repeat(2,1fr); }
  .hourly-panel { padding-left: 14px; }
  .hour-row { grid-template-columns: 48px minmax(80px, 1fr) 40px 52px; }
}
@media (max-width: 520px) {
  .map { height: 62svh; min-height: 430px; }
  .window-row { grid-template-columns: 50px 1fr; }
  .window-row .grade { grid-column: 2; justify-self: start; }
  .hourly-list { max-height: 260px; }
}

/* Leaflet hardening: keeps the tile grid stable in Netlify deploy previews and darkens OSM tiles. */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}
.leaflet-container img.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  width: 256px !important;
  height: 256px !important;
  transform-origin: 0 0 !important;
}
.base-map-tile {
  filter: brightness(.82) contrast(1.08) saturate(1.05);
}

@media (max-width: 980px) {
  .leaflet-tile-container, .leaflet-map-pane { will-change: transform; }
}

.map-notices {
  position: absolute;
  z-index: 910;
  top: 88px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  pointer-events: none;
}
.map-notices.below-routes-panel {
  z-index: 965;
}
.map-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  background: var(--panel-strong);
  border: 1px solid rgba(255,178,26,.38);
  border-radius: 16px;
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
}
.map-notice[hidden] { display: none; }
.map-notice span {
  color: #ffe1a2;
  font-size: 13px;
  line-height: 1.35;
}
.map-notice button {
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  color: #071018;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.map-notice button:hover { filter: brightness(1.08); }

.wind-pin {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 74px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(8, 14, 22, .96);
  color: var(--text);
  border: 1px solid rgba(255,178,26,.75);
  box-shadow: 0 12px 36px rgba(0,0,0,.42), 0 0 0 6px rgba(255,178,26,.16);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.wind-pin:after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 9px solid rgba(255,178,26,.92);
}
.wind-pin-tooltip {
  background: rgba(8, 14, 22, .96);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}
.wind-pin-tooltip:before { display: none; }

@media (max-width: 980px) {
  .map-notices {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    z-index: 5;
    margin: 0 12px;
    display: none;
    pointer-events: none;
  }
  .map-notices.has-visible-notices { display: flex; }
  .map-notice { pointer-events: auto; }
}
@media (max-width: 520px) {
  .map-notices { margin: 0 8px; gap: 8px; }
  .map-notice { align-items: flex-start; flex-direction: column; }
}

.selected-zone-ring {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 2px solid rgba(53,208,127,.92);
  background: rgba(53,208,127,.12);
  box-shadow: 0 0 0 10px rgba(53,208,127,.08), 0 0 28px rgba(53,208,127,.22);
  transform: translateZ(0);
  pointer-events: none;
}
.selected-zone-ring.maybe {
  border-color: rgba(255,212,93,.95);
  background: rgba(255,212,93,.13);
  box-shadow: 0 0 0 10px rgba(255,212,93,.08), 0 0 28px rgba(255,212,93,.22);
}
.selected-zone-ring.bad {
  border-color: rgba(255,107,107,.95);
  background: rgba(255,107,107,.13);
  box-shadow: 0 0 0 10px rgba(255,107,107,.08), 0 0 28px rgba(255,107,107,.22);
}

/* GPX route browser */
.routes-card { padding: 14px; }
.routes-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.route-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.routes-head h3 { margin: 0; font-size: 16px; }
.routes-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.route-auth-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.route-auth-actions button,
.route-upload-toggle,
.route-upload button,
.route-tabs button { border: 0; border-radius: 999px; padding: 8px 10px; font-size: 12px; font-weight: 850; cursor: pointer; color: #071018; background: var(--accent); }
.route-auth-actions button[hidden] { display: none; }
.route-upload-toggle { width: 100%; margin-top: 12px; }
.route-upload-toggle.active { background: rgba(255,255,255,.14); color: var(--text); border: 1px solid var(--line); }
.route-upload { display: grid; gap: 8px; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.045); }
.route-upload[hidden] { display: none; }
.route-upload.disabled { opacity: .58; }
.route-upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.route-upload input { width: 100%; min-width: 0; color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; outline: none; }
.route-file-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.route-file-row input[type="file"] { font-size: 11px; padding: 8px; }
.route-upload button:disabled { cursor: not-allowed; filter: grayscale(.8); opacity: .7; }
.route-tabs { display: flex; gap: 8px; margin-top: 12px; }
.route-tabs button { color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.route-tabs button.active { color: #071018; background: var(--accent); border-color: rgba(255,178,26,.8); }
.route-list { display: grid; gap: 8px; margin-top: 10px; max-height: 240px; overflow: auto; padding-right: 2px; }
.route-item { width: 100%; color: var(--text); background: rgba(255,255,255,.065); border: 1px solid rgba(255,255,255,.09); border-radius: 14px; padding: 10px; transition: .15s; }
.route-item:hover,
.route-item.selected { background: rgba(255,178,26,.13); border-color: rgba(255,178,26,.55); }
.route-view-btn { width: 100%; display: block; text-align: left; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; }
.route-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.route-download-btn,
.route-share-btn,
.route-delete-btn { border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 900; cursor: pointer; }
.route-download-btn { border: 1px solid rgba(75,179,253,.45); color: #d7ecff; background: rgba(75,179,253,.12); }
.route-download-btn:hover { border-color: rgba(75,179,253,.82); background: rgba(75,179,253,.2); }
.route-share-btn { border: 1px solid rgba(255,178,26,.52); color: #ffe1a2; background: rgba(255,178,26,.12); }
.route-share-btn:hover { border-color: rgba(255,178,26,.85); background: rgba(255,178,26,.2); }
.route-delete-btn { border: 1px solid rgba(255,107,107,.42); color: #ffd0d0; background: rgba(255,107,107,.12); }
.route-delete-btn:hover { border-color: rgba(255,107,107,.8); background: rgba(255,107,107,.22); }
.route-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.route-title-row strong { font-size: 13px; }
.route-title-row span { color: var(--accent); font-size: 12px; font-weight: 900; white-space: nowrap; }
.route-meta,
.route-description,
.route-weather,
.route-empty { color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 5px; }
.route-weather { color: #d7ecff; }
@media (max-width: 980px) {
  .route-list { max-height: none; }
}
@media (max-width: 520px) {
  .route-upload-grid,
  .route-file-row { grid-template-columns: 1fr; }
  .route-auth-actions { flex-direction: column; }
}

/* Auth and GPX route layout iteration */
.search-auth-row {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  pointer-events: none;
}
.search-auth-row .searchbox,
.top-auth-actions { pointer-events: auto; }
.top-auth-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.top-auth-actions button {
  border: 0;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-weight: 850;
  white-space: nowrap;
}
.top-auth-actions button.active,
.top-auth-actions button.logged-in {
  border-color: rgba(255,178,26,.65);
  background: rgba(255,178,26,.18);
}

.routes-card {
  display: none;
  position: fixed;
  top: 88px;
  right: 16px;
  left: auto;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 104px);
  overflow: auto;
  z-index: 875;
}
.routes-card.open { display: block; }
.route-panel-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.mobile-route-menu { display: none; }

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 18px;
}
.auth-modal[hidden] { display: none; }
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(5px);
}
.auth-dialog {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  z-index: 1;
}
.auth-dialog h3 { margin: 0 0 6px; }
.auth-help,
.auth-message { color: var(--muted); font-size: 13px; line-height: 1.4; }
.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  font-size: 20px;
}
.auth-mode-row { display: flex; gap: 8px; margin: 14px 0 10px; }
.auth-mode-row button,
.custom-auth-form button {
  border: 0;
  border-radius: 999px;
  padding: 9px 11px;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 850;
}
.auth-mode-row button.active,
.custom-auth-form button {
  color: #071018;
  background: var(--accent);
  border-color: rgba(255,178,26,.75);
}
.custom-auth-form { display: grid; gap: 9px; }
.custom-auth-form input {
  width: 100%;
  color: var(--text);
  background: rgba(255,255,255,.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
.auth-message { min-height: 18px; margin-top: 10px; color: #ffe1a2; }

@media (max-width: 980px) {
  .search-auth-row { order: 1; width: 100%; gap: 8px; }
  .searchbox { order: initial; }
  .top-auth-actions { flex: 0 0 auto; }
  .top-auth-actions button { padding: 11px 12px; }
  .brand { order: 2; }
  .routes-card {
    position: fixed;
    top: 74px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100svh - 92px);
    z-index: 960;
  }
}

@media (max-width: 520px) {
  .search-auth-row { gap: 7px; }
  .top-auth-actions button { padding: 10px 11px; font-size: 13px; }
  .searchbox button { padding: 10px 11px; }
}

/* 18 June debug fixes: unlock existing accounts and make mobile panels scale better */
.route-unlock-btn {
  margin-top: 8px;
  border: 1px solid rgba(255,178,26,.58);
  border-radius: 999px;
  color: #071018;
  background: var(--accent);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.route-unlock-btn[hidden] { display: none; }

@media (max-width: 980px) {
  .routes-card { overflow: auto; }
  .route-list { max-height: 42svh; overflow: auto; }
}

@media (max-width: 560px) {
  .sidepanel { padding: 8px; gap: 8px; }
  .hero { padding: 14px; }
  .hero-head { gap: 10px; }
  .eyebrow { font-size: 10px; letter-spacing: .16em; }
  .hero h2 { font-size: clamp(25px, 8.2vw, 34px); line-height: .98; }
  .hero .sub { font-size: clamp(13px, 4vw, 16px); line-height: 1.35; }
  .scorebubble { width: 64px; height: 64px; flex-basis: 64px; font-size: 21px; }
  .scorebubble:after { inset: 6px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
  .metric { min-width: 0; padding: 10px; border-radius: 15px; }
  .metric label { font-size: 10px; letter-spacing: .12em; }
  .metric strong { font-size: clamp(18px, 5.6vw, 23px); line-height: 1.12; overflow-wrap: anywhere; }
  .metric:last-child { grid-column: 1 / -1; }
  .route-tip { padding: 10px; font-size: 12px; line-height: 1.35; }
  .controls { padding: 10px; gap: 8px; }
  .selectrow select { min-width: 0; font-size: 15px; }
  .windows { border-radius: 18px; }
  .window-row { padding: 10px 12px; gap: 9px; }
  .row-title { align-items: flex-start; }
  .day-weather-meta span { font-size: 10px; }
  .routes-card { top: 64px; max-height: calc(100svh - 76px); }
  .route-upload input { font-size: 16px; }
}


/* Desktop zoom buttons and calmer map controls */
.leaflet-bottom.leaflet-right {
  z-index: 960 !important;
}
.leaflet-bottom.leaflet-right .leaflet-control {
  margin-right: 18px !important;
  margin-bottom: 18px !important;
}

.leaflet-control-zoom {
  display: block !important;
  border: 1px solid rgba(8, 14, 22, .18) !important;
  border-radius: 14px !important;
  box-shadow: 0 14px 40px rgba(0,0,0,.22) !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  width: 42px !important;
  height: 42px !important;
  line-height: 40px !important;
  color: #101924 !important;
  background: rgba(255,255,255,.94) !important;
  border: 0 !important;
  font-size: 22px !important;
  font-weight: 850 !important;
}
.leaflet-control-zoom a:hover {
  background: #fff !important;
}
.leaflet-control-zoom-in {
  border-bottom: 1px solid rgba(8, 14, 22, .14) !important;
}
@media (max-width: 980px) {
  .leaflet-control-zoom { display: none !important; }
}


/* Mobile route panel should behave as a true modal above the app. */
.route-modal-backdrop { display: none; }

@media (max-width: 980px) {
  body.route-panel-open {
    overflow: hidden;
  }
  body.route-panel-open .route-modal-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(0, 0, 0, .38);
    backdrop-filter: blur(2px);
    pointer-events: auto;
  }
  body.route-panel-open .sidepanel {
    z-index: 1200;
  }
  body.route-panel-open .topbar,
  body.route-panel-open .map-notices,
  body.route-panel-open .bottompanel {
    pointer-events: none;
    filter: blur(3px);
  }
  body.route-panel-open .sidepanel > :not(.routes-card.open) {
    pointer-events: none;
    filter: blur(3px);
    opacity: .58;
  }
  body.route-panel-open .routes-card.open {
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100svh - 24px);
    z-index: 1201;
    pointer-events: auto;
  }
}

@media (max-width: 560px) {
  body.route-panel-open .routes-card.open {
    top: 10px;
    max-height: calc(100svh - 20px);
  }
}
