@font-face { font-family: "Fredoka"; src: url("fonts/fredoka-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
:root {
  --bg1: #1b1446; --bg2: #2c1d7a; --bg3: #0f4c8a;
  --card: rgba(255,255,255,.1); --card2: rgba(255,255,255,.16); --line: rgba(255,255,255,.18);
  --ink: #fff; --muted: #c9c4f0; --ok: #2fe39a; --bad: #ff5d7a; --gold: #ffc53d; --teal: #3fe0c5; --blue: #4da3ff;
  --r: 22px; --shadow: 0 10px 30px rgba(6, 2, 40, .35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif; color: var(--ink);
  background: radial-gradient(1200px 800px at 15% -10%, #4b2fc2 0%, transparent 60%),
              radial-gradient(900px 700px at 110% 110%, #0d6fb8 0%, transparent 55%),
              linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
  background-attachment: fixed; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.sky i { position: absolute; width: 180px; height: 180px; border-radius: 50%; filter: blur(2px);
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.18), rgba(255,255,255,0) 70%);
  animation: drift 18s ease-in-out infinite alternate; }
.sky i:nth-child(1) { left: 5%; top: 12%; } .sky i:nth-child(2) { left: 70%; top: 6%; width: 120px; height: 120px; animation-duration: 14s; }
.sky i:nth-child(3) { left: 82%; top: 60%; width: 220px; height: 220px; animation-duration: 22s; }
.sky i:nth-child(4) { left: 12%; top: 70%; width: 90px; height: 90px; animation-duration: 12s; }
.sky i:nth-child(5) { left: 45%; top: 40%; width: 60px; height: 60px; animation-duration: 10s; }
.sky i:nth-child(6) { left: 30%; top: 88%; width: 140px; height: 140px; animation-duration: 16s; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, -50px) scale(1.15); } }

.top { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 6px; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .globe { display: inline-block; animation: spin 12s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.who { margin-left: auto; font-size: 15px; color: var(--muted); }
.icon-btn { width: 42px; height: 42px; border-radius: 14px; background: var(--card); font-size: 20px; }
main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 8px 16px 24px; }
.foot { position: relative; z-index: 1; text-align: center; font-size: 11px; color: rgba(255,255,255,.45); padding: 8px 8px max(10px, env(safe-area-inset-bottom)); }

h1 { font-size: clamp(30px, 6vw, 46px); margin: 10px 0 4px; line-height: 1.05; }
h2 { font-size: clamp(22px, 4.5vw, 30px); margin: 6px 0 12px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 17px; }
.center { text-align: center; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row.c { justify-content: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

.btn { border-radius: 18px; padding: 14px 22px; font-weight: 600; font-size: 18px; background: var(--card2); border: 1px solid var(--line);
  transition: transform .12s ease, background .2s, box-shadow .2s; min-height: 54px; }
.btn:active { transform: scale(.96); }
.btn.go { background: linear-gradient(135deg, #2fe39a, #1fb6d6); color: #06243a; border: 0; box-shadow: 0 8px 22px rgba(47,227,154,.35); font-size: 21px; padding: 16px 34px; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 42px; padding: 8px 14px; font-size: 15px; border-radius: 14px; }
.link { color: var(--muted); text-decoration: underline; font-size: 15px; padding: 8px; }

/* login */
.players { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 14px 0; }
.players .player { width: 150px; }
@media (max-width: 420px) { .players .player { width: calc(50% - 6px); } }
.player { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 10px; border-radius: 20px; background: var(--card); border: 2px solid transparent; font-size: 19px; font-weight: 600; }
.player .av { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: linear-gradient(135deg, #7b5cff, #3fe0c5); }
.player.picked { border-color: var(--teal); background: rgba(63,224,197,.16); box-shadow: 0 0 0 4px rgba(63,224,197,.15); }
.player .best { font-size: 13px; color: var(--muted); font-weight: 400; }
.name-input { width: 100%; max-width: 380px; font: inherit; font-size: 22px; padding: 14px 18px; border-radius: 16px; border: 2px solid var(--line); background: rgba(0,0,0,.2); color: #fff; outline: none; }
.name-input:focus { border-color: var(--teal); }
.err { color: var(--bad); min-height: 22px; margin: 8px 0; }

/* menu */
.diff { display: inline-flex; background: rgba(0,0,0,.22); border-radius: 18px; padding: 5px; gap: 4px; margin: 4px 0 6px; }
.diff button { padding: 10px 18px; border-radius: 14px; font-weight: 600; font-size: 17px; color: var(--muted); }
.diff button.on { background: #fff; color: #2a1c74; }
.diff-hint { color: var(--muted); font-size: 15px; min-height: 20px; margin-bottom: 14px; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.mode { position: relative; text-align: left; padding: 16px; border-radius: 22px; min-height: 128px; display: flex; flex-direction: column; gap: 4px;
  background: linear-gradient(150deg, rgba(255,255,255,.18), rgba(255,255,255,.06)); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s; }
.mode:hover { transform: translateY(-3px); }
.mode .ic { font-size: 34px; }
.mode .nm { font-size: 20px; font-weight: 700; }
.mode .bs { font-size: 14px; color: var(--muted); margin-top: auto; }
.mode.star { background: linear-gradient(150deg, rgba(255,197,61,.35), rgba(255,93,122,.18)); }
.menu-links { margin-top: 18px; }

/* play */
.hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; font-size: 16px; }
.pill { background: var(--card); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.pill.score { margin-left: auto; font-weight: 700; font-size: 18px; }
.combo { background: linear-gradient(135deg, #ff9f43, #ff5d7a); border: 0; font-weight: 700; }
.combo.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.25); } }
.timer { height: 10px; border-radius: 999px; background: rgba(0,0,0,.25); overflow: hidden; margin-bottom: 14px; }
.timer > i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--ok), var(--gold), var(--bad)); background-size: 300% 100%; }
.prompt { font-size: clamp(20px, 4.2vw, 28px); font-weight: 600; text-align: center; margin: 4px 0 12px; display: flex; gap: 10px; justify-content: center; align-items: center; }
.say { width: 40px; height: 40px; border-radius: 12px; background: var(--card); flex: none; font-size: 18px; }
.stage { display: grid; place-items: center; margin-bottom: 14px; min-height: 120px; }
.flag { width: min(320px, 70vw); aspect-ratio: 4 / 3; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.4); background: #fff center / cover no-repeat; }
.shape { width: min(250px, 60vw); height: min(250px, 60vw); filter: drop-shadow(0 10px 18px rgba(0,0,0,.35)); }
.shape path { fill: url(#land); stroke: #fff; stroke-width: 1.2; }
.country-name { font-size: clamp(30px, 7vw, 48px); font-weight: 700; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.country-name .mini { width: 96px; aspect-ratio: 4/3; border-radius: 8px; background: #fff center / cover; box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { min-height: 66px; padding: 12px; border-radius: 18px; font-size: clamp(17px, 3.6vw, 21px); font-weight: 600; background: #fff; color: #2a1c74; box-shadow: 0 6px 0 rgba(0,0,0,.18); transition: transform .1s, background .2s; }
.choice:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.choice.ok { background: var(--ok); color: #053321; animation: pop .4s ease; }
.choice.bad { background: var(--bad); color: #fff; animation: shake .4s ease; }
.choice.dim { opacity: .45; }
.kids .choice { min-height: 92px; font-size: clamp(21px, 4.6vw, 26px); }
.kids .choices.three { grid-template-columns: 1fr; }
@media (min-width: 640px) { .kids .choices.three { grid-template-columns: repeat(3, 1fr); } }
@keyframes pop { 50% { transform: scale(1.06); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.float { position: fixed; pointer-events: none; font-weight: 700; font-size: 30px; color: var(--gold); text-shadow: 0 3px 10px rgba(0,0,0,.4); animation: rise 1s ease forwards; z-index: 9; }
@keyframes rise { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -70px) scale(1.2); } }
.toast { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); background: linear-gradient(135deg, #ff9f43, #ff5d7a); padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: 24px; z-index: 9; animation: toast 1.1s ease forwards; box-shadow: var(--shadow); }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -20px); } }
.answer-line { text-align: center; min-height: 28px; font-size: 19px; margin-top: 10px; color: var(--muted); }

/* maps */
.mapwrap { position: relative; width: 100%; border-radius: 20px; overflow: hidden; background: radial-gradient(circle at 50% 40%, #2b78c9, #123a7a); box-shadow: var(--shadow); touch-action: none; }
.mapwrap svg { display: block; width: 100%; height: auto; max-height: 62vh; user-select: none; -webkit-user-select: none; }
.mapwrap path.l { fill: #e9f1ff; stroke: #7f95c9; stroke-width: .7; vector-effect: non-scaling-stroke; }
.mapwrap path.c { fill: #fdfdff; cursor: pointer; transition: fill .15s; }
.mapwrap path.c:hover { fill: #ffe9a8; }
.mapwrap path.ok, .mapwrap circle.ok { fill: var(--ok) !important; animation: blink .5s ease 3; }
.mapwrap path.bad, .mapwrap circle.bad { fill: var(--bad) !important; }
.mapwrap circle.dot { fill: rgba(255,255,255,.9); stroke: #7f95c9; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: pointer; }
@keyframes blink { 50% { opacity: .35; } }
.mapwrap .zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.mapwrap .zoom button { width: 44px; height: 44px; border-radius: 12px; background: rgba(0,0,0,.4); font-size: 24px; font-weight: 700; }
.world path { stroke: rgba(255,255,255,.55); stroke-width: .6; cursor: pointer; transition: filter .15s; }
.world path:hover { filter: brightness(1.15); }
.world .sphere { fill: #1c5aa8; stroke: none; cursor: default; }
.target-name { font-size: clamp(26px, 6vw, 40px); font-weight: 700; color: var(--gold); }

/* results */
.result { text-align: center; }
.stars { font-size: 64px; letter-spacing: 8px; margin: 6px 0; }
.stars span { display: inline-block; opacity: .2; transform: scale(.6); transition: all .4s cubic-bezier(.3,1.6,.5,1); }
.stars span.on { opacity: 1; transform: scale(1); filter: drop-shadow(0 4px 12px rgba(255,197,61,.6)); }
.medal { display: inline-block; padding: 8px 18px; border-radius: 999px; font-weight: 700; margin: 6px 0 4px; }
.medal.or { background: linear-gradient(135deg, #ffe17a, #f7a600); color: #4a2c00; }
.medal.argent { background: linear-gradient(135deg, #f2f5ff, #a9b4cf); color: #24304d; }
.medal.bronze { background: linear-gradient(135deg, #f3b07a, #b0612e); color: #3d1a00; }
.big-score { font-size: clamp(48px, 12vw, 80px); font-weight: 700; line-height: 1; margin: 6px 0; }
.record { color: var(--gold); font-weight: 700; font-size: 22px; animation: pop .6s ease 2; }
.stats { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 12px 0 18px; }
.recap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 16px 0; text-align: left; }
.recap div { background: var(--card); border-radius: 12px; padding: 8px 10px; font-size: 14px; }
.recap .y::before { content: "✅ "; } .recap .n::before { content: "❌ "; }

/* tables */
table.hs { width: 100%; border-collapse: collapse; font-size: 17px; }
table.hs td, table.hs th { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.hs th { color: var(--muted); font-weight: 500; font-size: 14px; }
table.hs td.n { text-align: right; font-weight: 700; }
table.hs tr.me td { color: var(--gold); }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs button { padding: 8px 12px; border-radius: 12px; background: var(--card); font-size: 15px; }
.tabs button.on { background: #fff; color: #2a1c74; font-weight: 600; }
.empty { color: var(--muted); padding: 20px; text-align: center; }
.offline { background: rgba(255,197,61,.18); border: 1px solid rgba(255,197,61,.4); color: #ffe6a8; padding: 8px 12px; border-radius: 12px; font-size: 14px; margin-bottom: 10px; }
.countdown { font-size: 120px; font-weight: 700; text-align: center; margin-top: 60px; animation: pop .6s ease infinite; }

@media (max-width: 420px) {
  main { padding: 6px 12px 18px; }
  .choices { gap: 10px; }
  .choice { min-height: 60px; }
  .modes { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mode { min-height: 112px; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sky i, .brand .globe { animation-duration: 60s; }
}
