/* ============================================================
   HK Weather Dashboard — Professional Dark-First Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================================
   DESIGN TOKENS — Dark Theme (default)
   ============================================================ */
:root {
  --bg-primary: #090d14;
  --bg-secondary: #111723;
  --bg-surface: #161d2b;
  --bg-surface-hover: #1c2334;
  --bg-elevated: #1e2738;
  --bg-input: #111723;
  --bg-overlay: rgba(0,0,0,0.55);
  --border-default: #243044;
  --border-subtle: #1d2a3a;
  --border-accent: rgba(59,130,246,0.35);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-muted: rgba(59,130,246,0.12);
  --accent-glow: rgba(59,130,246,0.25);
  --text-primary: #e6edf5;
  --text-secondary: #94a3b8;
  --text-muted: #5e6d80;
  --text-inverse: #0f172a;
  --temp-hot: #ef4444;
  --temp-warm: #f97316;
  --temp-mild: #eab308;
  --temp-cool: #22d3ee;
  --temp-cold: #3b82f6;
  --rain: #3b82f6;
  --rain-fill: rgba(59,130,246,0.18);
  --humidity: #22c55e;
  --humidity-fill: rgba(34,197,94,0.15);
  --pressure: #a855f7;
  --pressure-fill: rgba(168,85,247,0.12);
  --wind: #f59e0b;
  --wind-fill: rgba(245,158,11,0.12);
  --uv: #a855f7;
  --vis: #14b8a6;
  --lightning: #fbbf24;
  --warn-bg: rgba(239,68,68,0.10);
  --warn-border: rgba(239,68,68,0.25);
  --warn-text: #fca5a5;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #eab308;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-glow: 0 4px 20px rgba(59,130,246,0.15), 0 2px 8px rgba(59,130,246,0.08);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Cascadia Code', monospace;
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --chart-grid: rgba(148,163,184,0.08);
  --chart-grid-zero: rgba(148,163,184,0.18);
  --card-header-height: 3px;
}

/* ============================================================
   DESIGN TOKENS — Light Theme
   ============================================================ */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --bg-overlay: rgba(15,23,42,0.3);
  --border-default: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-accent: rgba(37,99,235,0.25);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-muted: rgba(37,99,235,0.06);
  --accent-glow: rgba(37,99,235,0.12);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #fff;
  --temp-hot: #dc2626;
  --temp-warm: #ea580c;
  --temp-mild: #ca8a04;
  --temp-cool: #0891b2;
  --temp-cold: #2563eb;
  --rain: #2563eb;
  --rain-fill: rgba(37,99,235,0.10);
  --humidity: #16a34a;
  --humidity-fill: rgba(22,163,74,0.08);
  --pressure: #7c3aed;
  --pressure-fill: rgba(124,58,237,0.08);
  --wind: #d97706;
  --wind-fill: rgba(217,119,6,0.08);
  --uv: #7c3aed;
  --vis: #0d9488;
  --lightning: #d97706;
  --warn-bg: rgba(220,38,38,0.06);
  --warn-border: rgba(220,38,38,0.2);
  --warn-text: #dc2626;
  --success: #16a34a;
  --error: #dc2626;
  --warning: #ca8a04;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 16px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-glow: 0 4px 20px rgba(37,99,235,0.10), 0 2px 8px rgba(37,99,235,0.06);
  --chart-grid: rgba(100,116,139,0.10);
  --chart-grid-zero: rgba(100,116,139,0.16);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3 { color: var(--text-primary); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
  gap: 16px;
}

.header h1 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  white-space: nowrap;
}

.header-icon { width: 56px; height: 56px; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.header-meta span { white-space: nowrap; }
.header-meta strong { color: var(--text-primary); font-weight: 600; }

/* ---- Nav Links ---- */
.nav-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}
.nav-link:hover {
  background: var(--accent-muted);
  color: var(--accent);
}
.nav-link.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

/* ---- Theme Toggle ---- */
.theme-toggle {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--accent);
  background: var(--accent-muted);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---- Refresh Button ---- */
#refreshBtn {
  background: var(--accent-muted);
  border: none;
  color: var(--accent);
  padding: 6px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 5px;
}
#refreshBtn:hover {
  background: var(--accent);
  color: var(--text-inverse);
}
#refreshBtn.refreshing { opacity: 0.5; pointer-events: none; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 48px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  border: 1px solid var(--border-subtle);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition-fast);
  position: relative;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}
.card-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.card-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}
.card-select {
  font-size: 0.8rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  max-width: 100%;
  cursor: pointer;
  font-weight: 500;
  font-family: var(--font);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: auto;
}
.card-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================================
   COMBINED CURRENT CONDITIONS CARD
   ============================================================ */
.combined-card {
  grid-column: 1 / -1;
  padding: 24px 28px;
}
.combined-card .card-header {
  margin-bottom: 12px;
}
.combined-card .card-title {
  font-size: 0.78rem;
}
.combined-row {
  display: flex;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.combined-row:last-of-type { border-bottom: none; padding-bottom: 4px; }
.combined-icon {
  width: 34px; height: 34px;
  margin-right: 14px;
  flex-shrink: 0;
  opacity: 0.8;
}
.combined-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 200px;
}
.combined-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  text-align: right;
}
.combined-value-group {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.combined-value-group .combined-value {
  margin-left: 0;
}
.combined-suffix {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}
.combined-wind {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.combined-card .map-btn {
  display: inline-block;
  background: var(--accent);
  color: var(--text-inverse);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.combined-card .map-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* ============================================================
   STATUS BAR
   ============================================================ */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 20px;
  font-weight: 500;
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34,197,94,0.5);
  transition: background var(--transition), box-shadow var(--transition);
}
.status-dot.error { background: var(--error); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.status-dot.loading { background: var(--warning); box-shadow: 0 0 8px rgba(234,179,8,0.5); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   WARNINGS
   ============================================================ */
.warnings {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-left: 3px solid var(--error);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--warn-text);
  font-weight: 500;
  font-size: 0.84rem;
  line-height: 1.5;
}
.warnings.hidden { display: none; }
.warn-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; opacity: 0.9; }
.warn-content { flex: 1; }
.warn-content div { margin-bottom: 3px; }
.warn-content div:last-child { margin-bottom: 0; }

/* ============================================================
   GRID
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.full-width { grid-column: 1 / -1; }

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}
.section-title:first-of-type { margin-top: 0; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}
.chart-container canvas { width: 100% !important; }

/* ============================================================
   FORECAST CARDS
   ============================================================ */
.forecast-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.forecast-scroll::-webkit-scrollbar { height: 5px; }
.forecast-scroll::-webkit-scrollbar-track { background: transparent; }
.forecast-scroll::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}

.forecast-card {
  width: 144px;
  min-height: 258px;
  text-align: center;
  padding: 16px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.forecast-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-default);
}
.forecast-card .weekday {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.forecast-card .date {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}
.forecast-card img {
  width: 50px; height: 50px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
  transition: transform var(--transition);
}
.forecast-card:hover img { transform: scale(1.06); }
.forecast-card .temps {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.3px;
  display: flex;
  gap: 8px;
}
.forecast-card .temps .hi { color: var(--temp-warm); }
.forecast-card .temps .lo { color: var(--temp-cool); }
.forecast-card .weather {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 5px;
  line-height: 1.3;
  flex: 1;
}
.forecast-card .wind {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.25;
}
.forecast-card .psr {
  font-size: 0.66rem;
  font-weight: 700;
  margin-top: 6px;
  color: var(--accent);
  padding: 3px 10px;
  background: var(--accent-muted);
  border-radius: var(--radius-pill);
  display: inline-block;
}

/* ============================================================
   STATION LIST
   ============================================================ */
.station-list { max-height: 320px; overflow-y: auto; }
.station-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  transition: background var(--transition-fast);
}
.station-row:hover { background: var(--bg-surface-hover); }
.station-row:last-child { border-bottom: none; }
.station-name { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); }
.station-value { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

/* ============================================================
   TIME SERIES CONTROLS
   ============================================================ */
.ts-controls {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ts-controls select {
  padding: 7px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  background: var(--bg-input);
  color: var(--text-primary);
  min-width: 150px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: auto;
}
.ts-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.ts-controls button {
  padding: 7px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--bg-surface);
  color: var(--accent);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: all var(--transition-fast);
}
.ts-controls button:hover {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* ---- Station Pills ---- */
.ts-station-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  flex: 1;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 85%, transparent 100%);
}
.ts-pill {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}
.ts-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}
.ts-pill.active {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ============================================================
   CLIMATE PAGE
   ============================================================ */
.climate-station {
  font-size: 0.78rem;
  color: var(--text-muted);
  align-self: center;
  white-space: nowrap;
  font-weight: 500;
}
.climate-slider {
  width: 100%;
  margin-top: 12px;
  cursor: pointer;
  accent-color: var(--accent);
  height: 5px;
  border-radius: 3px;
  appearance: none;
  background: var(--border-default);
}
.climate-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ============================================================
   SITUATION TEXT
   ============================================================ */
.situation-text {
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--bg-surface-hover) 40%,
    transparent 80%
  );
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 20px 24px;
}
.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
  width: 60%;
}
.skeleton-line.short { width: 35%; }
.skeleton-line.long { width: 80%; }

/* ============================================================
   MAP PAGE ELEMENTS (usable from map.html)
   ============================================================ */
.map-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-body .header { flex-shrink: 0; }
.map-body .footer {
  flex-shrink: 0;
  z-index: 1000;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  padding: 6px 24px;
  font-size: 0.7rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#mapContainer { flex: 1; position: relative; min-height: 0; }
#map { width: 100%; height: 100%; }

.map-dropdown select {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.84rem;
  font-family: var(--font);
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  cursor: pointer;
  outline: none;
  appearance: auto;
}
.map-dropdown select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.marker-wrapper { background: none !important; border: none !important; }
.marker-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px; height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  color: #fff;
  font-weight: 700;
  font-size: 10px;
  text-align: center;
  border: 2px solid rgba(0,0,0,0.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.marker-pill.no-data {
  background: #6b7280 !important;
  font-size: 12px;
}
.marker-pill.wind-label {
  min-width: 32px; height: 32px;
  font-size: 12px;
}
.station-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 0 4px var(--bg-primary), 0 0 4px var(--bg-primary), 0 0 4px var(--bg-primary);
  white-space: nowrap;
  line-height: 14px;
}

.legend {
  background: var(--bg-surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-default);
  font-size: 0.7rem;
  line-height: 1.7;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
}
.legend-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 0.76rem;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.popup-content {
  font-size: 0.84rem;
  line-height: 1.6;
  min-width: 150px;
  color: #1e293b;
}
.popup-name {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 4px;
}
.popup-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.popup-label { color: #64748b; }
.popup-value { font-weight: 600; color: #0f172a; }

.record-ctrl {
  background: var(--bg-surface);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-default);
  font-size: 0.7rem;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
}

/* ---- Station Detail Panel (map page) ---- */
.station-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 44vh;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius) var(--radius) 0 0;
}
.station-panel.open { transform: translateY(0); }
.station-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.station-panel-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); }
.station-panel-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1.3rem; cursor: pointer; padding: 4px 8px; line-height: 1;
  border-radius: var(--radius-xs); transition: all var(--transition-fast);
}
.station-panel-close:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.station-panel-current {
  padding: 0 16px 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.station-panel-current strong { color: var(--text-primary); }
.station-panel-chart-title {
  padding: 6px 16px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.station-panel-controls {
  padding: 0 16px 8px;
  flex-shrink: 0;
}
.station-panel-controls select {
  padding: 5px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  appearance: auto;
}
.station-panel-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.station-panel-chart {
  flex: 1;
  min-height: 0;
  padding: 0 12px 12px;
}
@media (max-width: 768px) {
  .station-panel { max-height: 50vh; border-radius: var(--radius) var(--radius) 0 0; }
  .station-panel-name { font-size: 0.85rem; }
  .station-panel-current { font-size: 0.72rem; }
}

/* ============================================================
   FOCUS-VISIBLE (accessibility)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px 28px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.disclaimer {
  margin-top: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeInUp 0.35s ease-out both; }
.grid > *:nth-child(2) .card { animation-delay: 0.04s; }
.grid > *:nth-child(3) .card { animation-delay: 0.08s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .header { padding: 0 16px; }
  .header-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .header h1 { font-size: 0.95rem; }
  .header-icon { width: 46px; height: 46px; }
  .header-meta {
    font-size: 0.72rem;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
   #refreshBtn, .nav-link { padding: 5px 11px; font-size: 0.72rem; }
  .theme-toggle { width: 28px; height: 28px; }
  .main { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 16px 18px; }
  .card-value { font-size: 1.85rem; }
  .combined-card { grid-column: 1 / -1; }
  .combined-value { font-size: 1.35rem; }
  .combined-label { min-width: 120px; font-size: 0.76rem; }
  .combined-icon { width: 28px; height: 28px; }
  .combined-suffix { font-size: 0.68rem; white-space: normal; }
  .forecast-card { width: 130px; min-height: 240px; }
  .chart-container { height: 260px; }
  .ts-controls { gap: 8px; }
  .ts-controls select { min-width: 120px; font-size: 0.78rem; }
  #windRefBtn { width: 100%; }
}

@media (max-width: 420px) {
  .header-meta { gap: 4px; }
  .header h1 { font-size: 0.88rem; }
  .header-icon { width: 40px; height: 40px; }
  #refreshBtn .btn-label { display: none; }
   #refreshBtn { padding: 5px 11px; }
  .card { padding: 14px 14px; }
  .card-value { font-size: 1.6rem; }
  .combined-value { font-size: 1.15rem; }
  .combined-label { min-width: 85px; font-size: 0.68rem; }
  .combined-icon { width: 22px; height: 22px; margin-right: 8px; }
  .combined-card { padding: 14px 14px; }
  .combined-suffix { font-size: 0.64rem; }
}
