:root {
  --ink: #25143a;
  --paper: #fff7e9;
  --panel: rgba(255, 250, 236, 0.92);
  --hot: #ef476f;
  --gold: #ffd166;
  --blue: #118ab2;
  --green: #06d6a0;
  --purple: #8338ec;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 209, 102, .45), transparent 24rem),
    radial-gradient(circle at 85% 10%, rgba(239, 71, 111, .35), transparent 21rem),
    linear-gradient(135deg, #32145f, #101433 48%, #061b24);
  color: var(--ink);
  font-family: "Nunito Sans", system-ui, sans-serif;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

.hero {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 20px 24px;
  border: 2px solid rgba(255,255,255,.45);
  border-radius: 5px;
  background: linear-gradient(110deg, rgba(255,247,233,.94), rgba(255,255,255,.72));
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
}

.eyebrow {
  margin: 0;
  color: #b83280;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: -4px 0 0;
  font-family: "Barriecito", "Nunito Sans", cursive;
  font-size: clamp(3rem, 8vw, 7.6rem);
  line-height: .86;
  color: #3c096c;
  text-shadow: 3px 3px 0 var(--gold), 7px 7px 0 rgba(239, 71, 111, .35);
}

.subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  font-size: clamp(1rem, 1.6vw, 1.25rem);
}

.pill-button, .close-button, #legendToggle {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
}

.pill-button {
  flex: none;
  padding: 13px 18px;
  border-radius: 5px;
  color: white;
  background: linear-gradient(135deg, var(--hot), var(--purple));
  box-shadow: 0 8px 20px rgba(131,56,236,.28);
}

.map-card {
  position: relative;
  z-index: 1;
  overflow: hidden;
  height: min(76vh, 820px);
  min-height: 570px;
  border-radius: 5px;
  border: 2px solid rgba(255,255,255,.42);
  background:
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.05) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(255,255,255,.22), rgba(255,255,255,.06) 43%, rgba(0,0,0,.15));
  background-size: 42px 42px, 42px 42px, auto;
  box-shadow: inset 0 0 100px rgba(0,0,0,.16), 0 24px 70px rgba(0,0,0,.34);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.graticule {
  fill: none;
  stroke: rgba(255,255,255,.16);
  stroke-width: .7;
}

.sphere {
  fill: rgba(14, 39, 69, .42);
  stroke: rgba(255,255,255,.35);
  stroke-width: 1.4;
}

.country {
  stroke: rgba(255,255,255,.7);
  stroke-width: .52;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: opacity .2s ease, filter .2s ease;
}

.country:hover {
  opacity: .9;
  filter: brightness(1.16) saturate(1.25);
}

.country.no-record {
  cursor: default;
  fill: rgba(255,255,255,.17);
  stroke: rgba(255,255,255,.25);
}

.country.selected {
  stroke: #ffffff;
  stroke-width: 2.5;
  filter: drop-shadow(0 0 8px rgba(255,255,255,.9)) drop-shadow(0 0 16px rgba(255,209,102,.75));
}

.info-panel {
  position: absolute;
  z-index: 10;
  top: 22px;
  left: 22px;
  width: min(370px, calc(100% - 44px));
  max-height: calc(100% - 44px);
  overflow: auto;
  padding: 18px 20px;
  border-radius: 5px;
  background: var(--panel);
  box-shadow: 0 18px 44px rgba(0,0,0,.22);
  border: 2px solid rgba(255,255,255,.75);
}

.panel-kicker {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--gold);
  color: #5f245e;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.info-panel h2 {
  margin: 0 0 8px;
  color: #3c096c;
  font-size: 1.7rem;
}

.dance-name {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(255,209,102,.65), rgba(6,214,160,.25));
  font-weight: 900;
  font-size: 1.1rem;
}

.dance-list {
  padding-left: 1.1rem;
  margin: 8px 0 0;
}

.dance-list li { margin: 3px 0; }

.legend {
  position: absolute;
  z-index: 11;
  right: 22px;
  bottom: 22px;
  width: min(310px, calc(100% - 44px));
  border-radius: 22px;
  background: var(--panel);
  border: 2px solid rgba(255,255,255,.75);
  box-shadow: 0 16px 38px rgba(0,0,0,.23);
}

#legendToggle {
  width: 100%;
  padding: 13px 16px;
  color: #3c096c;
  text-align: left;
  background: transparent;
}

.legend-body {
  padding: 0 16px 14px;
  font-size: .93rem;
}

.legend.collapsed .legend-body { display: none; }

.swatch {
  display: inline-block;
  width: 22px;
  height: 14px;
  margin-right: 8px;
  border-radius: 8px;
  vertical-align: -2px;
  border: 1px solid rgba(0,0,0,.16);
}

.swatch.has-data { background: linear-gradient(90deg, var(--hot), var(--gold), var(--green), var(--blue), var(--purple)); }
.swatch.no-data { background: rgba(100,100,100,.22); }
.swatch.selected { background: white; box-shadow: 0 0 0 3px var(--gold); }

.loading {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 1.25rem;
  background: rgba(10,12,30,.58);
}

.loading[hidden] { display: none; }

.ideas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
  color: var(--paper);
}

.ideas h2 {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  color: #fff7e9;
}

.ideas article {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10,8,24,.62);
}

.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  max-width: 680px;
  padding: 24px;
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 28px 80px rgba(0,0,0,.38);
}

.close-button {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: var(--hot);
  font-size: 1.5rem;
}

a { color: #3c096c; font-weight: 900; }

@media (max-width: 820px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .map-card { min-height: 680px; height: 78vh; }
  .info-panel { top: 12px; left: 12px; width: calc(100% - 24px); max-height: 230px; }
  .legend { right: 12px; bottom: 12px; width: calc(100% - 24px); }
  .ideas { grid-template-columns: 1fr; }
}
