/* ============================ QUIZBANK ACTIVITIES (Part 2) ============================
   Activity hub + four games. Uses adaptive --card-bg / --input-bg /
   --ring-* from 00-base.css so the design adapts cleanly across themes.
   Each game keeps its accent color: Flashcards=cyan, Matching=violet,
   Quiz=lime, Typing=amber/orange. */

body.qplay-mode > .aurora,
body.qplay-mode > .wrap,
body.qplay-mode > section:not(#quizbank-play-page){ display:none !important; }
body.qplay-mode{ position:relative; }

/* Dark atmospheric backdrop: violet + amber crossfade */
body.qplay-mode::before{
  content:""; position:fixed; inset:0; z-index:0; pointer-events:none;
  background:
    radial-gradient(720px 540px at 78% 18%, rgba(124,92,255,.20), transparent 60%),
    radial-gradient(620px 480px at 16% 80%, rgba(255,170,80,.14), transparent 60%),
    radial-gradient(520px 420px at 92% 88%, rgba(78,224,242,.16), transparent 65%);
  animation:gDrift 30s ease-in-out infinite alternate;
}
/* Light atmospheric backdrop: peach + lavender + sky — distinct from dark */
:root[data-theme="light"] body.qplay-mode::before{
  background:
    radial-gradient(800px 580px at 80% 14%, rgba(196,181,253,.32), transparent 60%),
    radial-gradient(680px 500px at 14% 80%, rgba(255,179,71,.30), transparent 62%),
    radial-gradient(520px 440px at 92% 92%, rgba(125,211,252,.28), transparent 64%);
  animation:gDrift 32s ease-in-out infinite alternate;
}
@keyframes gDrift{
  0%   { transform:translate(0,0) scale(1); }
  50%  { transform:translate(30px, -20px) scale(1.05); }
  100% { transform:translate(-20px, 30px) scale(.98); }
}

body.qplay-mode > header   { position:relative; z-index:50; }
body.qplay-mode > footer,
body.qplay-mode > .admin-fab,
body.qplay-mode > #quizbank-play-page{ position:relative; z-index:1; }
#quizbank-play-page{ max-width:1080px; margin:0 auto; padding:32px 22px 80px; }

/* ---------- HUB ---------- */
.g-hub-head{ text-align:center; margin:8px 0 22px; animation:gFadeIn .6s ease both; }
.g-hub-head .eyebrow{
  font-size:11.5px; font-weight:800; letter-spacing:3px; opacity:.92;
  color:var(--violet); text-transform:uppercase;
}
.g-hub-head h2{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:clamp(32px, 5.2vw, 50px); letter-spacing:-1.5px;
  margin:6px 0 6px;
  background:linear-gradient(120deg, #ffffff 0%, #a99aff 40%, #ffb070 100%);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
:root[data-theme="light"] .g-hub-head h2{
  background:linear-gradient(120deg, #0f172a 0%, #6d28d9 40%, #ea580c 100%);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
.g-hub-sub{ color:var(--muted); font-size:15px; max-width:600px; margin:0 auto; }

.g-setup{
  background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:18px;
  padding:20px 22px; backdrop-filter:blur(12px);
  display:flex; flex-direction:column; gap:14px;
  margin-bottom:22px;
  box-shadow:0 14px 36px -20px rgba(0,0,0,.55);
  animation:gFadeIn .65s .05s ease both;
}
.g-setup-row{ display:flex; flex-direction:column; gap:8px; }
.g-setup-row label{
  font-size:11.5px; font-weight:800; letter-spacing:1.5px;
  text-transform:uppercase; color:var(--muted);
}
/* ---- custom source dropdown (themed; native <select> can't be styled open) ---- */
.g-select{ position:relative; }
.g-select-btn{
  width:100%;
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--input-bg); border:1px solid var(--card-border);
  color:var(--text);
  padding:11px 14px; border-radius:11px;
  font-size:14px; font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; cursor:pointer;
  text-align:left; outline:none;
  transition:border-color .15s, background .15s, box-shadow .15s;
}
.g-select-btn:hover{ border-color:var(--card-border-hi); }
.g-select.open .g-select-btn{
  background:var(--input-bg-focus);
  border-color:var(--violet);
  box-shadow:0 0 0 3px var(--ring-violet);
}
.g-select-val{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.g-select-chev{ display:inline-flex; color:var(--muted); flex-shrink:0; transition:transform .2s; }
.g-select-chev svg{ width:12px; height:8px; }
.g-select.open .g-select-chev{ transform:rotate(180deg); }

.g-select-menu{
  position:absolute; top:calc(100% + 6px); left:0; right:0; z-index:90;
  background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:13px;
  padding:6px;
  box-shadow:0 24px 60px -20px rgba(0,0,0,.6);
  backdrop-filter:blur(16px);
  max-height:330px; overflow:auto;
  display:none;
}
:root[data-theme="light"] .g-select-menu{ box-shadow:0 24px 60px -20px rgba(30,40,80,.32); }
.g-select.open .g-select-menu{ display:block; animation:gFadeIn .16s ease both; }
.g-select-group{
  font-size:10.5px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:var(--muted); padding:10px 12px 5px;
}
.g-select-opt{
  width:100%; display:flex; align-items:center; gap:8px;
  background:transparent; border:none; border-radius:9px;
  color:var(--text); padding:10px 12px; cursor:pointer;
  font-size:14px; font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; text-align:left;
  transition:background .14s, color .14s;
}
.g-select-opt:hover{ background:var(--chip-bg-hover); color:var(--violet); }
.g-select-opt.is-active{ background:rgba(124,92,255,.14); color:var(--violet); }
.g-select-opt-label{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.g-select-opt-count{ font-size:12.5px; color:var(--muted); font-weight:600; flex-shrink:0; }
.g-select-opt.is-active .g-select-opt-count{ color:var(--violet); opacity:.85; }
.g-select-check{ color:var(--violet); font-weight:800; flex-shrink:0; }
.g-pill-row{ display:flex; gap:8px; flex-wrap:wrap; }
.g-pill-row button{
  background:var(--chip-bg); border:1px solid var(--card-border);
  color:var(--text); padding:9px 18px; border-radius:999px;
  font-weight:700; font-size:13px; cursor:pointer; transition:all .18s;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif;
}
.g-pill-row button:hover{
  border-color:var(--violet); color:var(--violet);
  transform:translateY(-1px);
}
.g-pill-row button.is-active{
  background:linear-gradient(135deg, #7c5cff, #5b3edc);
  color:#ffffff; border-color:#7c5cff;
  box-shadow:0 8px 22px -10px rgba(124,92,255,.55);
  animation:gPillPop .25s cubic-bezier(.34,1.56,.64,1);
}
:root[data-theme="light"] .g-pill-row button.is-active{
  background:linear-gradient(135deg, #6d28d9, #5b21b6);
  color:#ffffff; border-color:#6d28d9;
}
@keyframes gPillPop{
  0%   { transform:scale(.94); }
  50%  { transform:scale(1.06); }
  100% { transform:scale(1); }
}
.g-setup-preview{
  font-size:13px; color:var(--muted);
  padding-top:6px; border-top:1px dashed var(--hairline);
}
.g-setup-preview b{ color:var(--text); }

.g-cards{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(220px,1fr)); gap:14px;
  margin-bottom:20px;
}
.g-card{
  display:flex; flex-direction:column; align-items:flex-start; gap:6px;
  background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:18px;
  padding:22px; cursor:pointer; transition:all .25s;
  backdrop-filter:blur(12px); text-align:left;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif;
  color:var(--text);
  box-shadow:0 12px 30px -18px rgba(0,0,0,.5);
  position:relative; overflow:hidden;
  animation:gCardEnter .55s ease both;
  animation-delay:var(--g-delay, 0ms);
}
/* Subtle accent stripe at the top of each card */
.g-card::before{
  content:""; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg, transparent, currentColor, transparent);
  opacity:.5;
}
.g-card--blue   { color:var(--cyan); }
.g-card--purple { color:var(--violet); }
.g-card--green  { color:var(--lime); }
.g-card--orange { color:#f97316; }
.g-card-ico{ font-size:36px; line-height:1; transition:transform .25s; }
.g-card-title{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:22px; font-weight:700; letter-spacing:-.5px; color:var(--text);
}
.g-card-sub{ font-size:13px; color:var(--muted); }
.g-card-go{
  margin-top:auto; padding-top:10px;
  font-weight:800; font-size:12px; letter-spacing:1px; text-transform:uppercase;
  color:var(--muted); transition:color .18s;
}
.g-card:hover{
  transform:translateY(-4px) rotate(-.4deg);
  box-shadow:0 22px 50px -22px rgba(0,0,0,.6);
}
.g-card:hover .g-card-ico{ transform:scale(1.15) rotate(-4deg); }
.g-card:hover .g-card-go{ color:currentColor; }
.g-card--blue:hover   { border-color:rgba(78,224,242,.6); box-shadow:0 22px 50px -18px rgba(78,224,242,.42); }
.g-card--purple:hover { border-color:rgba(124,92,255,.7); box-shadow:0 22px 50px -18px rgba(124,92,255,.45); }
.g-card--green:hover  { border-color:rgba(198,242, 78,.7); box-shadow:0 22px 50px -18px rgba(198,242,78,.42); }
.g-card--orange:hover { border-color:rgba(255,170, 80,.75); box-shadow:0 22px 50px -18px rgba(255,170,80,.45); }
:root[data-theme="light"] .g-card--blue:hover   { box-shadow:0 22px 50px -18px rgba(8,145,178,.40); }
:root[data-theme="light"] .g-card--purple:hover { box-shadow:0 22px 50px -18px rgba(109,40,217,.40); }
:root[data-theme="light"] .g-card--green:hover  { box-shadow:0 22px 50px -18px rgba(101,163,13,.40); }
:root[data-theme="light"] .g-card--orange:hover { box-shadow:0 22px 50px -18px rgba(234,88,12,.40); }

.g-shortcut{ display:flex; justify-content:center; animation:gFadeIn .7s .15s ease both; }
.g-weak-btn{
  background:linear-gradient(135deg, rgba(239,68,68,.20), rgba(255,170,80,.20));
  border:1px solid rgba(239,68,68,.5); color:#fb923c;
  padding:13px 26px; border-radius:14px;
  font-weight:800; font-size:14.5px; letter-spacing:.5px;
  cursor:pointer; transition:all .2s;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif;
  box-shadow:0 10px 28px -14px rgba(239,68,68,.35);
}
.g-weak-btn:hover{
  background:linear-gradient(135deg, rgba(239,68,68,.30), rgba(255,170,80,.30));
  transform:translateY(-2px);
  box-shadow:0 14px 32px -14px rgba(239,68,68,.5);
}
:root[data-theme="light"] .g-weak-btn{
  background:linear-gradient(135deg, rgba(239,68,68,.18), rgba(249,115,22,.20));
  color:#dc2626; border-color:rgba(220,38,38,.5);
}

/* ---------- SHARED game chrome ---------- */
.g-game-head{
  display:flex; align-items:center; gap:10px; justify-content:space-between;
  padding:14px 18px; margin-bottom:14px;
  background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:14px;
  backdrop-filter:blur(12px);
  animation:gFadeIn .5s ease both;
}
.g-game-title{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:20px; font-weight:700; letter-spacing:-.5px;
  color:var(--text);
}
.g-exit{
  background:transparent; border:1px solid var(--card-border);
  color:var(--muted); width:32px; height:32px; border-radius:9px;
  cursor:pointer; font-size:14px;
  display:inline-flex; align-items:center; justify-content:center;
  transition:all .15s;
}
.g-exit:hover{ color:#ef4444; border-color:rgba(239,68,68,.5); transform:rotate(90deg); }
.g-head--blue   .g-game-title{ color:var(--cyan); }
.g-head--purple .g-game-title{ color:var(--violet); }
.g-head--green  .g-game-title{ color:var(--lime); }
.g-head--orange .g-game-title{ color:#f97316; }

.g-progress{ display:flex; align-items:center; gap:14px; margin-bottom:14px; animation:gFadeIn .5s .05s ease both; }
.g-progress-bar{
  flex:1; height:8px; background:var(--chip-bg);
  border-radius:999px; overflow:hidden;
  border:1px solid var(--hairline);
}
.g-progress-fill{
  height:100%;
  background:linear-gradient(90deg, var(--cyan), var(--violet));
  border-radius:999px; transition:width .35s ease;
}
.g-progress-text{ font-size:12.5px; font-weight:800; color:var(--muted); }

.g-btn{
  background:var(--chip-bg); border:1px solid var(--card-border); color:var(--text);
  padding:10px 18px; border-radius:11px;
  font-weight:700; font-size:13.5px; cursor:pointer; transition:all .18s;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif;
}
.g-btn:hover{
  background:var(--chip-bg-hover);
  border-color:var(--cyan); color:var(--cyan);
  transform:translateY(-1px);
}
.g-btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; }
.g-btn--known{
  background:linear-gradient(135deg, #c6f24e, #7eea3a);
  color:#0a0b10; border-color:#c6f24e;
}
:root[data-theme="light"] .g-btn--known{
  background:linear-gradient(135deg, #84cc16, #65a30d);
  color:#ffffff; border-color:#65a30d;
}
.g-btn--known:hover{ filter:brightness(1.07); color:#0a0b10; }
:root[data-theme="light"] .g-btn--known:hover{ color:#ffffff; }
.g-btn--learning{
  background:rgba(255,170,80,.14); border-color:rgba(217,119,6,.50); color:#d97706;
}
:root[data-theme="dark"] .g-btn--learning,
:root:not([data-theme]) .g-btn--learning{ color:#ffc850; }
.g-btn--learning:hover{ background:rgba(255,170,80,.22); color:#d97706; }
:root[data-theme="dark"] .g-btn--learning:hover,
:root:not([data-theme]) .g-btn--learning:hover{ color:#ffc850; }
.g-btn--check{
  background:linear-gradient(135deg, #4ee0f2, #2cb5cc); color:#0a0b10;
  border-color:#4ee0f2;
}
:root[data-theme="light"] .g-btn--check{
  background:linear-gradient(135deg, #0891b2, #0e7490); color:#ffffff; border-color:#0891b2;
}
.g-btn--hint{
  background:rgba(124,92,255,.14); border-color:var(--ring-violet); color:var(--violet);
}
.g-btn--hint:hover{ background:rgba(124,92,255,.22); }
.g-btn--skip{ color:var(--muted); }
.g-btn--next{
  margin-top:14px;
  background:linear-gradient(135deg, #4ee0f2, #2cb5cc); color:#0a0b10;
  border-color:#4ee0f2;
}
:root[data-theme="light"] .g-btn--next{
  background:linear-gradient(135deg, #0891b2, #0e7490); color:#ffffff; border-color:#0891b2;
}
.g-btn--review{
  background:linear-gradient(135deg, rgba(239,68,68,.22), rgba(255,170,80,.22));
  border-color:rgba(249,115,22,.55); color:#fb923c;
}
:root[data-theme="light"] .g-btn--review{
  background:linear-gradient(135deg, rgba(239,68,68,.18), rgba(249,115,22,.20));
  color:#dc2626; border-color:rgba(220,38,38,.45);
}

/* ---------- FLASHCARDS ---------- */
.g-fc-stage{ display:flex; justify-content:center; padding:24px 0; animation:gFadeIn .5s .1s ease both; }
.g-fc-card{
  position:relative; width:100%; max-width:540px; min-height:320px;
  perspective:1200px; cursor:pointer;
}
.g-fc-face{
  position:absolute; inset:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:14px; padding:32px;
  background:var(--card-bg);
  border:1px solid var(--ring-cyan); border-radius:22px;
  backdrop-filter:blur(12px);
  backface-visibility:hidden;
  transition:transform .55s ease, box-shadow .25s;
  text-align:center;
  box-shadow:0 22px 50px -22px rgba(78,224,242,.4);
}
:root[data-theme="light"] .g-fc-face{
  box-shadow:0 22px 50px -22px rgba(8,145,178,.35);
}
.g-fc-back{
  transform:rotateY(180deg);
  align-items:flex-start; text-align:left;
  gap:10px;
}
.g-fc-card.is-flipped .g-fc-front{ transform:rotateY(180deg); }
.g-fc-card.is-flipped .g-fc-back{  transform:rotateY(360deg); }
.g-fc-term{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:clamp(36px, 6vw, 56px); font-weight:700; letter-spacing:-1.5px;
  color:var(--text);
}
.g-fc-phon{ color:var(--muted); font-style:italic; font-size:15px; }
.g-fc-speak{
  background:rgba(78,224,242,.14); border:1px solid var(--ring-cyan);
  color:var(--cyan); width:44px; height:44px; border-radius:12px;
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; transition:all .18s;
}
.g-fc-speak svg{ width:19px; height:19px; }
.g-fc-speak:hover{ background:rgba(78,224,242,.24); transform:scale(1.06); }
.g-fc-speak.pronouncing{ animation:gPulse 1s ease infinite; }
@keyframes gPulse{
  0%,100% { box-shadow:0 0 0 0 rgba(78,224,242,.5); }
  50%     { box-shadow:0 0 0 10px rgba(78,224,242,0); }
}
.g-fc-hint{ font-size:12px; color:var(--muted); margin-top:8px; letter-spacing:.5px; }
.g-fc-pos{
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  background:rgba(198,242,78,.14); color:#65a30d;
  padding:3px 10px; border-radius:999px; border:1px solid rgba(101,163,13,.40);
  align-self:flex-start;
}
:root[data-theme="dark"] .g-fc-pos,
:root:not([data-theme]) .g-fc-pos{ color:#c6f24e; border-color:rgba(198,242,78,.30); }
.g-fc-def{ font-size:17px; line-height:1.5; color:var(--text); }
.g-fc-sent{
  font-size:14px; color:var(--muted); line-height:1.5;
  background:var(--chip-bg);
  border-left:3px solid var(--cyan);
  padding:9px 12px; border-radius:6px; align-self:stretch;
}
.g-fc-src{ font-size:12px; color:var(--muted); margin-top:auto; }
.g-fc-actions{ display:flex; gap:12px; justify-content:center; animation:gFadeIn .5s .2s ease both; }
.g-fc-actions .g-btn{ min-width:170px; }

/* ---------- MATCHING ---------- */
.g-match-meter{
  display:flex; gap:18px; justify-content:center; padding:8px 0 14px;
  font-size:13.5px; color:var(--muted);
  animation:gFadeIn .5s .1s ease both;
}
.g-match-meter b{ color:var(--text); }
.g-match-grid{
  display:grid; grid-template-columns:1fr 1fr; gap:14px;
  animation:gFadeIn .55s .15s ease both;
}
.g-match-col-title{
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:var(--muted); margin-bottom:8px;
}
.g-match-col{ display:flex; flex-direction:column; gap:8px; }
.g-match-tile{
  background:var(--card-bg);
  border:1px solid var(--ring-violet); border-radius:12px;
  padding:13px 15px; color:var(--text);
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; font-size:14.5px; text-align:left;
  cursor:pointer; transition:all .18s;
  min-height:50px; line-height:1.4;
}
.g-match-tile:hover{
  border-color:var(--violet);
  transform:translateY(-1px);
  box-shadow:0 8px 20px -10px rgba(124,92,255,.4);
}
.g-match-tile.is-picked{
  background:rgba(124,92,255,.20);
  border-color:var(--violet);
  box-shadow:0 0 0 3px var(--ring-violet);
}
.g-match-tile.is-matched{
  background:rgba(198,242,78,.16);
  border-color:rgba(101,163,13,.6); color:var(--muted);
  pointer-events:none;
  animation:gMatchPop .35s ease;
}
:root[data-theme="dark"] .g-match-tile.is-matched,
:root:not([data-theme]) .g-match-tile.is-matched{
  background:rgba(198,242,78,.14);
}
@keyframes gMatchPop{
  0%   { transform:scale(1); }
  50%  { transform:scale(1.04); }
  100% { transform:scale(1); }
}
.g-match-tile.is-wrong{
  background:rgba(239,68,68,.18);
  border-color:#ef4444; color:#ef4444;
  animation:gShake .35s ease;
}
.g-match-word{ font-weight:700; }
@keyframes gShake{
  0%,100% { transform:translateX(0); }
  20%     { transform:translateX(-5px); }
  40%     { transform:translateX(5px); }
  60%     { transform:translateX(-4px); }
  80%     { transform:translateX(4px); }
}

/* ---------- QUIZ ---------- */
.g-quiz-score{ text-align:right; font-size:13px; color:var(--muted); margin-bottom:8px; }
.g-quiz-score b{ color:var(--lime); font-size:16px; }
:root[data-theme="light"] .g-quiz-score b{ color:#65a30d; }
.g-quiz-stage{
  background:var(--card-bg);
  border:1px solid var(--ring-lime); border-radius:18px;
  padding:24px; backdrop-filter:blur(12px);
  box-shadow:0 18px 40px -22px rgba(198,242,78,.30);
  animation:gFadeIn .55s .1s ease both;
}
:root[data-theme="light"] .g-quiz-stage{
  box-shadow:0 18px 40px -22px rgba(101,163,13,.25);
}
.g-quiz-prompt{ text-align:center; margin-bottom:22px; }
.g-quiz-prompt-lbl{ font-size:12px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase; color:var(--muted); margin-bottom:10px; }
.g-quiz-prompt-def{ font-size:19px; line-height:1.4; color:var(--text); }
.g-quiz-prompt-word{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:38px; font-weight:700; letter-spacing:-1px; color:var(--text);
  display:inline-flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:center;
}
.g-quiz-phon{ font-size:16px; color:var(--muted); font-style:italic; }
.g-quiz-speak, .g-quiz-audio-btn{
  background:rgba(78,224,242,.14); border:1px solid var(--ring-cyan);
  color:var(--cyan); padding:8px 16px; border-radius:12px;
  display:inline-flex; align-items:center; gap:8px;
  cursor:pointer; transition:all .15s;
}
.g-quiz-speak{ width:38px; height:38px; padding:0; justify-content:center; }
.g-quiz-speak svg, .g-quiz-audio-btn svg{ width:18px; height:18px; }
.g-quiz-audio-btn{ font-weight:700; font-size:14px; font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; }
.g-quiz-audio-btn:hover, .g-quiz-speak:hover{ background:rgba(78,224,242,.24); transform:translateY(-1px); }
.g-quiz-audio{ display:flex; justify-content:center; padding:8px 0; }

.g-quiz-options{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
@media (max-width:560px){ .g-quiz-options{ grid-template-columns:1fr; } }
.g-quiz-opt{
  background:var(--card-bg-soft);
  border:1px solid var(--card-border); border-radius:12px;
  color:var(--text); padding:14px 16px; cursor:pointer; transition:all .18s;
  display:flex; align-items:center; gap:12px; text-align:left;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; font-size:14.5px;
  min-height:60px;
}
.g-quiz-opt:hover:not(:disabled){
  border-color:var(--ring-lime); transform:translateY(-1px);
  box-shadow:0 8px 20px -10px rgba(198,242,78,.4);
}
:root[data-theme="light"] .g-quiz-opt:hover:not(:disabled){
  box-shadow:0 8px 20px -10px rgba(101,163,13,.35);
}
.g-quiz-opt-key{
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:9px;
  background:rgba(198,242,78,.18); color:#65a30d;
  font-weight:800; font-size:13px; flex-shrink:0;
}
:root[data-theme="dark"] .g-quiz-opt-key,
:root:not([data-theme]) .g-quiz-opt-key{ color:#c6f24e; }
.g-quiz-opt-text{ flex:1; line-height:1.4; }
.g-quiz-opt.is-correct{
  background:rgba(198,242,78,.18);
  border-color:rgba(101,163,13,.7);
  animation:gMatchPop .35s ease;
}
.g-quiz-opt.is-correct .g-quiz-opt-key{ background:#65a30d; color:#ffffff; }
:root[data-theme="dark"] .g-quiz-opt.is-correct .g-quiz-opt-key,
:root:not([data-theme]) .g-quiz-opt.is-correct .g-quiz-opt-key{ background:#c6f24e; color:#0a0b10; }
.g-quiz-opt.is-wrong{
  background:rgba(239,68,68,.16);
  border-color:rgba(239,68,68,.7);
  animation:gShake .35s ease;
}
.g-quiz-opt.is-wrong .g-quiz-opt-key{ background:#ef4444; color:#ffffff; }
.g-quiz-opt:disabled{ cursor:default; transform:none; }
.g-quiz-reveal{
  margin-top:18px; padding:14px 16px; border-radius:12px;
  font-size:14.5px; font-weight:700;
  animation:gFadeIn .35s ease;
}
.g-quiz-reveal.is-ok  { background:rgba(198,242,78,.14); color:#65a30d; border:1px solid rgba(101,163,13,.40); }
.g-quiz-reveal.is-bad { background:rgba(239,68,68,.12); color:#dc2626; border:1px solid rgba(239,68,68,.40); }
:root[data-theme="dark"] .g-quiz-reveal.is-ok,
:root:not([data-theme]) .g-quiz-reveal.is-ok{ color:#c6f24e; border-color:rgba(198,242,78,.30); }
:root[data-theme="dark"] .g-quiz-reveal.is-bad,
:root:not([data-theme]) .g-quiz-reveal.is-bad{ color:#ff8b8b; border-color:rgba(255,107,107,.30); }
.g-quiz-reveal-src{ font-size:12px; color:var(--muted); font-weight:500; margin-top:4px; }
.g-quiz-reveal b{ color:var(--text); }

/* ---------- TYPING ---------- */
.g-typing-score{ text-align:right; font-size:13px; color:var(--muted); margin-bottom:8px; }
.g-typing-score b{ color:#f97316; font-size:16px; }
.g-typing-stage{
  background:var(--card-bg);
  border:1px solid rgba(249,115,22,.35); border-radius:18px;
  padding:24px; backdrop-filter:blur(12px);
  box-shadow:0 18px 40px -22px rgba(249,115,22,.30);
  animation:gFadeIn .55s .1s ease both;
}
.g-typing-prompt{ text-align:center; margin-bottom:22px; }
.g-typing-prompt-lbl{ font-size:12px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase; color:var(--muted); margin-bottom:10px; }
.g-typing-prompt-def{ font-size:19px; line-height:1.5; color:var(--text); }
.g-typing-pos{
  display:inline-block; margin-top:8px;
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  background:rgba(198,242,78,.14); color:#65a30d;
  padding:3px 10px; border-radius:999px; border:1px solid rgba(101,163,13,.40);
}
:root[data-theme="dark"] .g-typing-pos,
:root:not([data-theme]) .g-typing-pos{ color:#c6f24e; border-color:rgba(198,242,78,.30); }
.g-typing-audio-row{ display:flex; justify-content:center; padding:6px 0; }

.g-typing-input-row{ display:flex; gap:10px; margin-bottom:12px; }
.g-typing-input-row input{
  flex:1; background:var(--input-bg); border:1px solid rgba(249,115,22,.40);
  color:var(--text); padding:14px 16px; border-radius:12px;
  font-size:19px; font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; outline:none;
  letter-spacing:.5px;
  transition:border-color .15s, box-shadow .15s, background .15s;
}
.g-typing-input-row input:focus{
  background:var(--input-bg-focus);
  border-color:#f97316; box-shadow:0 0 0 3px var(--ring-amber);
}
.g-typing-input-row input.is-shake{ animation:gShake .35s ease; border-color:#ef4444; }
.g-typing-hint-row{
  display:flex; gap:10px; align-items:center; flex-wrap:wrap;
}
.g-typing-hint-count{ font-size:13px; color:var(--muted); }
.g-typing-mask{
  margin-top:14px; padding:12px;
  background:var(--chip-bg); border-radius:10px; text-align:center;
  display:flex; gap:6px; justify-content:center;
  min-height:44px;
}
.g-typing-mask:empty{ display:none; }
.g-typing-letter{
  display:inline-block; min-width:20px; padding:5px 7px;
  background:var(--card-bg-soft); border:1px solid var(--card-border);
  border-radius:7px;
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:22px; font-weight:700; color:var(--muted);
  text-align:center;
}
.g-typing-letter--shown{
  color:#f97316; background:rgba(249,115,22,.12); border-color:rgba(249,115,22,.45);
  animation:gPillPop .25s cubic-bezier(.34,1.56,.64,1);
}

/* ---------- SHARED FIRST-LETTER HINT (Quiz · Sentence · Word Race) ---------- */
.g-hint{
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  justify-content:center; margin-top:16px;
  animation:gFadeIn .4s ease both;
}
.g-hint-btn{
  display:inline-flex; align-items:center; gap:7px;
  background:rgba(124,92,255,.14); border:1px solid var(--ring-violet);
  color:var(--violet); padding:9px 16px; border-radius:999px;
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; font-weight:700; font-size:13.5px;
  cursor:pointer; transition:transform .16s, background .16s, box-shadow .16s;
}
.g-hint-btn:hover:not(:disabled){
  background:rgba(124,92,255,.24); transform:translateY(-1px);
  box-shadow:0 8px 20px -12px rgba(124,92,255,.85);
}
.g-hint-btn:disabled{ opacity:.55; cursor:default; }
.g-hint-btn.is-done{ border-style:dashed; }
.g-hint-ico{ font-size:15px; line-height:1; }
/* cost chip + key hint riding on the pill */
.g-hint-cost{
  font-size:10.5px; font-weight:800; letter-spacing:.3px;
  padding:2px 6px; border-radius:999px;
  background:rgba(124,92,255,.2); color:var(--violet);
  text-transform:uppercase;
}
.g-hint-kbd{
  font-family:inherit; font-size:10px; font-weight:800; line-height:1;
  padding:3px 6px; border-radius:5px; color:var(--muted);
  background:var(--card-bg-soft); border:1px solid var(--card-border);
}
/* once spent, drop the affordances so the pill reads as "used" */
.g-hint-btn.is-done .g-hint-cost,
.g-hint-btn.is-done .g-hint-kbd{ display:none; }
.g-hint-word{ display:none; gap:5px; align-items:center; }
.g-hint-word.is-on{ display:inline-flex; }
.g-hint-gap{ width:10px; }
.g-hint-tile{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:22px; height:30px; padding:0 5px;
  border:1px solid var(--card-border); border-radius:7px;
  background:var(--card-bg-soft);
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:700; font-size:17px;
  color:var(--muted);
}
/* Hidden slots show a faint underscore so the row reads as "letters to come". */
.g-hint-tile:not(.is-shown)::after{
  content:''; width:9px; height:2px; border-radius:1px;
  background:var(--muted); opacity:.38;
}
.g-hint-tile.is-shown{
  color:var(--violet); background:rgba(124,92,255,.15);
  border-color:var(--ring-violet);
  animation:gPillPop .28s cubic-bezier(.34,1.56,.64,1);
}
.g-hint-tile.is-shown::after{ display:none; }

/* Flashcards "peek at the meaning" — progressive word reveal below the card. */
.g-fc-hintbar{ display:flex; flex-direction:column; align-items:center; gap:10px; margin:2px 0 4px; }
.g-fc-peek{
  display:none; flex-wrap:wrap; gap:4px 8px; justify-content:center;
  max-width:560px; text-align:center; line-height:1.55; font-size:15px;
}
.g-fc-peek.is-on{ display:flex; animation:gFadeIn .3s ease both; }
.g-fc-peek-w{ color:var(--muted); opacity:.5; letter-spacing:1.5px; }
.g-fc-peek-w.is-shown{
  color:var(--text); opacity:1; letter-spacing:normal; font-weight:600;
  animation:gPillPop .26s cubic-bezier(.34,1.56,.64,1);
}

/* Matching "reveal a pair" — a hinted pair reads amber+dashed so it's clearly
   distinct from a pair the player matched themselves (lime). */
.g-match-hintbar{ display:flex; justify-content:center; margin-top:18px; }
.g-match-tile.is-matched.is-hinted{
  background:rgba(251,191,36,.14); border-color:rgba(217,119,6,.6);
  border-style:dashed;
}

/* ---------- SUMMARY ---------- */
.g-summary{
  background:var(--card-bg);
  border:1px solid var(--card-border); border-radius:18px;
  padding:24px; backdrop-filter:blur(12px);
  box-shadow:0 18px 40px -22px rgba(0,0,0,.5);
  animation:gFadeIn .6s ease both;
}
/* Equal-width tiles on a grid, not a centred flex-wrap — see the note on
   .sh-hero-stats in 25-shadowing.css. */
.g-summary-stats{
  display:grid; grid-template-columns:repeat(auto-fit, 172px);
  justify-content:center; gap:14px; margin-bottom:20px;
}
.g-summary-stat{
  background:var(--card-bg-soft); border:1px solid var(--card-border);
  border-radius:14px; padding:16px 24px; min-width:140px; text-align:center;
  transition:transform .2s;
}
.g-summary-stat:hover{ transform:translateY(-2px); }
.g-summary-num{
  font-size:32px; font-weight:800;
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  background:linear-gradient(120deg, #c6f24e, #4ee0f2);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
:root[data-theme="light"] .g-summary-num{
  background:linear-gradient(120deg, #65a30d, #0891b2);
  -webkit-background-clip:text; background-clip:text;
  -webkit-text-fill-color:transparent;
}
.g-summary-lbl{ font-size:11px; color:var(--muted); letter-spacing:1px; text-transform:uppercase; margin-top:4px; }

.g-summary-clean{ text-align:center; font-size:19px; color:#65a30d; padding:14px; font-weight:700; }
:root[data-theme="dark"] .g-summary-clean,
:root:not([data-theme]) .g-summary-clean{ color:#c6f24e; }
.g-summary-missed{
  margin-bottom:18px; padding:14px;
  background:rgba(239,68,68,.06); border:1px solid rgba(239,68,68,.22); border-radius:12px;
}
.g-summary-missed-title{
  font-size:11.5px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:#dc2626; margin-bottom:10px;
}
:root[data-theme="dark"] .g-summary-missed-title,
:root:not([data-theme]) .g-summary-missed-title{ color:#ff8b8b; }
.g-summary-missed-list{ display:flex; flex-direction:column; gap:6px; }
.g-summary-missed-item{
  display:flex; align-items:center; gap:10px;
  padding:9px 12px;
  background:var(--chip-bg); border-radius:9px;
  font-size:13.5px;
}
.g-summary-missed-term{ font-weight:700; color:var(--text); min-width:100px; }
.g-summary-missed-def{ color:var(--muted); font-size:12.5px; flex:1; }
.g-summary-speak{
  background:var(--chip-bg); border:1px solid var(--card-border);
  color:var(--text); width:30px; height:30px; border-radius:9px;
  display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.g-summary-speak svg{ width:13px; height:13px; }
.g-summary-more{ font-size:12px; color:var(--muted); text-align:center; padding-top:6px; }

.g-summary-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }
.g-summary-switch{
  margin-top:18px; padding-top:14px; border-top:1px dashed var(--hairline);
}
.g-summary-switch-title{
  font-size:11.5px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:var(--muted); margin-bottom:10px;
}
.g-summary-switch-row{ display:flex; gap:10px; flex-wrap:wrap; }

.g-empty{
  text-align:center; padding:40px 20px; color:var(--muted);
}

/* ---------- SHARED ANIMATIONS ---------- */
@keyframes gFadeIn{
  from{ opacity:0; transform:translateY(8px); }
  to  { opacity:1; transform:translateY(0); }
}
@keyframes gCardEnter{
  from{ opacity:0; transform:translateY(10px) scale(.96); }
  to  { opacity:1; transform:translateY(0) scale(1); }
}

/* ====================================================================
   ARCADE LAYER (Part 3) — score/streak HUD, new game accents, and the
   three new games: Sentence (cloze), Scramble, Speed. Reuses the same
   adaptive tokens as everything above.
   ==================================================================== */

/* ---------- header + live HUD ---------- */
.g-game-head{ justify-content:flex-start; gap:12px; }
.g-game-title{ margin-right:auto; }
.g-hud{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.g-hud-mute{
  background:transparent; border:1px solid var(--card-border); color:var(--muted);
  width:30px; height:30px; border-radius:9px; cursor:pointer; font-size:13px;
  display:inline-flex; align-items:center; justify-content:center; transition:all .15s;
}
.g-hud-mute:hover{ border-color:var(--card-border-hi); color:var(--text); }
.g-hud-score{ display:inline-flex; align-items:baseline; gap:3px; font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; }
.g-hud-score b{ font-size:18px; font-weight:800; color:var(--text); font-variant-numeric:tabular-nums; }
.g-hud-score i{ font-size:10px; font-style:normal; letter-spacing:1px; text-transform:uppercase; color:var(--muted); }
.g-hud-streak{
  display:inline-flex; align-items:center; gap:3px; padding:3px 9px; border-radius:999px;
  background:var(--chip-bg); border:1px solid var(--hairline);
  font-weight:800; font-size:13px; color:var(--muted); transition:all .2s;
  font-variant-numeric:tabular-nums;
}
.g-hud-streak .g-hud-flame{ filter:grayscale(1) opacity(.55); transition:filter .2s; font-size:12px; }
.g-hud-streak.is-hot{
  background:linear-gradient(135deg, rgba(249,115,22,.22), rgba(239,68,68,.22));
  border-color:rgba(249,115,22,.5); color:#fb923c;
}
:root[data-theme="light"] .g-hud-streak.is-hot{ color:#ea580c; }
.g-hud-streak.is-hot .g-hud-flame{ filter:none; animation:gFlame 1s ease-in-out infinite; }
.g-pop{ animation:gHudPop .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes gHudPop{ 0%{ transform:scale(1); } 50%{ transform:scale(1.28); } 100%{ transform:scale(1); } }
@keyframes gFlame{ 0%,100%{ transform:translateY(0) scale(1); } 50%{ transform:translateY(-1px) scale(1.18); } }

/* ---------- card "New" badge + new accent colors ---------- */
/* ---- locked game cards (below the per-game minimum-words threshold) ---- */
.g-card.is-locked{
  opacity:.6; cursor:not-allowed; filter:grayscale(.55);
}
.g-card.is-locked:hover{
  transform:none; border-color:var(--card-border);
  box-shadow:0 12px 30px -18px rgba(0,0,0,.5);
}
.g-card.is-locked:hover .g-card-ico{ transform:none; }
.g-card-lock{
  position:absolute; top:12px; right:12px; z-index:2;
  font-size:15px; opacity:.85; filter:grayscale(0);
}
.g-card-go--locked{
  color:#ef4444 !important; text-transform:none; letter-spacing:0;
  font-size:11px; font-weight:800;
}
:root[data-theme="light"] .g-card-go--locked{ color:#dc2626 !important; }

.g-card-badge{
  position:absolute; top:12px; right:12px; z-index:2;
  font-size:9.5px; font-weight:800; letter-spacing:1px; text-transform:uppercase;
  padding:3px 8px; border-radius:999px;
  background:linear-gradient(135deg, #f472b6, #a855f7); color:#fff;
  box-shadow:0 6px 16px -6px rgba(168,85,247,.7);
  animation:gBadgePulse 2.4s ease-in-out infinite;
}
@keyframes gBadgePulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.08); } }
.g-card--pink { color:#f472b6; }
.g-card--teal { color:#2dd4bf; }
.g-card--red  { color:#f87171; }
:root[data-theme="light"] .g-card--pink{ color:#db2777; }
:root[data-theme="light"] .g-card--teal{ color:#0d9488; }
:root[data-theme="light"] .g-card--red { color:#dc2626; }
.g-card--pink:hover{ border-color:rgba(236,72,153,.65); box-shadow:0 22px 50px -18px rgba(236,72,153,.42); }
.g-card--teal:hover{ border-color:rgba(20,184,166,.70); box-shadow:0 22px 50px -18px rgba(20,184,166,.42); }
.g-card--red:hover { border-color:rgba(239,68,68,.70);  box-shadow:0 22px 50px -18px rgba(239,68,68,.42); }
.g-head--pink .g-game-title{ color:#ec4899; }
.g-head--teal .g-game-title{ color:#14b8a6; }
.g-head--red  .g-game-title{ color:#ef4444; }

/* ---------- kbd hint caps ---------- */
.g-fc-hint kbd, .g-btn kbd, .g-fc-actions kbd{
  display:inline-block; min-width:15px; padding:1px 5px; margin-left:5px;
  border-radius:5px; border:1px solid var(--card-border); background:var(--chip-bg);
  font-family:'Hanken Grotesk', 'Native Emoji', sans-serif; font-size:10.5px; font-weight:800; line-height:1.5;
  color:var(--muted); vertical-align:middle;
}
.g-btn--known kbd, .g-btn--next kbd{ border-color:rgba(0,0,0,.18); background:rgba(0,0,0,.10); color:inherit; opacity:.8; }

/* ---------- in-context term highlight (flashcards + quiz reveal) ---------- */
.g-mark{
  background:linear-gradient(180deg, transparent 56%, rgba(198,242,78,.5) 56%);
  color:inherit; font-weight:800; border-radius:2px; padding:0 1px;
}
:root[data-theme="light"] .g-mark{ background:linear-gradient(180deg, transparent 56%, rgba(132,204,22,.45) 56%); }

/* ---------- quiz reveal — richer teaching block ---------- */
.g-quiz-reveal-head{ font-weight:800; }
.g-quiz-pts{
  display:inline-block; margin-left:6px; padding:1px 9px; border-radius:999px;
  background:rgba(198,242,78,.22); color:#65a30d; font-size:12.5px; font-weight:800;
}
:root[data-theme="dark"] .g-quiz-pts, :root:not([data-theme]) .g-quiz-pts{ color:#c6f24e; }
.g-quiz-reveal-def{ margin-top:8px; font-size:14px; font-weight:600; color:var(--text); }
.g-quiz-reveal-eg{ margin-top:6px; font-size:13px; color:var(--muted); font-style:italic; line-height:1.55; }

/* ---------- summary hero stat (points) ---------- */
.g-summary-stat--hero{
  background:linear-gradient(135deg, rgba(124,92,255,.18), rgba(78,224,242,.12));
  border-color:rgba(124,92,255,.42);
}
.g-summary-stat--hero .g-summary-num{
  background:linear-gradient(120deg, #a99aff, #4ee0f2);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
}
:root[data-theme="light"] .g-summary-stat--hero .g-summary-num{
  background:linear-gradient(120deg, #6d28d9, #0891b2);
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
}

/* ---------- empty-state suggestions ---------- */
.g-empty-actions{ display:flex; gap:10px; justify-content:center; margin-top:16px; flex-wrap:wrap; }

/* ---------- SENTENCE (cloze) ---------- */
.g-quiz-stage.g-stage--pink{ border-color:rgba(236,72,153,.4); box-shadow:0 18px 40px -22px rgba(236,72,153,.32); }
.g-cloze{
  font-size:clamp(18px, 3vw, 22px); line-height:1.8; color:var(--text);
  text-align:center; max-width:660px; margin:0 auto;
}
.g-cloze-blank{
  display:inline-block; min-width:64px; padding:0 8px; margin:0 3px;
  border-bottom:3px solid #ec4899; color:#ec4899; font-weight:800;
  text-align:center; border-radius:4px; white-space:pre; transition:all .25s;
}
.g-cloze-blank.is-filled{ border-bottom-color:transparent; white-space:normal; padding:1px 8px; }
.g-cloze-blank.is-ok { background:rgba(198,242,78,.20); color:#65a30d; }
.g-cloze-blank.is-bad{ background:rgba(239,68,68,.16); color:#dc2626; }
:root[data-theme="dark"] .g-cloze-blank.is-ok, :root:not([data-theme]) .g-cloze-blank.is-ok{ color:#c6f24e; }
.g-cloze-pos{
  display:block; text-align:center; margin:14px auto 0; width:max-content;
  font-size:11px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  background:rgba(236,72,153,.14); color:#ec4899;
  padding:3px 12px; border-radius:999px; border:1px solid rgba(236,72,153,.35);
}

/* ---------- SCRAMBLE ---------- */
.g-quiz-stage.g-stage--teal{ border-color:rgba(20,184,166,.4); box-shadow:0 18px 40px -22px rgba(20,184,166,.32); }
.g-scr-clue{ text-align:center; margin-bottom:18px; }
.g-scr-def{ font-size:clamp(16px,2.6vw,19px); line-height:1.5; color:var(--text); max-width:560px; margin:6px auto 0; }
.g-scr-answer{
  display:flex; gap:8px; justify-content:center; flex-wrap:wrap;
  margin:8px 0 22px; min-height:56px;
}
.g-scr-answer.is-shake{ animation:gShake .42s ease; }
.g-scr-slot{
  width:46px; height:56px; border-radius:12px;
  border:2px dashed var(--card-border);
  display:inline-flex; align-items:center; justify-content:center;
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:26px; font-weight:700;
  color:var(--text); text-transform:uppercase; cursor:pointer; transition:all .18s;
}
.g-scr-slot.is-filled{ border-style:solid; border-color:#14b8a6; background:rgba(20,184,166,.14); animation:gPillPop .22s cubic-bezier(.34,1.56,.64,1); }
.g-scr-answer.is-solved .g-scr-slot{ border-color:#65a30d; background:rgba(198,242,78,.22); color:#65a30d; animation:gMatchPop .35s ease; }
:root[data-theme="dark"] .g-scr-answer.is-solved .g-scr-slot, :root:not([data-theme]) .g-scr-answer.is-solved .g-scr-slot{ color:#c6f24e; }
.g-scr-tiles{ display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:20px; }
.g-scr-tile{
  width:46px; height:52px; border-radius:12px;
  border:1px solid rgba(20,184,166,.4); background:var(--card-bg); color:var(--text);
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:24px; font-weight:700; text-transform:uppercase;
  cursor:pointer; transition:transform .15s, border-color .15s, opacity .2s;
  box-shadow:0 6px 16px -10px rgba(20,184,166,.5);
}
.g-scr-tile:hover:not(:disabled){ transform:translateY(-3px); border-color:#14b8a6; box-shadow:0 12px 22px -12px rgba(20,184,166,.6); }
.g-scr-tile.is-used{ opacity:0; pointer-events:none; transform:scale(.5); }
.g-scr-actions{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

/* ---------- SPEED ---------- */
.g-quiz-stage.g-stage--red{ border-color:rgba(239,68,68,.4); box-shadow:0 18px 40px -22px rgba(239,68,68,.32); }
.g-speed-timer{ display:flex; align-items:center; gap:14px; margin-bottom:16px; animation:gFadeIn .5s ease both; }
.g-speed-timer-bar{
  flex:1; height:14px; border-radius:999px;
  background:var(--chip-bg); border:1px solid var(--hairline); overflow:hidden;
}
.g-speed-timer-fill{
  height:100%; width:100%; border-radius:999px;
  background:linear-gradient(90deg, #f97316, #ef4444);
  transition:width .12s linear;
}
.g-speed-timer-fill.is-low{ background:linear-gradient(90deg, #ef4444, #b91c1c); animation:gSpeedPulse .6s ease-in-out infinite; }
@keyframes gSpeedPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.5; } }
.g-speed-secs{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-weight:800; font-size:22px;
  color:var(--text); min-width:70px; text-align:right; font-variant-numeric:tabular-nums;
}
.g-speed-secs i{ font-size:12px; font-style:normal; color:var(--muted); margin-left:2px; }

/* ---------- WORD RACE ---------- */
.g-card--gold{ color:#f59e0b; }
:root[data-theme="light"] .g-card--gold{ color:#d97706; }
.g-card--gold:hover{ border-color:rgba(245,158,11,.7); box-shadow:0 22px 50px -18px rgba(245,158,11,.45); }
.g-head--gold .g-game-title{ color:#f59e0b; }
.g-quiz-stage.g-stage--gold{ border-color:rgba(245,158,11,.4); box-shadow:0 18px 40px -22px rgba(245,158,11,.32); }

.g-race-track{
  position:relative; overflow:hidden;
  background:linear-gradient(180deg, rgba(18,20,28,.92), rgba(30,33,45,.92));
  border:1px solid var(--card-border); border-radius:16px;
  padding:12px 14px; margin-bottom:16px;
  box-shadow:inset 0 2px 22px -8px rgba(0,0,0,.65);
  animation:gFadeIn .5s ease both;
}
:root[data-theme="light"] .g-race-track{
  background:linear-gradient(180deg, rgba(236,240,247,.96), rgba(214,222,235,.96));
}
/* scrolling asphalt texture — sells the sense of speed */
.g-race-track::after{
  content:""; position:absolute; inset:0; z-index:0; pointer-events:none;
  background:repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.035) 46px 48px);
  animation:gTrackScroll 1s linear infinite;
}
:root[data-theme="light"] .g-race-track::after{
  background:repeating-linear-gradient(90deg, transparent 0 46px, rgba(0,0,0,.035) 46px 48px);
}
@keyframes gTrackScroll{ from{ transform:translateX(0); } to{ transform:translateX(-48px); } }

.g-race-lane{ position:relative; z-index:1; display:flex; align-items:center; gap:8px; height:44px; }
.g-race-lane + .g-race-lane{ border-top:1px dashed var(--hairline); }
.g-race-pos{
  flex-shrink:0; width:30px; text-align:center;
  font-size:10px; font-weight:800; color:var(--muted);
  font-variant-numeric:tabular-nums; transition:color .2s, transform .2s;
}
.g-race-pos.is-lead{ color:#f59e0b; transform:scale(1.14); }
.g-race-name{
  flex-shrink:0; width:40px; font-size:9.5px; font-weight:800; letter-spacing:.5px;
  text-transform:uppercase; color:var(--muted); text-align:right;
}
.g-race-road{ position:relative; flex:1; height:100%; }
.g-race-road::before{
  content:""; position:absolute; left:0; right:0; top:50%; height:2px; transform:translateY(-50%);
  background:repeating-linear-gradient(90deg, var(--hairline) 0 14px, transparent 14px 26px);
  opacity:.75; animation:gRoadScroll .5s linear infinite;
}
@keyframes gRoadScroll{ from{ background-position-x:0; } to{ background-position-x:-26px; } }

.g-race-car{
  position:absolute; top:50%; left:2%; z-index:1;
  transform:translate(-50%,-50%);
  transition:left .3s cubic-bezier(.22,1,.36,1); will-change:left;
}
.g-race-car.is-player{ z-index:3; }
.g-race-car.is-rival{ z-index:2; }
.g-race-body{ display:block; }
.g-race-svg{
  display:block; width:52px; height:auto;
  transform-origin:center bottom;
  animation:gRaceIdle 1.2s ease-in-out infinite;
}
.g-race-car.is-player .g-race-svg{ width:58px; filter:drop-shadow(0 3px 7px rgba(245,158,11,.55)); }
/* spinning wheel hubs */
.g-race-hub{ transform-box:fill-box; transform-origin:center; animation:gWheelSpin .5s linear infinite; }
@keyframes gWheelSpin{ from{ transform:rotate(0); } to{ transform:rotate(360deg); } }
/* alive idle bob */
@keyframes gRaceIdle{
  0%,100%{ transform:translateY(0) rotate(-.6deg); }
  50%    { transform:translateY(-1.5px) rotate(.6deg); }
}
/* boost — the body pops, wheels blur faster, speed lines whoosh */
.g-race-car.is-boost .g-race-body,
.g-race-car.is-finished .g-race-body{ animation:gRaceBoost .46s cubic-bezier(.34,1.56,.64,1); }
@keyframes gRaceBoost{
  0%  { transform:scale(1) rotate(0); }
  35% { transform:scale(1.22) rotate(-5deg) translateX(3px); }
  100%{ transform:scale(1) rotate(0); }
}
.g-race-car.is-boost .g-race-hub{ animation-duration:.12s; }
.g-race-fx{
  position:absolute; right:100%; top:50%; margin-right:-6px;
  width:26px; height:16px; transform:translateY(-50%);
  opacity:0; pointer-events:none; border-radius:2px;
  color:rgba(148,163,184,.75);
  background:
    linear-gradient(currentColor,currentColor) 0 3px /100% 2px no-repeat,
    linear-gradient(currentColor,currentColor) 0 8px /72%  2px no-repeat,
    linear-gradient(currentColor,currentColor) 0 13px/88%  2px no-repeat;
}
.g-race-car.is-player .g-race-fx{ color:rgba(251,191,36,.9); }
.g-race-car.is-boost .g-race-fx{ animation:gRaceStreak .46s ease-out; }
@keyframes gRaceStreak{
  0%  { opacity:0;   transform:translateY(-50%) translateX(8px) scaleX(.5); }
  35% { opacity:.95; }
  100%{ opacity:0;   transform:translateY(-50%) translateX(-12px) scaleX(1.2); }
}
.g-race-flag{
  flex-shrink:0; font-size:20px; line-height:1;
  transform-origin:left center; animation:gFlagWave 1.6s ease-in-out infinite;
}
@keyframes gFlagWave{ 0%,100%{ transform:rotate(-4deg); } 50%{ transform:rotate(4deg) scale(1.05); } }
.g-race-lap{
  text-align:center; font-size:11.5px; font-weight:800; letter-spacing:1.5px; text-transform:uppercase;
  color:#f59e0b; margin-bottom:6px;
}
.g-race-lap b{ color:var(--text); }
.g-race-actions{ display:flex; justify-content:center; margin-top:12px; }
/* respect reduced-motion — kill the ambient loops, keep position changes */
@media (prefers-reduced-motion: reduce){
  .g-race-track::after, .g-race-road::before, .g-race-hub, .g-race-svg, .g-race-flag{ animation:none !important; }
}

/* ---------- race placement banner (summary) ---------- */
.g-summary-place{
  display:flex; flex-direction:column; align-items:center; gap:4px;
  margin-bottom:18px; padding:16px; border-radius:16px;
  background:linear-gradient(135deg, rgba(245,158,11,.16), rgba(234,179,8,.08));
  border:1px solid rgba(245,158,11,.4);
  animation:gPillPop .4s cubic-bezier(.34,1.56,.64,1);
}
.g-place-medal{ font-size:46px; line-height:1; animation:gFlame 1.4s ease-in-out infinite; }
.g-place-text{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif; font-size:20px; font-weight:800; letter-spacing:-.3px;
  color:var(--text);
}
.g-summary-place.g-place--1{ background:linear-gradient(135deg, rgba(245,158,11,.22), rgba(234,179,8,.12)); border-color:rgba(245,158,11,.55); }
.g-summary-place.g-place--2{ background:linear-gradient(135deg, rgba(148,163,184,.20), rgba(203,213,225,.10)); border-color:rgba(148,163,184,.5); }
.g-summary-place.g-place--3{ background:linear-gradient(135deg, rgba(180,120,70,.20), rgba(217,150,90,.10)); border-color:rgba(180,120,70,.5); }

/* ---------- responsive tightening for the new games ---------- */
@media (max-width:560px){
  .g-scr-slot, .g-scr-tile{ width:40px; }
  .g-scr-slot{ height:50px; font-size:22px; }
  .g-scr-tile{ height:46px; font-size:21px; }
  .g-hud-score b{ font-size:16px; }
  .g-race-name{ width:26px; font-size:8.5px; }
  .g-race-pos{ width:22px; font-size:9px; }
  .g-race-svg{ width:42px; }
  .g-race-car.is-player .g-race-svg{ width:46px; }

  /* Flashcards: the faces are position:absolute for the flip, so they can never
     grow past min-height — a back face carrying definition + example + source
     + the translation strip overflowed by ~53px and spilled over the buttons.
     Taller card on phones, and let the face scroll if content still exceeds. */
  .g-fc-card{ min-height:400px; }
  .g-fc-face{ padding:22px 16px; gap:10px; justify-content:flex-start; overflow-y:auto; overscroll-behavior:contain; }
  .g-fc-src{ margin-top:12px; }

  /* Two 170px buttons + 12px gap = 352px, wider than the 331px available. */
  .g-fc-actions{ flex-wrap:wrap; }
  .g-fc-actions .g-btn{ min-width:0; flex:1 1 140px; }

  /* Matching: two columns gave each definition a 129px content box — a 55-char
     definition became three cramped lines. One column per side is readable. */
  .g-match-grid{ grid-template-columns:1fr; gap:18px; }

  /* Hint tiles for a long word ran ~111px past the screen edge. */
  .g-hint-word.is-on{ flex-wrap:wrap; justify-content:center; row-gap:5px; }
  .g-hint-tile{ min-width:19px; height:27px; font-size:15px; padding:0 4px; }

  /* Same bug, second component: Typing renders ONE .g-typing-letter per
     character into a nowrap flex row. Each tile is ~34px + 6px gap, so a
     12-letter term needed ~480px against the ~298px the stage actually has —
     the mask ran straight off the screen. (.g-hint-word above was fixed; this
     one was missed.) */
  .g-typing-mask{ flex-wrap:wrap; }

  /* A single long headword ("industrialisation") at 38px measures ~360px, and
     nothing can break a lone word without an explicit rule — flex-wrap on the
     row does not help. Scale it down and allow an in-word break as a backstop. */
  .g-quiz-prompt-word{ font-size:30px; overflow-wrap:anywhere; }

  /* Missed-word rows: a 100px min-width term + 10px gap + the 30px speaker left
     the definition a ~96px column inside the summary card. Give the meaning its
     own full-width line under the term. */
  .g-summary-missed-item{ flex-wrap:wrap; }
  .g-summary-missed-term{ min-width:0; }
  .g-summary-missed-def{ flex:1 1 100%; }
}

/* Classic flex trap: an <input> keeps its intrinsic ~20-character width unless
   min-width:0 lets it shrink, so this row ran ~40px past the screen. */
.g-typing-input-row input{ min-width:0; }

/* ==================================================================
   SMART TRANSLATION STRIP — Uzbek / Russian next to the definition
   Violet accent (the app's "language" colour). Lives on the flashcard
   back and the quiz reveal. See _gTransStripHTML / _gTransFill in 15a.
   ================================================================== */
.g-trans{
  align-self:stretch; width:100%;
  margin-top:12px; padding-top:11px;
  border-top:1px dashed var(--card-border);
  display:flex; flex-direction:column; gap:9px;
  animation:gFadeIn .35s ease both;
}
.g-trans-bar{ display:flex; align-items:center; gap:9px; flex-wrap:wrap; }
.g-trans-globe{ font-size:15px; line-height:1; opacity:.85; }
.g-trans-pills{
  display:inline-flex; gap:3px; padding:3px;
  background:var(--chip-bg); border:1px solid var(--card-border); border-radius:999px;
}
.g-trans-pill{
  display:inline-flex; align-items:center; gap:5px; border:0; background:transparent;
  color:var(--muted); font:inherit; font-size:12px; font-weight:700; cursor:pointer;
  padding:4px 10px; border-radius:999px; transition:background .18s, color .18s, box-shadow .18s;
}
.g-trans-pill:hover{ color:var(--text); background:var(--chip-bg-hover); }
.g-trans-pill.is-active{
  color:var(--text);
  background:color-mix(in srgb, var(--violet) 24%, transparent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--violet) 44%, transparent);
}
.g-trans-flag{ font-size:13px; line-height:1; }
.g-trans-code{ white-space:nowrap; }

.g-trans-body{ font-size:14px; line-height:1.5; min-height:20px; }
.g-trans-hint{ color:var(--muted); font-size:12.5px; }
.g-trans-hint b{ color:var(--violet); font-weight:800; }
.g-trans-loading{ color:var(--muted); font-size:13px; display:inline-flex; align-items:center; gap:8px; }
.g-trans-spin{
  flex:none; width:14px; height:14px; border-radius:50%;
  border:2px solid color-mix(in srgb, var(--violet) 28%, transparent);
  border-top-color:var(--violet); animation:gSpin .7s linear infinite;
}
.g-trans-spin.sm{ width:11px; height:11px; }
@keyframes gSpin{ to{ transform:rotate(360deg); } }

.g-trans-word{ display:flex; align-items:center; gap:8px; margin-bottom:4px; flex-wrap:wrap; }
.g-trans-tag{
  flex:none; font-size:9.5px; font-weight:900; letter-spacing:.06em; text-transform:uppercase;
  color:#fff; background:var(--violet); border-radius:6px; padding:3px 7px; line-height:1;
}
.g-trans-word-txt{
  font-family:'Bricolage Grotesque', 'Native Emoji', sans-serif;
  font-size:20px; font-weight:800; letter-spacing:-.01em; color:var(--text);
}
.g-trans-def{ font-size:14px; color:var(--text); line-height:1.55; }
.g-trans-def.is-loading{ color:var(--muted); font-size:13px; display:inline-flex; align-items:center; gap:8px; }
.g-trans-def.is-muted{ color:var(--muted); font-style:italic; font-size:13px; }

/* On the quiz reveal panel the surrounding text is tinted ok/bad; keep the
   strip's own text neutral so the translation stays readable in both. */
.g-quiz-reveal .g-trans{ border-top-color:color-mix(in srgb, currentColor 22%, transparent); }
.g-quiz-reveal .g-trans-word-txt,
.g-quiz-reveal .g-trans-def{ color:var(--text); }

@media (max-width:560px){
  .g-trans-pill{ padding:4px 8px; font-size:11.5px; }
  .g-trans-word-txt{ font-size:18px; }
}
@media (prefers-reduced-motion: reduce){
  .g-trans{ animation:none; }
  .g-trans-spin{ animation:none; }
}
