:root {
  --bg: #1c2a33;
  --panel: rgba(28,42,51,0.92);
  --ink: #eef3f5;
  --muted: #9fb3bd;
  --line: rgba(255,255,255,0.12);
  --camp: #2e7d32;
  --fishing: #1565c0;
  --fallback: #f59e0b;
  --signal: #7c3aed;
  --home: #d32f2f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); overscroll-behavior: none; }
#map { position: absolute; inset: 0; }

#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to bottom, rgba(20,30,37,0.85), transparent);
  z-index: 5; pointer-events: none;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; text-shadow: 0 1px 3px rgba(0,0,0,.5); }

.chip {
  pointer-events: auto;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity .15s, transform .1s;
}
.chip:active { transform: scale(.95); }
.chip.off { opacity: .38; }
.chip.month.on { background: #2b6cb0; border-color: #2b6cb0; }
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }

#filters {
  position: absolute; left: 8px; bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; gap: 8px; z-index: 5;
}

#controls {
  position: absolute; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex; flex-direction: column; gap: 8px; z-index: 5;
}
#controls button {
  width: 44px; height: 44px; border-radius: 12px; font-size: 20px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#controls button:active { transform: scale(.95); }

#offline-badge {
  position: absolute; top: calc(env(safe-area-inset-top) + 48px); right: 12px;
  background: rgba(46,125,50,.9); color: #fff; font-size: 11px; font-weight: 600;
  padding: 4px 9px; border-radius: 999px; z-index: 5;
}

/* POI markers */
.poi { transform: translate(-50%, -50%); cursor: pointer; }
.poi .pin {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.poi .lbl {
  position: absolute; left: 50%; top: 20px; transform: translateX(-50%);
  white-space: nowrap; font-size: 11px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 2px rgba(0,0,0,.9);
  pointer-events: none; display: none;
}
#map.labels-on .poi .lbl { display: block; }
/* home label always shown — it's the anchor and never crowds */
.poi.home .lbl { display: block; }
.poi.home .pin { width: 22px; height: 22px; }
/* Overnight-low badge — the hero number, colored cold=good / hot=bad */
.poi .temp {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
  min-width: 26px; text-align: center; padding: 1px 5px; border-radius: 8px;
  font-size: 11px; font-weight: 800; color: #fff; line-height: 1.4;
  box-shadow: 0 1px 4px rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.35);
  pointer-events: none; white-space: nowrap;
}
.poi .temp.coldest::after { content: " ❄"; }
.poi .temp.coldest { box-shadow: 0 0 0 2px #fff, 0 1px 6px rgba(0,0,0,.5); }
.me-dot {
  width: 16px; height: 16px; border-radius: 50%; background: #38bdf8;
  border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(56,189,248,.28);
}

/* Bottom sheet */
#sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  border-top: 1px solid var(--line);
  padding: 8px 18px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 62vh; overflow-y: auto;
  box-shadow: 0 -8px 30px rgba(0,0,0,.4);
  transform: translateY(0); transition: transform .22s ease;
}
#sheet[hidden] { display: block; transform: translateY(110%); }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--muted); margin: 6px auto 12px; opacity: .6; }
.sheet-body h2 { margin: 0 0 4px; font-size: 19px; }
.sheet-cat { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: 6px; color: #fff; margin-bottom: 10px; }
.sheet-row { margin: 8px 0; font-size: 14px; line-height: 1.45; color: var(--ink); }
.sheet-row .k { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 2px; }
.sheet-regs { background: rgba(245,158,11,.14); border: 1px solid rgba(245,158,11,.4); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions a {
  flex: 1; text-align: center; text-decoration: none; font-weight: 700; font-size: 14px;
  padding: 11px; border-radius: 10px; background: #2b6cb0; color: #fff;
}
.sheet-actions a.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }

/* Overnight-low forecast block — the most important thing on the sheet */
.wx { background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 4px 0 12px; }
.wx-head { display: flex; align-items: baseline; gap: 10px; }
.wx-lo { font-size: 30px; font-weight: 800; line-height: 1; }
.wx-cap { color: var(--muted); font-size: 12px; font-weight: 600; }
.wx-days { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.wx-day { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 40px;
  background: rgba(255,255,255,.05); border-radius: 8px; padding: 6px 4px; }
.wx-day b { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.wx-day i { font-size: 15px; font-weight: 800; font-style: normal; }
.wx-as { color: var(--muted); font-size: 11px; margin-top: 10px; }
.approx { font-size: 11px; color: var(--fallback); font-weight: 600; }

.maplibregl-ctrl-attrib { font-size: 10px; }

/* First-load offline-caching overlay */
#loader {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
#loader[hidden] { display: none; }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.loader-text { color: var(--muted); font-size: 14px; font-weight: 600; }
.spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: #f4a259;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
