* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Nunito", system-ui, sans-serif;
  background: #ffffff;
  color: #3c3c3c;
  font-weight: 600;
}
:root { --header-h: 70px; }
#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  padding-top: calc(var(--header-h) + 16px);
}
/* Fixed to the viewport (not just sticky within #app's centered 900px
   column) so it's a solid full-width bar with nothing showing above/beside
   it, rather than a floating card over the map. */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: #ffffff;
  padding: 0 max(16px, calc((100vw - 900px) / 2 + 16px));
  border-bottom: 2px solid #e5e5e5;
}
h1 {
  font-size: 1.3rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  flex-shrink: 0;
  font-weight: 800;
  color: #58cc02;
}
#progress {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 800;
  color: #afafaf;
}

header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

header button {
  padding: 8px 18px;
  font-size: 0.8rem;
  flex-shrink: 0;
}

#prompt {
  flex: 1;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 1rem;
  font-weight: 800;
  color: #4b4b4b;
  background: #f7f7f7;
  border-radius: 999px;
  padding: 0 20px;
}
#prompt .target {
  font-weight: 800;
  color: #1cb0f6;
}

#map-wrap {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: auto;
  background: #ddf4ff;
}
#map {
  display: block;
  width: 100%;
  height: 100%;
}

/* position: fixed (not absolute, and not nested inside #map-wrap) so the
   controls stay pinned to the viewport corner regardless of how far the map
   is scrolled/panned underneath them — an absolutely-positioned descendant
   of the scrolling #map-wrap would drift with its scroll offset instead. */
#zoom-controls {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#zoom-controls button {
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  overflow: hidden;
  background: #ffffff;
  color: #58cc02;
  box-shadow: 0 4px 0 #e5e5e5;
  border: 2px solid #e5e5e5;
}
#zoom-controls button:hover { background: #f7f7f7; }
/* two IDs so this beats "#zoom-controls button" above */
#zoom-controls #zoom-reset-btn { font-size: 0.6rem; color: #4b4b4b; }

button {
  appearance: none;
  -webkit-appearance: none;
  font-size: 1rem;
  line-height: 1.2;
  padding: 10px 20px;
  border-radius: 14px;
  border: none;
  background: #58cc02;
  color: #ffffff;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 0 #46a302;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}
button:hover { background: #61e002; }
button:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #46a302;
}

/* Home/Skip: secondary, gray outline instead of the primary green so the
   one actual call-to-action (Start Quiz) still stands out in the header. */
#skip-btn, #home-btn, #results-home-btn {
  background: #ffffff;
  color: #4b4b4b;
  border: 2px solid #e5e5e5;
  box-shadow: 0 4px 0 #e5e5e5;
}
#skip-btn:hover, #home-btn:hover, #results-home-btn:hover { background: #f7f7f7; }
#skip-btn:active, #home-btn:active, #results-home-btn:active,
#retry-btn:active, #results-home-btn:active {
  box-shadow: 0 0 0 #e5e5e5;
}

#learn-quiz-btn { background: #1cb0f6; box-shadow: 0 4px 0 #1899d6; }
#learn-quiz-btn:hover { background: #3ec1ff; }
#learn-quiz-btn:active { box-shadow: 0 0 0 #1899d6; }

#home-screen {
  margin: 16px 0;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.home-main { flex: 1; min-width: 0; }

#today-results {
  flex: 0 0 240px;
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 14px;
  padding: 14px 16px;
  position: sticky;
  top: 16px;
}
#today-results h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #afafaf;
  font-weight: 800;
  margin: 0 0 10px;
}
#today-results-empty { color: #afafaf; font-size: 0.8rem; margin: 0; }
#today-results-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
#today-results-list li {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.8rem;
}
#today-results-list .result-region { font-weight: 800; }
#today-results-list .result-score { color: #afafaf; }
#today-results-list li.good { background: #d7ffb8; }
#today-results-list li.good .result-score { color: #58a700; }
#today-results-list li.bad { background: #ffdfe0; }
#today-results-list li.bad .result-score { color: #ea2b2b; }

@media (max-width: 800px) {
  #home-screen { flex-direction: column; }
  #today-results { position: static; width: 100%; flex: none; }
}
.continent-group + .continent-group { margin-top: 28px; }
.continent-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #afafaf;
  font-weight: 800;
  margin: 0 0 10px;
}
.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 120px);
  justify-content: start;
  gap: 10px;
}
.region-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 2px solid #e5e5e5;
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 3px 0 #e5e5e5;
  transition: transform 0.1s ease;
}
.region-card:hover { transform: translateY(-2px); border-color: #1cb0f6; }
.region-card h3 { font-size: 0.85rem; margin: 0 0 2px; line-height: 1.2; font-weight: 800; }
.region-meta { margin: 0; color: #afafaf; font-size: 0.7rem; font-weight: 700; }
.region-progress {
  margin: 4px 0 0;
  font-size: 0.65rem;
  color: #58cc02;
  font-weight: 800;
  min-height: 1.1em;
}

.card-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.card-actions button.learn-action { background: #1cb0f6; box-shadow: 0 4px 0 #1899d6; }
.card-actions button.learn-action:hover { background: #3ec1ff; }
.card-actions button.learn-action:active { box-shadow: 0 0 0 #1899d6; }
.region-card .card-actions {
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
}
.region-card .card-actions button {
  padding: 5px 8px;
  font-size: 0.65rem;
  border-radius: 10px;
  box-shadow: 0 3px 0 #46a302;
}
.region-card .card-actions button.learn-action { box-shadow: 0 3px 0 #1899d6; }
.region-card .card-actions button:active { box-shadow: 0 0 0; }

#results {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  text-align: center;
}
.result-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 24px 32px;
  max-width: 420px;
}
#results h2 { color: #58cc02; font-weight: 800; }
#roster-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
#roster-list li {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}
#roster-list li.missed { background: #ffdfe0; color: #ea2b2b; }
#roster-list li.ok { background: #d7ffb8; color: #58a700; }
