/* ══════════════════════════════════════════════════════════════════════════
   HejMap v2 — games (games-v2.html hub + games/<game>-v2.html, js/v2/games.js).
   Requires css/v2/base.css.
   ══════════════════════════════════════════════════════════════════════════ */

.v2 [hidden] { display: none !important; }
.v2-game main, .v2-games main { display: block; }
.v2-game .v2-section, .v2-games .v2-section { padding: 28px 0; }

/* ── Hero stage ───────────────────────────────────────────────────────────── */
.gm2-hero {
  position: relative;
  margin-top: calc(-1 * var(--nav-h));
  padding: calc(var(--nav-h) + 22px) 0 28px;
  overflow: hidden;
  isolation: isolate;
}
.gm2-sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 70% at 70% 40%, color-mix(in srgb, var(--cyan) 10%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 12%, var(--canvas)) 0%, var(--canvas) 90%);
}
.gm2-sky .v2-floaters { position: absolute; inset: 0; opacity: 0.45; }
.gm2-crumbs { display: flex; gap: 7px; color: var(--text-3); font-size: 12.5px; }
.gm2-crumbs a { color: var(--text-2); text-decoration: none; }
.gm2-titlebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
.gm2-titlebar h1 { display: flex; align-items: center; gap: 12px; margin: 0; font-size: clamp(26px, 3.4vw, 40px); font-weight: 760; letter-spacing: -0.035em; }
.gm2-titlebar h1 small { color: var(--text-3); font-size: 0.55em; font-weight: 600; letter-spacing: 0; }
.gm2-ico { display: grid; width: 46px; height: 46px; flex: 0 0 auto; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--t, var(--blue)) 15%, var(--surface)); color: var(--t, var(--blue)); }
.gm2-ico svg { width: 24px; height: 24px; }
.gm2-modes { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.gm2-modes button { height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer; }
.gm2-modes button[aria-pressed="true"] { background: var(--text); color: var(--surface); }
.gm2-regions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 16px; }
.gm2-regions a { display: inline-flex; height: 30px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.gm2-regions a:hover { border-color: var(--line-strong); color: var(--text); }
.gm2-regions a[aria-current="page"] { border-color: var(--text); background: var(--text); color: var(--surface); }

/* ── Board card ───────────────────────────────────────────────────────────── */
.gm2-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.gm2-hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.gm2-hud b { margin-left: 6px; color: var(--text); font-size: 18px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.gm2-dots { display: flex; gap: 5px; }
.gm2-dots i { width: 22px; height: 6px; border-radius: 999px; background: var(--surface-3); transition: background 0.3s; }
.gm2-dots i.is-now { background: var(--blue); }
.gm2-dots i.is-ok { background: #16a34a; }
.gm2-dots i.is-miss { background: #e8553d; }
.gm2-board { display: grid; gap: 18px; min-height: 440px; padding: 24px; }
.gm2-round { display: grid; justify-items: center; gap: 18px; }
.gm2-loading { margin: auto; color: var(--text-3); }
.gm2-prompt { margin: 0; font-size: clamp(20px, 2.4vw, 28px); font-weight: 650; letter-spacing: -0.02em; text-align: center; text-wrap: balance; }
.gm2-prompt em { font-family: var(--serif); font-size: 1.15em; font-style: italic; font-weight: 400; color: var(--blue); padding-right: 0.05em; }

/* Options */
.gm2-options { display: grid; gap: 10px; width: min(640px, 100%); }
.gm2-options--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gm2-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s;
}
.gm2-option:hover:not(:disabled) { border-color: var(--blue); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.gm2-option:disabled { cursor: default; }
.gm2-option.is-right { border-color: #16a34a; background: color-mix(in srgb, #16a34a 12%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 22%, transparent); }
.gm2-option.is-wrong { border-color: #e8553d; background: color-mix(in srgb, #e8553d 12%, var(--surface)); animation: gm2-shake 0.4s; }
.gm2-board.is-answered .gm2-option:not(.is-right):not(.is-wrong) { opacity: 0.55; }
@keyframes gm2-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.gm2-flag { flex: 0 0 auto; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08); }

/* Duel (Higher or Lower) */
.gm2-duel { position: relative; width: min(760px, 100%); }
.gm2-options--duel { grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; }
.gm2-options--duel .gm2-option { flex-direction: column; min-height: 280px; padding: 18px; }
.gm2-vs { position: absolute; left: 50%; top: 42%; display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--text); color: var(--surface); font-family: var(--serif); font-size: 20px; font-style: italic; transform: translate(-50%, -50%); pointer-events: none; }
.gm2-opt-name { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; }
.gm2-reveal-value { min-height: 1.4em; color: var(--blue); font-size: 17px; font-weight: 750; }
.gm2-sil { display: block; width: 100%; max-width: 260px; height: auto; overflow: visible; transition: transform 0.7s var(--ease); transform-origin: 50% 50%; }
.gm2-sil-shape { fill: var(--t, var(--blue)); stroke: var(--surface); stroke-width: 1.5; stroke-linejoin: round; }
.gm2-sil-shadow { fill: color-mix(in srgb, var(--text) 10%, transparent); transform: translate(6px, 8px); }
.gm2-board.is-true-size .gm2-sil { transform: scale(var(--true, 1)); }
.gm2-sil--mini { width: 80px; max-width: 80px; }
.gm2-sil--mini .gm2-sil-shadow { display: none; }

/* Greeting */
.gm2-play { position: relative; display: grid; width: 110px; height: 110px; place-items: center; border: 0; border-radius: 50%; background: var(--accent-grad); color: #fff; box-shadow: 0 16px 36px -14px color-mix(in srgb, var(--blue) 70%, transparent); cursor: pointer; transition: transform 0.2s var(--ease); }
.gm2-play:hover { transform: scale(1.05); }
.gm2-play > svg { width: 38px; height: 38px; margin-left: 5px; }
.gm2-wave { position: absolute; inset: -18px; display: none; place-items: center; }
.gm2-play.is-playing .gm2-wave { display: block; }
.gm2-wave i { position: absolute; inset: 0; border: 2px solid color-mix(in srgb, var(--blue) 40%, transparent); border-radius: 50%; animation: gm2-ring 1.6s ease-out infinite; }
.gm2-wave i:nth-child(2) { animation-delay: 0.3s; }
.gm2-wave i:nth-child(3) { animation-delay: 0.6s; }
.gm2-wave i:nth-child(n+4) { display: none; }
@keyframes gm2-ring { from { transform: scale(0.7); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.gm2-hello { display: block; font-size: clamp(40px, 5vw, 62px); font-style: italic; line-height: 1; color: var(--blue); padding-bottom: 4px; }

/* Shapes, flags, neighbours */
.gm2-shape-stage { width: min(460px, 100%); }
.gm2-shape-stage .gm2-sil { max-width: none; }
.gm2-flag-stage img { display: block; width: min(320px, 70vw); height: auto; border-radius: 12px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 18px 34px -16px rgba(16, 24, 40, 0.4); }
.gm2-options--grid .gm2-sil--mini { width: 46px; }
.gm2-target { display: grid; justify-items: center; gap: 8px; }
.gm2-target .gm2-sil { max-width: 300px; }
.gm2-target > span { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }

/* Maps */
.gm2-bigmap { width: 100%; }
.gm2-map { display: block; width: 100%; height: auto; max-height: 520px; }
.gm2-map path { fill: color-mix(in srgb, var(--text) 9%, var(--surface)); stroke: var(--surface); stroke-width: 0.6; vector-effect: non-scaling-stroke; transition: fill 0.2s; }
.gm2-map path.is-live { fill: color-mix(in srgb, var(--blue) 20%, var(--surface)); }
.gm2-map path.is-out { fill: color-mix(in srgb, var(--text) 5%, var(--surface)); }
.gm2-map.is-clickable path.is-live { cursor: pointer; }
.gm2-map.is-clickable path.is-live:hover { fill: color-mix(in srgb, var(--blue) 55%, var(--surface)); }
.gm2-map path.is-hit { fill: #16a34a !important; }
.gm2-map path.is-miss { fill: #e8553d !important; }
.gm2-map path.is-target { fill: var(--blue) !important; }
.gm2-mini { width: min(320px, 100%); padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.gm2-mini .gm2-map { max-height: 200px; }

/* After answering */
.gm2-after { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-radius: 18px; background: var(--surface-2); animation: xp-fade 0.3s var(--ease); }
.gm2-verdict { display: grid; flex: 1 1 360px; gap: 8px; }
.gm2-verdict > b { font-size: 17px; }
.gm2-verdict.is-ok > b { color: #16a34a; }
.gm2-verdict.is-miss > b { color: #e8553d; }
.gm2-reveal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.gm2-reveal-row small { display: block; margin-top: 4px; color: var(--text-2); font-size: 13px; }
.gm2-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; color: var(--text-2); font-size: 14.5px; }
.gm2-next { height: 44px; }
.gm2-next svg { width: 15px; height: 15px; }
@keyframes xp-fade { from { opacity: 0; transform: translateY(6px); } }

/* Result */
.gm2-result { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--canvas) 70%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.gm2-result-card { display: grid; justify-items: center; gap: 10px; width: min(440px, 100%); padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-md); text-align: center; animation: xp-fade 0.4s var(--ease); }
.gm2-result-card h2 { margin: 0; font-family: var(--serif); font-size: 40px; font-style: italic; font-weight: 400; }
.gm2-big-score { display: flex; align-items: baseline; gap: 6px; margin: 0; }
.gm2-big-score b { font-size: 64px; font-weight: 760; letter-spacing: -0.04em; line-height: 1; color: var(--blue); }
.gm2-big-score span { color: var(--text-3); font-size: 22px; font-weight: 700; }
.gm2-grid { margin: 0; font-size: 20px; letter-spacing: 2px; }
.gm2-stats { display: flex; gap: 22px; margin: 4px 0; padding: 0; list-style: none; }
.gm2-stats li { display: grid; }
.gm2-stats b { font-size: 22px; }
.gm2-stats span { color: var(--text-3); font-size: 12px; }
.gm2-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }

/* ── How to play + other games ────────────────────────────────────────────── */
.gm2-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 28px; }
.gm2-info h2 { margin: 6px 0 10px; font-size: 24px; letter-spacing: -0.02em; }
.gm2-info p, .gm2-info li { color: var(--text-2); line-height: 1.6; }
.gm2-info ol { margin: 0; padding-left: 20px; }

/* Game cards (hub + "more games") */
.gm2-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.gm2-gcard { position: relative; display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s; }
.gm2-gcard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--t) 45%, var(--line)); box-shadow: var(--shadow-md); }
.gm2-gcard h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.gm2-gcard p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.gm2-gcard .gm2-ico { width: 44px; height: 44px; }
.gm2-gcard-foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12.5px; }
.gm2-gcard-foot b { color: var(--t); font-size: 13.5px; }
.gm2-badge { position: absolute; top: 14px; right: 14px; padding: 2px 8px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }
.gm2-status { color: #16a34a; font-weight: 700; }

@media (max-width: 760px) {
  .gm2-board { min-height: 380px; padding: 16px; }
  .gm2-options--grid { grid-template-columns: 1fr; }
  .gm2-options--duel .gm2-option { min-height: 220px; padding: 12px; }
  .gm2-dots i { width: 14px; }
  .gm2-info { grid-template-columns: 1fr; }
  .gm2-hud { padding: 10px 14px; }
}

/* The greeting bubble would sit under the mode switch. */
.v2-game .v2-floater:has([data-greeting]) { display: none; }
.v2-game .gm2-card { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* Map zoom buttons */
.gm2-bigmap { position: relative; }
.gm2-bigmap .gm2-map { touch-action: none; }
.gm2-zoom { position: absolute; right: 8px; top: 8px; display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.gm2-zoom button { width: 36px; height: 36px; border: 0; background: none; color: var(--text); font-size: 20px; cursor: pointer; }
.gm2-zoom button + button { border-top: 1px solid var(--line); }
.gm2-zoom button:hover { background: var(--surface-2); }
/* Result: shown in place of the board */
.gm2-result { position: static; padding: 28px 20px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

@media (max-width: 760px) {
  .gm2-bigmap .gm2-map { height: min(78vw, 360px); }
}
