:root {
  --ink: #f1f7f2;
  --muted: #b7c5c0;
  --quiet: rgba(241, 247, 242, 0.72);
  --panel: rgba(7, 17, 20, 0.78);
  --panel-strong: rgba(7, 17, 20, 0.92);
  --line: rgba(213, 235, 226, 0.2);
  --aqua: #66e0d0;
  --moss: #a7d982;
  --amber: #f0c96d;
  --ember: #e47458;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell,
.world-map {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: #06161c;
  color: var(--ink);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 10000;
  transform: translateY(-140%);
  border-radius: 999px;
  background: var(--ink);
  color: #071114;
  padding: 10px 14px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  position: relative;
  isolation: isolate;
}

.world-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 52% 42%, rgba(102, 224, 208, 0.09), transparent 34%),
    linear-gradient(160deg, #06161c 0%, #092630 48%, #071116 100%);
}

.maplibregl-map {
  font: inherit;
}

.maplibregl-ctrl-attrib,
.maplibregl-ctrl-group {
  border: 1px solid var(--line) !important;
  border-radius: 999px !important;
  background: rgba(7, 17, 20, 0.72) !important;
  color: rgba(241, 247, 242, 0.72) !important;
  box-shadow: var(--shadow) !important;
}

.maplibregl-ctrl-attrib a {
  color: var(--aqua) !important;
}

.maplibregl-ctrl-group button {
  width: 34px !important;
  height: 34px !important;
}

.brand-bar,
.control-dock,
.event-panel,
.event-list-panel,
.legend-panel {
  position: fixed;
  z-index: 500;
}

.brand-bar {
  left: clamp(16px, 3vw, 34px);
  top: clamp(14px, 3vw, 28px);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: min(560px, calc(100vw - 32px));
  pointer-events: none;
}

.brand-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: clamp(38px, 4vw, 52px);
  height: clamp(38px, 4vw, 52px);
  flex: 0 0 auto;
  margin-top: clamp(23px, 2.1vw, 30px);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.36);
}

.brand-bar h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 4.8vw, 62px);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--aqua);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.world-summary {
  max-width: 420px;
  margin: 10px 0 0;
  color: rgba(241, 247, 242, 0.78);
  font-size: 13px;
  line-height: 1.4;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

.control-dock {
  left: 50%;
  bottom: clamp(16px, 3vw, 28px);
  display: flex;
  width: min(880px, calc(100vw - 32px));
  transform: translateX(-50%);
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(7, 17, 20, 0.74);
  box-shadow: var(--shadow);
  padding: 9px;
  backdrop-filter: blur(18px) saturate(1.15);
}

.control-group,
.view-filter,
.type-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip,
.icon-button,
.close-panel,
.text-button,
.event-list-item {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.chip {
  min-height: 36px;
  border-radius: 999px;
  background: rgba(241, 247, 242, 0.08);
  color: rgba(241, 247, 242, 0.84);
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.language-select {
  min-height: 36px;
  max-width: 170px;
  border: 1px solid rgba(102, 224, 208, 0.28);
  border-radius: 999px;
  background: rgba(241, 247, 242, 0.08);
  color: rgba(241, 247, 242, 0.9);
  padding: 8px 32px 8px 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1;
}

.language-select:focus-visible {
  outline: 2px solid rgba(102, 224, 208, 0.8);
  outline-offset: 3px;
}

.language-select option {
  background: #071b22;
  color: #f1f7f2;
}

.chip:hover,
.icon-button:hover,
.close-panel:hover,
.text-button:hover,
.event-list-item:hover {
  transform: translateY(-1px);
  border-color: rgba(102, 224, 208, 0.38);
  background: rgba(102, 224, 208, 0.14);
  color: var(--ink);
}

.chip.is-active {
  border-color: rgba(102, 224, 208, 0.58);
  background: rgba(102, 224, 208, 0.18);
  color: var(--ink);
}

.icon-button,
.close-panel {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: rgba(241, 247, 242, 0.09);
}

.icon-button svg,
.close-panel svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-menu {
  position: relative;
}

.filter-panel {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  padding: 14px;
}

.filter-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.text-button {
  min-height: 34px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(241, 247, 242, 0.08);
  color: var(--ink);
  padding: 8px 12px;
}

.event-list-panel,
.legend-panel,
.event-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.18);
}

.event-list-panel {
  left: clamp(16px, 3vw, 34px);
  top: clamp(156px, 23vh, 204px);
  width: min(360px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 290px));
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.event-list-panel.is-collapsed {
  display: none;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

.list-count {
  margin: 12px 0;
  color: var(--quiet);
  font-size: 13px;
}

.event-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.event-list-item {
  display: grid;
  align-content: start;
  gap: 7px;
  width: 100%;
  min-height: 96px;
  border-color: rgba(213, 235, 226, 0.12);
  border-radius: 14px;
  background: rgba(241, 247, 242, 0.06);
  color: var(--ink);
  padding: 13px 11px;
  text-align: left;
}

.event-list-item.is-active {
  border-color: rgba(102, 224, 208, 0.55);
  background: rgba(102, 224, 208, 0.15);
}

.list-item-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 760;
  line-height: 1.24;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.list-item-meta {
  display: block;
  min-height: 17px;
  margin-top: 0;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.severity-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.severity-tag::before,
.legend-dot {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(102, 224, 208, 0.15);
}

.legend-panel {
  left: clamp(16px, 3vw, 34px);
  bottom: 104px;
  width: min(330px, calc(100vw - 32px));
  padding: 16px;
}

.legend-block {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.legend-block h3,
.explain-block h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(241, 247, 242, 0.86);
  font-size: 13px;
}

.legend-note {
  margin: 14px 0 0;
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.45;
}

.credits-block {
  margin-top: 16px;
  border-top: 1px solid rgba(213, 235, 226, 0.16);
  padding-top: 14px;
}

.credits-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.credits-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: rgba(241, 247, 242, 0.78);
  font-size: 12px;
  line-height: 1.42;
}

.severity-low,
.marker-low::before {
  background: var(--moss);
  box-shadow: 0 0 0 4px rgba(167, 217, 130, 0.15);
}

.severity-moderate,
.marker-moderate::before {
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(102, 224, 208, 0.15);
}

.severity-important,
.marker-important::before {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(240, 201, 109, 0.18);
}

.severity-major,
.marker-major::before {
  background: var(--ember);
  box-shadow: 0 0 0 4px rgba(228, 116, 88, 0.18);
}

.event-panel {
  right: clamp(14px, 3vw, 28px);
  top: clamp(96px, 15vh, 132px);
  width: min(400px, calc(100vw - 28px));
  max-height: min(720px, calc(100vh - 178px));
  overflow: auto;
  transform: translateX(calc(100% + 40px));
  padding: 22px;
  opacity: 0;
  transition: transform 240ms ease, opacity 240ms ease;
}

.event-panel.is-open {
  transform: translateX(0);
  opacity: 1;
}

.close-panel {
  position: absolute;
  right: 14px;
  top: 14px;
}

.empty-state {
  padding-right: 42px;
}

.empty-state h2,
.event-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.04;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.empty-state p:last-child {
  margin: 16px 0 0;
  color: rgba(241, 247, 242, 0.82);
  line-height: 1.58;
}

.event-card.is-hidden,
.is-hidden {
  display: none !important;
}

.event-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: rgba(102, 224, 208, 0.12);
  color: var(--aqua);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 760;
}

.explain-block {
  margin-top: 18px;
}

.explain-block p {
  margin: 7px 0 0;
  color: rgba(241, 247, 242, 0.84);
  line-height: 1.55;
}

.event-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.event-meta div {
  min-width: 0;
  border: 1px solid rgba(213, 235, 226, 0.14);
  border-radius: 14px;
  background: rgba(241, 247, 242, 0.06);
  padding: 12px;
}

.event-meta dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
  text-transform: uppercase;
}

.event-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(102, 224, 208, 0.42);
  border-radius: 999px;
  background: rgba(102, 224, 208, 0.13);
  color: var(--ink);
  padding: 10px 14px;
  text-decoration: none;
}

.source-link:hover {
  background: rgba(102, 224, 208, 0.22);
}

.safety-note {
  width: 100%;
  color: rgba(241, 247, 242, 0.68);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

:focus-visible {
  outline: 3px solid rgba(102, 224, 208, 0.88);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 980px) {
  .event-list-panel {
    width: min(330px, calc(100vw - 32px));
  }
}

@media (max-width: 760px) {
  :root {
    --mobile-control-reserve: 164px;
    --mobile-panel-gap: 10px;
  }

  body {
    overflow: hidden;
  }

  .brand-bar {
    left: 14px;
    top: 12px;
    right: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-identity {
    gap: 10px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    margin-top: 18px;
    border-radius: 10px;
  }

  .brand-bar h1 {
    font-size: 34px;
  }

  .world-summary {
    max-width: 280px;
    font-size: 12px;
  }

  .control-dock {
    bottom: 10px;
    justify-content: flex-start;
    max-height: calc(var(--mobile-control-reserve) - 20px);
    overflow: auto;
    border-radius: 18px;
    padding: 8px;
  }

  .control-dock .safety-note {
    order: 10;
    flex: 1 0 100%;
    margin-top: 2px;
    padding: 0 4px 1px;
    font-size: 11px;
    text-align: left;
  }

  .chip {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .language-select {
    max-width: 138px;
    min-height: 36px;
    padding: 8px 28px 8px 10px;
    font-size: 12px;
  }

  .view-filter {
    flex-wrap: nowrap;
  }

  .filter-panel {
    left: 0;
    transform: none;
  }

  .event-list-panel,
  .event-panel {
    top: auto;
    right: auto;
    bottom: calc(var(--mobile-control-reserve) + var(--mobile-panel-gap));
    left: 12px;
    width: min(380px, calc(100vw - 24px));
    max-width: min(380px, calc(100vw - 24px));
    max-height: calc(100dvh - var(--mobile-control-reserve) - 128px);
    overflow-x: hidden;
    transform: translateY(calc(100% + 30px));
    border-radius: 22px;
  }

  .event-list-panel {
    display: flex;
    opacity: 0;
    transition: transform 240ms ease, opacity 240ms ease;
  }

  .event-list-panel:not(.is-collapsed) {
    transform: translateY(0);
    opacity: 1;
  }

  .event-panel.is-open {
    transform: translateY(0);
  }

  .legend-panel {
    left: 12px;
    bottom: calc(var(--mobile-control-reserve) + var(--mobile-panel-gap));
    width: min(360px, calc(100vw - 24px));
    max-height: calc(100dvh - var(--mobile-control-reserve) - 128px);
    overflow: auto;
  }

  .event-meta {
    grid-template-columns: 1fr;
  }

  .panel-close {
    display: grid;
  }
}

@media (min-width: 761px) {
  .panel-close {
    display: none;
  }
}

@media (max-width: 440px) {
  .brand-bar h1 {
    font-size: 30px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .control-dock {
    width: calc(100vw - 20px);
  }
}
