:root {
  --bg: #e9f3ef;
  --panel-soft: rgba(255, 255, 255, 0.9);
  --text: #10212a;
  --text-soft: #52626d;
  --light: #f5fbf8;
  --accent: #0f8c7b;
  --accent-2: #f0b45d;
  --accent-3: #0f4c81;
  --border: rgba(16, 33, 42, 0.12);
  --shadow: 0 20px 60px rgba(13, 42, 51, 0.14);
  --radius-xl: 28px;
  --radius-lg: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 140, 123, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(240, 180, 93, 0.22), transparent 28%),
    linear-gradient(180deg, #f4fbf7 0%, #e5f1ef 100%);
}

body {
  padding: 24px;
}

a {
  color: var(--accent-3);
}

.page-shell {
  max-width: 1500px;
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 20px;
  margin-bottom: 22px;
}

.hero-copy,
.hero-controls,
.map-panel,
.insight-panel,
.timeline-panel {
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
  border-radius: var(--radius-xl);
  background: linear-gradient(130deg, rgba(12, 41, 46, 0.95), rgba(15, 76, 129, 0.88));
  color: var(--light);
}

.panel-kicker,
.status-label,
.metric-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}

.hero h1,
.map-panel h2,
.timeline-panel h2,
.summary-card h2 {
  margin: 10px 0 0;
  font-family: "Archivo", sans-serif;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(2.6rem, 5vw, 4.5rem);
  max-width: 12ch;
}

.hero-controls {
  padding: 24px;
  border-radius: var(--radius-xl);
  background: rgba(245, 251, 248, 0.86);
  backdrop-filter: blur(18px);
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.mode-button,
.refresh-button,
.timeline-button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.mode-button {
  padding: 14px 16px;
  border-radius: 999px;
  background: rgba(16, 33, 42, 0.06);
  color: var(--text);
  font-weight: 600;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.mode-button:hover,
.refresh-button:hover,
.timeline-button:hover {
  transform: translateY(-1px);
}

.mode-button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: white;
}

.status-card,
.summary-card {
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  padding: 18px;
}

.status-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.status-value,
.source-note,
#algorithmNote,
#selectedTimeSubtitle,
.risk-text {
  margin: 8px 0 0;
  line-height: 1.6;
  color: var(--text-soft);
}

.refresh-button {
  align-self: flex-start;
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #3c2d0d;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, 0.72fr);
  gap: 22px;
}

.map-panel,
.insight-panel,
.timeline-panel {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.map-panel,
.timeline-panel {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 22px 24px 18px;
}

.panel-head--compact {
  padding: 12px 18px 8px;
}

.panel-meta,
.timeline-caption {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.panel-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.panel-meta--single {
  width: 100%;
  display: block;
}

#modeDescription {
  display: block;
  width: 100%;
  color: var(--text-soft);
  font-size: 0.84rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-canvas {
  width: 100%;
  height: 68vh;
  min-height: 520px;
  background: #dbe8f2;
}

.map-stage {
  position: relative;
}

.map-timeline-shell {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 450;
  padding: 12px 18px 16px;
  border-radius: 0;
  background: linear-gradient(180deg, rgba(9, 24, 31, 0) 0%, rgba(9, 24, 31, 0.74) 32%, rgba(9, 24, 31, 0.84) 100%);
  backdrop-filter: blur(16px);
}

.insight-panel {
  display: grid;
  gap: 14px;
  background: rgba(240, 247, 244, 0.82);
  padding: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.metric-grid strong,
.risk-item strong {
  display: block;
  margin-top: 6px;
  font-family: "Archivo", sans-serif;
}

.metric-grid strong {
  font-size: 1.35rem;
}

.risk-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.risk-item {
  padding: 14px;
  border-radius: 16px;
  background: rgba(16, 33, 42, 0.05);
  border: 1px solid rgba(16, 33, 42, 0.06);
  animation: riskBreath 6s ease-in-out infinite;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.risk-item strong {
  font-size: 1.14rem;
}

.risk-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.risk-item:nth-child(2) {
  animation-delay: 0.5s;
}

.risk-item:nth-child(3) {
  animation-delay: 1s;
}

.risk-item:nth-child(4) {
  animation-delay: 1.5s;
}

.risk-item:nth-child(5) {
  animation-delay: 2s;
}

.risk-item:hover {
  transform: translateY(-2px);
}

.risk-item--calm {
  background: rgba(16, 33, 42, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.risk-item--watch {
  background: linear-gradient(180deg, rgba(240, 180, 93, 0.18), rgba(16, 33, 42, 0.05));
  border-color: rgba(240, 180, 93, 0.32);
  box-shadow: 0 10px 24px rgba(240, 180, 93, 0.12);
}

.risk-item--alert {
  background: linear-gradient(180deg, rgba(15, 76, 129, 0.18), rgba(16, 33, 42, 0.06));
  border-color: rgba(15, 140, 123, 0.36);
  box-shadow: 0 12px 28px rgba(15, 76, 129, 0.14);
  animation: riskPulse 2.8s ease-in-out infinite;
}

.risk-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.risk-icon {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(16, 33, 42, 0.05);
}

.risk-icon--rain {
  animation: iconBob 2.8s ease-in-out infinite;
}

.risk-icon--wind {
  animation: spinSoft 5.5s linear infinite;
}

.risk-icon--uv {
  animation: sunPulse 3.2s ease-in-out infinite;
}

.risk-icon--drought {
  animation: leafTilt 3.6s ease-in-out infinite;
}

.risk-icon--balloon {
  animation: balloonFloat 4s ease-in-out infinite;
}

.risk-icon--moon {
  animation: moonGlow 3.8s ease-in-out infinite;
}

.risk-icon--drone {
  animation: droneHover 2.6s ease-in-out infinite;
}

.timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(100px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 0 24px 24px;
  scroll-snap-type: x proximity;
}

.timeline--map {
  grid-auto-columns: minmax(88px, 96px);
  gap: 8px;
  padding: 0;
  cursor: grab;
  user-select: none;
  overscroll-behavior-x: contain;
}

.timeline.is-dragging,
.timeline--map.is-dragging {
  cursor: grabbing;
}

.timeline-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(16, 33, 42, 0.06);
  color: var(--text-soft);
  font-weight: 600;
}

.timeline-button {
  min-height: 92px;
  padding: 14px 12px;
  border-radius: 20px;
  text-align: left;
  background: rgba(16, 33, 42, 0.06);
  color: var(--text);
  scroll-snap-align: start;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.timeline-button.active {
  background: linear-gradient(145deg, var(--accent), var(--accent-3));
  color: white;
}

.timeline-symbol {
  display: block;
  font-size: 1rem;
  line-height: 1;
  margin-bottom: 6px;
}

.timeline--map .timeline-button {
  min-height: 88px;
  padding: 10px 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.94);
}

.timeline--map .timeline-button.active {
  background: linear-gradient(145deg, rgba(15, 140, 123, 0.98), rgba(15, 76, 129, 0.98));
}

.timeline--map .timeline-date {
  font-size: 0.7rem;
}

.timeline--map .timeline-hour {
  font-size: 1rem;
}

.timeline--map .timeline-temp {
  font-size: 0.76rem;
}

.timeline-note {
  display: block;
  margin-top: 6px;
  font-size: 0.7rem;
  opacity: 0.88;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-date,
.timeline-hour {
  display: block;
}

.timeline-date {
  font-size: 0.78rem;
  opacity: 0.82;
}

.timeline-hour {
  margin-top: 6px;
  font-family: "Archivo", sans-serif;
  font-size: 1.18rem;
  font-weight: 700;
}

.timeline-temp {
  display: block;
  margin-top: 8px;
  font-size: 0.84rem;
  opacity: 0.9;
}

.leaflet-container {
  font: inherit;
}

.weather-marker {
  width: 150px;
  margin-left: -75px;
  margin-top: -46px;
}

.weather-marker--compact {
  width: 108px;
  margin-left: -54px;
  margin-top: -38px;
}

.weather-badge {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: linear-gradient(145deg, rgba(12, 41, 46, 0.9), rgba(15, 76, 129, 0.86));
  color: white;
  box-shadow: 0 14px 26px rgba(11, 37, 45, 0.24);
}

.weather-badge--selected {
  outline: 2px solid rgba(240, 180, 93, 0.95);
  box-shadow: 0 0 0 3px rgba(240, 180, 93, 0.16), 0 16px 30px rgba(11, 37, 45, 0.28);
}

.weather-marker--compact .weather-badge {
  gap: 6px;
  padding: 7px 9px;
  border-radius: 15px;
}

.weather-badge::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 16px;
  height: 16px;
  background: rgba(12, 41, 46, 0.92);
  transform: translateX(-50%) rotate(45deg);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.weather-city {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.78;
}

.weather-marker--compact .weather-city {
  font-size: 0.64rem;
  letter-spacing: 0.05em;
}

.weather-temp {
  margin-top: 2px;
  font-family: "Archivo", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
}

.weather-marker--compact .weather-temp {
  font-size: 1rem;
}

.weather-side {
  display: flex;
  align-items: center;
}

.weather-wind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  opacity: 0.88;
}

.weather-marker--compact .weather-wind {
  gap: 4px;
  font-size: 0.63rem;
}

.weather-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  line-height: 1;
  animation: iconBob 3.2s ease-in-out infinite;
}

.weather-marker--compact .weather-icon {
  font-size: 1.12rem;
}

.weather-icon::after {
  content: "";
  position: absolute;
  inset: auto;
  pointer-events: none;
}

.weather-icon--sun {
  filter: drop-shadow(0 0 10px rgba(255, 204, 109, 0.35));
  animation: sunPulse 3.6s ease-in-out infinite;
}

.weather-icon--cloud {
  animation: cloudDrift 4.5s ease-in-out infinite;
}

.weather-icon--rain::after,
.weather-icon--storm::after {
  left: 50%;
  top: 80%;
  width: 18px;
  height: 12px;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, rgba(150, 214, 255, 0), rgba(150, 214, 255, 0.95)),
    linear-gradient(180deg, rgba(150, 214, 255, 0), rgba(150, 214, 255, 0.8)),
    linear-gradient(180deg, rgba(150, 214, 255, 0), rgba(150, 214, 255, 0.75));
  background-repeat: no-repeat;
  background-size: 2px 100%, 2px 90%, 2px 100%;
  background-position: 1px 0, 8px 2px, 15px 0;
  animation: rainDrops 1.1s linear infinite;
}

.weather-icon--storm {
  animation: stormFlash 3s ease-in-out infinite;
}

.weather-icon--storm::before {
  content: "⚡";
  position: absolute;
  right: -4px;
  bottom: -6px;
  font-size: 0.7em;
  animation: lightningBlink 1.8s steps(1) infinite;
}

.weather-icon--snow::after {
  content: "✦ ✦";
  position: absolute;
  left: 50%;
  top: 82%;
  transform: translateX(-50%);
  font-size: 0.36em;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.95);
  animation: snowFall 1.8s linear infinite;
}

.weather-icon--fog::after {
  left: 50%;
  top: 86%;
  width: 22px;
  height: 10px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  background-repeat: no-repeat;
  background-size: 100% 2px, 80% 2px;
  background-position: 0 1px, 2px 7px;
  animation: fogSweep 2.8s ease-in-out infinite;
}

.wind-arrow {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  transform: rotate(var(--rotation));
  transform-origin: center;
  animation: windDrift 2.4s ease-in-out infinite;
}

.weather-marker--compact .wind-arrow {
  width: 14px;
  height: 14px;
  font-size: 0.72rem;
}

.weather-zone-marker {
  background: transparent;
  border: 0;
}

.rain-zone {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle, rgba(82, 165, 255, 0.2) 0%, rgba(82, 165, 255, 0.1) 34%, rgba(82, 165, 255, 0.03) 62%, transparent 76%);
  animation: rainPulse 4s ease-in-out infinite;
}

.rain-zone::before {
  content: "";
  position: absolute;
  inset: -12%;
  background: repeating-linear-gradient(110deg, transparent 0 10px, rgba(177, 222, 255, 0.28) 10px 14px, transparent 14px 26px);
  animation: rainSweep var(--rain-speed) linear infinite;
}

.rain-zone::after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 999px;
  border: 1px solid rgba(201, 233, 255, 0.24);
}

.rain-zone--2 {
  background: radial-gradient(circle, rgba(82, 165, 255, 0.24) 0%, rgba(82, 165, 255, 0.14) 36%, rgba(82, 165, 255, 0.05) 65%, transparent 78%);
}

.rain-zone--3 {
  background: radial-gradient(circle, rgba(82, 165, 255, 0.3) 0%, rgba(82, 165, 255, 0.18) 34%, rgba(82, 165, 255, 0.06) 68%, transparent 80%);
}

.wind-zone {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotate(var(--rotation));
  opacity: var(--zone-opacity);
}

.wind-zone::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 18px;
  top: calc(50% - 1px);
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(116, 217, 196, 0.55), transparent);
}

.wind-zone::after {
  content: "";
  position: absolute;
  right: 10px;
  top: calc(50% - 6px);
  width: 12px;
  height: 12px;
  border-top: 2px solid rgba(116, 217, 196, 0.88);
  border-right: 2px solid rgba(116, 217, 196, 0.88);
  transform: rotate(45deg);
}

.wind-zone span {
  position: absolute;
  left: -28%;
  width: 38%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(116, 217, 196, 0), rgba(116, 217, 196, 0.95), rgba(116, 217, 196, 0));
  animation: windSweep var(--stream-speed) linear infinite;
}

.wind-zone span:nth-child(1) {
  top: 24%;
}

.wind-zone span:nth-child(2) {
  top: 50%;
  animation-delay: 0.35s;
}

.wind-zone span:nth-child(3) {
  top: 76%;
  animation-delay: 0.7s;
}

@keyframes windDrift {
  0% { translate: 0 0; }
  50% { translate: 0 -2px; }
  100% { translate: 0 0; }
}

@keyframes iconBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes sunPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.07); }
}

@keyframes cloudDrift {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(2px) translateY(-1px); }
}

@keyframes rainDrops {
  0% { opacity: 0.15; transform: translateX(-50%) translateY(-2px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(4px); }
}

@keyframes stormFlash {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0)); }
  12% { filter: drop-shadow(0 0 10px rgba(255, 244, 170, 0.5)); }
  18% { filter: drop-shadow(0 0 4px rgba(255, 244, 170, 0.15)); }
}

@keyframes lightningBlink {
  0%, 74%, 100% { opacity: 0; }
  75%, 79% { opacity: 1; }
  80%, 84% { opacity: 0.35; }
  85%, 89% { opacity: 1; }
}

@keyframes snowFall {
  0% { opacity: 0.15; transform: translateX(-50%) translateY(-2px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(5px); }
}

@keyframes fogSweep {
  0%, 100% { transform: translateX(-50%) translateX(-2px); opacity: 0.4; }
  50% { transform: translateX(-50%) translateX(2px); opacity: 0.75; }
}

@keyframes rainPulse {
  0%, 100% { transform: scale(1); opacity: 0.82; }
  50% { transform: scale(1.04); opacity: 1; }
}

@keyframes rainSweep {
  0% { transform: translate3d(-12px, -8px, 0); }
  100% { transform: translate3d(14px, 12px, 0); }
}

@keyframes windSweep {
  0% { transform: translateX(0); opacity: 0; }
  12% { opacity: 0.85; }
  100% { transform: translateX(210%); opacity: 0; }
}

@keyframes riskBreath {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

@keyframes riskPulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 12px 28px rgba(15, 76, 129, 0.12); }
  50% { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(15, 76, 129, 0.2); }
}

@keyframes spinSoft {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes leafTilt {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-1px); }
}

@keyframes balloonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes moonGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(152, 174, 255, 0); }
  50% { transform: scale(1.06); box-shadow: 0 0 16px rgba(152, 174, 255, 0.22); }
}

@keyframes droneHover {
  0%, 100% { transform: translateY(0) translateX(0); }
  50% { transform: translateY(-2px) translateX(1px); }
}

.weather-tooltip {
  min-width: 240px;
}

.weather-tooltip h3 {
  margin: 0 0 8px;
  font-family: "Archivo", sans-serif;
  font-size: 1rem;
}

.weather-tooltip p {
  margin: 4px 0;
}

@media (max-width: 1120px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 460px;
    height: 62vh;
  }

  .map-timeline-shell {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .hero-copy,
  .hero-controls,
  .panel-head,
  .timeline {
    padding-left: 18px;
    padding-right: 18px;
  }

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .weather-marker {
    width: 126px;
    margin-left: -63px;
  }

  .weather-badge {
    padding: 8px 10px;
  }

  .weather-temp {
    font-size: 1.24rem;
  }

  .timeline--map {
    grid-auto-columns: minmax(82px, 88px);
  }
}
