/* ============================================================
   GAME-SPECIFIC STYLES
   Shell (topbar, sidebar, footer, .page, typography) comes from
   assets/styles.css. This block styles the practice-game
   components, including its own button variants, and the
   view-switching logic.
   ============================================================ */

/* ---- Game colour tokens ---- */
:root {
  --game-correct: #2e7d4f;
  --game-correct-bg: #e3f3e9;
  --game-correct-text: #1f5c3a;
  --game-wrong: #b3403a;
  --game-wrong-bg: #fbe9e7;
  --game-wrong-text: #8a2f2a;
}

/* The shared subtle token is marginal at 12px on this page's surface. */
body[data-page="game"] { --color-text-subtle: #5d6976; }

/* Author rules such as .btn-primary { display:inline-flex } otherwise beat the
   UA [hidden] rule, leaving visually blank buttons in the layout. */
[hidden] { display: none !important; }

/* ---- View switching (intra-page, not SPA routing) ---- */
.view { display: none; }
.view.is-active { display: block; }

/* The shared .kbd-tip rule hides it when data-prev and data-next are empty. */

/* ---- Button reset for game views & modals ---- */
/* :where() zeroes out specificity, so class-based rules (.btn-primary, .opt, .tile) win cleanly. */
:where(.view, .modal) button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Game buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  background: var(--color-teal);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--color-teal-dark); }
.btn-primary:disabled {
  opacity: 1;
  background: var(--color-border-input);
  color: var(--color-text-muted);
  cursor: not-allowed;
}
.btn-primary:disabled:hover { background: var(--color-border-input); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--color-surface-tinted); }

/* ---- Stats bar ---- */
.stats {
  display: flex;
  gap: 22px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: 20px;
}
.stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--color-text-muted);
}
.stat svg { width: 18px; height: 18px; }
.stat__num { font-weight: 700; color: var(--color-navy); font-size: 15px; }
.stat--flame svg { color: var(--color-gold-eyebrow); }
.stat--xp svg { color: var(--color-teal); }
.stat--units svg { color: var(--color-teal); }

/* ---- Path ---- */
.path {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding: 12px 0 8px;
}
/* Path connector line removed — nodes stand on their own for a cleaner look. */
.node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
  cursor: pointer;
}
.node__btn {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--color-teal);
  color: var(--color-text-inverse);
  box-shadow: 0 1px 3px rgba(22, 33, 46, 0.15), 0 2px 8px rgba(22, 33, 46, 0.08);
  transition: transform 0.15s, background 0.15s;
}
.node__btn svg { width: 28px; height: 28px; }
.node__btn:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 3px;
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.opt:focus-visible,
.icon-btn:focus-visible,
.tile:focus-visible,
.speak-big:focus-visible,
.speak-small:focus-visible,
.continue-button:focus-visible,
.review-card__button:focus-visible,
.reset-link:focus-visible,
.build-controls__btn:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}
.node__btn:hover { transform: translateY(-1px); background: var(--color-teal-dark); }
.node__btn:active { transform: translateY(1px); }
.node--done .node__btn { background: var(--color-gold); color: var(--color-navy); }
.node--done .node__btn:hover { background: var(--color-gold-hover); }
.node--current .node__btn::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--color-gold);
  animation: pulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  70% { transform: scale(1.15); opacity: 0; }
  100% { opacity: 0; }
}
.node__label {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-navy);
  text-align: center;
  margin-top: 6px;
  line-height: 1.2;
}
.node__sub {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.4;
}
.continue-row {
  display: flex;
  justify-content: center;
  margin: 0 0 14px;
}
.continue-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: var(--color-teal);
  color: var(--color-text-inverse);
  font-size: 14px;
  font-weight: 600;
}
.continue-button:hover { background: var(--color-teal-dark); }
.review-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 620px;
  margin: 0 auto 28px;
  padding: 16px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-tinted);
}
.review-card__copy { min-width: 0; }
.review-card h3 {
  margin: 0 0 4px;
  color: var(--color-navy);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 400;
}
.review-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.45;
}
.review-card__button {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--color-teal);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-teal);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.review-card__button:hover { background: var(--color-teal-soft); }
@media (max-width: 600px) {
  .review-card { flex-direction: column; align-items: stretch; }
  .review-card__button { width: 100%; }
  #view-home .page { padding-top: 16px; }
  #view-home .subtitle { margin-bottom: 12px; }
  #view-home .stats { padding: 10px 0 12px; margin-bottom: 12px; gap: 14px; }
  #view-home .review-card { padding: 12px 14px; gap: 10px; margin-bottom: 16px; }
  #view-home .path { padding-top: 4px; }
}
@media (max-width: 360px) {
  #view-home .page { padding-top: 8px; }
  #view-home .subtitle {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  #view-home .review-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  #view-home .review-card__copy { min-width: 0; }
  #view-home .review-card__copy p {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  #view-home .review-card__button { width: auto; min-width: 96px; }
  #view-home .path { padding-top: 0; }
}
.tts-note {
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-muted);
  text-align: center;
  max-width: 52ch;
  min-height: 4.7em;
  margin: 0 auto;
}
.tts-note:empty { min-height: 0; }
.storage-note {
  margin: 18px auto 0;
  color: var(--color-text-subtle);
  font-size: 12px;
  text-align: center;
}
.reset-link {
  display: block;
  margin: 24px auto 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.reset-link:hover { color: var(--color-teal); }

/* ---- Lesson view ---- */
.lesson-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(22, 33, 46, 0.05);
  margin-bottom: 24px;
  overflow-wrap: break-word;
}

.lesson-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  border-radius: calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px) 0 0;
  padding: 12px 60px;
}
.lesson-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
@media (max-width: 900px) {
  .lesson-bar {
    top: 46px; /* 44px toggle + 1px sidebar border top/bottom */
    padding: 10px 16px;
  }
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--color-teal-soft); color: var(--color-teal); }
.icon-btn svg { width: 20px; height: 20px; }

.progress {
  flex: 1;
  height: 8px;
  background: var(--color-border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 100%;
  background: var(--color-teal);
  border-radius: var(--radius-sm);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s ease;
}
.lesson-step {
  flex: none;
  min-width: 38px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hearts {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--game-wrong);
  min-width: 60px;
  justify-content: flex-end;
}
.hearts svg { width: 18px; height: 18px; }

/* ---- Exercise content ---- */
.exercise {
  padding: 20px 60px 92px;
}
body.lesson-foot-idle .exercise { padding-bottom: 20px; }
.lesson-count {
  margin: 14px 60px 0;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.exercise__prompt:focus { outline: none; }
@media (max-width: 900px) {
  .exercise { padding: 16px 16px 88px; }
  body.lesson-foot-idle .exercise { padding-bottom: 20px; }
  .lesson-count { margin: 12px 16px 0; }
}
@media (max-width: 480px) {
  .lesson-bar__inner { gap: 8px; }
  .lesson-step { min-width: 30px; font-size: 11px; }
  .hearts svg { width: 16px; height: 16px; }
}
.game-kbd-hint {
  display: none;
  margin: 0 60px 14px;
  color: var(--color-text-subtle);
  font-size: 12px;
  text-align: center;
}
@media (min-width: 768px) {
  .game-kbd-hint:not([hidden]) { display: block; }
}

.exercise__type {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--color-teal);
  font-weight: 700;
  margin: 0 0 8px;
}
.exercise__prompt {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-navy);
  margin: 0 0 8px;
}
.exercise__hint {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0 0 22px;
}

.word-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 0;
}
.word-display .word {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--color-navy);
  line-height: 1.2;
}
.word-display .icon-btn { width: 44px; height: 44px; }
.word-display .icon-btn svg { width: 18px; height: 18px; }

.phonetic {
  font-size: 14.5px;
  font-style: italic;
  color: var(--color-text-subtle);
  margin: 6px 0 20px;
}

/* ---- Option cards ---- */
.options { display: grid; gap: 10px; }
.options--listen { margin-top: 22px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: 56px;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-main);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.opt:hover:not(:disabled):not(.is-correct):not(.is-wrong):not(.is-selected) { border-color: var(--color-teal); background: var(--color-surface-tinted); }
.opt:active:not(:disabled):not(.is-correct):not(.is-wrong) { transform: scale(0.995); }
.opt .key {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-sm);
  display: none;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
}
@media (hover: hover) and (pointer: fine) {
  .opt .key { display: grid; }
}
.opt.is-selected { border-color: var(--color-teal); background: var(--color-teal-soft); }
.opt.is-selected .key { border-color: var(--color-teal); color: var(--color-teal); }
.opt.is-correct { border-color: var(--game-correct); background: var(--game-correct-bg); }
.opt.is-wrong { border-color: var(--game-wrong); background: var(--game-wrong-bg); }
.opt:disabled { cursor: default; }
.opt-phon {
  display: block;
  font-size: 12px;
  font-style: italic;
  color: var(--color-text-subtle);
  font-weight: 400;
  margin-top: 2px;
}

/* ---- Listen ---- */
.speak-big {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  background: var(--color-teal);
  color: var(--color-text-inverse);
  display: grid;
  place-items: center;
  margin: 8px 0 14px;
  transition: background 0.15s;
}
.speak-big:hover { background: var(--color-teal-dark); }
.speak-big svg { width: 44px; height: 44px; }

.speak-small {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  margin-top: 4px;
  border: 1px solid var(--color-teal);
  background: var(--color-surface);
  color: var(--color-teal);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.speak-small:hover { background: var(--color-teal-soft); }
.speak-small svg { width: 14px; height: 14px; }
.listen-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 600;
}

/* ---- Match ---- */
.match__labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 16px 0 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.match__count {
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--color-text-subtle);
}
.match__status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--game-wrong);
  font-size: 14px;
  font-weight: 600;
}
.match { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; row-gap: 18px; align-items: stretch; }
.match .opt { min-height: 60px; height: 100%; font-size: 15px; justify-content: center; text-align: center; }

/* ---- Build ---- */
.build-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}
.build-controls .build-controls__btn {
  min-height: 44px;
  padding: 8px 14px;
  background: var(--color-teal-soft);
  border-color: transparent;
  color: var(--color-teal-dark);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
}
.build-controls .build-controls__btn:hover:not(:disabled) {
  background: var(--color-teal-soft);
  border-color: transparent;
}
.build-controls__btn:disabled { opacity: 0.55; cursor: default; }
.answer-row {
  min-height: 56px;
  border-bottom: 2px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 4px;
  margin-bottom: 24px;
}
.answer-row.is-empty { border-bottom-style: dashed; }
.answer-row.is-correct { border-bottom-color: var(--game-correct); }
.answer-row.is-wrong { border-bottom-color: var(--game-wrong); }
.answer-row__hint {
  color: var(--color-text-subtle);
  font-size: 14px;
  padding-left: 4px;
}
.tile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--color-navy);
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, transform 0.1s;
}
.tile:hover:not(:disabled) { border-color: var(--color-teal); background: var(--color-teal-soft); }
.tile:active:not(:disabled) { transform: translateY(1px); }
.tile.is-used { display: none; }
.tiles .tile:disabled { cursor: default; }
.tiles .tile:disabled:not(.is-used) { opacity: 0.55; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- Lesson footer (Check bar inside the lesson card) ---- */
.lesson-foot {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 calc(var(--radius-md) - 1px) calc(var(--radius-md) - 1px);
  box-shadow: 0 -4px 12px rgba(22, 33, 46, 0.06);
  transition: background 0.2s;
}
.lesson-foot.is-right { background: var(--game-correct-bg); }
.lesson-foot.is-wrong { background: var(--game-wrong-bg); }
.lesson-foot__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 60px;
}
.lesson-foot__hint {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}
.lesson-foot__inner .btn-primary { 
  flex: none; 
  min-width: 140px; 
  margin-left: auto; /* Pins the button to the right */
}
@media (max-width: 900px) {
  .lesson-foot__inner { padding: 16px; }
  .game-kbd-hint { margin: 0 16px 14px; }
}
@media (max-width: 480px) {
  .lesson-foot.is-right .lesson-foot__inner,
  .lesson-foot.is-wrong .lesson-foot__inner {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .lesson-foot.is-right .feedback,
  .lesson-foot.is-wrong .feedback { width: 100%; align-items: flex-start; }
  .lesson-foot.is-right .lesson-foot__inner .btn-primary,
  .lesson-foot.is-wrong .lesson-foot__inner .btn-primary {
    width: 100%;
    margin-left: 0;
  }
}

.feedback { display: none; align-items: center; gap: 12px; min-width: 0; }
.lesson-foot.is-right .feedback,
.lesson-foot.is-wrong .feedback { display: flex; }
.feedback__icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--color-text-inverse);
}
.feedback__icon svg { width: 20px; height: 20px; }
.lesson-foot.is-right .feedback__icon { background: var(--game-correct); }
.lesson-foot.is-wrong .feedback__icon { background: var(--game-wrong); }
.feedback__text { min-width: 0; overflow-wrap: anywhere; }
.feedback__title { font-size: 16px; font-weight: 700; }
.lesson-foot.is-right .feedback__title { color: var(--game-correct-text); }
.lesson-foot.is-wrong .feedback__title { color: var(--game-wrong-text); }
.feedback__sub {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.shake { animation: shake 0.4s ease; }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* ---- Done view ---- */
.done { text-align: center; padding: 16px 0 8px; }
.done__badge {
  width: 96px;
  height: 96px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--color-gold);
  color: var(--color-navy);
  display: grid;
  place-items: center;
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.done__badge svg { width: 46px; height: 46px; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.done h2 {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  color: var(--color-navy);
  margin: 0 0 8px;
  line-height: 1.2;
}
.done h2:focus { outline: none; }
.done__sub {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0 0 26px;
}
.done__note {
  margin: -10px 0 24px;
  font-size: 14px;
  color: var(--color-text-muted);
}
.done__chips {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-tinted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-navy);
}
.chip svg { width: 18px; height: 18px; }
.chip--xp svg { color: var(--color-gold-eyebrow); }
.done__actions { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.chip--acc svg { color: var(--color-teal); }
.chip--strk svg { color: var(--color-gold-eyebrow); }

.done-mistakes {
  max-width: 540px;
  margin: 0 auto 26px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border-subtle);
  text-align: left;
}
.done-mistakes h3 {
  margin: 0 0 10px;
  color: var(--color-navy);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
}
.done-mistakes__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mistake {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
.mistake__text { display: flex; flex-direction: column; min-width: 0; }
.mistake__word {
  color: var(--color-navy);
  font-family: var(--font-serif);
  font-size: 17px;
}
.mistake__meaning { color: var(--color-text-main); font-size: 13px; line-height: 1.4; }
.mistake__phon { color: var(--color-text-subtle); font-size: 12px; font-style: italic; }
.mistake .speak-small { flex: none; margin-top: 0; }
@media (max-width: 480px) {
  .mistake { align-items: flex-start; flex-direction: column; }
  .mistake .speak-small { width: 100%; justify-content: center; }
}

/* ---- Modals ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
body.modal-open { overflow: hidden; }
.modal.is-open { display: flex; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 33, 46, 0.55);
}
.modal__card {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  max-width: 400px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(22, 33, 46, 0.3);
  animation: pop 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.modal__card h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--color-navy);
  margin: 0 0 8px;
  line-height: 1.25;
}
.modal__card p {
  font-size: 15px;
  color: var(--color-text-muted);
  margin: 0 0 22px;
  line-height: 1.55;
}
.modal__actions { display: flex; flex-direction: column; gap: 10px; }

/* ---- Confetti ---- */
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -14px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.95;
  animation: fall var(--d, 2.6s) linear var(--delay, 0s) forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0.8; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .node--current .node__btn::after,
  .shake,
  .done__badge,
  .modal__card,
  .confetti i {
    animation: none;
  }
  .node__btn,
  .icon-btn,
  .opt,
  .tile,
  .speak-big,
  .btn-primary,
  .btn-secondary,
  .progress__fill {
    transition: none;
  }
}

/* Noscript fallback for the game page. */
.practice-noscript {
  max-width: 640px;
  margin: 24px auto;
  padding: 0 20px;
}

