/* ═══ Trò chơi (games.js) ═══ */
#gamesSection { --gm-width: 760px; --gm-ease: cubic-bezier(.2, .8, .2, 1); }

/* ── Hub: one card per game; the whole card opens the game ── */
.gm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.gm-card {
  display: flex; flex-direction: column; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, transform .25s var(--gm-ease), box-shadow .25s ease;
}
.gm-card:hover { border-color: var(--primary-border); transform: translateY(-3px); box-shadow: var(--shadow); }
.gm-card:hover .gm-art svg { transform: scale(1.04); }
.gm-art { position: relative; overflow: hidden; aspect-ratio: 240 / 130; background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); }
.gm-art svg, .gm-setup-art svg { width: 100%; height: 100%; display: block; transition: transform .4s var(--gm-ease); }
.gm-badge {
  position: absolute; top: 10px; right: 10px; padding: 3px 10px; border-radius: 999px;
  background: var(--primary); color: var(--on-primary); font-size: .72em; font-weight: 700; text-transform: uppercase;
}
.gm-card-body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 14px 16px 16px; }
.gm-card-head { display: flex; align-items: center; gap: 8px; }
.gm-card-head h2 { margin: 0; font-size: 1.12em; }
.gm-card-body p { margin: 0; color: var(--muted); flex: 1; font-size: .92em; line-height: 1.45; }
.gm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.gm-tags span { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .76em; font-weight: 600; }
.gm-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.gm-card-foot .gm-play { margin-left: auto; }
.gm-link { background: none; border: none; padding: 4px 0; color: var(--muted); cursor: pointer; font: inherit; font-size: .9em; }
.gm-link:hover { color: var(--primary-text); }
.gm-best {
  margin-left: auto; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--warn-soft, rgba(255, 196, 0, .14)); color: var(--warn-text); font-size: .8em; font-weight: 700;
}

/* Illustrations */
.gm-art-main { fill: var(--primary); }
.gm-art-light { fill: rgba(255, 255, 255, .85); }
.gm-art-soft { fill: var(--primary-text); opacity: .6; }
.gm-art-line { fill: none; stroke: var(--primary-text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gm-art-trail { fill: none; stroke: var(--primary-text); stroke-width: 4; stroke-linecap: round; opacity: .4; }
.gm-art-dash { fill: none; stroke: var(--primary-text); stroke-width: 2.5; stroke-dasharray: 5 5; }
.gm-art-tick { fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.gm-art-text { fill: #fff; font: 700 14px var(--font); text-anchor: middle; }

/* ── Panels: setup, end, the board of a calm game ── */
.gm-panel {
  max-width: var(--gm-width); margin: 0 auto; padding: 22px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
  animation: gm-in .3s var(--gm-ease);
}
.gm-center { text-align: center; }
.gm-error { color: var(--danger-text); text-align: center; }
.gm-hint { margin: 0 0 14px; text-align: center; color: var(--muted); font-size: .9em; }
.gm-stage > .gm-panel + .gm-hint, .gm-panel .gm-hint:not(:first-child) { margin: 14px 0; }

/* ── Setup: the word set, how many, which way, how hard ── */
/* minmax(0, 1fr): a long topic name in a <select> must not widen the panel past its edge */
.gm-setup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 520px; padding: 0 0 22px; }   /* no overflow: hidden — the topic list opens past it */
.gm-setup > :not(.gm-setup-art) { margin-inline: 22px; }
.gm-setup-art { height: 130px; overflow: hidden; border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0; background: linear-gradient(135deg, var(--primary-soft), var(--surface-2)); }
.gm-loading .gm-setup-art { animation: gm-pulse-bg 1.2s ease-in-out infinite alternate; }
.gm-setup-head { display: grid; gap: 4px; justify-items: center; text-align: center; margin-top: -2px; }
.gm-setup-head h2 { margin: 0; font-size: 1.4em; }
.gm-setup-head p { margin: 0; }
.gm-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; font-weight: 700; font-size: .88em; }
.gm-field legend { padding: 0; margin-bottom: 6px; }
.gm-field select { font-size: 1.05em; font-weight: 500; }
/* The word set: a button opening a searchable list that loads more as it is scrolled (paged.js; also the
   vocabulary's practices — this sheet is on every page) */
.gm-picker { position: relative; }
.gm-picker-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: 500 1.05em var(--font); text-align: left; cursor: pointer;
}
.gm-picker-btn span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-picker-btn[aria-expanded=true] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gm-picker-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 6px; padding: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  animation: gm-in .15s var(--gm-ease);
}
.gm-picker-pop[hidden] { display: none; }
.gm-picker-pop input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 500; }
.gm-picker-list { max-height: 260px; overflow-y: auto; margin: 0; padding: 0; list-style: none; overscroll-behavior: contain; }
.gm-picker-list li[data-topic] { display: flex; align-items: center; }
.gm-picker-list li[data-topic] > button { flex: 1; min-width: 0; }
.gm-picker-list li[hidden] { display: none; }
.gm-picker-list button {
  display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font: 500 .95em var(--font); text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.gm-picker-list button:hover, .gm-picker-list button:focus-visible { background: var(--surface-2); outline: none; }
.gm-picker-list button[aria-selected=true] { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.gm-picker-more, .gm-picker-none { padding: 8px 10px; color: var(--muted); font-size: .88em; font-weight: 500; }
/* Buttons that are radio buttons */
.gm-seg { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--surface-2); }
.gm-seg label { flex: 1; min-width: 0; }
.gm-seg input, .gm-level input { position: absolute; opacity: 0; pointer-events: none; }
.gm-seg span {
  display: block; padding: 9px 6px; border-radius: calc(var(--radius) - 4px); text-align: center; cursor: pointer;
  font-weight: 600; color: var(--muted); white-space: nowrap; transition: background .15s ease, color .15s ease;
}
.gm-seg span:hover { color: var(--text); }
.gm-seg input:checked + span { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
.gm-seg input:focus-visible + span, .gm-level:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.gm-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.gm-level {
  position: relative; display: grid; gap: 3px; align-content: start; padding: 10px; cursor: pointer; text-align: center;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .15s ease, background .15s ease;
}
.gm-level b { font-size: 1em; }
.gm-level small { color: var(--muted); font-weight: 500; font-size: .85em; line-height: 1.3; }
.gm-level .gm-level-best { color: var(--warn-text); font-weight: 700; }
.gm-level:hover { border-color: var(--primary-border); }
.gm-level:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.gm-start { padding: 13px; font-size: 1.08em; font-weight: 700; }
.gm-start.busy { opacity: .7; cursor: progress; }

/* ── In a game: the bar over the board ── */
.gm-hud {
  position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  max-width: var(--gm-width); margin: 0 auto 12px; padding: 8px 10px 12px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm);
}
.gm-hud-quit { margin: 0; }
.gm-hud-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gm-hud-title b { font-size: 1.05em; white-space: nowrap; }
.gm-level-chip { padding: 1px 8px; border-radius: 999px; background: var(--surface-2); font-size: .74em; font-weight: 700; white-space: nowrap; }
/* One row that never wraps, so a longer score or a new chip cannot make the bar taller and push the board
   down: it takes the room left between title and buttons, and scrolls sideways when even that runs out */
.gm-hud-stats {
  display: flex; flex: 1 1 0; min-width: 0; gap: 6px; overflow-x: auto; scrollbar-width: none; font-variant-numeric: tabular-nums;
}
.gm-hud-stats::-webkit-scrollbar { display: none; }
.gm-hud-stats > :first-child { margin-left: auto; }   /* to the right, and still scrollable when too wide */
.gm-stat {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); font-weight: 700; font-size: .9em; white-space: nowrap; animation: gm-pop .25s var(--gm-ease);
}
.gm-stat-score { background: var(--primary-soft); color: var(--primary-text); }
.gm-stat-combo { background: rgba(255, 138, 61, .16); color: #d2601a; }
.gm-stat-slow { background: rgba(111, 211, 255, .2); color: #1f7fb3; }
.gm-stat-fast { background: var(--danger-soft); color: var(--danger-text); }
.gm-icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; font-size: 1em;
}
.gm-icon-btn:hover { border-color: var(--primary); color: var(--primary-text); }
.gm-icon-btn.gm-off { opacity: .45; text-decoration: line-through; }
.gm-music { display: inline-flex; align-items: center; gap: 4px; }
.gm-music input[type=range] { width: 72px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.gm-music:has(.gm-off) input[type=range] { opacity: .45; }
.gm-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--surface-2); }
.gm-progress i { display: block; height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: 0 50%; transition: transform .4s var(--gm-ease); }

/* Over the sky: the countdown, the pause menu */
.gm-overlay {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: rgba(12, 6, 16, .55); backdrop-filter: blur(3px); animation: gm-fade .2s ease;
}
.gm-countdown { background: rgba(12, 6, 16, .3); backdrop-filter: none; pointer-events: none; }
.gm-countdown b { color: #fff; font-size: 5em; font-weight: 800; text-shadow: 0 4px 24px rgba(235, 71, 153, .8); animation: gm-count .65s ease-out forwards; }
.gm-overlay-card {
  display: grid; gap: 8px; min-width: 220px; padding: 20px; text-align: center;
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow); animation: gm-pop .25s var(--gm-ease);
}
.gm-overlay-card h3 { margin: 0 0 4px; }

/* ── The end ── */
.gm-end { position: relative; max-width: 560px; overflow: hidden; }
.gm-end-icon { font-size: 3.2em; line-height: 1; animation: gm-pop .5s var(--gm-ease); }
.gm-end-title { margin: 8px 0 0; color: var(--muted); font-weight: 700; }
.gm-end-score { margin: 2px 0; font-size: 3em; font-weight: 800; color: var(--primary-text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.gm-end-score small { font-size: .38em; font-weight: 700; color: var(--muted); }
.gm-end-note { margin: 0 0 14px; font-weight: 600; }
.gm-record .gm-end-note { color: var(--warn-text); }
.gm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0 0 12px; }
.gm-tiles div { display: grid; gap: 2px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); }
.gm-tiles b { font-size: 1.25em; }
.gm-tiles small { color: var(--muted); font-weight: 600; }
.gm-missed { text-align: left; margin: 16px 0; }
.gm-missed h3 { display: flex; align-items: center; gap: 6px; font-size: 1em; margin: 0 0 8px; }
.gm-missed h3 span { padding: 0 8px; border-radius: 999px; background: var(--danger-soft); color: var(--danger-text); font-size: .85em; }
.gm-missed ul { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.gm-missed li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); overflow-wrap: anywhere; }
.gm-missed li small { display: block; color: var(--muted); }
.gm-say { flex: none; padding: 4px 8px; border-radius: 999px; }
.gm-perfect { margin: 12px 0; font-weight: 700; color: var(--success-text); }
.gm-mistakes { margin: 4px 0 14px; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 12px; font-size: .92em; }
.gm-mistakes p { margin: 0 0 6px; }
.gm-mistakes button { margin-top: 6px; font-weight: 700; }
.gm-end-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.gm-end-actions button { min-width: 150px; padding: 11px 16px; font-weight: 700; }
.gm-confetti {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; pointer-events: none;
  animation: gm-confetti var(--fall) var(--delay) cubic-bezier(.3, .6, .5, 1) forwards;
}

.gm-help { max-width: min(500px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); }
.gm-help::backdrop { background: var(--overlay); }
.gm-help h3 { margin-top: 0; }
.gm-help ol { padding-left: 20px; line-height: 1.6; }
.gm-help .gm-setup-actions { display: flex; justify-content: flex-end; }
.gm-power-list { display: grid; gap: 4px; margin: 8px 0 0; padding: 10px 12px; list-style: none; border-radius: var(--radius); background: var(--surface-2); }

/* ── The sky of the falling games (Bắn từ, Gạch rơi) ── */
.gm-sky {
  position: relative; overflow: hidden; max-width: var(--gm-width); height: min(64vh, 480px); margin: 0 auto;
  border-radius: var(--radius-lg); border: 1px solid var(--border); contain: layout paint;
  background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.08) 0 1px, transparent 2px) 0 0 / 60px 60px,
              linear-gradient(180deg, #1a0d1f 0%, #2a1030 70%, #3a1538 100%);
  touch-action: manipulation; transition: box-shadow .3s ease;
}
.gm-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; background: linear-gradient(180deg, transparent, rgba(235, 71, 153, .25)); border-top: 2px solid var(--primary-border); }
.gm-shake { animation: gm-shake .35s; }
.gm-sky.gm-slow { box-shadow: inset 0 0 0 3px #6fd3ff, inset 0 0 40px rgba(111, 211, 255, .35); }
.gm-sky.gm-fast { box-shadow: inset 0 0 0 3px #ff3d3d, inset 0 0 40px rgba(255, 61, 61, .35); }

/* Bắn từ: space */
.gm-space {
  background: radial-gradient(ellipse 60% 40% at 80% 15%, rgba(120, 60, 200, .28), transparent 70%),
              radial-gradient(ellipse 50% 35% at 15% 35%, rgba(235, 71, 153, .2), transparent 70%),
              linear-gradient(180deg, #05030d 0%, #0d0820 55%, #1a0d2e 100%);
  border-color: #2a1d3d;
}
/* Three layers of stars, each a tile that slides down by exactly its own height: a loop without a seam */
.gm-stars { position: absolute; inset: -240px 0 0; pointer-events: none; animation: gm-stars linear infinite; will-change: transform; }
/* tiles of different sizes, so no pattern shows; the near stars twinkle */
.gm-stars-far { --tile: 197px; animation-duration: 90s; opacity: .5;
  background: radial-gradient(1px 1px at 23px 41px, #fff, transparent), radial-gradient(1px 1px at 131px 17px, #cfd8ff, transparent),
              radial-gradient(1px 1px at 171px 133px, #fff, transparent), radial-gradient(1px 1px at 67px 163px, #ffd6ea, transparent),
              radial-gradient(1px 1px at 97px 89px, #fff, transparent), radial-gradient(1px 1px at 151px 71px, #fff, transparent) 0 0 / 197px 197px; }
.gm-stars-mid { --tile: 263px; animation-duration: 48s; opacity: .75;
  background: radial-gradient(1.5px 1.5px at 59px 23px, #fff, transparent), radial-gradient(1.5px 1.5px at 211px 149px, #bfe6ff, transparent),
              radial-gradient(1.5px 1.5px at 19px 197px, #fff, transparent), radial-gradient(1.2px 1.2px at 139px 239px, #ffe9a8, transparent),
              radial-gradient(1.2px 1.2px at 241px 61px, #fff, transparent) 0 0 / 263px 263px; }
.gm-stars-near { --tile: 331px; animation: gm-stars 24s linear infinite, gm-twinkle 3s ease-in-out infinite alternate;
  background: radial-gradient(2px 2px at 113px 59px, #fff, transparent), radial-gradient(2px 2px at 283px 211px, #ffe9a8, transparent),
              radial-gradient(1.8px 1.8px at 37px 293px, #cfe6ff, transparent) 0 0 / 331px 331px; }
.gm-stars { inset: -331px 0 0; }
.gm-nebula {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; animation: gm-nebula 12s ease-in-out infinite alternate;
  background: radial-gradient(ellipse 40% 30% at 65% 40%, rgba(95, 208, 255, .12), transparent 70%),
              radial-gradient(ellipse 35% 25% at 30% 60%, rgba(255, 95, 174, .12), transparent 70%);
}
/* The planet the ship stands on: only its glowing rim shows */
.gm-planet {
  position: absolute; left: -30%; right: -30%; bottom: -230px; height: 300px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, #6b2a6e 0%, #3a1640 35%, #1a0a22 70%);
  box-shadow: 0 -2px 0 rgba(255, 156, 204, .6), 0 -12px 40px rgba(235, 71, 153, .45), inset 0 18px 30px rgba(255, 156, 204, .25);
  transition: box-shadow .3s ease;
}
.gm-danger .gm-planet { animation: gm-alarm .5s ease-in-out infinite alternate; }
.gm-hurt::after { content: ''; position: absolute; inset: 0; z-index: 4; pointer-events: none; animation: gm-hurt .5s ease-out forwards;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 40, 70, .55)); }

/* The ship: it bobs, turns to each shot, its engine flickers (gold during a run of hits) */
.gm-ship { position: absolute; left: 50%; bottom: 58px; width: 52px; height: 66px; margin-left: -26px; z-index: 2; pointer-events: none;
  animation: gm-bob 2.4s ease-in-out infinite; }
.gm-ship-body { position: relative; width: 100%; height: 100%; transform-origin: 50% 70%; transition: transform .12s ease-out;
  filter: drop-shadow(0 0 10px rgba(235, 71, 153, .55)); }
.gm-ship svg { position: relative; z-index: 1; width: 100%; height: 100%; display: block; }
.gm-flame {
  position: absolute; left: 50%; bottom: -12px; width: 12px; height: 24px; margin-left: -6px; border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
  background: linear-gradient(180deg, #fff, #9fe8ff 30%, #5f8bff 65%, transparent); filter: blur(1px);
  transform-origin: 50% 0; animation: gm-flame .09s ease-in-out infinite alternate;
}
.gm-hot .gm-flame { width: 16px; height: 32px; margin-left: -8px; background: linear-gradient(180deg, #fff, #ffe680 30%, #ff8a3d 65%, transparent); }
.gm-hot .gm-ship-body { filter: drop-shadow(0 0 14px rgba(255, 196, 60, .8)); }
.gm-shielded .gm-ship::after {
  content: ''; position: absolute; inset: -14px -18px -8px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(159, 180, 255, .8); background: radial-gradient(circle, transparent 55%, rgba(159, 180, 255, .25));
  animation: gm-glow 1s ease-in-out infinite alternate;
}
/* The word to shoot, on glass under the ship; tap it to hear it again */
.gm-cannon-word {
  position: absolute; left: 50%; bottom: 8px; z-index: 3; translate: -50% 0; display: grid; justify-items: center; gap: 0;
  padding: 3px 18px 4px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .22); cursor: pointer;
  background: rgba(30, 14, 44, .65); backdrop-filter: blur(8px); color: #fff; font: inherit; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(235, 71, 153, .25), 0 6px 20px rgba(0, 0, 0, .4);
}
.gm-cannon-word b { font-size: 1.2em; letter-spacing: .02em; }
.gm-cannon-word small { font-size: .72em; opacity: .75; }
/* A word's part of speech (posTag): a small "n" / "v" / "adj" chip after the word or meaning, the same size anywhere */
.gm-pos { display: inline-block; margin: 0 0 0 6px; padding: 0 6px; border-radius: 5px; vertical-align: middle;
          background: var(--primary-soft); color: var(--primary-text); font: 700 .7rem/1.6 var(--font); letter-spacing: 0; white-space: nowrap; }
.gm-brick .gm-pos, .gm-cannon-word .gm-pos { background: rgba(255, 255, 255, .22); color: #fff; }
.gm-cannon-word:hover { border-color: rgba(255, 156, 204, .7); }
.gm-word-in { animation: gm-word-in .35s var(--gm-ease); }

/* A meteor: a fiery trail, a turning rock, its meaning on glass */
.gm-meteor {
  position: absolute; left: 0; top: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 0; border: none; background: none; color: #fff; font: inherit; cursor: crosshair; will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.gm-trail {
  position: absolute; top: -44px; left: 50%; width: 26px; height: 64px; margin-left: -13px; border-radius: 50%; pointer-events: none;
  background: linear-gradient(to top, rgba(255, 196, 90, .95), rgba(255, 95, 109, .55) 45%, transparent);
  filter: blur(5px); animation: gm-trail .18s ease-in-out infinite alternate;
}
.gm-rock {
  position: relative; width: 50px; height: 50px; border-radius: 52% 46% 55% 47% / 48% 54% 46% 52%;
  background: radial-gradient(circle at 66% 62%, rgba(0, 0, 0, .38) 0 6px, transparent 7px),
              radial-gradient(circle at 34% 70%, rgba(0, 0, 0, .3) 0 4px, transparent 5px),
              radial-gradient(circle at 58% 28%, rgba(0, 0, 0, .25) 0 3px, transparent 4px),
              radial-gradient(circle at 30% 28%, #d4c2cb, #7d6573 42%, #3f2d3a 78%);
  box-shadow: inset -7px -8px 12px rgba(0, 0, 0, .5), inset 4px 4px 8px rgba(255, 220, 200, .25), 0 0 20px rgba(255, 130, 70, .55);
  animation: gm-spin var(--spin, 9s) linear infinite var(--turn, normal);
}
.gm-plate {
  display: flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .2); background: rgba(22, 10, 34, .72); backdrop-filter: blur(6px);
  font-weight: 700; font-size: .88em; line-height: 1.25; text-align: center; overflow-wrap: anywhere;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35); transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.gm-plate kbd { flex: none; padding: 0 5px; border: 0; border-radius: 5px; background: rgba(255, 255, 255, .16); color: #ffd1e8; box-shadow: none; font: inherit; font-size: .78em; }
.gm-meteor:hover .gm-plate, .gm-meteor:focus-visible .gm-plate { border-color: #ff9ccc; background: rgba(110, 24, 70, .8); transform: scale(1.04); }
.gm-meteor:hover .gm-rock { filter: brightness(1.2); }
.gm-meteor:focus-visible { outline: none; }
/* A falling thing is placed by its transform: its own scale or rotate would also scale or turn where it is, so
   the effects grow, turn and fade what is inside it */
.gm-meteor.gm-boom, .gm-meteor.gm-broken { animation: gm-fadeout .5s ease-in forwards; pointer-events: none; }
.gm-meteor.gm-boom .gm-trail { display: none; }
.gm-meteor.gm-gone { animation: gm-fadeout .45s ease-out forwards; pointer-events: none; }
.gm-meteor.gm-gone .gm-trail { display: none; }
.gm-meteor.gm-boom .gm-rock { animation: gm-rock-boom .35s ease-out forwards; }
.gm-meteor.gm-boom .gm-plate { animation: gm-rock-boom .35s ease-out forwards; }
.gm-meteor.gm-broken .gm-plate { border-color: #ff5f6d; background: rgba(150, 20, 40, .8); }
.gm-meteor.gm-broken .gm-rock { filter: grayscale(1) brightness(.7); animation: gm-rock-broken .55s ease-in forwards; }
.gm-meteor.gm-broken .gm-trail { display: none; }
.gm-meteor.gm-landed { pointer-events: none; }
.gm-meteor.gm-landed .gm-plate { border-color: #6ee7a8; background: rgba(20, 110, 70, .85); }   /* this was the right one */
.gm-meteor.gm-landed .gm-trail { display: none; }
.gm-meteor.gm-landed .gm-rock { animation: gm-squash .4s ease-out forwards; }

/* The shot and what it does */
.gm-laser {
  position: absolute; height: 4px; margin-top: -2px; transform-origin: 0 50%; border-radius: 2px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, #fff, #ffd1e8 30%, #ff5fae); box-shadow: 0 0 8px #ff5fae, 0 0 20px #eb4799;
  animation: gm-beam .26s ease-out forwards;
}
.gm-muzzle, .gm-ring, .gm-flash, .gm-spark, .gm-impact { position: absolute; pointer-events: none; z-index: 2; translate: -50% -50%; }
.gm-muzzle { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle, #fff, rgba(255, 95, 174, .8) 45%, transparent 70%); animation: gm-muzzle .22s ease-out forwards; }
.gm-flash { width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 250, 220, .95), rgba(255, 170, 80, .5) 35%, transparent 70%); animation: gm-flash .4s ease-out forwards; }
.gm-ring { width: 24px; height: 24px; border-radius: 50%; border: 3px solid #ffd27a; animation: gm-ring .6s ease-out forwards; }
.gm-spark { width: var(--size); height: var(--size); border-radius: 50%; box-shadow: 0 0 6px currentColor; animation: gm-spark .75s cubic-bezier(.15, .7, .4, 1) forwards; }
.gm-impact { width: 140px; height: 26px; border-radius: 50%; background: radial-gradient(ellipse, rgba(255, 210, 120, .95), rgba(255, 90, 80, .6) 45%, transparent 70%); animation: gm-impact .7s ease-out forwards; }
.gm-combo { position: absolute; z-index: 2; translate: -50% 0; color: #ffb347; font-weight: 800; text-shadow: 0 2px 6px rgba(0, 0, 0, .6); pointer-events: none; animation: gm-points .9s ease-out forwards; }
/* Paused: everything in the sky holds still */
.gm-frozen, .gm-frozen * { animation-play-state: paused !important; }

/* Gạch rơi */
.gm-bricks { height: min(56vh, 440px); }
.gm-brick {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 8px 6px; border-radius: 7px; border: 2px solid rgba(0,0,0,.25);
  background: linear-gradient(180deg, #ff9ccc, var(--primary) 70%); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
  color: #fff; font: 600 .9em var(--font); line-height: 1.25; text-align: center; overflow-wrap: anywhere;
  pointer-events: none; will-change: transform; transition: outline-color .15s ease;
  outline: 3px solid transparent; outline-offset: 2px;
}
.gm-brick small { font-weight: 400; font-size: .78em; opacity: .85; letter-spacing: .04em; }
.gm-brick.gm-aim { outline-color: #fff; }   /* its word starts with what is typed */
.gm-brick.gm-landed { background: linear-gradient(180deg, #9ef0c4, var(--success) 70%); }
.gm-brick.gm-landed b { font-size: 1.1em; }
.gm-shard { position: absolute; width: 10px; height: 8px; border-radius: 2px; pointer-events: none; animation: gm-shard .7s cubic-bezier(.2, .7, .4, 1) forwards; }
.gm-points {
  position: absolute; z-index: 2; translate: -50% 0; color: #ffe680; font-size: 1.3em; font-weight: 800;
  text-shadow: 0 2px 6px rgba(0,0,0,.5); pointer-events: none; animation: gm-points .9s ease-out forwards;
}
.gm-type { display: flex; gap: 8px; max-width: var(--gm-width); margin: 12px auto 0; }
.gm-type input {
  flex: 1; min-width: 0; box-sizing: border-box; padding: 13px 16px; font: 700 1.2em var(--font); text-align: center;
  border: 2px solid var(--primary-border); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.gm-type input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.gm-type input.wrong { border-color: var(--danger-text); animation: gm-shake .35s; }
.gm-type input:disabled { opacity: .6; }
.gm-type button { flex: none; width: 54px; padding: 0; font-size: 1.3em; border-radius: var(--radius); }
/* The keyboard drawn on a phone (Gạch rơi): sky, box and keys fit one screen */
.gm-keys { display: grid; gap: 6px; max-width: var(--gm-width); margin: 8px auto 0; padding: 6px 4px; border-radius: var(--radius);
  background: var(--surface-2); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.gm-keys-row { display: flex; gap: 4px; justify-content: center; }
.gm-keys button {
  flex: 1 1 0; min-width: 0; max-width: 44px; height: 44px; padding: 0; border: 0; border-radius: 7px;
  background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--border-strong);
  font: 700 1.1em var(--font); -webkit-tap-highlight-color: transparent;
}
.gm-keys button.down { background: var(--primary-soft); color: var(--primary-text); transform: translateY(2px); box-shadow: none; }
.gm-keys .gm-key-wide { flex-grow: 1.5; max-width: 66px; }
.gm-keys .gm-key-space { flex-grow: 4; max-width: none; font-size: .85em; color: var(--muted); }
.gm-keys .gm-key-enter { flex-grow: 2.5; max-width: none; background: var(--primary); color: var(--on-primary); font-size: .95em; }
.gm-type input[readonly] { caret-color: transparent; }
body.gm-playing .dict-fab { display: none; }

/* Special words and bricks */
.gm-brick.gm-power { box-shadow: inset 0 -4px 0 rgba(0,0,0,.2), 0 0 0 2px #fff6, 0 0 16px var(--gm-glow, #fff8); }
.gm-power-heart { --gm-glow: #ff5c8a; }
.gm-power-gold { --gm-glow: #ffd23f; background: linear-gradient(180deg, #ffe680, #e0a100 70%); color: #3a2800; }
.gm-power-slow { --gm-glow: #6fd3ff; background: linear-gradient(180deg, #b8ecff, #2f9bd6 70%); }
.gm-power-shield { --gm-glow: #9fb4ff; }
.gm-power-bomb { --gm-glow: #ff8a3d; background: linear-gradient(180deg, #5a5a6e, #26232e 70%); }
.gm-power-rage { --gm-glow: #ff3d3d; background: linear-gradient(180deg, #ff8a7a, #c4142b 70%); animation: gm-glow .8s ease-in-out infinite alternate; }
.gm-power-badge {
  position: absolute; top: -10px; right: -8px; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); font-style: normal; font-size: 14px; line-height: 1;
}
.gm-power-tag {
  display: block; margin: -2px auto 2px; padding: 0 8px; width: fit-content; border-radius: 999px;
  background: #fff; color: var(--primary-text); font: 700 .62em var(--font); font-style: normal;
}
.gm-power-tag.bad { background: #ffe1e1; color: #b3121f; }
.gm-toast {
  position: absolute; left: 50%; top: 40%; z-index: 3; translate: -50% 0; padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.95); color: #c2185b; font-weight: 800; white-space: nowrap; pointer-events: none;
  box-shadow: var(--shadow-sm); animation: gm-toast 1.4s ease-out forwards;
}
.gm-toast.bad { color: #b3121f; }

/* ── Trắc nghiệm ── */
.gm-timer { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.gm-timer i { display: block; height: 100%; background: var(--primary); transform-origin: 0 50%; transition: transform .1s linear, background .3s ease; }
.gm-timer i.low { background: var(--danger); }
.gm-question { display: grid; gap: 4px; justify-items: center; margin: 20px 0 8px; text-align: center; animation: gm-in .3s var(--gm-ease); }
.gm-question-kind { padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8em; font-weight: 700; }
.gm-question-text { display: flex; align-items: center; gap: 8px; font-size: 2.2em; font-weight: 800; overflow-wrap: anywhere; }
.gm-say-q { font-size: .45em; }
.gm-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.gm-choice, .gm-tile, .gm-target, .gm-chip {
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; overflow-wrap: anywhere;
  transition: border-color .15s ease, background .15s ease, transform .15s var(--gm-ease), opacity .3s ease;
}
.gm-choice { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 16px; text-align: left; font-size: 1.05em; font-weight: 600; }
.gm-choice kbd { flex: none; min-width: 1.7em; padding: 2px 6px; border-radius: 6px; text-align: center; background: var(--surface-3); color: var(--muted); font: inherit; font-size: .8em; }
.gm-choice:hover:not(:disabled), .gm-tile:hover:not(:disabled), .gm-target:hover:not(:disabled), .gm-chip:hover { border-color: var(--primary); transform: translateY(-1px); }
.gm-choice:active:not(:disabled), .gm-tile:active:not(:disabled) { transform: scale(.98); }
.gm-choice:disabled, .gm-tile:disabled, .gm-target:disabled { cursor: default; }
.gm-choice:disabled:not(.correct):not(.wrong) { opacity: .5; }
.gm-feedback { margin-top: 14px; min-height: 1.5em; text-align: center; line-height: 1.6; }
.gm-feedback .ok { color: var(--success-text); font-weight: 700; }
.gm-feedback .bad { color: var(--danger-text); font-weight: 700; }
.gm-feedback .primary { margin-top: 10px; min-width: 140px; }
#gamesSection .correct, #gamesSection .matched { border-color: var(--success-border) !important; background: var(--success-soft) !important; color: var(--success-text) !important; }
#gamesSection .correct { animation: gm-pop .3s var(--gm-ease); }
.gm-panel .wrong { border-color: var(--danger-text) !important; background: var(--danger-soft) !important; animation: gm-shake .35s; }
#gamesSection .chosen { border-color: var(--primary) !important; background: var(--primary-soft) !important; box-shadow: 0 0 0 3px var(--primary-soft); }

/* ── Nối từ ── */
.gm-match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gm-col { display: grid; gap: 10px; align-content: start; }
.gm-tile { min-height: 54px; padding: 10px 12px; text-align: center; font-weight: 600; animation: gm-in .3s var(--gm-ease); }
.gm-tile.matched { opacity: .45; transform: scale(.97); }

/* ── Kéo & Thả ── */
.gm-targets { display: grid; gap: 10px; }
.gm-target { padding: 14px 16px; text-align: left; line-height: 1.7; border-style: dashed; animation: gm-in .3s var(--gm-ease); }
.gm-target.over { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.01); }
.gm-gap { display: inline-block; min-width: 4em; padding: 0 6px; border-bottom: 2px solid var(--primary-border); color: var(--primary-text); font-weight: 700; text-align: center; }
.gm-target.matched .gm-gap { border-color: var(--success-border); color: var(--success-text); }
.gm-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; min-height: 48px; }
.gm-chip { padding: 11px 20px; font-weight: 700; background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary-text); touch-action: none; user-select: none; }
.gm-chip.dragging { opacity: .35; }
.gm-ghost { position: fixed; z-index: 1000; pointer-events: none; translate: -50% -50%; box-shadow: var(--shadow); }

/* ── Nghe & Gõ ── */
.gm-listen { max-width: 560px; text-align: center; }
.gm-listen-play { display: grid; justify-items: center; gap: 8px; margin: 6px 0 4px; }
.gm-big-say {
  width: 96px; height: 96px; border-radius: 50%; border: none; cursor: pointer; font-size: 2.4em;
  background: radial-gradient(circle at 35% 30%, #ff9ccc, var(--primary) 65%); color: #fff;
  box-shadow: 0 8px 24px rgba(235, 71, 153, .35), 0 0 0 8px var(--primary-soft); transition: transform .15s var(--gm-ease);
  animation: gm-pop .35s var(--gm-ease);
}
.gm-big-say:hover { transform: scale(1.05); }
.gm-big-say:active { transform: scale(.95); }
.gm-listen .gm-type { margin-top: 4px; }
.gm-listen-tools { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.gm-listen-tools[hidden], .gm-letters[hidden] { display: none; }
.gm-type input.correct { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.gm-spelled { margin: 6px 0 2px; font-size: 1.7em; font-weight: 800; letter-spacing: .06em; overflow-wrap: anywhere; }
.gm-spelled .ok { color: var(--success-text); }
.gm-spelled .bad { color: var(--danger-text); text-decoration: underline wavy; text-underline-offset: 5px; }

/* ── Xếp chữ ── */
.gm-scramble { max-width: 620px; text-align: center; }
.gm-clue { font-size: 1.6em; }
.gm-slots, .gm-letters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0; }
.gm-slots { width: fit-content; max-width: 100%; margin: 18px auto; padding: 4px; border-radius: 14px; }   /* its glow hugs the slots */
.gm-slot, .gm-letter {
  display: grid; place-items: center; width: 46px; height: 52px; padding: 0; border-radius: 10px;
  font: 800 1.35em var(--font); text-transform: lowercase; cursor: pointer;
  transition: transform .15s var(--gm-ease), background .15s ease, border-color .15s ease, opacity .15s ease;
}
.gm-slot { border: 2px dashed var(--border-strong); background: var(--surface-2); color: var(--text); }
.gm-slot:disabled { cursor: default; }
.gm-slot.filled { border-style: solid; border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary-text); animation: gm-pop .2s var(--gm-ease); }
.gm-slot-gap { width: 16px; }
.gm-slots.gm-misplaced .gm-slot { border-color: var(--danger-text); background: var(--danger-soft); color: var(--danger-text); }
.gm-slots.gm-misplaced { animation: gm-shake .35s; }
.gm-slots.solved .gm-slot { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); animation: gm-pop .3s var(--gm-ease); }
.gm-letter { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); box-shadow: 0 3px 0 var(--border-strong); }
.gm-letter:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-2px); }
.gm-letter:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.gm-letter:disabled { opacity: .2; cursor: default; box-shadow: none; }

/* ── Đúng hay Sai ── */
.gm-tf { max-width: 560px; }
.gm-tf-card {
  display: grid; justify-items: center; gap: 4px; margin: 20px 0; padding: 28px 16px; border-radius: var(--radius-lg);
  border: 2px solid var(--border); background: var(--surface-2); text-align: center; transition: border-color .15s ease, background .15s ease;
}
.gm-tf-in { animation: gm-in .2s var(--gm-ease); }
.gm-tf-word { font-size: 2.2em; font-weight: 800; overflow-wrap: anywhere; }
.gm-tf-eq { color: var(--muted); font-weight: 700; }
.gm-tf-meaning { font-size: 1.5em; font-weight: 700; color: var(--primary-text); overflow-wrap: anywhere; }
.gm-tf-ok { border-color: var(--success-border); background: var(--success-soft); }
.gm-tf-bad { border-color: var(--danger-text); background: var(--danger-soft); animation: gm-shake .35s; }
.gm-tf-fix { margin-top: 8px; padding: 4px 12px; border-radius: 999px; background: var(--surface); color: var(--success-text); font-weight: 700; }
.gm-tf-sentence-card { padding: 24px 18px; }
.gm-tf-sentence { font-size: 1.45em; font-weight: 700; line-height: 1.5; overflow-wrap: anywhere; }
.gm-fill { display: inline-block; margin: 0 2px; padding: 0 8px; border-radius: 8px; background: #ffe680; color: #3a2800; box-shadow: 0 2px 0 #e0a100; }
.gm-tf-vi { margin-top: 8px; color: var(--muted); font-weight: 600; }
.gm-tf-sentence-card .gm-tf-fix { font-size: 1.05em; }
.gm-tf-fix b { padding: 0 4px; border-radius: 5px; background: var(--success-soft); }
.gm-tf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gm-tf-buttons button {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; border-radius: var(--radius);
  font: 800 1.2em var(--font); cursor: pointer; border: 2px solid; transition: transform .1s var(--gm-ease), filter .15s ease;
}
.gm-tf-buttons button:active { transform: scale(.97); }
.gm-tf-buttons button:hover { filter: brightness(1.05); }
.gm-tf-buttons span { font-size: 1.3em; }
.gm-tf-buttons kbd { padding: 0 6px; border-radius: 5px; background: rgba(0, 0, 0, .12); font: inherit; font-size: .65em; opacity: .8; }
.gm-tf-no { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.gm-tf-yes { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }

/* ── Ô chữ ── */
.gm-cross { max-width: 820px; }
.gm-cross-board { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.gm-cross-grid {
  /* as wide as the screen allows: less the page's and the panel's sides, the grid's padding and its gaps */
  --cell: min(42px, calc((100vw - 92px - (var(--cols) - 1) * 3px) / var(--cols)));
  display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); gap: 3px;
  padding: 8px; border-radius: var(--radius); background: var(--surface-2); justify-self: center;
}
.gm-cross-void { visibility: hidden; }
.gm-cross-cell {
  position: relative; display: grid; place-items: center; padding: 0; border: 2px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); color: var(--text); font: 800 calc(var(--cell) * .5) var(--font); text-transform: uppercase; cursor: pointer;
  transition: background .2s ease, border-color .15s ease, transform .15s var(--gm-ease);
}
.gm-cross-cell.given { cursor: default; background: var(--surface-3); border-color: transparent; color: var(--text-2, var(--text)); }
.gm-cross-cell.filled { border-color: var(--primary); color: var(--primary-text); animation: gm-pop .2s var(--gm-ease); }
.gm-cross-cell.inword:not(.given):not(.solved) { background: var(--primary-soft); }   /* the word being filled */
.gm-cross-cell.chosen { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gm-cross-cell.solved { background: var(--word); border-color: var(--word); color: #fff; cursor: default; animation: gm-pop .35s var(--gm-ease); }
.gm-cross-cell.gm-cross-wrong { border-color: var(--danger-text); background: var(--danger-soft); animation: gm-shake .35s; }
.gm-cross-n { position: absolute; top: 1px; left: 3px; font: 700 calc(var(--cell) * .24) var(--font); font-style: normal; color: var(--muted); }
.gm-cross-cell.solved .gm-cross-n { color: rgba(255, 255, 255, .85); }
.gm-cross-clues { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.gm-cross-clues li {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: baseline; padding: 8px 10px;
  border-left: 4px solid var(--word); border-radius: 8px; background: var(--surface-2); font-weight: 600; overflow-wrap: anywhere;
}
.gm-cross-clues li small { color: var(--muted); font-weight: 500; }
.gm-cross-clue-n { font-weight: 800; color: var(--word); white-space: nowrap; }
.gm-cross-answer { grid-column: 2; color: var(--word); font-weight: 800; }
.gm-cross-answer:empty { display: none; }
.gm-cross-clues li:not(.solved) { cursor: pointer; }
.gm-cross-clues li.solved { background: color-mix(in srgb, var(--word) 14%, var(--surface)); }
.gm-cross-clues .gm-power-calm { margin: 0 0 0 4px; font-size: .72em; }
.gm-cross-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 48px; margin: 18px 0 6px; touch-action: manipulation; }
.gm-cross-tile {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; cursor: grab; touch-action: none; user-select: none;
  background: linear-gradient(180deg, #fff6d6, #ffe08a); color: #4a3500; box-shadow: 0 3px 0 #d9a92c;
  font: 800 1.3em var(--font); text-transform: uppercase; transition: transform .12s var(--gm-ease);
}
.gm-cross-tile[hidden] { display: none; }
.gm-cross-tile:hover { transform: translateY(-2px); }
.gm-cross-tile.chosen { transform: translateY(-4px); box-shadow: 0 0 0 3px var(--primary), 0 5px 0 #d9a92c; }

/* ── Bóng bay chữ ── */
.gm-balloons { max-width: 620px; text-align: center; }
.gm-balloon-stage { position: relative; height: 210px; margin: -6px auto 0; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(180deg, #bfe6ff 0%, #e6f6ff 70%, #f4fbf2 100%); }
.gm-balloon-scene { width: 100%; height: 100%; display: block; }
.gm-grass { fill: #8fd18a; }
.gm-bear-fur { fill: #c98b5a; }
.gm-bear-belly { fill: #f1d2b0; }
.gm-balloon-string { fill: none; stroke: #6b7280; stroke-width: 1; opacity: .7; }
.gm-bear-wrap { animation: gm-bob 2.6s ease-in-out infinite; }
.gm-bear { transition: transform 1.1s cubic-bezier(.3, .7, .3, 1); transform-box: view-box; }
.gm-balloon { transform-box: fill-box; transform-origin: 50% 100%; animation: gm-balloon-sway 3s ease-in-out infinite alternate; }
.gm-balloon.popped { animation: gm-balloon-pop .35s ease-out forwards; }
.gm-balloon-stage.flying .gm-bear { transform: translateY(-260px); }   /* the word found: up and away */
.gm-balloon-stage.landed .gm-bear-wrap { animation: none; }
.gm-balloon-stage.landed .gm-bear { transform: translateY(18px); }   /* no balloon left: down on the grass */
.gm-balloon-stage.landed .gm-bear-mouth { d: path('M117 161 q3 -3 6 0'); }
.gm-word-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: fit-content; max-width: 100%; margin: 14px auto; padding: 4px; border-radius: 12px; }
.gm-word-letter { display: grid; place-items: center; width: 34px; height: 42px; border-bottom: 3px solid var(--primary-border);
  font: 800 1.45em var(--font); color: var(--text); }
.gm-word-letter.shown { color: var(--primary-text); animation: gm-pop .25s var(--gm-ease); }
.gm-word-letter.missed { color: var(--danger-text); border-color: var(--danger-border); }
.gm-word-gap { width: 16px; }
.gm-word-mark { align-self: end; font: 800 1.45em var(--font); color: var(--muted); }
.gm-abc { display: grid; gap: 6px; margin: 6px auto 0; max-width: 520px; touch-action: manipulation; }
.gm-abc[hidden] { display: none; }
.gm-abc button {
  flex: 1 1 0; min-width: 0; max-width: 46px; height: 46px; padding: 0; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); box-shadow: 0 2px 0 var(--border-strong); font: 800 1.1em var(--font); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background .15s ease, transform .1s ease;
}
.gm-abc button:hover:not(:disabled) { border-color: var(--primary); }
.gm-abc button:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.gm-abc button.hit { background: var(--success-soft); border-color: var(--success-border); color: var(--success-text); box-shadow: none; }
.gm-abc button.miss { background: var(--surface-2); color: var(--muted); text-decoration: line-through; box-shadow: none; opacity: .6; }
.gm-float-pop { font-size: 1.6em; animation: gm-stamp .5s ease-out forwards; }

/* ── Right and wrong (every game) ── */
.gm-cheer { animation: gm-cheer .6s var(--gm-ease); }
.gm-boo { animation: gm-boo .6s ease-out; }
.gm-float {
  position: fixed; z-index: 1001; translate: -50% -50%; pointer-events: none; font-weight: 800; white-space: nowrap;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .25); animation: gm-float .95s ease-out both;   /* both: hidden until a delayed one starts */
}
.gm-float-ok { color: var(--success-text); font-size: 1.5em; }
.gm-float-streak { color: #d2601a; font-size: 1.1em; animation-delay: .08s; }
.gm-float-bad { color: var(--danger-text); font-size: 2.6em; animation: gm-stamp .7s var(--gm-ease) forwards; }
.gm-cheer-spark { position: fixed; z-index: 1000; width: 7px; height: 7px; border-radius: 50%; translate: -50% -50%; pointer-events: none;
  animation: gm-cheer-spark .65s cubic-bezier(.15, .7, .4, 1) forwards; }

/* A question with a power (the games without falling things) */
.gm-power-calm {
  display: inline-block; margin: 4px auto 6px; padding: 2px 12px; border-radius: 999px; font: 800 .82em var(--font); font-style: normal;
  background: linear-gradient(90deg, #fff3b0, #ffd23f); color: #5a3e00; box-shadow: 0 2px 10px rgba(255, 196, 60, .45);
  animation: gm-pop .35s var(--gm-ease), gm-glow 1.2s ease-in-out .35s infinite alternate;
}
.gm-power-calm.bad { background: linear-gradient(90deg, #ffd1d1, #ff8a8a); color: #7a0d16; box-shadow: 0 2px 10px rgba(255, 61, 61, .35); }
.gm-tf-card .gm-power-calm, .gm-listen > .gm-power-calm { display: table; }
.gm-tile, .gm-target { position: relative; }
.gm-float-note { color: #b06d00; font-size: 1.05em; animation-delay: .12s; }
.gm-float-note.bad { color: var(--danger-text); }

/* ── Sentences in the games ── */
.gm-blank { display: inline-block; min-width: 3.2em; margin: 0 4px; padding: 0 6px; border-bottom: 3px solid var(--primary); color: var(--primary-text); text-align: center; }
.gm-question .gm-tf-sentence { max-width: 100%; }
.gm-feedback .gm-tf-fix { display: inline-block; margin-top: 6px; }
.gm-target-vi { display: block; margin-top: 4px; color: var(--muted); font-size: .85em; }
.gm-spelled-sentence { font-size: 1.25em; letter-spacing: 0; line-height: 1.5; }
.gm-slots-words, .gm-letters-words { gap: 8px; }
.gm-slots-words .gm-slot { width: auto; min-width: 54px; padding: 0 12px; font-size: 1.05em; text-transform: none; }
.gm-letters-words .gm-letter { width: auto; padding: 0 14px; font-size: 1.05em; text-transform: none; }
.gm-slot-end { align-self: flex-end; font-size: 1.6em; font-weight: 800; color: var(--muted); }

/* ── Motion ── */
@keyframes gm-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes gm-fade { from { opacity: 0; } }
@keyframes gm-pop { from { transform: scale(.85); opacity: .4; } }
@keyframes gm-pulse-bg { to { opacity: .55; } }
@keyframes gm-count { from { transform: scale(1.8); opacity: 0; } 30% { transform: scale(1); opacity: 1; } to { transform: scale(.9); opacity: 0; } }
@keyframes gm-shake { 25% { translate: -6px 0; } 50% { translate: 6px 0; } 75% { translate: -3px 0; } }
@keyframes gm-shard { to { transform: translate(var(--dx), calc(var(--dy) + 90px)) rotate(var(--spin)); opacity: 0; } }
@keyframes gm-points { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { transform: translateY(-6px) scale(1.2); opacity: 1; } to { transform: translateY(-50px) scale(1); opacity: 0; } }
@keyframes gm-toast { from { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-40px); } }
@keyframes gm-glow { to { filter: brightness(1.25); } }
@keyframes gm-stars { from { transform: translateY(0); } to { transform: translateY(var(--tile)); } }
@keyframes gm-twinkle { to { opacity: .55; } }
@keyframes gm-nebula { to { opacity: .55; transform: scale(1.06); } }
@keyframes gm-bob { 50% { translate: 0 -5px; } }
@keyframes gm-flame { to { transform: scaleY(1.35) scaleX(.85); opacity: .8; } }
@keyframes gm-trail { to { transform: scaleY(1.15); opacity: .8; } }
@keyframes gm-spin { to { rotate: 360deg; } }
@keyframes gm-squash { to { scale: 1.3 .6; translate: 0 10px; filter: brightness(.6); } }
@keyframes gm-fadeout { to { opacity: 0; } }
@keyframes gm-rock-boom { to { scale: 1.7; opacity: 0; filter: brightness(2.2); } }
@keyframes gm-rock-broken { to { rotate: 50deg; translate: 0 34px; scale: .6; } }
@keyframes gm-word-in { from { opacity: 0; translate: -50% 10px; scale: .9; } }
@keyframes gm-beam { from { opacity: 1; } 60% { opacity: .9; } to { opacity: 0; height: 1px; } }
@keyframes gm-muzzle { from { scale: .4; } to { scale: 1.8; opacity: 0; } }
@keyframes gm-flash { from { scale: .3; opacity: 1; } to { scale: 1.2; opacity: 0; } }
@keyframes gm-ring { to { scale: 6; opacity: 0; border-width: 1px; } }
@keyframes gm-spark { to { transform: translate(var(--dx), calc(var(--dy) + 30px)); opacity: 0; scale: .3; } }
@keyframes gm-impact { from { scale: .3 1; opacity: 1; } to { scale: 1.6 .6; opacity: 0; } }
@keyframes gm-alarm { to { box-shadow: 0 -2px 0 rgba(255, 90, 110, .9), 0 -18px 50px rgba(255, 40, 70, .7), inset 0 18px 30px rgba(255, 90, 110, .4); } }
@keyframes gm-hurt { from { opacity: 1; } to { opacity: 0; } }
@keyframes gm-cheer { 0% { box-shadow: 0 0 0 0 rgba(44, 150, 100, .55); scale: 1; } 30% { scale: 1.04; } 100% { box-shadow: 0 0 0 16px rgba(44, 150, 100, 0); scale: 1; } }
@keyframes gm-boo { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .6); } 100% { box-shadow: 0 0 0 14px rgba(229, 72, 77, 0); } }
@keyframes gm-float { from { opacity: 0; transform: translateY(6px) scale(.7); } 20% { opacity: 1; transform: translateY(-6px) scale(1.15); } to { opacity: 0; transform: translateY(-46px) scale(1); } }
@keyframes gm-stamp { from { opacity: 0; transform: scale(2.2) rotate(-12deg); } 25% { opacity: 1; transform: scale(1) rotate(0); } 75% { opacity: 1; } to { opacity: 0; transform: scale(.9); } }
@keyframes gm-cheer-spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; scale: .3; } }
@keyframes gm-balloon-sway { from { rotate: calc(var(--sway, 0) * 3deg - 2deg); } to { rotate: calc(var(--sway, 0) * -3deg + 2deg); } }
@keyframes gm-balloon-pop { 40% { scale: 1.35; opacity: 1; } to { scale: 1.6; opacity: 0; } }
@keyframes gm-confetti { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(var(--drift), 560px) rotate(var(--spin)); opacity: 0; } }

/* ── Phones ── */
@media (max-width: 560px) {
  .gm-grid { gap: 10px; grid-template-columns: minmax(0, 1fr); }
  /* a game is a row: its picture beside its name */
  .gm-card { flex-direction: row; }
  .gm-art { flex: none; width: 112px; aspect-ratio: auto; }
  .gm-art svg { position: absolute; inset: 0; height: 100%; }
  .gm-badge { top: 6px; left: 6px; right: auto; padding: 2px 6px; font-size: .62em; }
  .gm-card-body { padding: 12px; gap: 6px; }
  .gm-card-body p { font-size: .86em; }
  .gm-panel { padding: 16px; }
  .gm-setup { padding: 0 0 16px; }
  .gm-setup > :not(.gm-setup-art) { margin-inline: 16px; }
  .gm-setup-art { height: 100px; }
  .gm-levels { gap: 6px; }
  .gm-level { padding: 8px 4px; }
  .gm-hud { gap: 8px; padding: 6px 8px 10px; }
  .gm-hud-title b { font-size: .95em; }
  .gm-hud-stats { order: 5; flex-basis: 100%; }
  .gm-hud-stats > :first-child { margin-left: 0; }
  .gm-music { margin-left: auto; }
  .gm-stat { padding: 2px 8px; font-size: .84em; }
  .gm-match { gap: 8px; }
  .gm-choices { grid-template-columns: 1fr; }
  .gm-tile { font-size: .9em; padding: 8px; }
  .gm-question-text { font-size: 1.7em; }
  .gm-plate { font-size: .74em; padding: 4px 6px; }
  .gm-plate kbd { display: none; }
  .gm-rock { width: 40px; height: 40px; }
  .gm-brick { font-size: .78em; padding: 6px 4px 4px; }
  .gm-sky { height: min(56vh, 420px); }
  .gm-bricks { height: min(42vh, 340px); }
  .gm-end-score { font-size: 2.5em; }
  .gm-end-actions button { flex: 1; min-width: 0; }
  .gm-slot, .gm-letter { width: 38px; height: 44px; font-size: 1.15em; }
  .gm-slots, .gm-letters { gap: 6px; }
  .gm-clue, .gm-tf-meaning { font-size: 1.3em; }
  .gm-tf-word { font-size: 1.8em; }
  .gm-tf-sentence { font-size: 1.2em; }
  .gm-balloon-stage { height: 170px; }
  /* the letters right under the grid, the clues after them: no scrolling between where a letter is and where it goes */
  .gm-cross { display: flex; flex-direction: column; }
  .gm-cross-board { display: contents; }
  .gm-cross-grid { order: 1; }
  .gm-cross-tray { order: 2; margin: 12px 0 4px; gap: 6px; }
  .gm-cross > .gm-listen-tools { order: 3; margin-top: 4px; }
  .gm-cross-clues { order: 4; margin-top: 12px; gap: 4px; }
  .gm-cross-clues li { padding: 6px 8px; font-size: .92em; }
  .gm-cross > .gm-hint { order: 5; }
  .gm-cross-tile { width: 38px; height: 38px; }
  .gm-word-letter { width: 26px; height: 36px; font-size: 1.2em; }
  .gm-abc { gap: 5px; }
  .gm-abc .gm-keys-row { gap: 4px; }
  .gm-abc button { height: 42px; }
  .gm-slots-words .gm-slot, .gm-letters-words .gm-letter { min-width: 40px; height: 40px; padding: 0 9px; font-size: .95em; }
  .gm-tf-buttons kbd { display: none; }
  .gm-big-say { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  #gamesSection *, #gamesSection *::before { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .gm-confetti { display: none; }
  /* messages that only fade: shown still, for as long as they last */
  .gm-countdown b, .gm-toast, .gm-points, .gm-float { animation: none !important; }
  .gm-cheer-spark { display: none; }
}

/* After the phone rules above: on a touch screen (the keys drawn, see .gm-keys) the sky takes what is left of
   the screen under the bar, above the box and the keys */
@media (pointer: coarse) {
  .gm-bricks { height: clamp(180px, calc(100svh - 400px), 440px); }
}

/* Cấp: the level a game has climbed to */
.gm-stat-stage { background: rgba(124, 92, 255, .14); color: #6a4fe0; }
/* Each question's countdown, at the top of the game's panel */
.gm-qtimer { margin-bottom: 12px; }
/* A pair, word or crossword word the clock ran out on: shown, as missed */
#gamesSection .gm-tile.missed, #gamesSection .gm-target.missed, #gamesSection .gm-cross-cell.missed {
  border-color: var(--danger-border, var(--danger)) !important; background: var(--danger-soft) !important; color: var(--danger-text) !important;
}
.gm-tile.missed { opacity: .55; }
.gm-cross-clues li.missed { background: var(--danger-soft); }
.gm-cross-clues li.missed .gm-cross-answer { color: var(--danger-text); }

/* Nghe & Gõ, "Ô chữ": one box a letter (games.js letterBoxes) */
.gm-type-boxes { align-items: flex-end; }
.gm-boxes { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 10px 4px;
  padding: 10px 6px; border: 2px solid transparent; border-radius: var(--radius); cursor: text; }
.gm-box-word { display: inline-flex; gap: 4px; align-items: flex-end; }
.gm-box-space { width: 14px; }
.gm-type .gm-boxes input.gm-box {
  flex: none; width: 2.1em; height: 2.5em; padding: 0; text-align: center; font: 700 1.15em/1 var(--font); text-transform: none;
  border: 2px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
.gm-type .gm-boxes input.gm-box:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gm-type .gm-boxes input.gm-box.given { border-style: dashed; background: var(--surface-2); color: var(--muted); }
.gm-box-fixed { padding: 0 1px 6px; font-weight: 700; font-size: 1.2em; color: var(--text-2); }
.gm-panel .gm-boxes.wrong { background: none !important; }
.gm-panel .gm-boxes.wrong input.gm-box:not(.given) { border-color: var(--danger-text); }
#gamesSection .gm-boxes.correct { background: none !important; }
#gamesSection .gm-boxes.correct input.gm-box { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
@media (max-width: 600px) { .gm-type .gm-boxes input.gm-box { width: 1.8em; height: 2.2em; font-size: 1.05em; } }
/* "Ô chữ · báo ngay": each letter judged as it is typed */
.gm-type .gm-boxes input.gm-box.ok { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.gm-type .gm-boxes input.gm-box.bad { border-color: var(--danger-text); background: var(--danger-soft); color: var(--danger-text); animation: gm-shake .3s; }
