html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #bcc7d0;
}

body {
  color: #16212b;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#map-shell {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

#map-rotator {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  transition: transform 5s ease-in-out;
  will-change: transform;
}

#app.flipped #map-rotator {
  transform: rotate(180deg);
}

#map {
  width: 100%;
  height: 100%;
  background: #bcc7d0;
}

.leaflet-container {
  background: #bcc7d0;
}

.leaflet-control-attribution {
  font-size: 11px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px 0 0 0;
}

.leaflet-control-attribution a {
  color: #20456f;
}

.map-title {
  position: absolute;
  z-index: 1000;
  max-width: min(62vw, 460px);
  background: rgba(255, 255, 255, 0.75);
  padding: 5px;
  border-radius: 5px;
  font-size: clamp(22px, 2vw, 28px);
  line-height: 1.1;
  font-weight: 700;
  box-shadow: 0 2px 16px rgba(17, 24, 39, 0.10);
  transition:
    top 5s ease-in-out,
    right 5s ease-in-out,
    bottom 5s ease-in-out,
    left 5s ease-in-out,
    transform 5s ease-in-out,
    opacity 1.2s ease-in-out;
  pointer-events: none;
}

.title-primary {
  top: 16px;
  left: 16px;
  right: auto;
  bottom: auto;
  transform: rotate(0deg);
  opacity: 1;
}

.title-secondary {
  top: 16px;
  left: 16px;
  right: auto;
  bottom: auto;
  opacity: 0;
  transform: translateY(-12px);
}

#app.flipped .title-primary {
  top: auto;
  left: auto;
  right: 16px;
  bottom: 16px;
  transform: rotate(180deg);
  opacity: 1;
}

#app.flipped .title-secondary {
  top: 16px;
  left: 16px;
  right: auto;
  bottom: auto;
  transform: translateY(0);
  opacity: 1;
}

.toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.pill-button {
  border: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.88);
  color: #1f2d3a;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.icon-button:hover,
.pill-button:hover,
.icon-button:focus-visible,
.pill-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.16);
  outline: none;
  background: rgba(255, 255, 255, 0.96);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pill-button {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
}

.status-chip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.82);
  color: #223142;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.10);
  font-size: 14px;
  transition: opacity 300ms ease;
}

.status-chip.ready {
  opacity: 0;
  pointer-events: none;
}

.modal.hidden {
  display: none;
}

.modal {
  position: absolute;
  inset: 0;
  z-index: 1002;
  background: rgba(16, 24, 40, 0.25);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(540px, calc(100vw - 32px));
  max-height: min(72vh, 640px);
  overflow: auto;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.22);
  padding: 18px 18px 16px;
}

.modal-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.sources-content p {
  margin: 0 0 10px;
  line-height: 1.45;
}

.sources-content a {
  color: #1c5fa1;
}

@media (max-width: 640px) {
  .map-title {
    max-width: calc(100vw - 124px);
    font-size: 20px;
  }

  .toolbar {
    gap: 8px;
    top: 12px;
    right: 12px;
  }

  .pill-button {
    padding: 0 12px;
    min-height: 36px;
    font-size: 13px;
  }
}
