/* ---- Aurora Theme System ---- */
:root {
  /* Default: night/aurora */
  --aurora-start: #0c0820;
  --aurora-end: #0a1028;
  --aurora-accent: #9b8aef;
  --aurora-blob1: rgba(123,97,255,0.20);
  --aurora-blob2: rgba(60,180,220,0.12);
  --aurora-text: #ffffff;
  --aurora-text2: rgba(255,255,255,0.6);
  --aurora-card: rgba(255,255,255,0.04);
  --aurora-border: rgba(255,255,255,0.06);
}

/* Weather condition overrides */
.weather-clear { --aurora-start:#0f0a1e; --aurora-end:#2d1810; --aurora-accent:#ffb832; --aurora-blob1:rgba(255,160,40,0.25); --aurora-blob2:rgba(180,80,200,0.15); }
.weather-cloudy { --aurora-start:#141828; --aurora-end:#1a1e30; --aurora-accent:#8e9fc0; --aurora-blob1:rgba(150,170,200,0.10); --aurora-blob2:rgba(100,130,165,0.08); }
.weather-rainy { --aurora-start:#080e20; --aurora-end:#0d2040; --aurora-accent:#4a90d6; --aurora-blob1:rgba(40,120,220,0.25); --aurora-blob2:rgba(20,80,160,0.20); }
.weather-dusty { --aurora-start:#14100a; --aurora-end:#2a1c0a; --aurora-accent:#c8a060; --aurora-blob1:rgba(200,150,60,0.18); --aurora-blob2:rgba(180,100,30,0.12); }
.weather-thunderstorm { --aurora-start:#0c0820; --aurora-end:#1a0830; --aurora-accent:#7B61FF; --aurora-blob1:rgba(123,97,255,0.20); --aurora-blob2:rgba(60,180,220,0.12); }
.weather-night { --aurora-start:#0c0820; --aurora-end:#0a1028; --aurora-accent:#9b8aef; --aurora-blob1:rgba(123,97,255,0.20); --aurora-blob2:rgba(60,180,220,0.12); }

/* Light mode overrides */
body.light-mode.weather-clear { --aurora-start:#e8dcc8; --aurora-end:#f0e8d8; --aurora-accent:#9a6a08; --aurora-blob1:rgba(255,180,60,0.30); --aurora-blob2:rgba(255,220,140,0.30); --aurora-text:#3a2a10; --aurora-text2:rgba(60,40,10,0.6); --aurora-card:rgba(180,120,20,0.06); --aurora-border:rgba(180,120,20,0.12); }
body.light-mode.weather-cloudy { --aurora-start:#c8ccd8; --aurora-end:#d8dae4; --aurora-accent:#5a6e8c; --aurora-blob1:rgba(150,170,200,0.20); --aurora-blob2:rgba(120,140,180,0.15); --aurora-text:#1a2a40; --aurora-text2:rgba(20,40,60,0.6); --aurora-card:rgba(90,110,140,0.06); --aurora-border:rgba(90,110,140,0.10); }
body.light-mode.weather-rainy { --aurora-start:#c8d8e8; --aurora-end:#d8e4f0; --aurora-accent:#2a6aaa; --aurora-blob1:rgba(60,130,220,0.25); --aurora-blob2:rgba(100,160,240,0.20); --aurora-text:#1a3050; --aurora-text2:rgba(20,50,80,0.6); --aurora-card:rgba(40,100,180,0.06); --aurora-border:rgba(40,100,180,0.10); }
body.light-mode.weather-dusty { --aurora-start:#ddd0b8; --aurora-end:#e8dcc8; --aurora-accent:#7a5a18; --aurora-blob1:rgba(200,160,80,0.25); --aurora-blob2:rgba(220,180,100,0.20); --aurora-text:#3a2a10; --aurora-text2:rgba(60,40,10,0.6); --aurora-card:rgba(160,120,40,0.06); --aurora-border:rgba(160,120,40,0.10); }
body.light-mode.weather-thunderstorm { --aurora-start:#c8c0d8; --aurora-end:#d8d0e4; --aurora-accent:#6a4aaa; --aurora-blob1:rgba(100,80,200,0.20); --aurora-blob2:rgba(140,120,220,0.15); --aurora-text:#2a2040; --aurora-text2:rgba(40,30,60,0.6); --aurora-card:rgba(90,70,160,0.06); --aurora-border:rgba(90,70,160,0.10); }
body.light-mode.weather-night { --aurora-start:#c8c4d8; --aurora-end:#d4d0e0; --aurora-accent:#5a4a8a; --aurora-blob1:rgba(100,80,200,0.20); --aurora-blob2:rgba(140,120,220,0.15); --aurora-text:#2a2040; --aurora-text2:rgba(40,30,60,0.6); --aurora-card:rgba(90,70,160,0.06); --aurora-border:rgba(90,70,160,0.10); }

/* Animated background */
#aurora-bg {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(160deg, var(--aurora-start), var(--aurora-end));
  z-index: -2;
  transition: background 1s ease;
  overflow: hidden;
}
#aurora-bg::before, #aurora-bg::after {
  content: ''; position: absolute; border-radius: 50%;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite; animation-direction: alternate;
}
#aurora-bg::before {
  width: 400px; height: 400px; top: -100px; right: -100px;
  background: var(--aurora-blob1);
  animation: auroraFloat1 10s infinite alternate;
}
#aurora-bg::after {
  width: 300px; height: 300px; bottom: -50px; left: -50px;
  background: var(--aurora-blob2);
  animation: auroraFloat2 12s infinite alternate;
}

@keyframes auroraFloat1 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-40px, 50px) scale(1.15); }
}
@keyframes auroraFloat2 {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, -40px) scale(1.1); }
}

@media (prefers-reduced-motion: reduce) {
  #aurora-bg::before, #aurora-bg::after { animation: none; }
  #weather-particles { display: none; }
}

/* ============================================================
   Weather Particles
   ============================================================ */
#weather-particles {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1; pointer-events: none; overflow: hidden;
}

/* Night: star particles */
.weather-night #weather-particles::before,
.weather-night #weather-particles::after {
  content: '';
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  animation: starDrift 20s linear infinite;
}
.weather-night #weather-particles::before {
  box-shadow:
    50px 80px 0 rgba(255,255,255,0.4), 150px 200px 0 rgba(255,255,255,0.3),
    280px 60px 0 rgba(255,255,255,0.5), 400px 300px 0 rgba(255,255,255,0.2),
    100px 400px 0 rgba(255,255,255,0.35), 320px 150px 0 rgba(255,255,255,0.4),
    200px 350px 0 rgba(255,255,255,0.25), 450px 100px 0 rgba(255,255,255,0.3),
    60px 250px 0 rgba(255,255,255,0.45), 350px 400px 0 rgba(255,255,255,0.2);
  top: 0; left: 0;
}
.weather-night #weather-particles::after {
  box-shadow:
    80px 120px 0 rgba(255,255,255,0.3), 220px 80px 0 rgba(255,255,255,0.4),
    370px 250px 0 rgba(255,255,255,0.25), 130px 320px 0 rgba(255,255,255,0.35),
    480px 180px 0 rgba(255,255,255,0.3), 30px 150px 0 rgba(255,255,255,0.2),
    260px 420px 0 rgba(255,255,255,0.4), 410px 50px 0 rgba(255,255,255,0.3);
  top: -10px; left: 20px;
  animation-delay: -10s;
}

@keyframes starDrift {
  0% { transform: translateY(0) translateX(0); opacity: 0.6; }
  50% { opacity: 1; }
  100% { transform: translateY(-15px) translateX(10px); opacity: 0.6; }
}

/* Rain: falling dashes */
.weather-rainy #weather-particles::before,
.weather-rainy #weather-particles::after {
  content: '';
  position: absolute;
  width: 1px; height: 12px;
  border-radius: 1px;
  animation: rainFall 1.2s linear infinite;
}
.weather-rainy #weather-particles::before {
  box-shadow:
    40px 0 0 rgba(100,180,255,0.2), 120px -30px 0 rgba(100,180,255,0.15),
    200px -80px 0 rgba(100,180,255,0.25), 300px -20px 0 rgba(100,180,255,0.2),
    80px -60px 0 rgba(100,180,255,0.18), 260px -100px 0 rgba(100,180,255,0.22),
    380px -50px 0 rgba(100,180,255,0.15), 160px -90px 0 rgba(100,180,255,0.2);
  top: -20px; left: 10%;
}
.weather-rainy #weather-particles::after {
  box-shadow:
    60px -40px 0 rgba(100,180,255,0.2), 180px -70px 0 rgba(100,180,255,0.18),
    340px -10px 0 rgba(100,180,255,0.22), 100px -55px 0 rgba(100,180,255,0.15),
    420px -85px 0 rgba(100,180,255,0.2), 240px -25px 0 rgba(100,180,255,0.17);
  top: -20px; left: 20%;
  animation-delay: -0.6s;
}

@keyframes rainFall {
  0% { transform: translateY(-20px); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0.3; }
}

/* Clear: warm subtle motes */
.weather-clear #weather-particles::before {
  content: '';
  position: absolute;
  width: 3px; height: 3px;
  border-radius: 50%;
  box-shadow:
    80px 100px 4px rgba(255,200,80,0.15), 200px 200px 6px rgba(255,180,50,0.1),
    350px 120px 5px rgba(255,220,100,0.12), 100px 300px 4px rgba(255,200,80,0.08),
    400px 250px 6px rgba(255,180,50,0.1), 250px 80px 5px rgba(255,220,100,0.12);
  animation: sunMote 15s ease-in-out infinite alternate;
  top: 0; left: 0;
}

@keyframes sunMote {
  0% { transform: translate(0, 0); opacity: 0.5; }
  100% { transform: translate(20px, 15px); opacity: 1; }
}

/* Base reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0a;
  color: var(--aurora-text);
  overflow-x: hidden;
  min-height: 100vh;
  width: 100vw;
  overflow-y: hidden;
}

/* ============================================================
   Glass Card System
   ============================================================ */

.glass-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
}
body.light-mode .glass-card {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
}

.glass-capsule {
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 28px;
}
body.light-mode .glass-capsule {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.10);
}

.glass-circle {
  background: rgba(255,255,255,0.08) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  border-radius: 50% !important;
}
body.light-mode .glass-circle {
  background: rgba(0,0,0,0.05) !important;
  border-color: rgba(0,0,0,0.10) !important;
}

/* ============================================================
   HOME STATE: Scrollable Content
   ============================================================ */

#home-content {
  position: relative;
  z-index: 5;
  max-width: 96%;
  margin: 0 auto;
  padding: 0 12px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

[data-app-state="home"] #home-content {
  opacity: 1;
  transform: translateY(0);
  height: calc(100vh - 0px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

[data-app-state="fullMap"] #home-content {
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transform: translateY(20px);
  height: 0;
  overflow: hidden;
}

/* ============================================================
   WEATHER PILL
   ============================================================ */

#weather-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  margin: 12px auto 10px;
  width: fit-content;
  border-radius: 28px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}
#weather-pill:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.15);
}
body.light-mode #weather-pill:hover {
  background: rgba(0,0,0,0.07);
}
#pill-icon { font-size: 22px; }
#pill-temp { font-size: 20px; font-weight: 600; color: var(--aurora-text); }
#pill-location { font-size: 13px; color: var(--aurora-text2); }

/* ============================================================
   SETTINGS + INFO BUTTONS (Home state)
   ============================================================ */

#settings-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}
[data-app-state="fullMap"] #settings-btn { display: none; }

#info-btn-home {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
}
[data-app-state="fullMap"] #info-btn-home { display: none; }

#settings-panel {
  position: fixed;
  top: 60px;
  left: 14px;
  width: 280px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  z-index: 900;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.panel-header h3 {
  font-size: 15px;
  color: #4fc3f7;
}

.panel-header button {
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
}

.panel-content {
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #bbb;
}
.panel-content a { color: #4fc3f7; text-decoration: none; }
.panel-content ul { list-style: none; padding-left: 0; }
.panel-content li { padding: 2px 0; }

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 14px; color: #ccc; }
.settings-value { font-size: 12px; color: #888; }

.segmented-control {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.seg-btn {
  padding: 6px 12px;
  font-size: 12px;
  background: transparent;
  border: none;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
}
.seg-btn.active {
  background: rgba(79,195,247,0.2);
  color: #4fc3f7;
}
.seg-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  color: #ccc;
}

/* ============================================================
   MAP CONTAINER (2-state)
   ============================================================ */

#map-container {
  position: relative;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* STATE: HOME - map inside scroll content */
[data-app-state="home"] #map-container {
  position: relative;
  height: 35vh;
  border-radius: 14px;
  overflow: hidden;
}

/* STATE: FULL MAP */
[data-app-state="fullMap"] #map-container {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  height: 100vh !important;
  width: 100vw !important;
  margin: 0;
  padding: 0;
  border-radius: 0;
  z-index: 500;
  border: none;
}

/* Map expand button */
#map-expand-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  width: 36px;
  height: 36px;
}
[data-app-state="fullMap"] #map-expand-btn { display: none; }

/* ============================================================
   HOME: Compact Playback
   ============================================================ */

#home-playback {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 0 8px;
  z-index: 5;
  position: relative;
}
[data-app-state="fullMap"] #home-playback { display: none; }

/* ============================================================
   HOME: Current Conditions Card
   ============================================================ */

.home-card {
  margin-bottom: 10px;
  padding: 16px;
}

.home-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--aurora-text2);
  margin-bottom: 10px;
}

.hc-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.hc-hero-icon { font-size: 40px; }
.hc-hero-temp { font-size: 40px; font-weight: 200; color: var(--aurora-text); }
.hc-hero-desc { text-align: center; font-size: 14px; color: var(--aurora-text2); margin-top: 4px; }
.hc-hero-feels { text-align: center; font-size: 12px; color: var(--aurora-text2); opacity: 0.7; margin-top: 2px; }

/* ============================================================
   HOME: 6-item Stats Grid
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  transition: background 0.2s;
}
body.light-mode .stat-item { background: rgba(0,0,0,0.02); }
.stat-icon { font-size: 18px; }
.stat-value { font-size: 14px; font-weight: 600; color: var(--aurora-text); }
.stat-label { font-size: 10px; color: var(--aurora-text2); }

/* ============================================================
   HOME: Hourly Strip
   ============================================================ */

.hourly-strip {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.hourly-strip::-webkit-scrollbar { height: 2px; }
.hourly-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 1px; }

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  font-size: 11px;
  gap: 3px;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.2s;
}
.hourly-item:hover { background: rgba(255,255,255,0.05); }
.hourly-item .hi-time { color: var(--aurora-text2); font-size: 10px; }
.hourly-item .hi-icon { font-size: 16px; }
.hourly-item .hi-temp { font-weight: 600; color: var(--aurora-text); }

.hourly-placeholder { padding: 20px; text-align: center; color: var(--aurora-text2); font-size: 12px; }

/* ============================================================
   HOME: Daily Forecast
   ============================================================ */

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.daily-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}
.daily-day { width: 42px; color: var(--aurora-text); }
.daily-icon { width: 22px; text-align: center; font-size: 14px; }
.daily-pct { width: 28px; font-size: 10px; color: #00bcd4; text-align: right; }
.daily-lo { width: 28px; text-align: right; color: var(--aurora-text2); }
.daily-hi { width: 28px; text-align: right; color: var(--aurora-text); font-weight: 600; }
.daily-bar { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; position: relative; overflow: hidden; }
body.light-mode .daily-bar { background: rgba(0,0,0,0.06); }
.daily-bar-fill { position: absolute; top: 0; height: 100%; border-radius: 2px; background: linear-gradient(to right, #00bcd4, #ffc107, #ff9800); }

/* ============================================================
   TOP BAR (Full Map state) - glass capsules
   ============================================================ */

#top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 510;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12px 16px;
  gap: 10px;
  pointer-events: none;
}
[data-app-state="home"] #top-bar { display: none; }

#top-bar > * { pointer-events: auto; }

#time-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--aurora-text);
}

.run-time-capsule {
  padding: 6px 14px;
  font-size: 10px;
  color: var(--aurora-text2);
}

#fullmap-close {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 520;
  width: 40px;
  height: 40px;
}

/* Status dots */
.dot-loading {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ff9800;
  animation: pulse 1.5s infinite;
}
.dot-ready { background: #4caf50; animation: none; width: 8px; height: 8px; border-radius: 50%; }
.dot-error { background: #f44336; animation: none; width: 8px; height: 8px; border-radius: 50%; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   BOTTOM BAR (Full Map state)
   ============================================================ */

#bottom-bar {
  position: fixed;
  bottom: 80px; left: 0; right: 0;
  z-index: 510;
  padding: 0 12px;
  pointer-events: none;
}
[data-app-state="home"] #bottom-bar { display: none; }

#bottom-bar > * { pointer-events: auto; }

#bottom-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

#controls-left {
  display: flex;
  gap: 6px;
}

/* Buttons */
.ctrl-btn, .play-btn {
  background: rgba(30,30,30,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  color: #ccc;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 44px;
  min-height: 44px;
}
.ctrl-btn {
  width: 40px; height: 40px;
  font-size: 20px;
}
.ctrl-btn:hover, .play-btn:hover {
  background: rgba(60,60,60,0.9);
  color: #fff;
  border-color: rgba(255,255,255,0.2);
}

/* Model selector */
#model-selector {
  padding: 0;
  overflow: hidden;
}
#model-selector select {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--aurora-text);
  padding: 10px 36px 10px 14px;
  font-size: 13px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 180px;
}

/* Satellite selector */
#sat-toggle {
  padding: 0;
  overflow: hidden;
}
#sat-toggle select {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--aurora-text);
  padding: 10px 36px 10px 14px;
  font-size: 13px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 140px;
}

/* Layer toggle buttons */
#layer-toggle {
  display: flex;
  gap: 0;
  overflow: hidden;
  padding: 0;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.5);
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.toggle-btn:last-child { border-right: none; }
.toggle-btn.active {
  background: rgba(79,195,247,0.2);
  color: #4fc3f7;
}
.toggle-btn:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.8);
}

/* Opacity control */
#opacity-panel {
  position: fixed;
  right: 60px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 520;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px;
  width: 44px;
}
[data-app-state="home"] #opacity-panel { display: none !important; }

.opacity-label {
  font-size: 8px;
  color: var(--aurora-text2);
  letter-spacing: 0.3px;
}

#opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transform: rotate(-90deg);
  margin: 46px 0;
}
#opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #4fc3f7;
  border: 2px solid #fff;
  cursor: pointer;
}
#opacity-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #4fc3f7;
  border: 2px solid #fff;
  cursor: pointer;
}

/* ============================================================
   Timeline
   ============================================================ */

#timeline-bar {
  position: fixed;
  bottom: 48px; left: 16px; right: 16px;
  z-index: 510;
  padding: 0 4px;
}
[data-app-state="home"] #timeline-bar { display: none; }

#timeline-fade {
  position: absolute;
  bottom: -48px; left: -16px; right: -16px;
  height: 120px;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}

#timeline-track {
  position: relative;
  height: 6px;
  background: rgba(40,40,40,0.9);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}
#timeline-observed {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(79,195,247,0.5);
  width: 50%;
  border-radius: 3px;
}
#timeline-forecast {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  background: rgba(255,152,0,0.3);
  width: 50%;
  border-radius: 3px;
}
#timeline-cursor {
  position: absolute;
  top: -3px;
  width: 12px; height: 12px;
  background: #4fc3f7;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 8px rgba(79,195,247,0.6);
  transform: translateX(-50%);
  left: 50%;
  transition: left 0.15s ease;
  cursor: grab;
}
#timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 10px;
  color: #666;
}

/* Playback */
#playback-bar {
  position: fixed;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  z-index: 510;
  display: flex;
  gap: 8px;
  align-items: center;
}
[data-app-state="home"] #playback-bar { display: none; }

.play-btn {
  width: 36px; height: 36px;
  font-size: 16px;
}
.play-main {
  width: 44px; height: 44px;
  font-size: 20px;
  background: rgba(79,195,247,0.2);
  border-color: rgba(79,195,247,0.4);
  color: #4fc3f7;
}
.play-main:hover {
  background: rgba(79,195,247,0.35);
}

/* Info panel */
#info-panel {
  position: fixed;
  top: 60px; right: 16px;
  z-index: 900;
  width: 320px;
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

/* Active state for toggle controls */
.active-ctrl {
  background: rgba(79,195,247,0.25) !important;
  border-color: rgba(79,195,247,0.5) !important;
  color: #4fc3f7 !important;
}
body.light-mode .active-ctrl {
  background: rgba(2,119,189,0.15) !important;
  border-color: rgba(2,119,189,0.4) !important;
  color: #0277bd !important;
}

/* User location marker */
.user-location-dot {
  width: 16px;
  height: 16px;
  background: #4fc3f7;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(79,195,247,0.35), 0 0 12px rgba(79,195,247,0.5);
  animation: loc-pulse 2s infinite;
}
@keyframes loc-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(79,195,247,0.35), 0 0 12px rgba(79,195,247,0.5); }
  50% { box-shadow: 0 0 0 8px rgba(79,195,247,0.15), 0 0 20px rgba(79,195,247,0.3); }
}

.hidden { display: none !important; }

/* Loading bar */
#loading-container {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  text-align: center;
  width: 300px;
}
#loading-bar {
  height: 4px;
  background: #4fc3f7;
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s ease;
}
#loading-text {
  margin-top: 10px;
  font-size: 13px;
  color: #888;
}
#loading-container.hidden { display: none; }

/* ============================================================
   FORECAST MODAL
   ============================================================ */

#forecast-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
#forecast-modal.visible {
  opacity: 1;
  pointer-events: auto;
}
#forecast-modal.hidden {
  display: none !important;
}

#forecast-modal-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
body.light-mode #forecast-modal-backdrop {
  background: rgba(255,255,255,0.5);
}

#forecast-modal-content {
  position: relative;
  z-index: 1;
  width: 92%;
  max-width: 700px;
  max-height: 85vh;
  background: rgba(15,15,20,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
  box-shadow: 0 16px 64px rgba(0,0,0,0.5);
}
body.light-mode #forecast-modal-content {
  background: rgba(245,245,250,0.97);
  border-color: rgba(0,0,0,0.10);
  box-shadow: 0 16px 64px rgba(0,0,0,0.15);
}

#fc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(15,15,20,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
body.light-mode #fc-header {
  background: rgba(245,245,250,0.97);
}

#fc-location {
  display: flex;
  flex-direction: column;
}
#fc-loc-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--aurora-text);
}
#fc-loc-coords {
  font-size: 11px;
  color: var(--aurora-text2);
}

#fc-close {
  width: 36px; height: 36px;
  flex-shrink: 0;
}

/* Forecast tabs */
#fc-tabs {
  display: flex;
  gap: 0;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 12px;
}
.fc-tab {
  flex: 1;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--aurora-text2);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-height: 44px;
}
.fc-tab.active {
  background: rgba(79,195,247,0.12);
  color: var(--aurora-text);
}
.fc-tab:hover:not(.active) {
  background: rgba(255,255,255,0.04);
}
.fc-tab.fc-tab-hidden { display: none; }
.fc-tab-content { display: none; }
.fc-tab-content.active { display: block; }

/* ============================================================
   Light mode
   ============================================================ */
body.light-mode {
  background: #f5f5f5;
  color: #222;
}

body.light-mode .ctrl-btn,
body.light-mode .play-btn {
  background: rgba(255,255,255,0.9);
  border-color: rgba(0,0,0,0.12);
  color: #444;
}
body.light-mode .ctrl-btn:hover,
body.light-mode .play-btn:hover {
  background: rgba(240,240,240,1);
  color: #111;
}

body.light-mode .toggle-btn {
  color: rgba(0,0,0,0.4);
}
body.light-mode .toggle-btn.active {
  background: rgba(2,119,189,0.15);
  color: #0277bd;
}
body.light-mode .toggle-btn:hover:not(.active) {
  background: rgba(0,0,0,0.04);
  color: rgba(0,0,0,0.6);
}
body.light-mode #layer-toggle {
  border-color: rgba(0,0,0,0.10);
}

body.light-mode #model-selector select,
body.light-mode #sat-toggle select {
  color: #222;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23333'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

body.light-mode #timeline-track { background: rgba(200,200,200,0.7); }
body.light-mode #timeline-observed { background: rgba(2,119,189,0.4); }
body.light-mode #timeline-forecast { background: rgba(255,152,0,0.25); }
body.light-mode #timeline-cursor { background: #0277bd; box-shadow: 0 0 8px rgba(2,119,189,0.5); }
body.light-mode #timeline-labels { color: #888; }
body.light-mode #timeline-fade { background: linear-gradient(to top, rgba(255,255,255,0.6) 0%, transparent 100%); }

body.light-mode .play-main {
  background: rgba(2,119,189,0.15);
  border-color: rgba(2,119,189,0.3);
  color: #0277bd;
}
body.light-mode .play-main:hover {
  background: rgba(2,119,189,0.25);
}

body.light-mode #info-panel {
  background: rgba(255,255,255,0.97);
  border-color: rgba(0,0,0,0.1);
}
body.light-mode .panel-header { border-color: rgba(0,0,0,0.08); }
body.light-mode .panel-header h3 { color: #0277bd; }
body.light-mode .panel-header button { color: #666; }
body.light-mode .panel-content { color: #444; }
body.light-mode .panel-content a { color: #0277bd; }

body.light-mode .dot-ready { background: #2e7d32; }
body.light-mode #loading-text { color: #555; }
body.light-mode #loading-bar { background: #0277bd; }

body.light-mode #opacity-panel { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.1); }
body.light-mode .opacity-label { color: #666; }
body.light-mode #opacity-slider { background: rgba(0,0,0,0.15); }
body.light-mode #opacity-slider::-webkit-slider-thumb { background: #0277bd; }
body.light-mode #opacity-slider::-moz-range-thumb { background: #0277bd; }

/* Light mode: settings panel */
body.light-mode #settings-panel {
  background: rgba(255,255,255,0.95);
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
body.light-mode #settings-panel .panel-header {
  background: rgba(255,255,255,0.98);
  border-bottom-color: rgba(0,0,0,0.08);
}
body.light-mode .settings-label { color: #333; }
body.light-mode .settings-value { color: #666; }
body.light-mode .settings-row { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .segmented-control { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.light-mode .seg-btn { color: #666; }
body.light-mode .seg-btn.active { background: rgba(2,119,189,0.15); color: #0277bd; }

/* Light mode: forecast tabs */
body.light-mode #fc-tabs {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.06);
}
body.light-mode .fc-tab { color: #888; }
body.light-mode .fc-tab.active { background: rgba(2,119,189,0.1); color: #0277bd; }

/* Map attribution override */
.maplibregl-ctrl-attrib {
  background: rgba(0,0,0,0.5) !important;
  color: #666 !important;
  font-size: 10px !important;
}
.maplibregl-ctrl-attrib a { color: #888 !important; }
body.light-mode .maplibregl-ctrl-attrib {
  background: rgba(255,255,255,0.7) !important;
  color: #555 !important;
}
body.light-mode .maplibregl-ctrl-attrib a { color: #333 !important; }
body.light-mode .maplibregl-ctrl button { background-color: rgba(255,255,255,0.9) !important; }
body.light-mode .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: none !important; }

/* ============================================================
   Weather Panel Styles (used in forecast modal)
   ============================================================ */

.wp-section { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.wp-section:last-child { border-bottom: none; }
.wp-section b { font-size: 13px; }
.wp-current { text-align: center; padding: 16px 0; }
.wp-temp { font-size: 36px; font-weight: 200; }
.wp-desc { font-size: 13px; color: #999; margin-top: 4px; }
.wp-stats { display: flex; justify-content: center; gap: 14px; margin-top: 8px; font-size: 12px; color: #aaa; flex-wrap: wrap; }
.wp-marine .wp-stats { justify-content: flex-start; }
.wp-hourly { display: flex; gap: 2px; overflow-x: auto; padding: 8px 0; }
.wp-hour { display: flex; flex-direction: column; align-items: center; min-width: 40px; font-size: 11px; gap: 3px; }
.wp-hour span:first-child { color: #999; font-size: 10px; }
.wp-chart { width: 100%; height: auto; margin-top: 6px; }
.wp-tide-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.wp-tide-item { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 6px; border-radius: 4px; }
.wp-tide-item.tide-high { background: rgba(255,152,0,0.1); }
.wp-tide-item.tide-low { background: rgba(0,188,212,0.1); }
.wp-model-tabs { display: flex; gap: 6px; }
.wp-model-tab { flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 8px 4px; cursor: pointer; text-align: center; color: #999; transition: all 0.2s; min-height: 44px; }
.wp-model-tab.active { background: rgba(79,195,247,0.12); border-color: rgba(79,195,247,0.3); color: #fff; }
.wp-model-tab:hover { background: rgba(255,255,255,0.08); }
.wp-model-name { display: block; font-size: 10px; font-weight: 600; }
.wp-model-temp { display: block; font-size: 15px; margin-top: 2px; }
.wp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wp-grid-item { text-align: center; font-size: 12px; }
.wp-grid-item .wp-grid-icon { display: block; font-size: 16px; margin-bottom: 2px; }
.wp-grid-item b { display: block; font-size: 13px; }
.wp-grid-item span:last-child { color: #888; font-size: 10px; }
.wp-daily { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.wp-daily-row { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.wp-daily-day { width: 40px; }
.wp-daily-icon { width: 22px; text-align: center; }
.wp-daily-pct { width: 28px; font-size: 10px; color: #00bcd4; text-align: right; }
.wp-daily-lo { width: 28px; text-align: right; color: #999; }
.wp-daily-hi { width: 28px; text-align: right; }
.wp-daily-bar { flex: 1; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; position: relative; overflow: hidden; }
.wp-daily-bar-fill { position: absolute; top: 0; height: 100%; border-radius: 2px; background: linear-gradient(to right, #00bcd4, #ffc107, #ff9800); }
.wp-chart-params { display: flex; gap: 4px; margin: 8px 0; }
.wp-cparam { flex: 1; padding: 5px 2px; font-size: 11px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 6px; color: #999; cursor: pointer; text-align: center; transition: all 0.15s; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.wp-cparam.active { background: rgba(79,195,247,0.12); border-color: rgba(79,195,247,0.3); color: #fff; }
.wp-cparam:hover { background: rgba(255,255,255,0.08); }
.wp-chart-legend { display: flex; gap: 10px; font-size: 10px; color: #888; margin-top: 4px; justify-content: center; }
#wp-loading { padding: 20px; text-align: center; color: #888; }

/* Light mode overrides for weather content */
body.light-mode .wp-section { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .wp-desc, body.light-mode .wp-stats { color: #666; }
body.light-mode .wp-hour span:first-child { color: #888; }
body.light-mode .wp-model-tab, body.light-mode .wp-cparam { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #666; }
body.light-mode .wp-model-tab.active, body.light-mode .wp-cparam.active { background: rgba(2,119,189,0.1); border-color: rgba(2,119,189,0.3); color: #000; }
body.light-mode .wp-daily-bar { background: rgba(0,0,0,0.06); }
body.light-mode .wp-grid-item span:last-child { color: #888; }

/* Forecast popup on fullMap */
.forecast-popup .maplibregl-popup-content {
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 16px;
  color: #e0e0e0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 160px;
  text-align: center;
}
body.light-mode .forecast-popup .maplibregl-popup-content {
  background: rgba(255,255,255,0.95);
  border-color: rgba(0,0,0,0.1);
  color: #222;
}
.forecast-popup .maplibregl-popup-tip {
  border-top-color: rgba(15,15,15,0.92);
}
body.light-mode .forecast-popup .maplibregl-popup-tip {
  border-top-color: rgba(255,255,255,0.95);
}
.popup-view-forecast {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 20px;
  background: rgba(79,195,247,0.2);
  border: 1px solid rgba(79,195,247,0.4);
  border-radius: 8px;
  color: #4fc3f7;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.popup-view-forecast:hover {
  background: rgba(79,195,247,0.35);
}
body.light-mode .popup-view-forecast {
  background: rgba(2,119,189,0.1);
  border-color: rgba(2,119,189,0.3);
  color: #0277bd;
}

/* ============================================================
   Desktop Layout (>1024px): big map + columns underneath
   ============================================================ */

@media (min-width: 1025px) {
  #home-content {
    max-width: 96%;
    padding: 0 24px 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  /* Weather pill: full width top */
  #weather-pill { grid-column: 1 / -1; }

  /* Map: full width, taller */
  #map-container { grid-column: 1 / -1; }
  [data-app-state="home"] #map-container {
    height: 55vh;
  }

  /* Playback: full width */
  #home-playback { grid-column: 1 / -1; }

  /* Current conditions + stats side by side */
  #home-current { grid-column: 1 / 2; }
  #home-stats { grid-column: 2 / 3; }

  /* Hourly: full width */
  #home-hourly { grid-column: 1 / -1; }

  /* Daily: full width */
  #home-daily { grid-column: 1 / -1; }
}

/* ============================================================
   Disable heavy effects on mobile for performance
   ============================================================ */

@media (max-width: 768px) {
  #weather-particles { display: none; }

  #aurora-bg::before, #aurora-bg::after {
    filter: none;
    opacity: 0.5;
  }
}

/* ============================================================
   Mobile Responsive
   ============================================================ */

@media (max-width: 768px) {
  #home-content {
    max-width: 100%;
    padding: 0 8px 20px;
  }

  [data-app-state="home"] #map-container {
    height: 35vh;
  }

  /* Smaller weather pill on mobile */
  #weather-pill {
    padding: 8px 14px;
    gap: 6px;
  }
  #pill-icon { font-size: 18px; }
  #pill-temp { font-size: 16px; }
  #pill-location { font-size: 11px; }

  /* Full width cards with proper padding */
  .home-card {
    margin-left: 0;
    margin-right: 0;
    padding: 12px;
  }

  .hc-hero-icon { font-size: 32px; }
  .hc-hero-temp { font-size: 32px; }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .stat-item { padding: 6px 2px; }
  .stat-icon { font-size: 16px; }
  .stat-value { font-size: 12px; }
  .stat-label { font-size: 9px; }

  /* Bottom bar: wrap into rows */
  #bottom-controls-row {
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 4px;
  }

  #model-selector { order: 1; }
  #model-selector select { min-width: 160px; font-size: 14px; }
  #controls-left { order: 2; }
  #layer-toggle { order: 3; }
  #sat-toggle { order: 4; }

  .toggle-btn { padding: 8px 12px; font-size: 12px; }

  #bottom-bar { bottom: 88px; }

  /* Timeline */
  #timeline-bar { bottom: 52px; left: 10px; right: 10px; }
  #timeline-track { height: 8px; }
  #timeline-cursor { width: 16px; height: 16px; top: -4px; }

  /* Playback */
  #playback-bar { bottom: 10px; }
  .play-btn { width: 40px; height: 40px; font-size: 18px; }
  .play-main { width: 48px; height: 48px; font-size: 22px; }

  /* Info panel: full width on mobile */
  #info-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Forecast modal */
  #forecast-modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 16px 16px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  /* MapLibre nav controls */
  .maplibregl-ctrl-top-right { top: 50px !important; }

  #settings-panel { width: calc(100% - 28px); }
}

@media (max-width: 480px) {
  .stats-grid { gap: 4px; }

  #bottom-controls-row { gap: 4px; padding: 0; }
  #bottom-bar { bottom: 84px; }

  .toggle-btn { padding: 8px 10px; font-size: 11px; }

  #timeline-bar { left: 8px; right: 8px; bottom: 50px; }
  #playback-bar { bottom: 8px; gap: 6px; }
}
