/* World Cup History — see ../_GAMES_CONTRACT.md for the shared tokens + rules.
   Theme tokens come from css/gamekit.css (body.gk-theme aliases --brand, --accent,
   --green, … to the bright-green pitch palette), so this file declares NO :root
   block and no slate. Orange is used only by GameKit's primary CTA. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  color: var(--ink, #16291c);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app {
  max-width: 640px; margin: 0 auto;
  padding: 10px 14px 32px;
  display: flex; flex-direction: column; gap: 10px;
}

/* ---------- counter strip: GameKit pills + the 12px GameKit bar ---------- */
.hud { display: flex; flex-direction: column; gap: 6px; }

/* ---------- stage ---------- */
.stage {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.stage-head { display: flex; align-items: center; gap: 8px; }
.year-pill {
  background: var(--brand); color: #fff; font-weight: 800; font-size: 18px;
  padding: 4px 12px; border-radius: 12px; letter-spacing: .5px;
}
.wc-logo, .wc-logo.placeholder {
  height: 48px; width: auto; max-width: 120px; object-fit: contain;
}
.wc-logo.placeholder { font-size: 30px; line-height: 48px; width: 48px; text-align: center; }
/* question-type chip: icon + words, NOT a step number, and not the CTA colour */
.type-chip {
  margin-left: auto; background: #eefaf1; color: var(--brand-2);
  border: 2px solid var(--green); font-weight: 800;
  font-size: 13px; padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

.q {
  font-size: 19px; font-weight: 800; color: var(--brand);
  margin: 4px 0 0; line-height: 1.3; text-align: center;
}
.hint { margin: 0; color: var(--brand-2); font-weight: 700; font-size: 14px; text-align: center; }

/* ---------- choices ---------- */
.choices { display: grid; gap: 8px; }
.choices.single { grid-template-columns: repeat(2, 1fr); }
.choices.multi  { grid-template-columns: repeat(2, 1fr); }

.choice {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 7px 6px; cursor: pointer;
  background: #fff; border: 3px solid #cfe7d6; border-radius: 14px;
  font: inherit; font-weight: 800; color: var(--brand);
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.choice:hover:not(.locked) { border-color: var(--brand-2); transform: translateY(-2px); }
.choice .art { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; }
.choice .flag {
  width: 56px; height: 38px; object-fit: cover; border-radius: 6px;
  box-shadow: 0 2px 6px rgba(20, 83, 45, .18); background: #fff;
}
.choice .badge { width: 40px; height: 40px; object-fit: contain; }
.choice .name { font-size: 13px; line-height: 1.15; text-align: center; }

/* picked-but-not-graded yet (step 2 taps two): green ring + a tick, never colour alone */
.choice.picked { border-color: var(--brand-2); background: #eefaf1; }
.choice.picked::after {
  content: "✓"; position: absolute; top: 4px; right: 6px;
  font-size: 15px; font-weight: 900; color: var(--brand-2);
}
.choice.locked { cursor: default; }

/* ---------- feedback (GameKit verdict drops in here) ---------- */
.fb:empty { display: none; }
.gk-verdict { text-align: left; }
.gk-why { line-height: 1.35; }

/* the reward pop is the SHARED .gk-sticker-pop (css/gamekit.css §11) — this game
   only swaps the emoji slot for the tournament logo when it has one */
.gk-sticker-pop-logo { display: block; margin: 0 auto; height: 34px; width: auto; max-width: 60px; object-fit: contain; }

/* the mascot (js/gamekit-stickers.js) rides in the existing .stage-head row /
   above the result card — it costs no extra vertical space, so the 390x700
   fold is untouched. Its speech bubble is absolutely positioned and, per the
   shared rule (css/gamekit.css §11), hangs BELOW the chip: the chip ends the
   .stage-head row (top area, under the header), so the bubble is anchored to
   the chip's right edge and clamped to the viewport instead of being centred —
   a centred 260px bubble would run off the right edge of a 360px phone. */
.gk-mascot-host { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.gk-mascot-host .gk-mascot { padding: 4px 8px; }
.gk-mascot-host .gk-mascot-emoji { font-size: 26px; }
.gk-mascot-host .gk-bubble {
  left: auto; right: 0; transform: none;
  width: max-content;
  max-width: min(260px, calc(100vw - 24px));
}
.gk-mascot-host .gk-bubble::after {
  left: auto; right: 20px; margin: 0;
}
@media (max-width: 640px) {
  .gk-mascot-host .gk-mascot-name { display: none; }
}

/* correct-tile spark burst (local flourish; confetti itself is GameKit's) */
.spark-burst { position: fixed; z-index: 60; pointer-events: none; width: 0; height: 0; }
.spark-particle {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  left: -4px; top: -4px; opacity: 1;
  animation: spark-fly .6s ease-out forwards;
}
@keyframes spark-fly {
  0% { transform: translate(0,0) scale(1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.4); opacity: 0; }
}

/* ---------- actions ---------- */
.actions { display: flex; }
.actions .gk-next { flex: 1; }

/* ---------- result ---------- */
.result { text-align: center; }
.bigscore { font-size: 40px; font-weight: 900; color: var(--brand); margin: 4px 0; }
.bigscore small { font-size: 18px; color: var(--brand-2); }
.muted { color: var(--brand-2); font-weight: 700; margin: 4px 0; }
.loading { text-align: center; color: var(--brand-2); font-weight: 700; padding: 40px 0; }
.loading.err { color: var(--danger); }
.loading.small { font-size: 12px; opacity: .6; padding: 0; }

.collection { margin: 14px 0; text-align: left; }
.coll-head { font-weight: 800; color: var(--brand); margin-bottom: 8px; }
.allcards {
  background: #fffbe6; border: 2px dashed var(--gold);
  border-radius: 12px; padding: 10px; font-weight: 800; color: var(--brand); margin-bottom: 10px;
}
.cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.ccard {
  display: flex; align-items: center; justify-content: center;
  height: 70px; border-radius: 12px; background: #eef8f0; border: 2px solid #cfe7d6;
  font-weight: 800; color: #9dbfa8;
}
.ccard img { max-width: 86%; max-height: 56px; object-fit: contain; }
.ccard.got { background: #fff; border-color: var(--brand-2); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .q { font-size: 18px; }
  .type-chip { font-size: 12px; padding: 3px 8px; }
  .wc-logo, .wc-logo.placeholder { height: 40px; }
  .wc-logo.placeholder { font-size: 24px; line-height: 40px; width: 40px; }
  .year-pill { font-size: 17px; padding: 3px 10px; }
  .bigscore { font-size: 32px; }
}

/* short phones (390x700 class): the question, all four answers, the feedback and
   the Next button must fit the first screen with at most a short scroll */
@media (max-height: 780px) {
  .app { gap: 6px; padding-top: 6px; }
  .stage { padding: 10px; gap: 5px; }
  .q { font-size: 17px; }
  .wc-logo, .wc-logo.placeholder { height: 32px; }
  .wc-logo.placeholder { font-size: 20px; line-height: 32px; width: 32px; }
  .gk-verdict { padding: 12px 14px; }
  .choice { padding: 6px 5px; }
  .choice .flag { width: 52px; height: 35px; }
  .choice .art { min-height: 40px; }
  .cardgrid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .ccard { height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
