:root {
  --bg: #050a16;
  --panel: #111c31;
  --panel-2: #17253f;
  --ink: #e6edf7;
  --muted: #8ea0b8;
  --accent: #38bdf8;
  --good: #4ade80;
  --bad: #f87171;
  --a: #fb7185;
  --b: #38bdf8;
  --sea: #0c4a6e;
  --line: rgba(148, 178, 255, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(58% 36% at 50% -6%, rgba(56, 189, 248, 0.1), transparent 62%),
    linear-gradient(180deg, #000000 0%, #181818 30%, #262626 55%, #333333 78%, #3d3d3d 100%);
  background-attachment: fixed;
}

/* ---------- Header / scoreboard ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: rgba(7, 12, 24, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.scores { display: flex; align-items: center; gap: 10px; }

.team {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
  position: relative;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.team .dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; opacity: 0.95; flex: none; }
.team .score { font-size: 22px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.team .muted { color: inherit; opacity: 0.7; font-size: 13px; font-weight: 600; }
.team .turn-badge {
  display: none;
  position: absolute;
  top: -9px;
  left: 12px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: #0b1526;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.team-a { color: var(--a); }
.team-b { color: var(--b); }

.team.active { transform: translateY(-1px); }
.team.active .dot { animation: pulse 1.6s ease-in-out infinite; }
.team-a.active {
  background: rgba(251, 113, 133, 0.13);
  border-color: var(--a);
  box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.3), 0 8px 20px -8px rgba(251, 113, 133, 0.55);
}
.team-b.active {
  background: rgba(56, 189, 248, 0.13);
  border-color: var(--b);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.3), 0 8px 20px -8px rgba(56, 189, 248, 0.55);
}
.team.active .turn-badge { display: block; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.95; }
  50% { transform: scale(1.35); opacity: 0.6; }
}
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.score.bump { animation: bump 0.45s ease; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-inline: auto;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
}
.brand-icon { width: 21px; height: 21px; color: var(--accent); }

.status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.counter {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.progress {
  width: 180px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}
#progressFill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--b), #22d3ee);
  transition: width 0.4s ease;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.55);
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 2200px;
  margin: 0 auto;
  padding: 16px 16px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.prompt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.turn-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.turn-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
body.a-turn .turn-chip { color: var(--a); border-color: rgba(251, 113, 133, 0.4); }
body.a-turn .turn-chip::before { background: var(--a); box-shadow: 0 0 9px var(--a); }
body.b-turn .turn-chip { color: var(--b); border-color: rgba(56, 189, 248, 0.4); }
body.b-turn .turn-chip::before { background: var(--b); box-shadow: 0 0 9px var(--b); }

/* ---------- Clue card ---------- */

.clue-wrap { width: 100%; max-width: 880px; }

.clue {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: linear-gradient(160deg, rgba(26, 40, 64, 0.92), rgba(12, 20, 37, 0.9));
  border: 1px solid rgba(148, 178, 255, 0.26);
  border-radius: 18px;
  padding: 18px 22px 16px;
  font-size: 16.5px;
  line-height: 1.55;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.clue::before {
  content: "Clue";
  display: block;
  width: max-content;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 2px 9px;
  border-radius: 999px;
  margin-bottom: 10px;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.clue::after {
  content: "Tap to reveal the clue";
  display: block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  animation: hintPulse 2.2s ease-in-out infinite;
}
@keyframes hintPulse { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.45; } }

.clue:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.7), 0 0 0 3px rgba(56, 189, 248, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.clue.active {
  cursor: default;
  transform: none;
  border-left: 4px solid var(--accent);
}
.clue.active::after { content: none; }
body.a-turn .clue.active { border-color: var(--a); box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.14), 0 14px 34px -14px rgba(0, 0, 0, 0.65); }
body.b-turn .clue.active { border-color: var(--b); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14), 0 14px 34px -14px rgba(0, 0, 0, 0.65); }
body.a-turn .clue.active::before { color: var(--a); background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.35); }
body.b-turn .clue.active::before { color: var(--b); background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.35); }

.skip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--muted);
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.skip:hover { color: var(--ink); border-color: var(--muted); background: rgba(255, 255, 255, 0.08); }

/* ---------- Map ---------- */

.map-wrap { position: relative; width: 100%; z-index: 0; }

.map-wrap::before {
  content: "";
  position: absolute;
  inset: 6% 3% 10%;
  z-index: -1;
  border-radius: 50%;
  background:
    radial-gradient(55% 55% at 50% 42%, rgba(56, 189, 248, 0.22), rgba(56, 189, 248, 0.06) 48%, transparent 72%),
    radial-gradient(42% 46% at 50% 62%, rgba(167, 139, 250, 0.16), transparent 72%),
    radial-gradient(36% 36% at 50% 34%, rgba(34, 211, 238, 0.14), transparent 68%);
  filter: blur(26px);
  pointer-events: none;
}

.map-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(1px 1px at 25px 35px, rgba(255, 255, 255, 0.9), transparent 100%),
    radial-gradient(1px 1px at 100px 150px, rgba(190, 215, 255, 0.6), transparent 100%),
    radial-gradient(1.5px 1.5px at 60px 90px, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(1px 1px at 140px 40px, rgba(255, 255, 255, 0.45), transparent 100%),
    radial-gradient(1px 1px at 200px 110px, rgba(210, 225, 255, 0.75), transparent 100%),
    radial-gradient(1.2px 1.2px at 45px 180px, rgba(255, 255, 255, 0.55), transparent 100%),
    radial-gradient(1px 1px at 175px 65px, rgba(255, 255, 255, 0.4), transparent 100%),
    radial-gradient(1.4px 1.4px at 118px 220px, rgba(160, 200, 255, 0.5), transparent 100%);
  background-size: 220px 210px;
  background-repeat: repeat;
  opacity: 0.6;
  animation: twinkle 6s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes twinkle {
  0% { opacity: 0.35; }
  100% { opacity: 0.75; }
}
@media (prefers-reduced-motion: reduce) {
  .map-wrap::after { animation: none; opacity: 0.6; }
}

#map {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 16px 42px rgba(0, 0, 0, 0.5));
}

.graticule {
  fill: none;
  stroke: rgba(215, 240, 255, 0.12);
  stroke-width: 0.4;
  pointer-events: none;
}

.country {
  fill: var(--c, rgba(148, 160, 116, 0.55));
  stroke: rgba(7, 26, 42, 0.85);
  stroke-width: 0.7;
  cursor: pointer;
  transition: fill 0.15s ease, filter 0.15s ease;
}
body.photo .country {
  fill: url(#sat);
  stroke: rgba(12, 34, 60, 0.6);
  stroke-width: 1;
}
body.photo .country:hover { fill: rgba(255, 255, 255, 0.32); }
body.photo .country.hi { fill: var(--accent); filter: brightness(1.05); }
body.photo .country.solved { fill: var(--good); }
body.photo .country.solved.wrong { fill: var(--bad); }
body.photo .shade { opacity: 0.26; }
.country.quiz { fill: var(--c, rgba(188, 168, 104, 0.85)); stroke-width: 1.1; }
.country:hover { filter: brightness(1.2); }
.country.hi { fill: var(--accent); filter: brightness(1.05); }
.country.solved { fill: var(--good); }
.country.solved.wrong { fill: var(--bad); }
.country:not(.quiz) { cursor: default; }

.shade { pointer-events: none; }
.vignette { pointer-events: none; }

.locate-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(9, 16, 32, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  z-index: 4;
}

.country-label {
  position: absolute;
  transform: translate(-50%, -135%);
  background: rgba(9, 16, 32, 0.95);
  border: 1px solid var(--accent);
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

/* ---------- Answer reveal ---------- */

.answer-reveal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 22px 48px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(16, 27, 49, 0.97), rgba(8, 14, 28, 0.97));
  border: 1px solid rgba(56, 189, 248, 0.4);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(56, 189, 248, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  pointer-events: none;
}
.answer-reveal.show { animation: revealPop 0.35s ease; }
.answer-reveal-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.answer-reveal-name {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--accent);
}
@keyframes revealPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  60% { transform: translate(-50%, -50%) scale(1.03); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .answer-reveal.show { animation: none; }
}

/* ---------- Feedback ---------- */

.feedback {
  min-height: 42px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 15px;
}
.feedback .right,
.feedback .nope,
.feedback .muted {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid;
  animation: pop 0.3s ease;
}
.feedback .right { color: #86efac; background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.35); }
.feedback .nope { color: #fca5a5; background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.35); }
.feedback .muted { color: var(--muted); background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.14); }

@keyframes pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}

/* ---------- End screen ---------- */

.end {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(10px);
  animation: fade 0.4s ease;
}
.end-card {
  text-align: center;
  padding: 42px 56px;
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(32, 46, 74, 0.96), rgba(13, 21, 38, 0.97));
  border: 1px solid rgba(148, 178, 255, 0.22);
  box-shadow: 0 34px 90px -24px rgba(0, 0, 0, 0.85);
  animation: rise 0.45s ease;
}
.end-card h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}
.end-card .final-score { font-size: 19px; color: var(--muted); margin: 0 0 26px; }
.end-card .final-score { animation: pop 0.4s ease; }
.end-actions { display: flex; justify-content: center; gap: 12px; }
.end-actions .btn { min-width: 150px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.btn.primary {
  background: linear-gradient(135deg, #38bdf8, #22d3ee);
  color: #04283a;
  border: none;
  padding: 13px 32px;
  font-size: 15.5px;
  font-weight: 800;
  font-family: inherit;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 12px 26px -8px rgba(56, 189, 248, 0.6);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn.primary:hover { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 16px 32px -8px rgba(56, 189, 248, 0.7); }
.btn.primary:active { transform: translateY(0); }

.hidden { display: none !important; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .bar { gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
  .brand { display: none; }
  .team { padding: 7px 10px; gap: 7px; }
  .team .score { font-size: 18px; }
  .team .muted { font-size: 12px; }
  .team .turn-badge { left: 9px; }
  .status { margin-left: auto; }
  .progress { width: 110px; }
  .clue { font-size: 15px; padding: 14px 16px; }
  .prompt { font-size: 14px; }
  .end-card { padding: 32px 26px; }
}
