:root {
  --green: #4caf50;
  --green-600: #43a047;
  --green-700: #2e7d32;
  --green-800: #1b5e20;
  --green-50: #edf7ee;
  --green-100: #d7eed8;
  --ink: #102214;
  --muted: #5d6f61;
  --line: #e3ebe4;
  --bg: #f5f8f5;
  --card: #ffffff;
  --danger: #e5484d;
  --gold: #f5b301;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(16, 34, 20, 0.06), 0 1px 3px rgba(16, 34, 20, 0.08);
  --shadow: 0 4px 12px rgba(16, 34, 20, 0.08), 0 12px 32px rgba(16, 34, 20, 0.08);
  --shadow-lg: 0 10px 40px rgba(16, 34, 20, 0.18);

  --font-display: var(--font-display);
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

a {
  color: var(--green-700);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--pill, 999px);
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:focus-visible,
.icon-btn:focus-visible,
.play-btn:focus-visible {
  outline: 3px solid rgba(76, 175, 80, 0.45);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, #56b95a 0%, var(--green-600) 100%);
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 6px 16px rgba(67, 160, 71, 0.35);
}

.btn-primary:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 10px 24px rgba(67, 160, 71, 0.42);
}

.btn-secondary {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.26);
}

.btn-danger-text {
  background: transparent;
  color: var(--muted);
}

.btn-danger-text:hover {
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 56px;
  font-size: 18px;
  padding: 14px 28px;
}

.icon-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: none;
  border-radius: var(--pill, 999px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.icon-btn:hover {
  background: var(--green-50);
  color: var(--green-700);
}

/* ---------- Brand ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--rx-sm, 10px);
  background: #fff;
  color: var(--green-600);
  box-shadow: var(--shadow-sm);
}

/* ---------- Home ---------- */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(27, 94, 32, 0.55), transparent 60%),
    linear-gradient(160deg, #5cbf60 0%, var(--green-600) 45%, var(--green-700) 100%);
  padding: calc(16px + var(--safe-top)) 20px 64px;
}

.hero::after {
  /* faint dotted globe texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  pointer-events: none;
}

.topnav {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
}

.topnav .btn {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 15px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 56px auto 0;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--pill, 999px);
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.eyebrow .material-symbols-rounded {
  font-size: 16px;
}

.hero h1 {
  margin-top: 18px;
  font-size: clamp(34px, 7vw, 60px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 16px auto 0;
  max-width: 520px;
  font-size: clamp(16px, 2.4vw, 19px);
  color: rgba(255, 255, 255, 0.9);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.cta .btn {
  min-width: 200px;
}

.btn-hero {
  background: #fff;
  color: var(--green-800);
  box-shadow: 0 10px 30px rgba(16, 34, 20, 0.25);
}

.btn-hero:hover {
  box-shadow: 0 14px 36px rgba(16, 34, 20, 0.3);
}

#flag-carousel {
  position: relative;
  overflow: hidden;
  padding: 18px 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.flag-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: marquee 90s linear infinite;
}

.flag {
  height: 30px;
  width: auto;
  border-radius: 5px;
  box-shadow: 0 0 0 1px rgba(16, 34, 20, 0.08), var(--shadow-sm);
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flag-track {
    animation: none;
  }
}

.section {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 20px 0;
}

.section-title {
  text-align: center;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
}

.section-subtitle {
  text-align: center;
  color: var(--muted);
  margin: 8px auto 0;
  max-width: 560px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.step-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--rx-sm, 12px);
  background: var(--green-50);
  color: var(--green-700);
}

.step h3 {
  margin-top: 14px;
  font-size: 19px;
}

.step p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.about-map {
  margin-top: 28px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--card);
}

.about-map img {
  display: block;
  width: 100%;
  height: auto;
}

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 20px calc(48px + var(--safe-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.site-footer .bmc {
  margin-top: 20px;
}

/* ---------- Game page ---------- */

.game-page {
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

#map {
  position: fixed;
  inset: 0;
  background: #e8eee9;
}

.game-topbar {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 8px 8px 12px;
  border-radius: var(--pill, 999px);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}

.game-topbar .brand {
  font-size: 15px;
  color: var(--ink);
}

.game-topbar .brand-mark {
  width: 30px;
  height: 30px;
  background: var(--green);
  color: #fff;
}

.game-topbar .brand-mark .material-symbols-rounded {
  font-size: 19px;
}

.pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--pill, 999px);
  background: var(--green-50);
  color: var(--green-800);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill .material-symbols-rounded {
  font-size: 18px;
}

.pill-strong {
  background: var(--green);
  color: #fff;
}

.pill.bump {
  animation: bump 0.5s ease;
}

@keyframes bump {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

.round-progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: transparent;
}

.round-progress > div {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.game-sheet {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 1000;
  width: min(520px, calc(100% - 24px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-lg);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}

.hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  min-height: 48px;
}

.hint .material-symbols-rounded {
  font-size: 18px;
  color: var(--green-600);
}

/* Custom audio player */

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  border-radius: var(--pill, 999px);
  background: var(--green-50);
}

.play-btn {
  appearance: none;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: var(--pill, 999px);
  background: linear-gradient(180deg, #56b95a 0%, var(--green-600) 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(67, 160, 71, 0.4);
  transition:
    transform 0.15s ease,
    box-shadow 0.2s ease;
}

.play-btn:hover {
  transform: scale(1.05);
}

.play-btn:active {
  transform: scale(0.95);
}

.play-btn .material-symbols-rounded {
  font-size: 32px;
}

.play-btn.attention::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.55);
  animation: ring 1.8s ease-out infinite;
}

@keyframes ring {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.55);
  }
  100% {
    box-shadow: 0 0 0 16px rgba(76, 175, 80, 0);
  }
}

.play-btn.loading .material-symbols-rounded {
  animation: spin 1s linear infinite;
}

.player-track {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--green-800);
}

.player-times {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.seek {
  --progress: 0%;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.seek::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--pill, 999px);
  background: linear-gradient(90deg, var(--green) var(--progress), var(--green-100) var(--progress));
}

.seek::-moz-range-track {
  height: 6px;
  border-radius: var(--pill, 999px);
  background: var(--green-100);
}

.seek::-moz-range-progress {
  height: 6px;
  border-radius: var(--pill, 999px);
  background: var(--green);
}

.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green);
  box-shadow: var(--shadow-sm);
}

.seek:hover::-webkit-slider-thumb,
.seek:active::-webkit-slider-thumb {
  transform: scale(1.2);
}

.seek:focus-visible {
  outline: none;
}

.seek:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.35);
}

/* Round result */

#answer-info {
  animation: fadeUp 0.35s ease;
}

.result {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 4px 0;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.result-country {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.result-points {
  flex: none;
  text-align: right;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  color: var(--green-700);
  font-variant-numeric: tabular-nums;
}

.result-points small {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.result-bar {
  height: 8px;
  border-radius: var(--pill, 999px);
  background: var(--green-50);
  overflow: hidden;
}

.result-bar > div {
  height: 100%;
  border-radius: var(--pill, 999px);
  background: linear-gradient(90deg, #8bd38e, var(--green-600));
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--pill, 999px);
  background: #f1f4f1;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.chip .material-symbols-rounded {
  font-size: 15px;
  color: var(--muted);
}

.chip-gold {
  background: #fff4d1;
  color: #8a5a00;
}

/* Map pins & tooltip */

.pin {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--ink);
  border: 3px solid #fff;
  box-shadow: 0 4px 10px rgba(16, 34, 20, 0.35);
  animation: drop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.pin::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fff;
}

.pin-answer {
  background: var(--green);
}

@keyframes drop {
  from {
    transform: rotate(-45deg) translate(10px, -10px) scale(0.6);
    opacity: 0;
  }
  to {
    transform: rotate(-45deg);
    opacity: 1;
  }
}

.leaflet-div-icon.pin-icon {
  background: none;
  border: none;
}

.leaflet-tooltip.answer-tooltip {
  padding: 6px 12px;
  border: none;
  border-radius: var(--pill, 999px);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.leaflet-tooltip-top.answer-tooltip::before {
  border-top-color: var(--ink);
}

.leaflet-container {
  font-family: var(--font-body);
}

.leaflet-control-attribution {
  border-radius: 8px 0 0 0;
  font-size: 10px;
}

/* ---------- Generic pages (scoreboard, stats) ---------- */

.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: calc(12px + var(--safe-top)) 20px 12px;
  background: linear-gradient(160deg, #56b95a 0%, var(--green-600) 60%, var(--green-700) 100%);
  color: #fff;
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.25);
}

.page-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
  margin: 0 auto;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(120px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 22px;
  animation: fadeUp 0.4s ease both;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
}

.card-title .material-symbols-rounded {
  color: var(--green-600);
}

.score-hero {
  text-align: center;
  padding: 28px 22px;
  background:
    radial-gradient(600px 200px at 50% -40%, var(--green-100), transparent 70%),
    var(--card);
}

.score-hero .label {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-hero .score {
  font-family: var(--font-display);
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  color: var(--green-700);
  font-variant-numeric: tabular-nums;
}

.score-hero .score-sub {
  color: var(--muted);
  font-size: 15px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 22px;
  text-align: left;
}

.stat {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--line);
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stat-label .material-symbols-rounded {
  font-size: 16px;
  color: var(--green-600);
}

.stat-value {
  margin-top: 2px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.stat-value small {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.round-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.round-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.round-row:first-child {
  border-top: none;
}

.round-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-50);
  color: var(--green-800);
  font-size: 13px;
  font-weight: 700;
}

.round-place {
  font-weight: 600;
  min-width: 0;
}

.round-place small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.round-points {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.leaderboard li.is-user {
  background: var(--green-50);
  box-shadow: inset 0 0 0 2px var(--green);
}

.leaderboard .rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.leaderboard .rank-1 {
  background: #ffd54f;
  border-color: #f5b301;
}

.leaderboard .rank-2 {
  background: #e0e0e0;
  border-color: #bdbdbd;
}

.leaderboard .rank-3 {
  background: #f0b98a;
  border-color: #d9935a;
}

.leaderboard .name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard .pts {
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.leaderboard .gap {
  text-align: center;
  color: var(--muted);
  background: none;
  padding: 0;
  display: block;
  line-height: 1;
}

.chart-wrap {
  position: relative;
  height: 420px;
}

.chart-caption {
  margin: -6px 0 12px;
  color: var(--muted);
}

.chart-caption strong {
  color: var(--green-700);
}

.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: linear-gradient(180deg, rgba(245, 248, 245, 0), var(--bg) 40%);
}

.action-bar .btn {
  width: min(100%, 340px);
}

/* Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row .input {
  flex: 1;
}

.input {
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  border-radius: var(--pill, 999px);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.input:focus {
  outline: none;
  background: #fff;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.18);
}

.field-hint {
  font-size: 13px;
  color: var(--muted);
  min-height: 1.4em;
}

.field-hint.success {
  color: var(--green-700);
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 34, 20, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 0.2s ease;
}

.modal {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: pop 0.3s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.modal h2 {
  font-size: 22px;
}

.modal p {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Loading */

#loading {
  position: fixed;
  inset: 0;
  z-index: 6000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.3s ease;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid var(--green-100);
  border-top-color: var(--green);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .steps {
    grid-template-columns: 1fr;
  }

  .step {
    display: grid;
    grid-template-columns: 44px 1fr;
    column-gap: 14px;
    align-items: start;
  }

  .step h3 {
    margin-top: 0;
  }

  .step p {
    grid-column: 2;
  }

  .hero-content {
    margin-top: 40px;
  }

  .cta {
    flex-direction: column;
    align-items: stretch;
  }

  .cta .btn {
    min-width: 0;
  }

  .game-topbar {
    top: calc(8px + var(--safe-top));
    left: 8px;
    right: 8px;
  }

  .game-topbar .brand-text {
    display: none;
  }

  .game-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    transform: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 14px 14px calc(14px + var(--safe-bottom));
    border-bottom: none;
  }

  .result-country {
    font-size: 21px;
  }

  /* keep the map attribution above the bottom sheet */
  .game-page .leaflet-bottom {
    bottom: var(--sheet-offset, 0px);
  }

  .chart-wrap {
    height: 360px;
  }

  .card {
    padding: 18px;
  }
}

/* ---------- GuesserGod additions: solo results + load error ---------- */

.load-error {
  background: var(--card);
  padding: 20px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 600;
}

.results-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 34, 20, 0.55);
  backdrop-filter: blur(4px);
}

.results-card {
  width: 100%;
  max-width: 460px;
  max-height: 100%;
  overflow-y: auto;
  padding: 28px 24px;
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.results-total {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 800;
  color: var(--green-700);
  line-height: 1.1;
}

.results-total small {
  font-size: 20px;
  color: var(--muted);
  font-weight: 600;
}

.results-rounds {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  text-align: left;
  font-size: 14px;
}

.results-rounds li {
  display: grid;
  grid-template-columns: 24px 1fr auto 56px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.results-round-num { color: var(--muted); }
.results-round-place { font-weight: 600; }
.results-round-km { color: var(--muted); }
.results-round-pts { text-align: right; font-weight: 700; color: var(--green-700); }

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.results-xp {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--green-50);
  font-size: 15px;
}
.results-xp .levelup { display: block; margin-top: 4px; font-weight: 700; color: var(--green-700); }
.results-xp .xp-line { margin-top: 8px; font-size: 13px; color: var(--muted); }
.results-xp .xp-track { height: 8px; margin-top: 4px; border-radius: var(--pill, 999px); background: var(--green-100); overflow: hidden; }
.results-xp .xp-track span { display: block; height: 100%; background: var(--green); border-radius: inherit; }
