:root {
  --bg0: #f6f7fb;
  --bg1: #eef2fb;
  --panel: #ffffff;
  --panel2: #f1f4fb;
  --text: #121826;
  --muted: #5b6472;
  --line: #d7deea;
  --good: #138a54;
  --bad: #d64545;
  --warn: #b67a00;

  --c-eu: #4fb6ff; /* azzurro */
  --c-as: #ff4d4d; /* rosso */
  --c-af: #ffd166; /* giallo */
  --c-na: #2d6cff; /* blu */
  --c-sa: #21d07a; /* verde */
  --c-oc: #111111; /* nero */
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(900px 500px at 15% 10%, #dce7ff 0%, transparent 55%),
    radial-gradient(800px 520px at 90% 15%, #d9f5ea 0%, transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 18px 34px;
}

.adWrap {
  margin-top: 14px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.top {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.player {
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-width: 160px;
}

.player .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.player .v {
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

.changeGame {
  margin-top: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffffff, #eef2fb);
  border: 1px solid var(--line);
  font-weight: 800;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.subtitle {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.stats {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.stat {
  min-width: 84px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.stat .k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat .v {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}

.card {
  margin-top: 18px;
  padding: 18px 16px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 22px 55px rgba(18, 24, 38, 0.12);
}

.flag {
  font-size: 112px;
  line-height: 1;
  padding: 16px 12px 10px;
  border-radius: 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  position: relative;
}

.flagBtn {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  text-align: inherit;
  border: none;
}

.card3d {
  width: 100%;
  display: grid;
  place-items: center;
  perspective: 1000px;
}

.cardInner {
  width: 100%;
  max-width: 520px;
  min-height: 250px;
  display: block;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 520ms cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.flag.flipped .cardInner {
  transform: rotateY(180deg);
}

.cardFace {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.cardFront {
  padding: 16px 14px 12px;
  transform: rotateY(0deg);
}

.cardBack {
  padding: 14px;
  transform: rotateY(180deg);
  align-content: start;
}

.flipHint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.backTitle {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 900;
}

.backGrid {
  width: 100%;
  margin: 10px 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.backRow {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.backRow dt {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.backRow dd {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
  overflow-wrap: anywhere;
}

.backNote {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.flagImg {
  width: min(420px, 92%);
  height: auto;
  max-height: 240px;
  border-radius: 14px;
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
}

.flagEmoji {
  display: inline-block;
}

.mapPane {
  padding: 12px;
  border-radius: 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
  position: relative;
}

.mapWrap {
  width: 100%;
}

#mapSvg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
}

.countryPath {
  fill: #e8edf7;
  stroke: #ffffff;
  stroke-opacity: 0.8;
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  paint-order: stroke fill;
}

.countryPath.cont-europe {
  fill: var(--c-eu);
}
.countryPath.cont-asia {
  fill: var(--c-as);
}
.countryPath.cont-africa {
  fill: var(--c-af);
}
.countryPath.cont-north_america {
  fill: var(--c-na);
}
.countryPath.cont-south_america {
  fill: var(--c-sa);
}
.countryPath.cont-oceania {
  fill: var(--c-oc);
}

.countryPath:hover {
  filter: brightness(0.92);
  stroke-opacity: 1;
}

.countryPath.hitGood {
  fill: #21d07a;
  stroke: #138a54;
  stroke-opacity: 1;
}

.countryPath.hitBad {
  fill: #ff6b6b;
  stroke: #d64545;
  stroke-opacity: 1;
}

.mapControls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px;
  backdrop-filter: blur(10px);
}

.mapBtn {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
}

.answer.where input[type="text"] {
  display: none;
}

.answer.where #confirmBtn {
  display: none;
}

.meta {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.hintRow {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.continent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 10px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.hint {
  font-size: 13px;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: var(--muted);
  font-size: 13px;
  user-select: none;
  cursor: pointer;
  position: relative;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  position: relative;
}

.slider::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 999px;
  position: absolute;
  left: 2px;
  top: 1px;
  background: rgba(255, 255, 255, 0.72);
  transition: transform 160ms ease, background 160ms ease;
}

.toggle input:checked + .slider {
  background: rgba(33, 208, 122, 0.18);
  border-color: rgba(33, 208, 122, 0.32);
}

.toggle input:checked + .slider::after {
  transform: translateX(16px);
  background: rgba(80, 240, 168, 0.92);
}

.toggleText {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.answer {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1 1 280px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}

input[type="text"]:focus {
  border-color: rgba(33, 208, 122, 0.75);
  box-shadow: 0 0 0 3px rgba(33, 208, 122, 0.22);
}

.btn {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.btn:hover {
  background: #f7f9ff;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.7);
}

.btn:disabled:active {
  transform: none;
}

.btn.primary {
  background: #2d6cff;
  border-color: #2d6cff;
  color: #ffffff;
}

.btn.confirm {
  background: #21d07a;
  border-color: #21d07a;
  color: #0b1a12;
  box-shadow: 0 14px 36px rgba(33, 208, 122, 0.22);
}

.btn.confirm:focus {
  box-shadow: 0 0 0 3px rgba(33, 208, 122, 0.22), 0 14px 36px rgba(33, 208, 122, 0.22);
}

.btn.ghost {
  background: transparent;
}

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

.feedback {
  margin-top: 10px;
  min-height: 22px;
  font-size: 14px;
}

.feedback.good {
  color: var(--good);
}

.feedback.bad {
  color: var(--bad);
}

.feedback.warn {
  color: var(--warn);
}

.actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.promoCard {
  position: relative;
  width: min(760px, 100%);
}

.promoModalGrid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  align-items: center;
}

.promoModalImg {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel2);
}

.promoClose {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.promoClose:hover {
  filter: brightness(0.98);
}

.promoBtn {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.promoSummary {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.promoSummaryTitle {
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.promoSummaryList {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.promoSummaryList strong {
  color: var(--text);
}

.promoContinue {
  margin-top: 10px;
  width: 100%;
}

.leaderboard {
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  background: var(--panel2);
  border: 1px solid var(--line);
}

.leaderHead {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
}

.leaderTitle {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.leaderNote {
  font-size: 12px;
  color: var(--muted);
}

.leaderCols {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.leaderCol {
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.leaderLabel {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  opacity: 0.9;
  margin-bottom: 8px;
}

.leaderList {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.leaderList li {
  margin: 6px 0;
}

.leaderEntry {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.leaderEntry .name {
  color: var(--text);
  font-weight: 800;
}

.leaderEntry .score {
  font-variant-numeric: tabular-nums;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(18, 24, 38, 0.35);
  backdrop-filter: blur(10px);
}

.modal.open {
  display: flex;
}

.modalCard {
  width: min(520px, 100%);
  border-radius: 22px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(18, 24, 38, 0.22);
}

.modalTitle {
  font-size: 18px;
  font-weight: 900;
}

.modalText {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modalForm {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modalForm input[type="text"] {
  flex: 1 1 240px;
}

.modeGrid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.modeBtn {
  text-align: left;
  border-radius: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  cursor: pointer;
  color: var(--text);
}

.modeBtn:hover {
  filter: brightness(0.98);
}

.modeTitle {
  font-size: 15px;
  font-weight: 900;
}

.modeDesc {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.25;
}

.legend {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.legendTitle {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.legendGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
}

.legendItem {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel);
}

.c-eu {
  background: var(--c-eu);
}
.c-as {
  background: var(--c-as);
}
.c-af {
  background: var(--c-af);
}
.c-na {
  background: var(--c-na);
}
.c-sa {
  background: var(--c-sa);
}
.c-oc {
  background: var(--c-oc);
}

.foot {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.seo {
  margin-top: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 44px rgba(18, 24, 38, 0.08);
}

.seo h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 1000;
}

.seo h3 {
  margin: 14px 0 6px;
  font-size: 14px;
  font-weight: 1000;
  letter-spacing: 0.01em;
}

.seo p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.seo ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.faq {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  padding: 10px 12px;
}

.faq summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--text);
}

.faq details p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .adWrap {
    display: none;
  }
  .flag {
    font-size: 96px;
  }
  .backRow {
    grid-template-columns: 110px 1fr;
  }
  .promoModalGrid {
    grid-template-columns: 1fr;
  }
  .stat {
    min-width: 78px;
  }
  .legendGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .leaderCols {
    grid-template-columns: 1fr;
  }
  .modeGrid {
    grid-template-columns: 1fr;
  }
}
