* {
  box-sizing: border-box;
}

body {
  background: #f5f7fb;
}

.geo-page {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 36px 0 50px;
  color: #152033;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.geo-back {
  margin-bottom: 18px;
}

.geo-back a {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: none;
}

.geo-hero {
  padding: 28px;
  margin-bottom: 22px;
  border-radius: 24px;
  color: white;
  background: linear-gradient(135deg, #0f172a, #2563eb);
}

.geo-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1;
}

.geo-hero p {
  margin: 0;
  max-width: 760px;
  font-size: 18px;
  line-height: 1.6;
}

.geo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}

.geo-map-box,
.geo-info {
  background: white;
  border: 1px solid #dbe3ec;
  border-radius: 20px;
}

.geo-map-box {
  padding: 14px;
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.map-help {
  color: #64748b;
  font-size: 13px;
  font-weight: 650;
}

.map-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.map-actions button {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.map-actions button:hover,
.map-actions button:focus {
  background: #f1f5f9;
}

#europe-map {
  display: block;
  width: 100%;
  height: auto;
  background: #dff1ff;
  border-radius: 14px;
  touch-action: none;
  cursor: grab;
}

#europe-map:active {
  cursor: grabbing;
}

.country {
  fill: #d8dee8;
  stroke: #ffffff;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .15s ease;
  outline: none;
}

.country:hover,
.country:focus {
  fill: #93c5fd;
}

.country.selected {
  fill: #f59e0b;
}

.country.correct {
  fill: #22c55e;
}

.country.wrong {
  fill: #ef4444;
}

.geo-info {
  padding: 22px;
}

.geo-info h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.country-name {
  min-height: 58px;
  font-size: 27px;
  font-weight: 800;
  color: #0f172a;
}

.country-code {
  margin-top: 8px;
  color: #64748b;
  font-size: 14px;
}

.geo-status {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.capital-halo {
  fill: rgba(255, 255, 255, .9);
  stroke: #0f172a;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.capital-marker {
  fill: #dc2626;
  stroke: #ffffff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.capital-label {
  fill: #0f172a;
  stroke: #ffffff;
  stroke-width: 4px;
  paint-order: stroke;
  stroke-linejoin: round;
  font-size: 17px;
  font-weight: 800;
}

.geo-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.geo-mode {
  min-height: 46px;
  padding: 10px 22px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: white;
  color: #334155;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.geo-mode:hover {
  background: #f1f5f9;
}

.geo-mode.active {
  color: white;
  background: #2563eb;
  border-color: #2563eb;
}

.quiz-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 20px 24px;
  margin-bottom: 20px;
  background: white;
  border: 1px solid #dbe3ec;
  border-radius: 20px;
}

.quiz-panel[hidden] {
  display: none;
}

.quiz-label {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.quiz-question {
  color: #0f172a;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 900;
  line-height: 1.1;
}

.quiz-feedback {
  min-height: 24px;
  margin-top: 8px;
  color: #64748b;
  font-weight: 700;
}

.quiz-feedback.success {
  color: #15803d;
}

.quiz-feedback.error {
  color: #b91c1c;
}

.quiz-score {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.quiz-score > div {
  min-width: 76px;
  padding: 9px 12px;
  text-align: center;
  background: #f8fafc;
  border-radius: 12px;
}

.quiz-score strong {
  display: block;
  color: #0f172a;
  font-size: 24px;
}

.quiz-score span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

#next-question,
.secondary-action {
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#next-question {
  background: #0f172a;
  color: white;
}

.secondary-action {
  border: 1px solid #cbd5e1;
  background: white;
  color: #334155;
}

.secondary-action:hover,
.secondary-action:focus {
  background: #f1f5f9;
}

#next-question:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.small-country-hit {
  fill: transparent;
  stroke: none;
  cursor: pointer;
}

.small-country-hit:hover,
.small-country-hit:focus {
  fill: transparent;
  stroke: none;
}

@media (max-width: 760px) {
  .geo-page {
    width: min(100% - 14px, 1180px);
    padding-top: 18px;
  }

  .geo-hero {
    padding: 22px;
  }

  .geo-layout {
    grid-template-columns: 1fr;
  }

  .geo-info {
    order: -1;
  }

  .country-name {
    min-height: 0;
  }

  .quiz-panel {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .quiz-score {
    justify-content: flex-start;
  }

  #next-question,
  .secondary-action {
    width: 100%;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-actions {
    width: 100%;
  }

  .map-actions button {
    flex: 1;
  }
}
