:root {
  --sky: #0099cc;
  --panel: #fff9ec;
  --ink: #1c2a2f;
  --muted: #62757d;
  --country: #57b65a;
  --country-hover: #f7c948;
  --selected: #ff8a3d;
  --correct: #27ae60;
  --wrong: #e74c3c;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #7ed8ee, var(--sky));
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 360px;
  gap: 20px;
  padding: 20px;
}

.map-panel {
  min-height: 560px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(255,255,255,.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
  overflow: hidden;
}

.map {
  width: min(100%, 900px);
  height: min(90vh, 900px);
  border: 0;
}

svg.map {
  display: block;
  background: rgba(255,255,255,.12);
  border-radius: 18px;
}

.country {
  fill: var(--country);
  stroke: rgba(255,255,255,.82);
  stroke-width: .22px;
  vector-effect: non-scaling-stroke;
  pointer-events: visibleFill;
  cursor: pointer;
  transition: fill .08s linear;
}
.country:hover { fill: var(--country-hover); }
.country:focus, .country:focus-visible { outline: none; }
.country.selected { fill: var(--selected); }
.country.borders-only { fill: transparent; pointer-events: none; stroke: rgba(255,255,255,.75); stroke-width: .18px; }
.country.correct { fill: var(--country-hover); }
.country.wrong { fill: var(--wrong); }
.country.reveal { fill: var(--country-hover); }
.sphere { fill: #d9f5ff; }
.graticule { fill: none; stroke: rgba(255,255,255,.45); stroke-width: .22px; vector-effect: non-scaling-stroke; pointer-events: none; }
.zoom-layer { will-change: transform; }
.zoom-controls { position: absolute; left: 16px; top: 16px; display: grid; gap: 8px; }
.map-panel { position: relative; }
.zoom-controls button { width: 42px; height: 42px; padding: 0; border-radius: 12px; font-size: 1.35rem; box-shadow: 0 8px 20px rgba(0,0,0,.16); }
.zoom-hint { position: absolute; left: 16px; bottom: 14px; color: #134; background: rgba(255,255,255,.82); padding: 7px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }

.side-panel {
  border-radius: 24px;
  background: var(--panel);
  padding: 22px;
  box-shadow: 0 18px 45px rgba(0,0,0,.18);
  align-self: start;
}

.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
h1 { margin: 0 0 18px; font-size: clamp(1.7rem, 4vw, 2.25rem); line-height: 1.05; }

.controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
button {
  border: 0;
  border-radius: 999px;
  padding: 11px 12px;
  font-weight: 800;
  color: #123;
  background: #e7eadf;
  cursor: pointer;
}
button:hover, button.active { background: var(--country-hover); }

.score-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.score-card div { background: #fff; border-radius: 16px; padding: 12px; text-align: center; }
.score-card strong { display: block; font-size: 1.8rem; }
.score-card span { color: var(--muted); font-size: .85rem; }

.prompt {
  min-height: 58px;
  border-radius: 16px;
  padding: 14px;
  background: #12343b;
  color: #fff;
  font-weight: 750;
  margin-bottom: 14px;
}
.prompt.correct { background: var(--correct); }
.prompt.wrong { background: var(--wrong); }
.continue-btn { width: 100%; margin: -4px 0 14px; background: var(--country-hover); }
.continue-btn[hidden] { display: none; }

.info-card { background: #fff; border-radius: 18px; padding: 16px; }
.info-card img { float: right; width: 120px; height: 80px; object-fit: contain; margin: 0 0 10px 12px; border: 1px solid #ddd; background: #f5f5f5; }
.flag-emoji { float: right; width: 98px; height: 72px; display: grid; place-items: center; margin: 0 0 10px 12px; border: 1px solid #ddd; border-radius: 12px; background: #f5f5f5; font-size: 3rem; }
h2 { margin: 0 0 10px; font-size: 1.5rem; }
dl { clear: both; display: grid; gap: 8px; margin: 0; }
dl div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }
.fun-fact { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #eee; font-style: italic; }

.fireworks {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 10;
}
.firework {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color, #f7c948);
  box-shadow: 0 0 14px var(--color, #f7c948);
  animation: firework-burst 900ms ease-out forwards;
}
@keyframes firework-burst {
  from { opacity: 1; transform: translate(-50%, -50%) scale(.8); }
  to { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(.2); }
}

@media (max-width: 850px) {
  .app { grid-template-columns: 1fr; padding: 12px; }
  .side-panel { order: -1; }
  .map-panel { min-height: 420px; }
  .map { height: 62vh; }
}
