/* ===== ENABLE ACADEMY — WORD GAMES =====
 * Shared by the games hub (games.html) and every game page (games/*.html,
 * built by scripts/build-game-pages.js). Linked with a ?v= content hash, so
 * re-run scripts/build-game-pages.js and scripts/stamp-asset-versions.js
 * after editing this file. */

/* ── ANIMATIONS ── */
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
@keyframes popIn { 0%{transform:scale(0.5);opacity:0} 70%{transform:scale(1.15)} 100%{transform:scale(1);opacity:1} }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
@keyframes bounce { 0%,100%{transform:translateY(0)} 40%{transform:translateY(-14px)} 70%{transform:translateY(-6px)} }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }
@keyframes scorePop { 0%{transform:scale(1)} 50%{transform:scale(1.4);color:var(--orange-ink)} 100%{transform:scale(1)} }
@keyframes starDrop { 0%{opacity:0;transform:translateY(-30px) scale(0)} 60%{transform:translateY(4px) scale(1.2)} 100%{opacity:1;transform:translateY(0) scale(1)} }
@keyframes drawIn { from{stroke-dashoffset:200} to{stroke-dashoffset:0} }
@keyframes letterPop { 0%{transform:scale(0) rotate(-10deg);opacity:0} 70%{transform:scale(1.2) rotate(3deg)} 100%{transform:scale(1) rotate(0);opacity:1} }
@keyframes confettiFall { 0%{transform:translateY(-10px) rotate(0deg);opacity:1} 100%{transform:translateY(100vh) rotate(720deg);opacity:0} }
@keyframes slideInLeft { from{opacity:0;transform:translateX(-30px)} to{opacity:1;transform:translateX(0)} }
@keyframes slideInRight { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }
@keyframes glow { 0%,100%{box-shadow:0 0 0 0 rgba(46,184,154,0)} 50%{box-shadow:0 0 0 8px rgba(46,184,154,0.25)} }

.anim-fadeup { animation: fadeInUp .4s ease both; }
.anim-pop { animation: popIn .4s cubic-bezier(.4,0,.2,1) both; }
.anim-shake { animation: shake .4s ease both; }
.anim-bounce { animation: bounce .5s ease both; }
.anim-pulse { animation: pulse .3s ease both; }

/* Game cards on the hub fade in one after another */
.game-select-grid .game-select-card { opacity:0; animation: fadeInUp .4s ease both; }
.game-select-grid .game-select-card:nth-child(1){animation-delay:.05s}
.game-select-grid .game-select-card:nth-child(2){animation-delay:.1s}
.game-select-grid .game-select-card:nth-child(3){animation-delay:.15s}
.game-select-grid .game-select-card:nth-child(4){animation-delay:.2s}
.game-select-grid .game-select-card:nth-child(5){animation-delay:.25s}
.game-select-grid .game-select-card:nth-child(6){animation-delay:.3s}
.game-select-grid .game-select-card:nth-child(7){animation-delay:.35s}
.game-select-grid .game-select-card:nth-child(8){animation-delay:.4s}
.game-select-grid .game-select-card:nth-child(9){animation-delay:.45s}
.game-select-grid .game-select-card:nth-child(10){animation-delay:.5s}
.game-select-grid .game-select-card:nth-child(11){animation-delay:.55s}

/* Hangman SVG draw */
.hm-part { stroke-dasharray:200; stroke-dashoffset:0; }
.hm-part.appearing { animation: drawIn .35s ease forwards; }

/* Letter reveal pop */
.hm-letter-box.revealed { animation: letterPop .35s cubic-bezier(.4,0,.2,1) both; }

/* Score display */
.score-display { transition: transform .2s; }
.score-display.bump { animation: scorePop .35s ease; }

/* Level complete stars */
.lc-star { display:inline-block; opacity:0; }
.lc-star.drop { animation: starDrop .4s cubic-bezier(.4,0,.2,1) both; }

/* Match card matched glow */
.match-card.matched { animation: glow .6s ease; }

/* Confetti canvas */
#confettiCanvas { position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:9999; }

/* Fill option correct burst */
.fill-option.correct-ans { animation: popIn .3s ease both; }

/* Scramble word entrance */
.scramble-word { transition: all .3s; }
.scramble-word.new-word { animation: slideInLeft .35s ease both; }

/* Flashcard entrance */
.flashcard-scene { animation: fadeInUp .4s ease both; }

/* Arena entrance */
.game-arena.active > * { animation: fadeInUp .35s ease both; }

/* ── SYNONYM / ANTONYM GAME ── */
.sa-type-badge {
  font-family: var(--font-head); font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; padding: 5px 16px;
  border-radius: 999px; margin: 0 auto 12px; text-align: center;
  display: block; width: fit-content;
}
.sa-type-badge.synonym  { background: var(--teal-pale); color: var(--teal-ink); border: 2px solid var(--teal); }
.sa-type-badge.antonym  { background: var(--orange-pale); color: var(--orange-ink); border: 2px solid var(--orange); }
.sa-prompt {
  text-align: center; font-family: var(--font-body); font-size: 16px; color: var(--text-muted);
  margin-bottom: 20px;
}
.sa-prompt strong { color: var(--navy); font-family: var(--font-head); }
.sa-target-card {
  background: white; border-radius: var(--radius-lg); padding: 32px 36px;
  border: 2px solid var(--border); box-shadow: var(--shadow-lg); text-align: center;
  margin-bottom: 28px;
}
.sa-target-word {
  font-family: var(--font-head); font-size: clamp(30px,5vw,52px); font-weight: 800;
  color: var(--navy); margin-bottom: 12px; letter-spacing: .02em;
}
.sa-target-meaning {
  font-size: 15px; color: var(--text-muted); font-style: italic; line-height: 1.6;
}
.sa-reveal {
  text-align: center; font-family: var(--font-head); font-size: 14px; font-weight: 600;
  color: var(--teal-ink); background: var(--teal-pale); border-radius: var(--radius);
  padding: 12px 20px; margin-top: 12px;
}

/* ── GAMES HUB ── */
.games-hub { display: none; }
.games-hub.active { display: block; }
.game-select-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; margin-bottom: 48px; }
@media(max-width:860px){ .game-select-grid { grid-template-columns: repeat(2,1fr); } }
@media(max-width:500px){ .game-select-grid { grid-template-columns: 1fr; } }
.game-select-card {
  background: white; border-radius: var(--radius-lg); padding: 36px 28px;
  border: 2px solid var(--border); box-shadow: var(--shadow);
  text-align: center; cursor: pointer; transition: all var(--transition);
  font-family: inherit; font-size: inherit; width: 100%;
}
.game-select-card:hover, .game-select-card.selected {
  border-color: var(--orange); box-shadow: 0 8px 32px rgba(245,132,31,.2); transform: translateY(-4px);
}
.game-select-card .game-emoji { display: block; font-size: 52px; line-height: 1.2; margin-bottom: 16px; }
.game-select-card h3 { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.game-select-card p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.diff-select { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 32px; }
.diff-btn {
  font-family: var(--font-head); font-size: 14px; font-weight: 600;
  padding: 12px 28px; border-radius: 999px; border: 2px solid var(--border);
  background: white; cursor: pointer; transition: all var(--transition); color: var(--text);
}
.diff-btn.basic.active, .diff-btn.basic:hover { background: var(--teal); color: var(--navy-dark); border-color: var(--teal); }
.diff-btn.intermediate.active, .diff-btn.intermediate:hover { background: var(--orange); color: var(--navy-dark); border-color: var(--orange); }
.diff-btn.advanced.active, .diff-btn.advanced:hover { background: var(--navy); color: white; border-color: var(--navy); }

.level-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; max-width: 480px; margin: 0 auto 40px; }
@media(max-width:480px){ .level-grid { grid-template-columns: repeat(4,1fr); } }
.level-btn {
  height: 52px; border-radius: var(--radius); border: 2px solid var(--border);
  background: white; font-family: var(--font-head); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 4px; flex-direction: column;
}
.level-btn .lvl-num { font-size: 16px; line-height: 1; }
.level-btn .lvl-stars { font-size: 9px; letter-spacing: 1px; color: var(--orange); }
.level-btn.completed .lvl-stars, .level-btn.active-lvl .lvl-stars { color: var(--navy-dark); }
.level-btn.unlocked { color: var(--navy); border-color: var(--navy); }
.level-btn.completed { background: var(--teal); border-color: var(--teal); color: var(--navy-dark); }
.level-btn.active-lvl { background: var(--orange); border-color: var(--orange); color: var(--navy-dark); transform: scale(1.05); }
.level-btn.locked { opacity: .4; cursor: not-allowed; }

/* ── GAME ARENA ── */
.game-arena { display: none; }
.game-arena.active { display: block; }
.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: white; border-radius: var(--radius-lg); padding: 16px 24px;
  border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 28px;
  flex-wrap: wrap; gap: 12px;
}
.game-info-pill {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-head); font-size: 13px; font-weight: 600;
}
.game-info-pill span { background: var(--bg); padding: 4px 10px; border-radius: 999px; font-size: 13px; }
.game-progress-bar { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; flex: 1; min-width: 100px; max-width: 200px; }
.game-progress-fill { height: 100%; background: var(--orange); border-radius: 3px; transition: width .4s; }
.score-display { font-family: var(--font-head); font-size: 20px; font-weight: 800; color: var(--navy); }

/* ── SCRAMBLE GAME ── */
.scramble-word {
  text-align: center; font-family: var(--font-head); font-size: clamp(32px,6vw,64px);
  font-weight: 800; color: var(--navy); letter-spacing: .15em; margin: 32px 0 12px;
  background: var(--bg); border-radius: var(--radius-lg); padding: 32px;
  border: 2px dashed var(--border);
}
.scramble-hint { text-align: center; font-size: 14px; color: var(--text-muted); margin-bottom: 28px; font-style: italic; }
.scramble-input-row { display: flex; gap: 12px; max-width: 480px; margin: 0 auto 24px; }
.scramble-input-row input {
  flex: 1; padding: 14px 20px; border: 2px solid var(--border); border-radius: 999px;
  font-family: var(--font-head); font-size: 18px; font-weight: 600; text-align: center;
  outline: none; transition: border-color var(--transition); text-transform: lowercase;
}
.scramble-input-row input:focus { border-color: var(--navy); }
.scramble-input-row input.correct { border-color: var(--teal); background: var(--teal-pale); }
.scramble-input-row input.wrong { border-color: var(--rose); background: var(--rose-pale); }
.scramble-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.feedback-msg {
  text-align: center; font-family: var(--font-head); font-size: 16px; font-weight: 700;
  padding: 12px 24px; border-radius: var(--radius); margin: 16px auto; max-width: 400px;
}
.feedback-msg.correct { background: var(--teal-pale); color: var(--teal-ink); }
.feedback-msg.wrong { background: var(--rose-pale); color: var(--rose-ink); }

/* ── MATCH GAME ── */
.match-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; max-width: 720px; margin: 0 auto; }
@media(max-width:600px){ .match-grid { grid-template-columns: repeat(3,1fr); } }
@media(max-width:400px){ .match-grid { grid-template-columns: repeat(2,1fr); } }

/* Perspective wrapper — each cell in the grid */
.match-card-wrap { perspective: 700px; min-height: 86px; cursor: pointer; }
.match-card-wrap.matched-wrap { cursor: default; pointer-events: none; }

/* The flipping card */
.match-card {
  position: relative; width: 100%; min-height: 86px;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(.4,0,.2,1);
  border-radius: var(--radius); user-select: none;
}
.match-card.flipped  { transform: rotateY(180deg); }
.match-card.matched  { transform: rotateY(180deg); }

/* Both faces share these */
.match-card-back,
.match-card-front {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 10px;
}

/* Back face — shown when card is face-down */
.match-card-back {
  background: var(--navy);
  flex-direction: column; gap: 6px;
}
.match-card-back .card-back-icon {
  font-size: 26px; opacity: .55;
}
.match-card-back .card-back-label {
  font-family: var(--font-head); font-size: 10px; font-weight: 700;
  color: var(--on-dark-muted); letter-spacing: .08em; text-transform: uppercase;
}

/* Front face — shown when flipped */
.match-card-front {
  transform: rotateY(180deg);
  border: 2px solid transparent;
}
.match-card-front.word-face {
  background: var(--navy); color: white;
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  border-color: transparent;
}
.match-card-front.meaning-face {
  background: white; color: var(--navy);
  font-family: var(--font-body); font-size: 11.5px; font-weight: 400; font-style: italic;
  border: 2px solid var(--border); line-height: 1.4;
}

/* Selected highlight (first card picked) */
.match-card.selected .match-card-front { border-color: var(--orange) !important; box-shadow: 0 0 0 3px rgba(245,132,31,.25); }
.match-card.selected.flipped { transform: rotateY(180deg) scale(1.04); }

/* Matched — stays face-up, teal glow */
.match-card.matched .match-card-front {
  background: var(--teal) !important; color: var(--navy-dark) !important;
  border-color: var(--teal) !important;
  font-style: normal !important;
}

/* Wrong flash — brief red tint on front face */
.match-card.wrong-flash .match-card-front {
  background: var(--rose) !important; border-color: var(--rose) !important; color: white !important;
}

/* ── FILL GAME ── */
.fill-sentence {
  font-family: var(--font-body); font-size: clamp(17px,2.5vw,22px); line-height: 1.9;
  text-align: center; background: white; border-radius: var(--radius-lg);
  padding: 36px; border: 1px solid var(--border); box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.fill-blank {
  display: inline-block; min-width: 130px; border-bottom: 3px solid var(--orange);
  padding: 2px 8px; font-family: var(--font-head); font-weight: 700; font-size: 20px;
  color: var(--orange-ink); text-align: center; vertical-align: middle;
}
.fill-options { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 24px; }
.fill-option {
  background: white; border: 2px solid var(--border); border-radius: 999px;
  font-family: var(--font-head); font-size: 15px; font-weight: 600;
  padding: 10px 24px; cursor: pointer; transition: all var(--transition); color: var(--text);
}
.fill-option:hover { border-color: var(--orange); color: var(--orange-ink); }
.fill-option.correct-ans { background: var(--teal); color: var(--navy-dark); border-color: var(--teal); }
.fill-option.wrong-ans { background: var(--rose); color: white; border-color: var(--rose); }
.fill-option.reveal { background: var(--teal-pale); border-color: var(--teal); color: var(--teal-ink); }
.fill-option:disabled, .fill-option.disabled { pointer-events: none; }

/* ── HANGMAN GAME ── */
.hangman-drawing {
  text-align: center; margin: 0 auto 20px;
}
.hangman-svg { width: 180px; height: 200px; }
.hm-part { stroke: var(--navy); stroke-width: 4; stroke-linecap: round; fill: none; transition: opacity .2s; }
.hm-part.hidden { opacity: 0; }
.hangman-letters {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 24px;
}
.hm-letter-box {
  width: 40px; height: 48px; border-bottom: 3px solid var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 22px; font-weight: 800;
  color: var(--navy); transition: all .2s;
}
.hm-letter-box.revealed { color: var(--teal-ink); border-color: var(--teal); }
.hangman-hint { text-align: center; font-size: 13px; color: var(--text-muted); font-style: italic; margin-bottom: 24px; }
.hangman-keyboard {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  max-width: 420px; margin: 0 auto;
}
.hm-key {
  width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--border);
  background: white; font-family: var(--font-head); font-size: 13px; font-weight: 700;
  cursor: pointer; transition: all var(--transition); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.hm-key:hover:not(:disabled) { background: var(--navy); color: white; border-color: var(--navy); }
.hm-key.used-correct { background: var(--teal); color: var(--navy-dark); border-color: var(--teal); pointer-events: none; }
.hm-key.used-wrong { background: var(--rose-pale); color: var(--rose-ink); border-color: var(--rose); pointer-events: none; }
.hm-wrong-count { text-align: center; font-family: var(--font-head); font-size: 13px; color: var(--rose-ink); font-weight: 600; margin-bottom: 8px; }

/* ── SPELLING BEE ── */
.spelling-card {
  background: white; border-radius: var(--radius-lg); padding: 36px;
  border: 1px solid var(--border); box-shadow: var(--shadow); text-align: center; margin-bottom: 24px;
}
.spelling-category { font-family: var(--font-head); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 16px; }
.spelling-definition { font-size: 18px; line-height: 1.7; color: var(--text); font-style: italic; margin-bottom: 16px; }
.spelling-example { font-size: 14px; color: var(--text-muted); background: var(--bg); border-radius: 8px; padding: 12px 16px; margin-bottom: 8px; }
.spelling-example em { font-style: normal; background: var(--orange-pale); padding: 1px 4px; border-radius: 4px; color: var(--orange-ink); font-weight: 700; }
.spelling-letters-hint { font-family: var(--font-head); font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.spelling-input-row { display: flex; gap: 12px; max-width: 440px; margin: 0 auto 16px; }
.spelling-input-row input {
  flex: 1; padding: 14px 20px; border: 2px solid var(--border); border-radius: 999px;
  font-family: var(--font-head); font-size: 18px; font-weight: 600; text-align: center;
  outline: none; transition: border-color var(--transition);
}
.spelling-input-row input:focus { border-color: var(--navy); }
.spelling-input-row input.correct { border-color: var(--teal); background: var(--teal-pale); }
.spelling-input-row input.wrong { border-color: var(--rose); background: var(--rose-pale); }
.spelling-actions { display: flex; gap: 10px; justify-content: center; }

/* ── FLASHCARDS ── */
.flashcard-scene {
  perspective: 1000px; width: 100%; max-width: 500px; height: 260px;
  margin: 0 auto 28px; cursor: pointer;
}
.flashcard-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .55s cubic-bezier(.4,0,.2,1);
}
.flashcard-scene.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px; backface-visibility: hidden; box-shadow: var(--shadow-lg);
}
.flashcard-front {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: white;
}
.flashcard-back {
  background: white; border: 2px solid var(--border);
  transform: rotateY(180deg); color: var(--text);
}
.fc-word { font-family: var(--font-head); font-size: clamp(28px,5vw,44px); font-weight: 800; margin-bottom: 10px; letter-spacing: .04em; }
.fc-category { font-size: 12px; opacity: .6; font-family: var(--font-head); text-transform: uppercase; letter-spacing: .1em; }
.fc-flip-hint { font-size: 12px; color: var(--text-muted); margin-top: 16px; font-family: var(--font-head); }
.fc-meaning { font-size: 15px; line-height: 1.6; color: var(--navy); font-weight: 600; margin-bottom: 12px; text-align: center; }
.fc-example { font-size: 13px; color: var(--text-muted); font-style: italic; text-align: center; line-height: 1.6; }
.flashcard-nav { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.fc-rate-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.fc-rate-btn {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  padding: 9px 20px; border-radius: 999px; border: 2px solid; cursor: pointer;
  transition: all var(--transition);
}
.fc-rate-easy { border-color: var(--teal); color: var(--teal-ink); background: var(--teal-pale); }
.fc-rate-easy:hover { background: var(--teal); color: var(--navy-dark); }
.fc-rate-hard { border-color: var(--orange); color: var(--orange-ink); background: var(--orange-pale); }
.fc-rate-hard:hover { background: var(--orange); color: var(--navy-dark); }
.fc-rate-again { border-color: var(--rose); color: var(--rose-ink); background: var(--rose-pale); }
.fc-rate-again:hover { background: var(--rose); color: white; }
.fc-progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.fc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: all .3s; }
.fc-dot.known { background: var(--teal); }
.fc-dot.hard { background: var(--orange); }
.fc-dot.active { background: var(--navy); transform: scale(1.4); }

/* ── CROSSWORD GAME ── */
.cw-container { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.cw-grid-wrap { overflow: auto; }
.cw-table { border-collapse: collapse; }
.cw-cell { width: 34px; height: 34px; padding: 0; position: relative; box-sizing: border-box; }
.cw-cell.black { background: var(--navy); }
.cw-cell.letter { background: white; border: 1.5px solid #9ca3af; }
.cw-cell.letter.active-word { background: var(--sky-pale); }
.cw-cell-num { position: absolute; top: 1px; left: 2px; font-size: 8px; font-weight: 700; color: var(--navy); line-height: 1; pointer-events: none; z-index: 1; }
.cw-input {
  width: 100%; height: 100%; border: none; background: transparent;
  text-align: center; font-family: var(--font-head); font-size: 15px; font-weight: 700;
  color: var(--navy); text-transform: uppercase; outline: none; padding: 0;
  cursor: pointer; caret-color: var(--navy);
}
.cw-input:focus-visible {
  outline: 2.5px solid var(--navy);
  outline-offset: -2px;
  background: var(--navy-pale);
}
.cw-input.correct-letter { color: var(--teal-ink); font-weight: 700; }
.cw-input.wrong-letter { color: var(--rose-ink); background: var(--rose-pale); text-decoration: underline; }
.cw-clues { min-width: 180px; max-width: 260px; max-height: 340px; overflow-y: auto; }
.cw-clues h4 { font-family: var(--font-head); font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.cw-clue-item {
  display: flex; gap: 8px; margin-bottom: 6px; cursor: pointer;
  padding: 5px 8px; border-radius: 6px; transition: background .2s;
  font-size: 12px; color: var(--text); line-height: 1.4; border: 1.5px solid transparent;
}
.cw-clue-item:hover { background: var(--bg); }
.cw-clue-item.active-clue { background: var(--sky-pale); border-color: var(--navy); }
.cw-clue-item strong { color: var(--navy); font-family: var(--font-head); min-width: 18px; }
.cw-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
@media(max-width:600px){ .cw-container { flex-direction: column; align-items: center; } .cw-clues { max-width: 100%; max-height: none; } .cw-cell { width: 28px; height: 28px; } .cw-input { font-size: 12px; } }
/* Touch screens: 16px letters, or iPhones zoom the page in each time a cell is tapped.
   In the 28px phone cells the letter sits 3px lower to clear the clue number; the fixed
   25px height (28px less the borders) stops the cell growing taller. */
@media (pointer: coarse) { .cw-input { font-size: 16px; } }
@media (pointer: coarse) and (max-width: 600px) { .cw-input { display: block; height: 25px; padding-top: 3px; } }

/* ── SENTENCE UNSCRAMBLER ── */
.su-context { text-align: center; background: var(--bg); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; }
.su-context strong { color: var(--navy); font-family: var(--font-head); font-size: 17px; display: block; }
.su-context em { color: var(--text-muted); font-style: italic; font-size: 13px; display: block; margin-top: 4px; }
.su-label { text-align: center; font-family: var(--font-head); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: 8px; }
.su-answer-row {
  min-height: 54px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  align-items: center; background: white; border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 10px 14px; margin-bottom: 8px; transition: border-color .2s;
}
.su-answer-row.has-words { border-style: solid; border-color: var(--navy); }
.su-word-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; min-height: 54px; padding: 8px; }
.su-chip {
  background: var(--navy); color: white; border-radius: 999px;
  padding: 7px 16px; font-family: var(--font-head); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all var(--transition); user-select: none; border: 2px solid var(--navy);
}
.su-chip:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(27,58,107,.3); }
.su-chip.in-answer { background: white; color: var(--navy); }
.su-chip.in-answer:hover { background: var(--rose-pale); border-color: var(--rose); color: var(--rose-ink); }
.su-chip.correct-chip { background: var(--teal) !important; border-color: var(--teal) !important; color: var(--navy-dark) !important; pointer-events: none; }
.su-chip.wrong-chip { background: var(--rose) !important; border-color: var(--rose) !important; color: white !important; }

/* ── GRAMMAR FILL ── */
.gf-topic { text-align: center; font-family: var(--font-head); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 16px; }
.gf-rule { font-size: 13px; color: var(--teal-ink); text-align: center; margin-top: 10px; font-style: italic; padding: 8px 16px; background: var(--teal-pale); border-radius: var(--radius); display: none; }

/* ── HUB STEPS ── */
.step-back-btn { display: flex; align-items: center; gap: 8px; background: none; border: none; font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; margin-bottom: 24px; padding: 0; transition: color var(--transition); }
.step-back-btn:hover { color: var(--navy); }
.game-select-card { position: relative; }
.game-select-card .play-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--orange); color: var(--navy-dark);
  font-family: var(--font-head); font-size: 10px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; opacity: 0;
  transition: opacity var(--transition);
}
.game-select-card:hover .play-badge { opacity: 1; }
.level-complete {
  display: none; text-align: center; background: white; border-radius: var(--radius-lg);
  padding: 56px 40px; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.level-complete.show { display: block; }
.level-complete .big-emoji { font-size: 80px; margin-bottom: 20px; }
.level-complete h2 { font-family: var(--font-head); font-size: 32px; font-weight: 800; color: var(--navy); margin-bottom: 10px; }
.level-complete p { font-size: 16px; color: var(--text-muted); margin-bottom: 32px; }
.stars-row { font-size: 40px; margin-bottom: 28px; letter-spacing: 8px; }
.lc-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 36px; }
.lc-stat-val { font-family: var(--font-head); font-size: 28px; font-weight: 800; color: var(--navy); }
.lc-stat-lbl { font-size: 12px; color: var(--text-muted); }

/* ── GAMES HUB (games.html) ── */
.games-hub-container { max-width: 860px; }
.games-hub-intro { margin-bottom: 32px; }
.games-hub-intro p { font-size: 15px; color: var(--text-muted); max-width: 560px; margin: 0 auto; }
a.game-select-card { display: block; text-decoration: none; color: inherit; line-height: normal; }
.game-select-card .game-card-progress { margin-top: 12px; font-family: var(--font-head); font-size: 12px; font-weight: 600; color: var(--teal-ink); }
.game-new-badge { margin: 0 0 0 4px; vertical-align: middle; }
@media (prefers-reduced-motion: reduce) {
  .game-select-grid .game-select-card { animation: none; opacity: 1; }
}

/* ── GAME PAGE (games/*.html): level picker ── */
.game-page.section { padding-top: 48px; }
.game-container { max-width: 860px; }
.picker-top { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.picker-top .step-back-btn { display: inline-flex; margin: 0; text-decoration: none; }
.picker-progress { margin: 0; font-family: var(--font-head); font-size: 13px; font-weight: 600; color: var(--text-muted); }
.picker-panel {
  background: white; border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 32px 24px;
}
.picker-title { font-family: var(--font-head); font-size: 20px; font-weight: 700; color: var(--navy); text-align: center; margin-bottom: 20px; line-height: 1.3; }
.picker-panel .diff-select { margin-bottom: 20px; }
.picker-hint { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.picker-panel .level-grid { margin-bottom: 28px; }
.picker-start { text-align: center; }
.picker-start .btn:disabled { opacity: .65; cursor: default; transform: none; }
.game-load-status { margin: 14px auto 0; max-width: 460px; font-size: 14px; color: var(--text-muted); text-align: center; }
.arena-counter { text-align: center; font-family: var(--font-head); font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.lc-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-orange { background: var(--orange); color: var(--navy-dark); }
.btn-orange:hover { background: var(--orange-light); transform: translateY(-2px); }
.btn-report { background: var(--navy); color: white; border: 2px solid var(--navy); }
.btn-report:hover { background: var(--navy-light); border-color: var(--navy-light); transform: translateY(-2px); }
@media (max-width: 480px) { .picker-panel { padding: 24px 16px; } }

/* ── GAME PAGE: about the game ── */
.game-about { margin-top: 64px; }
.game-about-block { margin-bottom: 48px; }
.game-about h2 { font-family: var(--font-head); font-size: clamp(22px, 3vw, 28px); font-weight: 700; color: var(--navy); line-height: 1.3; margin-bottom: 14px; }
.game-about-block p { margin-bottom: 14px; }
.game-about-block p a { color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.game-about-block p a:hover { color: var(--orange-ink); }

.game-steps { list-style: none; padding: 0; margin: 18px 0 0; counter-reset: step; }
.game-steps li { counter-increment: step; position: relative; padding-left: 46px; margin-bottom: 14px; min-height: 30px; }
.game-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--orange-pale); color: var(--orange-ink);
  font-family: var(--font-head); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.game-checklist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 28px; }
.game-checklist li { position: relative; padding-left: 28px; }
.game-checklist li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--teal-ink); font-family: var(--font-head); font-weight: 700; }
@media (max-width: 600px) { .game-checklist { grid-template-columns: 1fr; } }

.game-topics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 6px 0 20px; }
.game-topics-col { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.game-topics-col h3 { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.game-topics-col ol { padding-left: 22px; font-size: 14px; line-height: 1.6; }
@media (max-width: 720px) { .game-topics { grid-template-columns: 1fr; } }

.game-ielts {
  background: var(--teal-pale); border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 28px 28px 20px; margin-bottom: 48px;
}
.game-ielts .badge { background: white; margin-bottom: 10px; }
.game-ielts h2 { font-size: clamp(20px, 2.6vw, 24px); }
.game-ielts p { margin-bottom: 14px; }
.game-ielts-links { list-style: none; padding: 0; margin: 0; }
.game-ielts-links li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.game-ielts-links li::before { content: '→'; position: absolute; left: 0; top: 0; color: var(--teal-ink); font-weight: 700; }
.game-ielts-links a { color: var(--teal-ink); font-family: var(--font-head); font-size: 15px; font-weight: 600; text-decoration: none; }
.game-ielts-links a:hover { text-decoration: underline; }

.game-faq-item { background: white; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.game-faq-item summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 16px 52px 16px 20px; border-radius: var(--radius);
  font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--navy); line-height: 1.45;
}
.game-faq-item summary::-webkit-details-marker { display: none; }
.game-faq-item summary::after { content: '+'; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font-size: 22px; line-height: 1; color: var(--orange-ink); }
.game-faq-item[open] summary::after { content: '−'; }
.game-faq-item summary:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.game-faq-item p { padding: 0 20px 16px; margin: 0; font-size: 15px; }

.game-related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.game-related-col { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 22px 8px; }
.game-related-col h3 { font-family: var(--font-head); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 12px; }
.game-related-col ul { list-style: none; padding: 0; margin: 0; }
.game-related-col li { margin-bottom: 14px; line-height: 1.45; }
.game-related-col a { color: var(--navy); font-family: var(--font-head); font-size: 14px; font-weight: 600; text-decoration: none; }
.game-related-col a:hover { color: var(--orange-ink); text-decoration: underline; }
.game-related-meta { display: block; margin-top: 2px; font-family: var(--font-head); font-size: 12px; color: var(--text-muted); }
@media (max-width: 760px) { .game-related { grid-template-columns: 1fr; } }

.game-more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.game-more-card {
  display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; align-items: start;
  background: white; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; text-decoration: none; color: inherit; transition: all var(--transition);
}
.game-more-card:hover { border-color: var(--orange); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(245,132,31,.15); }
.game-more-card-emoji { grid-row: span 2; font-size: 28px; line-height: 1.25; }
.game-more-card-name { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--navy); line-height: 1.35; }
.game-more-card-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; margin-top: 2px; }
.game-more-card .game-new-badge { font-size: 9px; padding: 2px 8px; }
