/* =============== CSS Variables =============== */
:root {
  /* Color Palette - Modern and Accessible */
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --primary-dark: #1e3a8a;
  
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0891b2;
  
  /* Grayscale */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Semantic Colors */
  --bg-primary: var(--white);
  --bg-secondary: var(--gray-50);
  --bg-card: var(--white);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  
  /* Forecast Window Colors - Vibrant & Distinct */
  --hour-12: #ff0080;  /* Hot Pink/Magenta */
  --hour-24: #8000ff;  /* Electric Purple */
  --hour-48: #ffff00;  /* Bright Yellow */
  --hour-72: #00d4ff;  /* Bright Cyan/Aqua */

  /* Synopsis Severity Colors - Better Contrast */
  --dry-bg: #f0f9ff;
  --dry-border: #0ea5e9;
  --dry-text: #0c4a6e;

  --light-bg: #dbeafe;
  --light-border: #2563eb;
  --light-text: #1e3a8a;

  --wet-bg: #e0e7ff;
  --wet-border: #4f46e5;
  --wet-text: #3730a3;

  --soak-bg: #ddd6fe;
  --soak-border: #7c3aed;
  --soak-text: #5b21b6;
  
  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-strong: #475569;

    /* Dark mode synopsis colors with better contrast */
    --dry-bg: #0c4a6e30;
    --dry-border: #0ea5e9;
    --dry-text: #7dd3fc;

    --light-bg: #1e3a8a30;
    --light-border: #3b82f6;
    --light-text: #93c5fd;

    --wet-bg: #3730a330;
    --wet-border: #6366f1;
    --wet-text: #a5b4fc;

    --soak-bg: #5b21b630;
    --soak-border: #8b5cf6;
    --soak-text: #c4b5fd;
  }

  /* Timeline cards dark mode */
  .timeline-card {
    background: #1e293b;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  }

  .timeline-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }

  .timeline-main-amount {
    color: #f1f5f9;
  }

  .timeline-period {
    color: #94a3b8;
  }

  .timeline-range {
    color: #94a3b8;
  }

  .timeline-cumulative {
    background: linear-gradient(135deg, #422006 0%, #713f12 100%);
    border-color: #92400e;
    color: #fde68a;
  }

  .timeline-cumulative strong {
    color: #fef3c7;
  }

  .timeline-by {
    color: #fde68a;
  }

  .timeline-period {
    color: #cbd5e1;
  }
}

/* =============== Base Styles =============== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

/* =============== Location Detection Overlay =============== */
.location-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 64, 175, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(8px);
}

.location-overlay.active {
  display: flex;
}

.location-overlay-content {
  text-align: center;
  color: white;
  padding: var(--space-xl);
}

.location-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  margin: 0 auto var(--space-lg);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.location-overlay-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--space-sm);
}

.location-overlay-hint {
  font-size: 0.9rem;
  opacity: 0.8;
  margin: 0;
}

/* =============== Sponsor Banner (Optional) =============== */
#sponsor-banner {
  background: linear-gradient(180deg, #0a0a0a 0%, #1a1a2e 100%);
  padding: var(--space-lg) var(--space-md);
  margin: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sponsor-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.sponsor-label {
  color: var(--white);
  font-size: 0.75rem;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  width: 100%;
}

.sponsor-logo-link {
  display: flex;
  justify-content: center;
}

.sponsor-logo {
  height: auto;
  width: 280px;
  max-width: 80vw;
  object-fit: contain;
}

.sponsor-slogan {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  font-style: italic;
  opacity: 0.95;
  margin-top: -4px;
}

.sponsor-link {
  margin-top: var(--space-sm);
  color: #000;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 20px;
  background: #fff;
  border-radius: var(--radius-full);
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sponsor-link:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

@media (max-width: 480px) {
  #sponsor-banner {
    padding: var(--space-sm) var(--space-md);
  }

  .sponsor-logo {
    width: 240px;
  }

  .sponsor-label {
    font-size: 0.7rem;
  }

  .sponsor-slogan {
    font-size: 0.875rem;
  }
}

/* =============== Header =============== */
header {
  text-align: center;
  padding: var(--space-xl) var(--space-md) var(--space-lg);
  background:
    linear-gradient(180deg,
      rgba(30, 64, 175, 0.95) 0%,
      rgba(37, 99, 235, 0.98) 50%,
      rgba(59, 130, 246, 1) 100%
    ),
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,0.08) 0%, transparent 50%);
  color: var(--white);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(30, 64, 175, 0.3);
}

/* Subtle animated glow effect */
.rain-animation {
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 70%
  );
  animation: pulse 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.app-icon {
  font-size: 4rem;
  margin-bottom: var(--space-sm);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
  position: relative;
  z-index: 1;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-xs);
  position: relative;
  z-index: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.subtitle {
  font-size: 0.95rem;
  opacity: 0.95;
  font-weight: 400;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* GIS4AG header logo */
.gis4ag-header-logo {
  width: 280px;
  height: auto;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.gis4ag-header-logo:hover {
  opacity: 1;
  transform: scale(1.02);
}

/* Mobile adjustments */
@media (max-width: 480px) {
  header {
    padding: var(--space-lg) var(--space-md) var(--space-md);
  }

  .app-icon {
    font-size: 3rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.875rem;
  }

  .gis4ag-header-logo {
    width: 75%;
    max-width: 240px;
  }
}

/* =============== Search Container =============== */
.search-container {
  padding: var(--space-md);
  background: var(--bg-card);
  margin: var(--space-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.search-wrapper {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  min-width: 0; /* Prevent flex items from overflowing */
}

#search {
  flex: 1 1 auto;
  min-width: 0; /* Allow shrinking below content size */
  padding: 14px 16px;
  font-size: 16px; /* Prevents zoom on iOS */
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: border-color 0.2s;
}

#search:focus {
  outline: none;
  border-color: var(--primary-light);
}

.gps-btn, .map-picker-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.gps-btn:active, .map-picker-btn:active {
  transform: scale(0.95);
}

.gps-btn svg, .map-picker-btn svg {
  width: 20px;
  height: 20px;
}

.search-btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.search-btn:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

/* =============== Rain/Snow Toggle =============== */
.precip-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.toggle-text {
  font-size: 1rem;
  font-weight: 700;
  transition: opacity 0.2s;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.toggle-text.rain-text {
  color: white;
}

.toggle-text.snow-text {
  color: white;
}

/* Dim the inactive side */
.precip-toggle:not(.snow-mode) .snow-text {
  opacity: 0.5;
}

.precip-toggle.snow-mode .rain-text {
  opacity: 0.5;
}

.toggle-hint {
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--primary);
  border-radius: 26px;
  transition: background 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.toggle-hint.manual {
  color: var(--primary);
  opacity: 1;
  font-weight: 500;
}

/* =============== Location Status =============== */
.location-status {
  text-align: center;
  padding: 0 var(--space-md) var(--space-md);
}

.location-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.location-name strong {
  color: var(--primary);
  font-weight: 700;
}

.location-name small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.timestamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.timestamp small {
  font-size: 0.7rem;
  opacity: 0.9;
}

/* =============== Loading State =============== */
.loading-container {
  text-align: center;
  padding: var(--space-xl);
}

.loading-intro {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.loading-spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-md);
  border-radius: 50%;
  position: relative;
  background: conic-gradient(
    from 0deg,
    #0ea5e9 0deg,
    #2563eb 90deg,
    #4f46e5 180deg,
    #7c3aed 270deg,
    #0ea5e9 360deg
  );
  animation: spin 2s linear infinite, pulse-glow 3s ease-in-out infinite;
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
}

.loading-spinner::before {
  content: var(--spinner-icon, '☔');
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  background: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 60px;
  text-align: center;
  animation: float 2s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(124, 58, 237, 0.6);
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

.progress-container {
  margin-top: var(--space-md);
  width: 100%;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.loading-quote {
  margin-top: var(--space-lg);
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  opacity: 0.8;
}

/* =============== Summary Card =============== */
.summary-card {
  margin: 0 var(--space-md) var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border);
  position: relative;
  overflow-x: hidden;
  width: calc(100% - 2 * var(--space-md));
  box-sizing: border-box;
}

.summary-card.syn-dry {
  background: var(--dry-bg);
  border-color: var(--dry-border);
  color: var(--dry-text);
}

.summary-card.syn-light {
  background: var(--light-bg);
  border-color: var(--light-border);
  color: var(--light-text);
}

.summary-card.syn-wet {
  background: var(--wet-bg);
  border-color: var(--wet-border);
  color: var(--wet-text);
}

.summary-card.syn-soak {
  background: var(--soak-bg);
  border-color: var(--soak-border);
  color: var(--soak-text);
}

.summary-header {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.summary-icon {
  font-size: 2rem;
  line-height: 1;
}

.summary-content {
  flex: 1;
}

.summary-content h2 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
  opacity: 0.8;
}

.summary-main {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
}

/* Timeline section - full width below header */
.summary-timeline {
  width: 100%;
  margin-top: var(--space-md);
}

/* Timeline-specific styling */
.summary-main br {
  margin: var(--space-xs) 0;
}

/* Visual Timeline Cards - Clean, Mobile-First Design */
.timeline-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
}

.timeline-visual {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-md) 0;
  width: 100%;
  max-width: 600px;
  overflow-x: hidden;
}

/* Staggered entrance animation for timeline cards */
.timeline-visual .timeline-card {
  animation: card-entrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.timeline-visual .timeline-card:nth-child(1) { animation-delay: 0s; }
.timeline-visual .timeline-card:nth-child(2) { animation-delay: 0.1s; }
.timeline-visual .timeline-card:nth-child(3) { animation-delay: 0.2s; }
.timeline-visual .timeline-card:nth-child(4) { animation-delay: 0.3s; }
.timeline-visual .timeline-card:nth-child(5) { animation-delay: 0.4s; }
.timeline-visual .timeline-card:nth-child(6) { animation-delay: 0.5s; }

@keyframes card-entrance {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.timeline-card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-md);
  border-top: 5px solid var(--border);
  position: relative;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Shine effect overlay */
.timeline-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  transition: left 0.5s ease;
  pointer-events: none;
}

.timeline-card:hover::before {
  left: 100%;
}

.timeline-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  transform: translateY(-4px) scale(1.02);
}

/* Enhanced hover for each intensity level */
.timeline-card.dry:hover {
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.2);
}

.timeline-card.light:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}

.timeline-card.moderate:hover {
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.3);
}

.timeline-card.heavy:hover {
  box-shadow: 0 12px 32px rgba(124, 58, 237, 0.4), 0 0 40px rgba(124, 58, 237, 0.2);
  animation: none;
}

/* Intensity-based card styling with gradients and effects */
.timeline-card.dry {
  border-top-color: #0ea5e9;
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 30%);
}

.timeline-card.light {
  border-top-color: #2563eb;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 20%, #ffffff 50%);
  border-top-width: 6px;
}

.timeline-card.moderate {
  border-top-color: #4f46e5;
  background: linear-gradient(180deg, #c7d2fe 0%, #e0e7ff 15%, #ffffff 45%);
  border-top-width: 7px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}

.timeline-card.heavy {
  border-top-color: #7c3aed;
  background: linear-gradient(180deg, #ddd6fe 0%, #ede9fe 15%, #ffffff 40%);
  border-top-width: 8px;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25), 0 0 20px rgba(124, 58, 237, 0.1);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25), 0 0 20px rgba(124, 58, 237, 0.1);
  }
  50% {
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35), 0 0 30px rgba(124, 58, 237, 0.2);
  }
}

.timeline-period {
  font-size: 0.82rem;
  font-weight: 800;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: var(--space-sm);
  line-height: 1.3;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(248,250,252,0.9) 100%);
  border-radius: 20px;
  display: inline-block;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Color-code the period based on card intensity */
.timeline-card.light .timeline-period {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.7) 0%, rgba(239, 246, 255, 0.9) 100%);
  color: #1e40af;
}

.timeline-card.moderate .timeline-period {
  background: linear-gradient(135deg, rgba(199, 210, 254, 0.7) 0%, rgba(224, 231, 255, 0.9) 100%);
  color: #4338ca;
}

.timeline-card.heavy .timeline-period {
  background: linear-gradient(135deg, rgba(221, 214, 254, 0.7) 0%, rgba(237, 233, 254, 0.9) 100%);
  color: #6d28d9;
}

.timeline-icon {
  font-size: 3rem;
  text-align: center;
  line-height: 1;
  margin: var(--space-sm) 0;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease;
}

/* Animated icons based on precipitation intensity */
.timeline-card.light .timeline-icon {
  animation: gentle-bounce 2.5s ease-in-out infinite;
}

.timeline-card.moderate .timeline-icon {
  animation: wobble 2s ease-in-out infinite;
  font-size: 3.2rem;
  filter: drop-shadow(0 3px 6px rgba(79, 70, 229, 0.25));
}

.timeline-card.heavy .timeline-icon {
  animation: rain-drop 1.5s ease-in-out infinite;
  font-size: 3.5rem;
  filter: drop-shadow(0 4px 8px rgba(124, 58, 237, 0.35));
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes wobble {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-4px) rotate(-3deg); }
  75% { transform: translateY(-2px) rotate(3deg); }
}

@keyframes rain-drop {
  0%, 100% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-6px) scale(1.05); }
  60% { transform: translateY(2px) scale(0.98); }
}

.timeline-amount {
  text-align: center;
}

.timeline-main-amount {
  font-size: 1.85rem;
  font-weight: 900;
  color: #111827;
  display: block;
  margin: var(--space-sm) 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
  transition: color 0.3s ease, transform 0.3s ease;
}

/* Color the main amount based on card intensity */
.timeline-card.light .timeline-main-amount {
  color: #1e40af;
}

.timeline-card.moderate .timeline-main-amount {
  color: #4338ca;
  font-size: 1.95rem;
}

.timeline-card.heavy .timeline-main-amount {
  color: #6d28d9;
  font-size: 2.1rem;
  text-shadow: 0 2px 4px rgba(109, 40, 217, 0.15);
}

/* Subtle amount animation on hover */
.timeline-card:hover .timeline-main-amount {
  transform: scale(1.05);
}

.timeline-range {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
  line-height: 1.4;
}

.timeline-cumulative {
  font-size: 0.78rem;
  color: #92400e;
  font-weight: 600;
  display: block;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
  background-size: 200% 100%;
  border-radius: 8px;
  margin-top: 10px;
  line-height: 1.4;
  border: 1px solid #fbbf24;
  box-shadow: 0 2px 4px rgba(251, 191, 36, 0.2);
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer on cumulative when card is hovered */
.timeline-card:hover .timeline-cumulative {
  animation: shimmer 1.5s ease-in-out;
  box-shadow: 0 3px 6px rgba(251, 191, 36, 0.3);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.timeline-cumulative strong {
  color: #78350f;
  font-weight: 800;
  font-size: 0.85rem;
}

.timeline-by {
  color: #92400e;
  font-weight: 600;
}

/* Mini Bar Chart */
.timeline-chart {
  height: 24px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  position: relative;
  margin-top: var(--space-xs);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
}

.timeline-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  border-radius: 3px;
  opacity: 0.9;
}

.timeline-bar.p10-p90 {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  border: 1px solid #1e40af;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.timeline-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: #ffffff;
  border: 2px solid #dc2626;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #374151;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Mobile optimization - ensure full width */
@media (max-width: 480px) {
  .timeline-visual {
    margin: var(--space-md) 0;
    padding: 0;
    width: 100%;
  }

  .timeline-card {
    padding: var(--space-md) var(--space-sm);
    width: 100%;
    margin: 0;
  }

  .timeline-period {
    font-size: 0.7rem;
  }

  .timeline-icon {
    font-size: 2.5rem;
    margin: 6px 0;
  }

  .timeline-main-amount {
    font-size: 1.5rem;
  }

  .timeline-range {
    font-size: 0.75rem;
  }

  .timeline-cumulative {
    font-size: 0.7rem;
  }
}

/* Tablet and Desktop */
@media (min-width: 481px) {
  .timeline-card {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (min-width: 768px) {
  .timeline-card {
    max-width: 700px;
  }

  .timeline-main-amount {
    font-size: 2rem;
  }

  .timeline-icon {
    font-size: 3.5rem;
  }
}

.summary-details {
  font-size: 0.875rem;
  padding-top: var(--space-sm);
  border-top: 1px solid currentColor;
  opacity: 0.9;
}

/* =============== Forecast Section =============== */
#results-section {
  padding: 0 var(--space-md);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

.forecast-grid {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  align-items: start;
}

/* =============== Forecast Cards =============== */
.forecast-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: var(--space-md);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.forecast-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gray-400);
}

.forecast-card.h12::before { background: var(--hour-12); }
.forecast-card.h24::before { background: var(--hour-24); }
.forecast-card.h48::before { background: var(--hour-48); }
.forecast-card.h72::before { background: var(--hour-72); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: inline-block;
}

/* Timeframe-specific colored backgrounds with optimal text color */
.forecast-card.h12 .card-title {
  background: linear-gradient(135deg, var(--hour-12), #e6007a);
  color: white;
}
.forecast-card.h24 .card-title {
  background: linear-gradient(135deg, var(--hour-24), #7300e6);
  color: white;
}
.forecast-card.h48 .card-title {
  background: linear-gradient(135deg, var(--hour-48), #e6e600);
  color: black;
}
.forecast-card.h72 .card-title {
  background: linear-gradient(135deg, var(--hour-72), #00bfe6);
  color: black;
}

.hour-badge {
  padding: 6px 14px;
  background: var(--gray-100);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.forecast-card.h12 .hour-badge { background: var(--hour-12); color: var(--white); }
.forecast-card.h24 .hour-badge { background: var(--hour-24); color: var(--white); }
.forecast-card.h48 .hour-badge { background: var(--hour-48); color: #000000; }
.forecast-card.h72 .hour-badge { background: var(--hour-72); color: var(--white); }

.time-window {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

/* Rain Odds Synopsis - Collapsible Section */
.rain-odds-synopsis-container {
  margin: var(--space-md) 0;
}

.synopsis-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  user-select: none;
  transition: all 0.2s ease;
}

.synopsis-toggle:hover {
  background: var(--gray-100);
}

.synopsis-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.synopsis-arrow {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] .synopsis-arrow {
  transform: rotate(180deg);
}

.rain-odds-synopsis {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border-left: 3px solid var(--primary);
  padding: var(--space-md);
  margin-top: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.rain-odds-synopsis strong {
  color: var(--text-primary);
  font-weight: 600;
}

.forecast-card.h12 .rain-odds-synopsis {
  border-left-color: var(--hour-12);
}

.forecast-card.h24 .rain-odds-synopsis {
  border-left-color: var(--hour-24);
}

.forecast-card.h48 .rain-odds-synopsis {
  border-left-color: var(--hour-48);
}

.forecast-card.h72 .rain-odds-synopsis {
  border-left-color: var(--hour-72);
}

/* Main Values Display - Updated */
.amounts-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.amount-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-sm) 0;
  gap: var(--space-md);
}

.amount-row.cumulative {
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-md);
  margin-bottom: var(--space-sm);
}

.amount-row.incremental {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.amount-row.incremental .amount-label {
  hyphens: auto;
  word-break: break-word;
  line-height: 1.2;
}

.amount-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  line-height: 1.3;
  max-width: 140px;
}

.amount-row.cumulative .amount-label {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.amount-value {
  text-align: right;
  flex: 1;
  line-height: 1.4;
}

.amount-value strong {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1em;
}

.amount-value .likely-range {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
  display: block;
}

.most-likely-amount {
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.35em;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.02em;
}

.amount-mm {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
}

/* Enhanced Range Visual */
.range-visual {
  margin-bottom: var(--space-md);
}

.range-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.range-container {
  position: relative;
  padding: 45px 0 25px;
}

.range-bar {
  height: 40px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: visible;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.scale-tick {
  position: absolute;
  width: 1px;
  height: 100%;
  background: var(--border-strong);
  opacity: 0.7;
}

.range-fill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: var(--radius-sm);
  opacity: 0.8;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Range Points with Labels */
.range-point {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.range-point.p10 {
  z-index: 10;
}

.range-point.p90 {
  z-index: 11;
}

.range-point.p50 {
  z-index: 12; /* P50 on top */
}

.point-marker {
  width: 16px;
  height: 16px;
  background: var(--white);
  border: 3px solid var(--primary);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  margin: 0 auto;
}

.range-point.p10 .point-marker {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.range-point.p50 .point-marker {
  border-color: var(--primary);
  background: var(--white);
  width: 20px;
  height: 20px;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.4);
}

.range-point.p90 .point-marker {
  border-color: #1e40af;
  background: #dbeafe;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.3);
}

.point-label {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  white-space: nowrap;
  line-height: 1.2;
  background: var(--bg-card);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.point-label small {
  display: block;
  font-size: 0.55rem;
  color: var(--text-muted);
  font-weight: 400;
}

.range-point.p50 .point-label {
  font-weight: 800;
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.range-point.p50 .point-label small {
  color: rgba(255, 255, 255, 0.9);
}

/* Label positioning - above and below bar */
.point-label.above {
  top: -40px;
}

.point-label.below {
  top: 25px;
}

/* Scale Labels */
.scale-labels-container {
  position: relative;
  height: 20px;
  margin-top: 4px;
}

.scale-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Range Description */
.range-description {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.range-desc-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Confidence Indicator */
.confidence-indicator {
  margin-top: var(--space-md);
}

.confidence-box {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}

.confidence-level {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.confidence-description {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid;
}

.dot.p10 {
  background: #dbeafe;
  border-color: #60a5fa;
}

.dot.p50 {
  background: var(--white);
  border-color: var(--primary);
}

.dot.p90 {
  background: #dbeafe;
  border-color: #1e40af;
}

/* Probability Section */
.probability-section {
  margin-bottom: var(--space-md);
}

.prob-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.prob-timeframe {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-sm);
  font-style: italic;
}

/* Probability Pills */
.probability-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.prob-item {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-sm);
  text-align: center;
  border: 1px solid var(--border);
}

.prob-chance {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.prob-threshold {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.2;
}

.prob-threshold small {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Map Button */
.map-btn {
  width: 100%;
  padding: 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.map-btn:active {
  transform: scale(0.98);
  background: var(--border);
}

/* =============== Info Section =============== */
.info-section {
  padding: 0 var(--space-md) var(--space-lg);
}

.info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.info-card:hover {
  box-shadow: var(--shadow-md);
}

.info-card summary {
  padding: var(--space-md);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background: var(--bg-secondary);
  transition: background 0.2s ease;
}

.info-card summary:hover {
  background: var(--gray-100);
  color: var(--bg-secondary);
}

.info-card[open] summary {
  background: var(--gray-100);
  color: var(--bg-secondary);
}

.info-card summary::-webkit-details-marker {
  display: none;
}

.info-card summary::after {
  content: '▼';
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
  margin-left: var(--space-sm);
}

.info-card[open] summary::after {
  transform: rotate(180deg);
  color: var(--primary);
}

.info-card summary:hover::after,
.info-card[open] summary:hover::after {
  color: var(--bg-secondary);
}

.info-content {
  padding: var(--space-md);
}

.info-item {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}

.info-item:first-child {
  padding-top: 0;
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-item strong {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-size: 1rem;
}

.info-item p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
}

.info-item p:last-child {
  margin-bottom: 0;
}

.info-item ul {
  margin: var(--space-sm) 0;
  padding-left: var(--space-lg);
}

.info-item ul li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

.info-item ul li:last-child {
  margin-bottom: 0;
}

.info-item b {
  color: var(--text-primary);
  font-weight: 600;
}

.disclaimer {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
}

.disclaimer p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* =============== Map Overlay =============== */
.map-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
}

.map-overlay.open {
  display: block;
}

.map-panel {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.map-controls {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  right: var(--space-md);
  z-index: 10001;
  display: flex;
  justify-content: space-between;
}

.map-close {
  width: 44px;
  height: 44px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.map-close svg {
  width: 20px;
  height: 20px;
}

.map-legend-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-md);
  height: 44px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  color: var(--white);
  font-weight: 600;
  cursor: pointer;
}

.map-legend-btn svg {
  width: 18px;
  height: 18px;
}

.legend-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-lg);
  max-width: 90vw;
  max-height: 80vh;
  overflow: auto;
  z-index: 10002;
  display: none;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  font-weight: 600;
}

.legendClose {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.legend-popup img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--white);
}

.map-stack {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.map-slice {
  flex: 1;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.map-slice:last-child {
  border-bottom: none;
}

.slice-title {
  position: absolute;
  top: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: var(--white);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1000;
  pointer-events: none;
}

.slice-map {
  position: absolute;
  inset: 0;
}

/* =============== Location Picker Overlay =============== */
.location-picker-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  z-index: 10000;
  display: none;
  flex-direction: column;
}

.location-picker-overlay.open {
  display: flex;
}

.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-md);
}

.picker-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.picker-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
}

.picker-close svg {
  width: 20px;
  height: 20px;
}

.picker-instructions {
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.picker-instructions p {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.picker-coords {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}

.picker-map {
  flex: 1;
  position: relative;
  background: var(--gray-100);
}

.picker-footer {
  padding: var(--space-md);
  background: var(--bg-card);
  border-top: 2px solid var(--border);
  box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
}

.use-location-btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.use-location-btn:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  opacity: 0.6;
}

.use-location-btn:not(:disabled):active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

/* Custom marker for picked location */
.picker-marker-icon {
  width: 40px;
  height: 40px;
  margin-left: -20px;
  margin-top: -40px;
}

/* =============== Footer =============== */
footer {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* =============== Mobile Adjustments =============== */
@media (max-width: 480px) {
  /* Reduce card padding for more content on screen */
  .forecast-card {
    padding: var(--space-sm);
  }

  .card-header {
    margin-bottom: 6px;
  }

  .time-window {
    margin-bottom: var(--space-sm);
  }

  .rain-odds-synopsis-container {
    margin: var(--space-sm) 0;
  }

  .rain-odds-synopsis {
    padding: var(--space-sm);
    font-size: 0.8rem;
  }

  /* Info cards mobile optimization */
  .info-card summary {
    font-size: 0.9rem;
    padding: var(--space-sm) var(--space-md);
  }

  .info-content {
    padding: var(--space-sm) var(--space-md);
  }

  .info-item {
    padding: var(--space-sm) 0;
  }

  .info-item strong {
    font-size: 0.9rem;
  }

  .info-item p,
  .info-item ul li {
    font-size: 0.8rem;
  }

  /* Adjust search wrapper to prevent overflow */
  .search-wrapper {
    gap: 6px;
  }

  #search {
    min-width: 0;
    flex: 1 1 auto;
  }

  .gps-btn, .map-picker-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  
  .range-point .point-label {
    font-size: 0.55rem;
    padding: 1px 4px;
  }

  .range-point .point-label.above {
    top: -35px;
  }

  .range-point .point-label.below {
    top: 20px;
  }
  
  .range-point .point-label small {
    font-size: 0.5rem;
  }
  
  .range-container {
    padding: 40px 0 25px;
  }
  
  .range-description {
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm);
  }
  
  .scale-label {
    font-size: 0.65rem;
  }
  
  .amounts-container {
    padding: var(--space-sm);
  }
  
  .amount-row.cumulative {
    font-size: 0.9rem;
  }
  
  .amount-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .amount-label {
    max-width: none;
    font-size: 0.8rem;
  }
  
  .amount-value {
    text-align: left;
  }
  
  .rain-odds-synopsis {
    font-size: 0.8rem;
    padding: var(--space-sm);
  }
}

/* Extra small screens (iPhone SE, etc) */
@media (max-width: 375px) {
  .search-container {
    padding: var(--space-sm);
  }
  
  .search-wrapper {
    gap: 4px;
  }
  
  #search {
    font-size: 15px; /* Slightly smaller on very small screens */
    padding: 12px 10px;
  }
  
  .gps-btn, .map-picker-btn {
    width: 42px;
    height: 42px;
  }
  
  .gps-btn svg, .map-picker-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* =============== Tablet and Desktop =============== */
@media (min-width: 768px) {
  body {
    max-width: 768px;
    margin: 0 auto;
  }
  
  header {
    margin: var(--space-md);
    border-radius: var(--radius-lg);
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
  }

  .probability-list {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .map-stack {
    flex-direction: row;
  }
  
  .map-slice {
    border-right: 1px solid var(--border);
    border-bottom: none;
  }
}

@media (min-width: 1024px) {
  body {
    max-width: 1024px;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
  }
}

/* =============== Utilities =============== */
.hidden {
  display: none !important;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Touch feedback */
button:active,
.clickable:active {
  opacity: 0.8;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus-visible {
  outline-offset: 0;
}

/* =============== Vertical Bar Chart =============== */
.bar-chart-section {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.bar-chart-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bar-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  height: 120px;
  padding: 0 var(--space-md);
}

.bar {
  position: relative;
  width: 40px;
  min-height: 10px;
  border-radius: 4px 4px 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: all 0.3s ease;
}


.bar-value {
  position: absolute;
  top: -40px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  background: var(--bg-card);
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-align: center;
  line-height: 1.2;
}

.bar-value small {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: normal;
}

.bar-labels {
  display: flex;
  gap: var(--space-lg);
}

.bar-label {
  width: 40px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.2;
  font-weight: 500;
}

/* Mobile responsive for bar chart */
@media (max-width: 640px) {
  .bar-chart {
    gap: var(--space-md);
    height: 100px;
  }

  .bar {
    width: 32px;
  }

  .bar-labels {
    gap: var(--space-md);
  }

  .bar-label {
    width: 32px;
    font-size: 0.7rem;
  }

  .bar-value {
    font-size: 0.7rem;
    top: -35px;
  }

  .bar-value small {
    font-size: 0.6rem;
  }
}

/* Label positioning for overlapping P values */
.label-above {
  transform: translateY(-8px);
}

.label-below {
  transform: translateY(8px);
}

.label-center {
  transform: translateY(0);
}