/* Flag Detective — geo game. Four flags in a row: exactly one belongs to a
   different part of the world. Tap the odd one out and learn the grouping.
   Standalone static page; see ../_GAMES_CONTRACT.md. */
:root {
  --brand: #2C3A43;
  --brand-2: #517485;
  --accent: #E84E0F;
  --green: #2E9E4F;
  --gold: #FFD700;
  --danger: #D2434D;
  --bg: #eaf2f6;
  --card: #ffffff;
  --ink: #1e2b33;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(44, 58, 67, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
.grad-bg { background: linear-gradient(180deg, #eaf2f6 0%, #dcebf2 100%); min-height: 100vh; }

.app {
  max-width: 640px; margin: 0 auto; min-height: 100vh;
  padding: 16px 16px 32px; display: flex; flex-direction: column; gap: 16px;
}

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.back-link {
  font-weight: 800; color: var(--brand-2); text-decoration: none; font-size: 16px;
  white-space: nowrap; padding: 8px 0;
}
.back-link:active { opacity: .6; }
.topbar-title { font-weight: 800; color: var(--brand); font-size: 16px; }

/* ---------- header ---------- */
.game-head { text-align: center; }
.game-emoji { font-size: 52px; line-height: 1; }
.game-title { font-size: 26px; font-weight: 800; color: var(--brand); margin: 6px 0 2px; }
.game-sub { color: var(--brand-2); font-weight: 600; font-size: 15px; margin: 0; }

/* ---------- score strip ---------- */
.strip {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.chip {
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow);
  padding: 8px 16px; font-weight: 800; color: var(--brand); font-size: 15px;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip .v { color: var(--accent); }
.chip.fire { background: #fff3e8; }
.chip.round-progress { color: var(--brand-2); }

/* ---------- prompt ---------- */
.prompt {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 16px; text-align: center;
}
.prompt-q { font-size: 19px; font-weight: 800; color: var(--brand); margin: 0 0 4px; }
.prompt-target {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 24px; font-weight: 800; color: var(--accent); margin-top: 6px;
}
.prompt-target img { width: 40px; height: 27px; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.prompt-hint { color: var(--brand-2); font-weight: 600; font-size: 14px; margin: 8px 0 0; }
.prompt-hint b { color: var(--brand); }

/* ---------- choice grid ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
@media (min-width: 520px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.opt {
  display: flex; align-items: center; gap: 9px;
  background: var(--card); border: 3px solid transparent; border-radius: 14px;
  box-shadow: var(--shadow); padding: 12px 13px; min-height: 62px;
  font: inherit; font-weight: 700; font-size: 15px; color: var(--brand);
  text-align: left; cursor: pointer; transition: transform .1s ease, border-color .1s ease;
}
.opt:active { transform: scale(0.97); }
.opt img { width: 34px; height: 23px; object-fit: cover; border-radius: 3px; flex: 0 0 auto; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.opt .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt.picked { border-color: var(--green); background: #eefaf1; }
.opt.picked::after { content: "✅"; font-size: 16px; }
.opt.missed { border-color: var(--danger); background: #fdeef0; animation: shake .32s ease; }
.opt.missed::after { content: "❌"; font-size: 16px; }
.opt.disabled { pointer-events: none; opacity: .92; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.pulse { animation: pulse .3s ease; }

/* ---------- feedback ---------- */
.feedback {
  min-height: 30px; text-align: center; font-weight: 800; font-size: 17px;
}
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--danger); }
.feedback .why {
  display: block; font-weight: 600; font-size: 14px; color: var(--brand-2); margin-top: 4px;
}
.feedback.ok .why, .feedback.no .why { color: var(--brand-2); }

/* ---------- flag board ---------- */
.flags {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (min-width: 520px) { .flags { grid-template-columns: repeat(4, 1fr); } }

.coin {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: var(--card); border: 3px solid transparent; border-radius: 14px;
  box-shadow: var(--shadow); padding: 14px 8px; min-height: 108px;
  font: inherit; font-weight: 800; font-size: 14px; color: var(--brand);
  text-align: center; cursor: pointer; transition: transform .1s ease, border-color .1s ease;
}
.coin:active { transform: scale(0.97); }
.coin img { width: 84px; height: 56px; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,.22); background: #f2f6f8; }
.coin .nm { line-height: 1.2; }
.coin.picked { border-color: var(--green); background: #eefaf1; }
.coin.missed { border-color: var(--danger); background: #fdeef0; animation: shake .32s ease; }
.coin.disabled { pointer-events: none; opacity: .95; }
.coin.reveal { border-color: var(--accent); opacity: 1; }

/* ---------- buttons ---------- */
.btn {
  min-height: 58px; padding: 12px 20px; border: none; border-radius: 14px;
  background: var(--brand-2); color: #fff; font: inherit; font-weight: 700;
  font-size: 17px; cursor: pointer; box-shadow: var(--shadow); min-width: 80px;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); }
.btn.ghost { background: #fff; color: var(--brand-2); border: 2px solid var(--brand-2); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

/* ---------- end card ---------- */
.endcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 18px; text-align: center; display: flex; flex-direction: column; gap: 12px;
}
.endcard .big { font-size: 56px; line-height: 1; }
.endcard h2 { margin: 0; color: var(--brand); font-size: 23px; }
.endcard .score { font-size: 40px; font-weight: 800; color: var(--accent); }
.endcard p { margin: 0; color: var(--brand-2); font-weight: 600; }

/* ---------- misc ---------- */
.center { text-align: center; }
.muted { color: var(--brand-2); font-weight: 600; }
.loading { text-align: center; color: var(--brand-2); font-weight: 700; padding: 28px 0; }
.legend-note {
  text-align: center; color: var(--brand-2); font-weight: 600;
  font-size: 13px; margin: 0;
}
