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

:root {
  --nav-h: 68px;
  --slider-h: 68px;
  --accent: #60A5FA;
  --accent-light: #93C5FD;
  --bg: #0B1220;
  --bg2: #111827;
  --bg3: #1A2436;
  --text: #E0EAFF;
  --muted: #4B6080;
}

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

#map {
  position: fixed;
  inset: 0;
  bottom: calc(var(--nav-h) + var(--slider-h));
  z-index: 1;
}

.leaflet-control-attribution {
  font-size: 9px !important;
  background: rgba(11,18,32,0.85) !important;
  color: #8AAABF !important;
  backdrop-filter: blur(4px);
  border-radius: 4px 0 0 0 !important;
  padding: 2px 6px !important;
}
.leaflet-control-attribution a { color: #93C5FD !important; }

/* ── PANEL ── */
#panel {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--slider-h));
  z-index: 5;
  max-height: 62vh;
  background: var(--bg2);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.36s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#panel.open { transform: translateY(0); }

#panel-handle { display: flex; justify-content: center; padding: 12px 0 4px; }
#panel-handle div { width: 36px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); }
#panel-content { padding: 4px 22px 32px; }
#panel-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; color: var(--text); }
#panel-body { font-size: 14px; line-height: 1.7; color: var(--muted); }

/* ── Info cards ── */
.loading { color: var(--muted); font-size: 14px; padding: 8px 0; }
.loc-card { background: var(--bg3); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; }
.loc-card:last-child { margin-bottom: 0; }
.loc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.loc-name { font-size: 11px; font-weight: 600; color: var(--text); letter-spacing: 0.06em; text-transform: uppercase; }
.loc-bft { font-size: 10px; font-weight: 500; color: var(--muted); background: rgba(255,255,255,0.07); padding: 2px 8px; border-radius: 999px; }
.loc-now { display: flex; margin-bottom: 12px; }
.now-block { flex: 1; text-align: center; }
.now-block + .now-block { border-left: 1px solid rgba(255,255,255,0.07); }
.now-val { font-size: 19px; font-weight: 300; color: var(--text); line-height: 1; margin-bottom: 3px; }
.now-val.muted { color: var(--muted); }
.now-lbl { font-size: 10px; color: var(--muted); }
.forecast-header { font-size: 9px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.weather-row { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-top: 1px solid rgba(255,255,255,0.05); font-size: 12px; }
.wtime { width: 34px; color: var(--muted); font-size: 11px; flex-shrink: 0; }
.wtemp { width: 44px; font-weight: 500; }
.wrain { flex: 1; display: flex; align-items: center; gap: 3px; }
.wwind { width: 80px; text-align: right; font-weight: 500; }
.wgust { width: 64px; text-align: right; color: var(--muted); font-size: 10px; }
.wdir  { font-weight: 600; }
.wunit { font-weight: 300; font-size: 10px; }

.legend-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.legend-title {
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.legend-rows { display: flex; flex-direction: column; gap: 7px; }
.legend-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text);
}
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

#gust-toggle {
  display: flex; align-items: center; gap: 4px;
  background: rgba(96,165,250,0.1);
  border: 1px solid rgba(96,165,250,0.2);
  border-radius: 99px;
  padding: 4px 8px 4px 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
  outline: none;
}
#gust-toggle svg { stroke: var(--muted); transition: stroke 0.15s; }
#gust-label {
  font-size: 10px; font-weight: 500;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  transition: color 0.15s;
  white-space: nowrap;
}
#gust-toggle.active {
  background: rgba(96,165,250,0.2);
  border-color: rgba(96,165,250,0.5);
}
#gust-toggle.active svg { stroke: var(--accent-light); }
#gust-toggle.active #gust-label { color: var(--accent-light); }
#time-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: var(--nav-h);
  height: var(--slider-h);
  z-index: 15;
  background: rgba(11,18,32,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(96,165,250,0.12);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
}

#time-left {
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}
#time-main {
  font-size: 12px; font-weight: 500;
  color: var(--accent);
  line-height: 1;
}
#time-sub {
  font-size: 9px; font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
  display: block;
}

#slider-track { flex: 1; display: flex; align-items: center; height: 44px; }

#time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--pct, 0%),
    rgba(96,165,250,0.15) var(--pct, 0%),
    rgba(96,165,250,0.15) 100%
  );
  outline: none;
  cursor: pointer;
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 6px rgba(96,165,250,0.12), 0 2px 8px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
#time-slider:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 10px rgba(96,165,250,0.18), 0 2px 8px rgba(0,0,0,0.4);
  transform: scale(1.08);
}
#time-slider::-moz-range-thumb {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 0 6px rgba(96,165,250,0.12);
  cursor: pointer;
}

/* ── BOTTOM NAV ── */
#bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 20;
  background: rgba(11,18,32,0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(96,165,250,0.12);
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 8px 2px;
  background: none; border: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none; transition: opacity 0.15s;
}
.nav-btn:active { opacity: 0.6; }
.nav-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; position: relative; }
.nav-icon svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.2s; }
.nav-label { font-size: 9px; font-weight: 400; color: var(--muted); letter-spacing: 0.01em; transition: color 0.2s; line-height: 1; }

.nav-btn.active .nav-icon svg { stroke: var(--accent); }
.nav-btn.active .nav-label { color: var(--accent); font-weight: 500; }
.nav-btn.active .nav-icon::after {
  content: ''; position: absolute;
  top: -6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent-light);
}
