:root {
  --bg: #101820;
  --panel: rgba(18, 29, 39, 0.92);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f6f0dd;
  --muted: #b7c1c9;
  --accent: #f5c84b;
  --accent-strong: #ffdf66;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.1);
  --good: #78d798;
  --warn: #f5c84b;
  --danger: #ff7f6e;
  --radius-lg: 22px;
  --radius-md: 16px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  --content-width: 1320px;
  --body-font: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body-font);
  background:
    radial-gradient(circle at 16% 6%, rgba(245, 200, 75, 0.18), transparent 28%),
    radial-gradient(circle at 84% 0%, rgba(95, 166, 255, 0.16), transparent 30%),
    linear-gradient(180deg, #0d151d 0%, #172431 46%, #101820 100%);
}

a { color: #ffe08a; }
button { font: inherit; }

.page-shell {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
  padding: 26px 0 40px;
}

.hero { position: relative; margin-bottom: 22px; }
.hero-copy { padding: 14px 4px 6px; }
.language-switch {
  position: absolute;
  top: 8px;
  right: 4px;
  z-index: 2;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(18, 29, 39, .76);
  backdrop-filter: blur(8px);
}
.language-switch a,
.language-switch span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--text);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
}
.language-switch [aria-current='page'] { color: #101820; background: var(--accent-strong); }
.language-switch a:hover,
.language-switch a:focus-visible { background: var(--surface-strong); outline: none; }
.eyebrow, .panel-kicker {
  margin: 0 0 10px;
  color: #c9b56f;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}
.hero h1, .panel h2 { margin: 0; }
.hero h1 {
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: -0.055em;
}
.hero-period { display: inline-flex; align-items: center; gap: 9px; margin: 20px 0 0; padding: 9px 13px; border: 1px solid rgba(120,215,152,.24); border-radius: 999px; color: #dce9df; background: rgba(120,215,152,.09); font-size: .9rem; font-weight: 700; }
.hero-period span { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 5px rgba(120,215,152,.12); }

.dashboard { display: grid; gap: 20px; }
.panel {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 44%);
}
.panel > * { position: relative; z-index: 1; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 0;
}
.panel-head-compact { padding-bottom: 18px; }
.panel h2 { font-size: clamp(1.28rem, 2vw, 1.75rem); }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0 24px 10px;
}
.summary-card {
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--surface);
}
.summary-label, .summary-detail { display: block; color: var(--muted); }
.summary-label { font-size: .9rem; font-weight: 700; }
.summary-value {
  display: block;
  margin: 8px 0 4px;
  color: var(--accent-strong);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}
.summary-value-small { font-size: clamp(1.35rem, 3vw, 2rem); }
.summary-footnote { margin: 0; padding: 8px 24px 24px; color: var(--muted); line-height: 1.6; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
}
.status-pill[data-tone='loading'] { color: #95c9ff; background: rgba(82, 152, 231, .14); }
.status-pill[data-tone='success'] { color: #9af0b6; background: rgba(64, 190, 109, .14); }
.status-pill[data-tone='warning'] { color: #ffdd72; background: rgba(245, 200, 75, .16); }
.status-pill[data-tone='danger'] { color: #ffafa4; background: rgba(255, 127, 110, .16); }

.refresh-button, .collapse-button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid rgba(255, 224, 138, .35);
  color: #101820;
  background: linear-gradient(180deg, #ffe590, #f5c84b);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}
.collapse-button { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--panel-border); }
.refresh-button:hover:not(:disabled), .collapse-button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.refresh-button:disabled { cursor: wait; opacity: .7; }

.map-panel { padding-bottom: 18px; }
.map-frame {
  position: relative;
  margin: 22px 24px 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: #253848;
}
.map-canvas { width: 100%; min-height: 820px; }
.leaflet-container { background: #253848; font-family: var(--body-font); }
.leaflet-control-attribution { background: rgba(16, 24, 32, .72) !important; color: #d7dee4; }
.leaflet-control-attribution a { color: #ffe08a; }
.leaflet-bar { border: 0 !important; box-shadow: 0 10px 22px rgba(0,0,0,.18); }
.leaflet-bar a { background: #111d27; color: #ffe08a; border-color: rgba(255,255,255,.12); }
.leaflet-bar a:hover { background: #182938; color: #fff; }

.map-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, rgba(16, 24, 32, .08), rgba(16, 24, 32, .78));
  transition: opacity 220ms ease, visibility 220ms ease;
}
.map-overlay.is-hidden { opacity: 0; visibility: hidden; }
.overlay-card {
  width: min(430px, 92vw);
  padding: 22px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: rgba(16, 24, 32, .9);
  text-align: center;
  box-shadow: var(--shadow);
}
.overlay-title { margin: 0 0 8px; font-weight: 800; font-size: 1.1rem; }
.overlay-copy { margin: 0; color: var(--muted); line-height: 1.6; }
.map-caption { margin: 12px 24px 0; color: var(--muted); line-height: 1.55; }
.magnitude-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 14px 24px 0; padding: 12px 14px; border: 1px solid var(--panel-border); border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.035); font-size: .82rem; }
.magnitude-legend span { display: inline-flex; align-items: center; gap: 7px; }
.magnitude-legend i { width: 11px; height: 11px; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; }
.legend-micro { background: #8fb7d7; }
.legend-minor { background: #78d798; }
.legend-light { background: #ffe16a; }
.legend-moderate { background: #ffb14f; }
.legend-strong { background: #d94336; }

.storm-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.76);
  box-shadow: 0 0 0 2px rgba(0,0,0,.2), 0 10px 18px rgba(0,0,0,.2);
  color: #101820;
  font-size: .72rem;
  font-weight: 900;
}
.storm-dot-quiet { background: #7f8c8d; color: #fff; opacity: .76; }
.storm-dot-low { background: #71d38d; }
.storm-dot-medium { background: #ffe16a; }
.storm-dot-high { background: #ff9c45; }
.storm-dot-storm { background: #ff5d4d; color: #fff; }
.latest-storm-ring {
  display: block;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px rgba(255, 224, 138, .42), 0 0 28px rgba(255, 255, 255, .9);
  animation: lightning-ring 1s ease-in-out infinite;
}
@keyframes lightning-ring {
  0%, 100% { transform: scale(.86); opacity: .35; }
  50% { transform: scale(1.18); opacity: 1; }
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #101820; color: var(--text); }
.leaflet-popup-content-wrapper { border-radius: 16px; border: 1px solid rgba(255,255,255,.12); }
.leaflet-popup-content { margin: 14px 16px; width: min(300px, calc(88vw - 40px)) !important; }
.leaflet-popup-card h3 { margin: 0; font-size: 1.05rem; }
.leaflet-popup-card p { margin: 8px 0 0; color: var(--muted); }
.leaflet-popup-grid { display: grid; gap: 7px; margin-top: 12px; }
.leaflet-popup-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; }
.leaflet-popup-row span { color: var(--muted); }
.leaflet-popup-row strong { text-align: right; }

.list-collapsible { padding: 0 24px 24px; }
.list-state {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--surface);
  color: var(--muted);
}
.list-state[data-tone='success'] { color: #9af0b6; }
.list-state[data-tone='danger'] { color: #ffafa4; }
.earthquake-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.earthquake-list-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--surface);
  cursor: pointer;
}
.earthquake-list-item:hover { background: var(--surface-strong); }
.event-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.event-main strong { font-size: 1.02rem; }
.event-main span { color: var(--accent-strong); font-weight: 800; }
.event-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; color: var(--muted); font-size: .92rem; }
.storm-list-item-storm { border-color: rgba(255,93,77,.35); }
.storm-list-item-high { border-color: rgba(255,156,69,.32); }
.storm-list-item-medium { border-color: rgba(255,225,106,.28); }

.site-footer {
  display: grid;
  gap: 6px;
  margin-top: 22px;
  color: #aeb8c1;
  font-size: .94rem;
}
.site-footer p { margin: 0; }

@media (max-width: 860px) {
  .summary-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
  .panel-actions { justify-content: flex-start; }
  .map-canvas { min-height: 680px; }
  .event-main { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .page-shell { width: min(calc(100% - 22px), var(--content-width)); padding-top: 18px; }
  .language-switch { position: static; margin: 0 0 12px auto; width: max-content; }
  .panel-head, .summary-grid, .summary-footnote, .list-collapsible { padding-left: 16px; padding-right: 16px; }
  .map-frame { margin-left: 16px; margin-right: 16px; }
  .map-caption { margin-left: 16px; margin-right: 16px; }
  .magnitude-legend { margin-left: 16px; margin-right: 16px; }
  .map-canvas { min-height: 580px; }
}

.quake-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--dot-size, 34px);
  height: var(--dot-size, 34px);
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.78);
  box-shadow: 0 0 0 2px rgba(0,0,0,.22), 0 10px 18px rgba(0,0,0,.24);
  color: #101820;
  font-size: clamp(.68rem, calc(var(--dot-size, 34px) / 4.6), .92rem);
  font-weight: 900;
  line-height: 1;
}
.quake-dot-micro { background: #8fb7d7; }
.quake-dot-minor { background: #78d798; }
.quake-dot-light { background: #ffe16a; }
.quake-dot-moderate { background: #ffb14f; }
.quake-dot-significant { background: #ff7f6e; color: #fff; }
.quake-dot-strong { background: #d94336; color: #fff; }
.latest-quake-ring {
  display: block;
  width: 68px;
  height: 68px;
  border-radius: 999px;
  border: 5px solid #fff19a;
  background: rgba(219, 48, 42, .14);
  box-shadow: 0 0 0 3px rgba(219, 48, 42, .36), 0 0 32px rgba(255, 241, 154, .95);
  animation: latest-quake-pulse .9s ease-in-out infinite;
}
@keyframes latest-quake-pulse {
  0%, 100% {
    transform: scale(.72);
    opacity: .28;
    box-shadow: 0 0 0 0 rgba(219, 48, 42, .55), 0 0 16px rgba(255, 241, 154, .7);
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 0 0 9px rgba(219, 48, 42, .2), 0 0 38px rgba(255, 241, 154, 1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .latest-quake-ring {
    animation: none;
    opacity: 1;
    box-shadow: 0 0 0 7px rgba(219, 48, 42, .3), 0 0 26px rgba(255, 241, 154, .95);
  }
}
.quake-list-item-strong { border-color: rgba(217,67,54,.42); }
.quake-list-item-significant { border-color: rgba(255,127,110,.38); }
.quake-list-item-moderate { border-color: rgba(255,177,79,.34); }
.quake-list-item-light { border-color: rgba(255,225,106,.28); }
.quake-list-item-minor { border-color: rgba(120,215,152,.24); }
.quake-list-item-micro { border-color: rgba(143,183,215,.22); }
