/* ---------- Andika font (designed for beginning readers), hosted locally ---------- */
@font-face {
  font-family: 'Andika';
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/andika-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Andika';
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/andika-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Andika';
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/andika-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Andika';
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/andika-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Colors and sizes ---------- */
:root {
  --bg: #FFF8EE;
  --card: #FFFFFF;
  --ink: #2A2D3E;
  --muted: #6A6F82;
  --line: #EADFCF;
  --shadow: 0 2px 0 rgba(120, 90, 50, .08), 0 8px 24px rgba(120, 90, 50, .08);
  --right: #2E9E57;
  --right-light: #DDF4E4;
  --wrong: #D9503B;
  --wrong-light: #FCE3DE;
  --star: #F5B400;
  --radius: 22px;

  /* color of the current subject (overridden by the .color-* classes) */
  --c: #F08A3C;
  --c-light: #FFEBD9;
  --c-dark: #B35A17;
}

.color-red { --c: #E8615A; --c-light: #FDE5E2; --c-dark: #B23A33; }
.color-blue   { --c: #3D7DD8; --c-light: #E2EDFC; --c-dark: #2257A3; }
.color-green  { --c: #3A9E56; --c-light: #E0F3E5; --c-dark: #22733A; }
.color-purple { --c: #8B5CC9; --c-light: #EFE6FA; --c-dark: #6339A0; }
.color-orange { --c: #EC8A2F; --c-light: #FFEBD6; --c-dark: #A9560E; }
.color-teal   { --c: #1E9AA0; --c-light: #DDF3F3; --c-dark: #11686C; }
.color-amber  { --c: #C9861A; --c-light: #FBEFD5; --c-dark: #855508; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Andika', 'Trebuchet MS', system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

button, a { touch-action: manipulation; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

button, .button, .tile, .option, .bin, a {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

:focus-visible {
  outline: 4px solid var(--c);
  outline-offset: 3px;
}

h1, h2 { line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); }
h2 { font-size: clamp(1.3rem, 3.2vw, 1.8rem); }

.main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) 48px max(16px, env(safe-area-inset-left));
  outline: none;
}

/* ---------- Top bar ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(255, 248, 238, .92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}

.header__home {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.3rem;
  min-height: 48px;
}

.header__logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--c-light);
  font-size: 1.6rem;
}

.header__read-aloud {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 1rem;
  cursor: pointer;
}

.header__read-aloud[aria-pressed="false"] { color: var(--muted); }

.header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header__grade {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--c-light);
  color: var(--c-dark);
  font-size: 1rem;
  font-weight: 700;
}
.header__grade[hidden] { display: none; }

@media (max-width: 480px) {
  .header__label { display: none; }
  .header__home .header__title { display: none; }
}

/* ---------- Shared elements ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 0 4px;
  color: var(--c-dark);
  font-weight: 700;
}

.speak {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--c-light);
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform .15s;
}
.speak:active { transform: scale(.92); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
  padding: 0 28px;
  border: none;
  border-radius: 999px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.button:active { transform: scale(.96); }
.button:disabled { opacity: .35; cursor: default; }
.button--primary { background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--c-dark); }
.button--secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--c-light);
  color: var(--c-dark);
  font-size: .8rem;
  font-weight: 700;
}

.stars { display: inline-flex; gap: 2px; font-size: 1.4rem; line-height: 1; }
.star { color: #E3DBCD; }
.star--full { color: var(--star); }

.picture, .picture-icon { display: inline-flex; align-items: center; justify-content: center; gap: .1em; }
.shape { width: 1em; height: 1em; flex: none; }

/* ---------- Home and grade pages ---------- */
.intro {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0 24px;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (min-width: 760px) {
  .subject-grid--wide { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 520px) {
  .subject-grid { grid-template-columns: 1fr; }
}

.subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  padding: 24px 16px;
  border-radius: 28px;
  background: var(--c-light);
  box-shadow: inset 0 0 0 3px transparent, var(--shadow);
  text-align: center;
  transition: transform .15s;
}
.subject-card:active { transform: scale(.97); }

.subject-card__icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: var(--c);
  font-size: 3.2rem;
  box-shadow: 0 5px 0 var(--c-dark);
}

.subject-card__title { font-size: 1.6rem; font-weight: 700; color: var(--c-dark); }
.subject-card__progress { font-size: 1rem; color: var(--muted); }

.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
}

@media (max-width: 400px) {
  .grade-grid { grid-template-columns: repeat(2, 1fr); }
}

.grade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 200px;
  padding: 20px 12px;
  border-radius: 28px;
  background: var(--c-light);
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform .15s;
}
.grade-card:active { transform: scale(.97); }

.grade-card__number {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-size: 3.4rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 0 var(--c-dark);
}

.grade-card__title { margin-top: 10px; font-size: 1.5rem; font-weight: 700; color: var(--c-dark); }
.grade-card__info { font-size: .95rem; color: var(--muted); }

.grade-card__mine {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}

/* ---------- Subject page ---------- */
.subject-heading {
  margin-bottom: 20px;
  color: var(--c-dark);
}

.month + .month { margin-top: 28px; }

.month__title {
  margin: 0 0 12px;
  color: var(--c-dark);
  font-size: 1.25rem;
  text-transform: capitalize;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.lesson-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 100px;
  padding: 14px 18px 14px 14px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.lesson-card:active { transform: scale(.98); }

.lesson-card__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--c-light);
  color: var(--c-dark);
  font-size: 2.3rem;
  font-weight: 700;
}

.lesson-card__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.lesson-card__title { font-size: 1.2rem; font-weight: 700; }

/* ---------- Lesson page ---------- */
.lesson__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 8px 0 28px;
  text-align: center;
}

.lesson__icon {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 34px;
  background: var(--c-light);
  color: var(--c-dark);
  font-size: 4rem;
  font-weight: 700;
}

.lesson__description { margin: 0; color: var(--muted); max-width: 34em; }

.lesson__choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}

@media (max-width: 520px) {
  .lesson__choices { grid-template-columns: 1fr; }
}

.big-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 190px;
  border-radius: 28px;
  font-size: 1.6rem;
  font-weight: 700;
  transition: transform .15s;
}
.big-button:active { transform: scale(.97); }
.big-button small { font-size: 1rem; font-weight: 400; opacity: .85; }
.big-button__icon { font-size: 3.4rem; line-height: 1.1; }
.big-button--learn { background: var(--card); color: var(--c-dark); box-shadow: inset 0 0 0 3px var(--c-light), var(--shadow); }
.big-button--test { background: var(--c); color: #fff; box-shadow: 0 6px 0 var(--c-dark); }
.big-button--practice { background: var(--c-light); color: var(--c-dark); box-shadow: 0 6px 0 var(--c); }

.lesson__choices--three { grid-template-columns: repeat(3, 1fr); max-width: 980px; }
@media (max-width: 700px) {
  .lesson__choices--three { grid-template-columns: 1fr; }
  .lesson__choices--three .big-button { min-height: 120px; }
}

.lesson__best {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  color: var(--muted);
}

/* ---------- Learning slides ---------- */
.slides {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.slide {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  min-height: 52vh;
  padding: 32px 24px 88px;
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  animation: arrive .3s ease-out;
}

.slide .speak { position: absolute; right: 16px; bottom: 16px; }

.slide__image {
  font-size: clamp(3.5rem, 11vw, 6rem);
  line-height: 1.15;
  white-space: pre-line;
  flex-wrap: wrap;
}

.slide__heading {
  font-size: clamp(2.6rem, 9vw, 4.4rem);
  font-weight: 700;
  color: var(--c-dark);
  line-height: 1.1;
}

.slide__heading { white-space: pre-line; }
.slide__heading--long { font-size: clamp(1.6rem, 4.6vw, 2.4rem); }

.slide__word {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 700;
  color: var(--c);
}

.slide__text {
  margin: 0;
  max-width: 26em;
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
}

.dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dot--done { background: var(--c-light); box-shadow: inset 0 0 0 2px var(--c); }
.dot--active { background: var(--c); transform: scale(1.25); }

.slides__nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 720px;
}

/* ---------- Test ---------- */
.progress {
  height: 14px;
  margin: 4px 0 20px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress__fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--c);
  transition: width .4s ease;
}

.test {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: arrive .3s ease-out;
}

.prompt__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.prompt__image {
  min-height: 1.3em;
  padding: 12px 28px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 700;
  line-height: 1.2;
  white-space: pre-line;
  flex-wrap: wrap;
  text-align: center;
}

.prompt__image--word {
  font-size: clamp(2.6rem, 9vw, 4.2rem);
  letter-spacing: .06em;
}

.prompt__image--text {
  max-width: 100%;
  font-size: clamp(1.5rem, 4.4vw, 2.2rem);
}

.listen {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 0 32px;
  border: none;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: 0 5px 0 var(--c-dark);
  cursor: pointer;
}
.listen:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--c-dark); }

/* choice options */
.options {
  display: grid;
  grid-template-columns: repeat(var(--columns, 3), 1fr);
  gap: 16px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.options--stacked { grid-template-columns: 1fr; max-width: 640px; }

@media (max-width: 520px) {
  .options:not(.options--stacked) { grid-template-columns: repeat(2, 1fr); }
  .bin { min-height: 104px; }
}

.option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: inset 0 0 0 3px var(--line), 0 5px 0 var(--line);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
  cursor: pointer;
  transition: transform .12s, background .2s;
}
.option:active { transform: translateY(3px); }
.option--big { min-height: 150px; font-size: clamp(2.8rem, 8vw, 4.6rem); }
.options--stacked .option--big { min-height: 96px; font-size: clamp(1.8rem, 5vw, 2.6rem); }
.option__content { flex-wrap: wrap; white-space: pre-line; }
.option--right { background: var(--right-light); box-shadow: inset 0 0 0 4px var(--right), 0 5px 0 var(--right); }
.option--wrong { background: var(--wrong-light); box-shadow: inset 0 0 0 3px var(--wrong); opacity: .6; }

/* tiles for ordering and matching */
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: 88px;
  padding: 10px 18px;
  border: none;
  border-radius: 20px;
  background: var(--card);
  box-shadow: inset 0 0 0 3px var(--line), 0 5px 0 var(--line);
  font-size: clamp(1.6rem, 4.6vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  transition: transform .12s, background .2s, opacity .2s;
}
.tile:active { transform: translateY(3px); }
.tile--long { font-size: clamp(1.05rem, 2.6vw, 1.35rem); }
.tile--selected { background: var(--c-light); box-shadow: inset 0 0 0 4px var(--c), 0 5px 0 var(--c-dark); transform: translateY(-2px); }
.tile--used { opacity: .2; }
.tile--matched { cursor: default; }
.tile--pair0 { background: #DDF4E4; box-shadow: inset 0 0 0 3px #2E9E57; }
.tile--pair1 { background: #E2EDFC; box-shadow: inset 0 0 0 3px #3D7DD8; }
.tile--pair2 { background: #FFF1CC; box-shadow: inset 0 0 0 3px #E0A100; }
.tile--pair3 { background: #EFE6FA; box-shadow: inset 0 0 0 3px #8B5CC9; }

.order { display: flex; flex-direction: column; align-items: center; gap: 28px; }

.order__slots, .order__pool {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.order__slot {
  display: grid;
  place-items: center;
  min-width: 96px;
  min-height: 88px;
  padding: 10px 14px;
  border-radius: 20px;
  border: 3px dashed var(--line);
  font-size: clamp(1.6rem, 4.6vw, 2.4rem);
  font-weight: 700;
}
.order__slot--filled { border: 3px solid var(--right); background: var(--right-light); animation: arrive .25s ease-out; }

.match {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 8vw, 80px);
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.match__column { display: flex; flex-direction: column; gap: 14px; }

/* sorting */
.sort { display: flex; flex-direction: column; align-items: center; gap: 24px; }

.sort__item {
  display: grid;
  place-items: center;
  min-width: 150px;
  min-height: 150px;
  padding: 16px;
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: clamp(3.5rem, 11vw, 5rem);
}
.sort__item:empty { visibility: hidden; }
.sort__item--new { animation: arrive .3s ease-out; }
.sort__item--text { min-height: 110px; padding: 16px 28px; font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 700; text-align: center; }

.sort__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
}

.bin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-height: 150px;
  padding: 16px;
  border: 3px dashed var(--c);
  border-radius: 28px;
  background: var(--c-light);
  cursor: pointer;
}
.bin:active { transform: scale(.98); }
.bin__name { font-size: 1.35rem; font-weight: 700; color: var(--c-dark); }

.sort__content {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  font-size: 1.6rem;
}
.bin__thing { animation: arrive .25s ease-out; }
.bin__thing { padding: 2px 6px; font-weight: 700; }

/* message after an answer */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 20;
  padding: 14px 28px;
  border-radius: 999px;
  font-size: 1.4rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 20px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast--visible { opacity: 1; transform: translate(-50%, 0); }
.toast--right { background: var(--right); color: #fff; }
.toast--wrong { background: #fff; color: var(--wrong); box-shadow: inset 0 0 0 3px var(--wrong), var(--shadow); }

/* result */
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 24px;
  border-radius: 32px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  animation: arrive .4s ease-out;
}
.result p { margin: 0; color: var(--muted); }
.stars--big { font-size: clamp(4rem, 14vw, 6rem); gap: 8px; }
.stars--big .star--full { animation: star-pop .5s ease-out backwards; }
.stars--big .star:nth-child(2) { animation-delay: .2s; }
.stars--big .star:nth-child(3) { animation-delay: .4s; }

.result__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
}

.not-found { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 60px 0; text-align: center; }

.noscript { max-width: 640px; margin: 40px auto; padding: 0 16px; text-align: center; }

/* ---------- Animations ---------- */
@keyframes arrive {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes star-pop {
  0% { transform: scale(0) rotate(-40deg); }
  70% { transform: scale(1.25) rotate(8deg); }
  100% { transform: none; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.shake { animation: shake .4s ease; }

.confetti { position: fixed; inset: 0; z-index: 30; overflow: hidden; pointer-events: none; }
.confetti__piece {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 18px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

/* hint under a task (generated practice) */
.hint-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.hint-button {
  min-height: 56px;
  padding: 0 26px;
  border: none;
  border-radius: 999px;
  background: var(--card);
  color: var(--c-dark);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 3px var(--c-light);
  cursor: pointer;
}
.hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 820px;
  padding: 18px;
  border-radius: 24px;
  background: var(--c-light);
  animation: arrive .3s ease-out;
}
.hint[hidden] { display: none; }
.hint__groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.hint__group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 330px;
  padding: 10px;
  border-radius: 18px;
  background: var(--card);
}
.hint__plus { font-size: 2.4rem; font-weight: 700; color: var(--c-dark); }
.hint__zero { padding: 0 12px; font-size: 2.2rem; font-weight: 700; }
.hint__item {
  position: relative;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 14px;
  background: transparent;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
}
.hint__item--counted { background: var(--right-light); box-shadow: inset 0 0 0 3px var(--right); }
.hint__item--crossed { opacity: .45; }
.hint__item--crossed::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 5px;
  border-radius: 3px;
  background: var(--wrong);
  transform: rotate(-35deg);
}
.hint__text { margin: 0; text-align: center; font-size: 1.15rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
