/* alessIA-2026 — components: header, cards, screen chrome */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 4px 14px;
}

.title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--accent);
  text-shadow: 2px 2px 0 #fff, 3px 3px 0 rgba(0,0,0,0.1);
  letter-spacing: 0.5px;
}

.stars-counter {
  background: linear-gradient(135deg, var(--star-a), var(--star-b));
  color: white;
  padding: 8px 16px;
  border-radius: var(--r-chip);
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 4px 0 var(--star-shadow), 0 6px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
}

.menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 4px;
}

.card {
  background: white;
  border-radius: var(--r-card);
  padding: 18px 10px 16px;
  min-height: 132px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, filter 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
  border: 3px solid transparent;
  font-family: inherit;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0.15;
  z-index: 0;
}

.card:active { transform: scale(0.96); }
.card:focus-visible,
.btn-back:focus-visible,
.btn-skip:focus-visible,
.btn-nav:focus-visible,
.option:focus-visible,
.num-chip:focus-visible,
.match-cell:focus-visible,
.phonics-word:focus-visible,
.body-primary:focus-visible,
.body-chip:focus-visible,
.body-answer:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 3px;
  filter: drop-shadow(0 0 0.65rem rgba(233,30,99,0.45));
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
  position: relative; z-index: 1;
  display: block;
}
.card-image {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
  display: block;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.10));
}

.menu.home .card {
  min-height: 250px;
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
}

.menu.home .card-image {
  width: 100%;
  height: auto;
  min-height: 0;
  flex: 1 1 auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  margin: 0 0 10px;
}

.menu.home .card-title {
  font-size: 1.05rem;
  flex: 0 0 auto;
}

.screen-title .card-image {
  width: 30px;
  height: 30px;
  margin: 0;
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  position: relative; z-index: 1;
  line-height: 1.2;
}

.card-sub {
  font-size: 0.7rem;
  color: var(--ink-mute);
  margin-top: 2px;
  position: relative; z-index: 1;
}

.card.c1 { --grad: var(--grad-c1); box-shadow: var(--depth-c1); }
.card.c2 { --grad: var(--grad-c2); box-shadow: var(--depth-c2); }
.card.c3 { --grad: var(--grad-c3); box-shadow: var(--depth-c3); }
.card.c4 { --grad: var(--grad-c4); box-shadow: var(--depth-c4); }
.card.c5 { --grad: var(--grad-c5); box-shadow: var(--depth-c5); }
.card.c6 { --grad: var(--grad-c6); box-shadow: var(--depth-c6); }

.best-badge {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 34px;
  background: rgba(255,255,255,0.9);
  padding: 2px 5px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  z-index: 2;
}

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  border-radius: var(--r-panel);
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.08);
  gap: 8px;
}

.screen-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  flex: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  line-height: 1.15;
}

.btn-back {
  background: #ff6b9d; color: white; border: none;
  min-height: 44px; min-width: 88px;
  padding: 9px 13px; border-radius: 14px;
  font-weight: 700; font-size: 0.85rem;
  cursor: pointer; box-shadow: 0 3px 0 #c84b7a;
  font-family: inherit;
}
.btn-back:active { transform: translateY(2px); box-shadow: 0 1px 0 #c84b7a; }

.btn-skip {
  background: #e8e8f0; color: var(--ink-mute); border: none;
  min-height: 44px; min-width: 64px;
  padding: 8px 12px; border-radius: 12px; font-size: 0.78rem;
  cursor: pointer; font-family: inherit; box-shadow: 0 2px 0 #c0c0d0;
}
.btn-skip:active { transform: translateY(1px); box-shadow: 0 1px 0 #c0c0d0; }

.btn-nav {
  background: white; border: 3px solid #e0e0e0;
  min-height: 58px;
  padding: 13px 18px; border-radius: var(--r-button);
  font-family: var(--font-display); font-size: 1.1rem;
  color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 #c0c0c0;
  flex: 1; transition: all 0.15s;
}
.btn-nav:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #c0c0c0; }
.btn-nav:disabled {
  opacity: 0.55;
  cursor: default;
  filter: grayscale(0.2);
}

.btn-nav.primary {
  background: linear-gradient(135deg, #1dd1a1, #10ac84); color: white;
  border-color: #10ac84; box-shadow: 0 4px 0 #0a7a5c;
}
.btn-nav.primary:active { box-shadow: 0 2px 0 #0a7a5c; }

.btn-nav.play {
  background: linear-gradient(135deg, #feca57, #ff9f43); color: white;
  border-color: #ff9f43; box-shadow: 0 4px 0 #c96f1c; font-size: 1.2rem;
}
.btn-nav.play:active { box-shadow: 0 2px 0 #c96f1c; }

.header-spacer {
  flex: 0 0 64px;
}

.nav-row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

.progress-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: rgba(255,255,255,0.6); border: 2px solid white;
  transition: all 0.2s;
}
.dot.done    { background: #1dd1a1; border-color: #10ac84; }
.dot.current { background: #feca57; border-color: #ff9f43; transform: scale(1.2); }

.error {
  background: white; border-radius: var(--r-card);
  padding: 20px; text-align: center; color: var(--accent);
  box-shadow: 0 3px 0 rgba(0,0,0,0.08);
}

/* --- Tutorial content box --- */
.tut-content {
  background: white;
  border-radius: var(--r-card);
  padding: 22px 18px 24px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.05);
  margin-bottom: 14px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* --- Summary screen --- */
.summary {
  background:
    radial-gradient(circle at 18% 12%, rgba(254,202,87,0.28), transparent 30%),
    radial-gradient(circle at 86% 20%, rgba(72,219,251,0.22), transparent 26%),
    white;
  border-radius: var(--r-card);
  padding: 28px 18px 20px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.05);
  text-align: center;
}
.summary-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 12px;
  border: 2px solid rgba(45,45,95,0.18);
  border-radius: 999px;
  background: rgba(255,255,255,0.82);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}
.summary-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1.05;
  margin: 8px 0 6px;
}
.summary-emoji {
  font-size: 4rem;
  animation: pop 0.5s cubic-bezier(0.17, 0.89, 0.32, 1.49) backwards;
}
.summary-badge {
  display: flex;
  justify-content: center;
  animation: pop 0.5s cubic-bezier(0.17, 0.89, 0.32, 1.49) backwards;
}
.summary-image {
  width: 112px;
  height: 112px;
  object-fit: contain;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.12));
}
@keyframes pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.summary-score {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--ink);
  margin: 8px 0 4px;
}
.summary-stars {
  color: var(--star-b);
  margin-bottom: 20px;
}

.asset-icon,
.mini-icon,
.button-icon,
.inline-asset,
.prompt-image,
.pair-asset,
.tiny-star {
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
}
.mini-icon {
  width: 24px;
  height: 24px;
}
.button-icon {
  width: 24px;
  height: 24px;
  margin-right: 4px;
}
.inline-asset {
  width: 1.35em;
  height: 1.35em;
  margin: 0 0.08em;
}
.prompt-image {
  width: min(150px, 55vw);
  height: 120px;
  margin: 6px auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 0 rgba(0,0,0,0.10));
}
.prompt-image.small {
  width: 96px;
  height: 72px;
}
.stars-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 24px;
}
.tiny-star {
  width: 22px;
  height: 22px;
}
.empty-star {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,149,0,0.45);
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
}
.text-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef7ff;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.85em;
  border: 2px solid rgba(72,219,251,0.45);
}
.text-badge.good {
  background: #e8faf5;
  border-color: #1dd1a1;
}
.text-badge.try {
  background: #ffe8e8;
  border-color: #ff7675;
}
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* --- Mission Mode shared practice shell --- */
.mission-shell {
  display: grid;
  gap: 12px;
}

.mission-hud {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,248,225,0.96)),
    white;
  border: 3px solid rgba(45,45,95,0.18);
  border-radius: var(--r-panel);
  padding: 13px 14px 12px;
  box-shadow: 0 5px 0 rgba(45,45,95,0.14), 0 9px 18px rgba(45,45,95,0.08);
}

.mission-hud::after {
  content: '';
  position: absolute;
  width: 72px;
  height: 72px;
  right: -22px;
  top: -28px;
  border: 3px dashed rgba(233,30,99,0.18);
  border-radius: 50%;
  transform: rotate(12deg);
}

.mission-title-group {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.mission-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.1;
}

.mission-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.05;
}

.mission-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mission-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 9px;
  border: 2px solid rgba(45,45,95,0.16);
  border-radius: 15px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.1;
  box-shadow: 0 3px 0 rgba(45,45,95,0.12);
  text-align: center;
}

.mission-pill.score {
  background: #fff8e1;
  border-color: rgba(255,149,0,0.34);
  color: var(--star-shadow);
}

.mission-pill.streak {
  grid-column: 1 / -1;
  background: #e8faf5;
  border-color: rgba(16,172,132,0.32);
  color: #0a7a5c;
}

.mission-progress {
  position: relative;
  z-index: 1;
  height: 10px;
  margin-top: 10px;
  background: rgba(45,45,95,0.12);
  border: 2px solid rgba(45,45,95,0.16);
  border-radius: 999px;
  overflow: hidden;
}

.mission-progress span {
  display: block;
  height: 100%;
  min-width: 10px;
  background: linear-gradient(90deg, #1dd1a1, #feca57, #ff6b9d);
  border-radius: inherit;
  transition: width 0.25s ease;
}

.mission-replay {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px auto 0;
  padding: 6px 14px 7px;
  background: white;
  border: 2px solid rgba(45,45,95,0.22);
  border-radius: 999px;
  color: var(--ink);
  font-family: inherit;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(45,45,95,0.16);
  width: max-content;
  align-self: center;
  justify-self: center;
}

.mission-hud {
  display: grid;
  justify-items: center;
}

.mission-title-group,
.mission-stats,
.mission-progress {
  width: 100%;
}

.mission-replay:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(45,45,95,0.16);
}

.mission-replay-icon {
  font-size: 1.1rem;
}

.mission-feedback {
  display: grid;
  gap: 2px;
  min-height: 54px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.86);
  border: 3px solid rgba(45,45,95,0.14);
  border-radius: 18px;
  color: var(--ink-soft);
  box-shadow: 0 4px 0 rgba(45,45,95,0.10);
}

.mission-feedback b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.05;
}

.mission-feedback span {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.mission-feedback.good {
  background: #e8faf5;
  border-color: #10ac84;
  color: #0a7a5c;
  animation: mission-pop 0.28s ease;
}

.mission-feedback.try {
  background: #fff0f0;
  border-color: #ff7675;
  color: #a42020;
  animation: mission-nudge 0.28s ease;
}

.mission-stage {
  display: block;
}

.mission-stage .question-box {
  margin-bottom: 12px;
}

@keyframes mission-pop {
  0% { transform: scale(0.98); }
  70% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes mission-nudge {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}

/* --- Exercise UI (shared by all exercise types) --- */
.question-box {
  background: white;
  border-radius: var(--r-card);
  padding: 20px 18px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.08), 0 8px 20px rgba(0,0,0,0.05);
  margin-bottom: 16px;
  text-align: center;
}
.question-text {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
  font-weight: 500;
  line-height: 1.3;
}
.question-text b { color: var(--ink); }
.question-big {
  font-family: var(--font-display);
  font-size: 2.6rem;
  color: var(--accent);
  margin: 8px 0;
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.options.three { grid-template-columns: 1fr 1fr 1fr; }

.option {
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: var(--r-button);
  min-height: 64px;
  padding: 14px 12px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 #c0c0c0;
  transition: all 0.15s;
  position: relative;
}
.option:active:not(.correct):not(.wrong) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c0c0c0;
}
.option.correct {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  color: white; border-color: #10ac84; box-shadow: 0 4px 0 #0a7a5c;
}

/* When the round was a wrong tap and the engine flags the stage with
   .teach, the *revealed* correct answer pulses softly so Alessia notices
   and learns it. No red X energy. */
.mission-stage.teach .option.correct,
.mission-stage.teach .match-cell.matched,
.mission-stage.teach .body-answer.correct {
  animation: teach-pulse 0.9s ease-in-out 2;
  box-shadow:
    0 4px 0 #0a7a5c,
    0 0 0 6px rgba(29,209,161,0.32);
}

@keyframes teach-pulse {
  0%, 100% { filter: brightness(1) saturate(1); }
  50%      { filter: brightness(1.15) saturate(1.2); transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .mission-stage.teach .option.correct,
  .mission-stage.teach .match-cell.matched,
  .mission-stage.teach .body-answer.correct { animation: none; }
}
.option.wrong {
  background: linear-gradient(135deg, #ff7675, #d63031);
  color: white; border-color: #d63031; box-shadow: 0 4px 0 #a42020;
}
.option.correct::after,
.option.wrong::after,
.match-cell.matched::after,
.match-cell.wrong::after,
.body-answer.correct::after,
.body-answer.wrong::after {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(45,45,95,0.16);
}
.option.correct::after,
.match-cell.matched::after,
.body-answer.correct::after {
  content: "✓";
}
.option.wrong::after,
.match-cell.wrong::after,
.body-answer.wrong::after {
  content: "!";
}

/* --- Phonics adventure --- */
.phonics-game {
  display: grid;
  gap: 12px;
}

.phonics-roadmap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.phonics-step {
  background: rgba(255,255,255,0.72);
  border: 2px solid rgba(45,45,95,0.16);
  border-radius: 14px;
  padding: 7px 4px;
  text-align: center;
  color: var(--ink-mute);
  box-shadow: 0 2px 0 rgba(45,45,95,0.10);
}

.phonics-step span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin: 0 auto 3px;
  border-radius: 50%;
  background: white;
  font-family: var(--font-display);
  color: var(--ink);
}

.phonics-step b {
  display: block;
  font-size: 0.68rem;
  line-height: 1.05;
}

.phonics-step.current {
  border-color: #ff6b9d;
  color: var(--ink);
  background: white;
}

.phonics-step.done span {
  background: #1dd1a1;
  color: white;
}

.phonics-score {
  justify-self: center;
  background: white;
  border-radius: var(--r-chip);
  padding: 8px 14px;
  font-family: var(--font-display);
  box-shadow: 0 3px 0 rgba(45,45,95,0.16);
}

.phonics-card {
  background: white;
  border-radius: var(--r-card);
  padding: 16px;
  box-shadow: 0 6px 0 rgba(45,45,95,0.14), 0 12px 24px rgba(45,45,95,0.08);
  display: grid;
  gap: 12px;
  overflow: hidden;
  position: relative;
}

.phonics-art {
  display: grid;
  place-items: center;
}

.phonics-image {
  width: min(100%, 260px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.12);
}

.phonics-copy {
  text-align: center;
}

.phonics-kicker {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 3px;
}

.phonics-copy h3 {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.28rem;
  margin-bottom: 4px;
}

.phonics-copy p {
  color: var(--ink-soft);
  font-weight: 500;
  line-height: 1.3;
}

.phonics-action {
  display: grid;
  gap: 10px;
}

.phonics-sentence-slots,
.phonics-bank,
.phonics-match {
  display: grid;
  gap: 8px;
}

.phonics-sentence-slots {
  grid-template-columns: repeat(4, 1fr);
}

.phonics-sentence-slots span,
.phonics-word,
.phonics-prompt {
  border: 3px solid var(--ink);
  border-radius: 16px;
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 8px;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.phonics-sentence-slots span {
  background: #fff8e1;
  color: var(--ink);
}

.phonics-sentence-slots .empty {
  background: #f1f3fb;
  color: #9aa0b8;
  border-style: dashed;
}

.phonics-bank {
  grid-template-columns: repeat(3, 1fr);
}

.phonics-word {
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 0 #0a8ab1;
}

.phonics-word.used,
.phonics-word:disabled {
  opacity: 0.45;
  cursor: default;
}

.phonics-prompt {
  background: #f7f8fc;
  color: var(--ink);
  text-align: center;
}

.phonics-guide {
  display: grid;
  gap: 8px;
  background: #fff8e1;
  border: 3px solid #feca57;
  border-radius: 18px;
  padding: 10px;
}

.phonics-guide-row {
  display: grid;
  gap: 3px;
  text-align: left;
  background: rgba(255,255,255,0.72);
  border-radius: 12px;
  padding: 8px 10px;
}

.phonics-guide-row b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
}

.phonics-guide-row span {
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.92rem;
}

.phonics-clue {
  background: #e8faf5;
  border: 3px solid #1dd1a1;
  border-radius: 16px;
  color: #0a7a5c;
  font-weight: 800;
  line-height: 1.25;
  padding: 10px 12px;
  text-align: center;
}

.phonics-option {
  display: grid;
  gap: 5px;
  align-content: center;
}

.phonics-option span {
  display: block;
}

.phonics-option small {
  display: block;
  color: var(--ink-mute);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.15;
}

.phonics-option.correct small,
.phonics-option.wrong small {
  color: rgba(255,255,255,0.92);
}

.phonics-match {
  grid-template-columns: 1fr 1fr;
}

.phonics-match-col {
  display: grid;
  gap: 8px;
}

.phonics-feedback {
  background: #f7f8fc;
  color: var(--ink-soft);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
  text-align: center;
}

.phonics-feedback.good {
  background: #e8faf5;
  color: #0a7a5c;
}

.phonics-feedback.try {
  background: #ffe8e8;
  color: #a42020;
  animation: mission-nudge 0.28s ease;
}

.phonics-party {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.phonics-party span {
  position: absolute;
  left: calc(12% + (var(--i) * 10%));
  top: 48%;
  color: hsl(calc(var(--i) * 48deg), 88%, 58%);
  font-family: var(--font-display);
  font-size: 1.55rem;
  text-shadow: 0 2px 0 rgba(255,255,255,0.9);
  animation: phonics-party-pop 0.95s ease-out forwards;
  animation-delay: calc(var(--i) * 0.035s);
}

@keyframes phonics-party-pop {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.6) rotate(0deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-150px) scale(1.25) rotate(55deg);
  }
}

/* --- Decenas blocks visualization --- */
.blocks-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 72px;
  margin: 10px 0 4px;
}
.tens-group {
  display: flex;
  gap: 4px;
  align-items: flex-end;
}
.ten-bar {
  width: 14px;
  height: 64px;
  background: linear-gradient(180deg, #ff6b9d, #e91e63);
  border-radius: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.12);
}
.units-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  max-width: 70px;
}
.unit-block {
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.12);
}

/* --- Sort (ordenar) --- */
.order-instruction {
  font-size: 1rem;
  color: var(--ink-soft);
  font-weight: 500;
  text-align: center;
}
.order-instruction b { color: var(--accent); }
.sort-question {
  min-height: 90px;
}

.order-slots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0 14px;
  flex-wrap: wrap;
}
.slot {
  min-width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.55);
  border: 3px dashed rgba(45,45,95,0.25);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
}
.slot.filled {
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  color: white;
  border: 3px solid #0a8ab1;
  box-shadow: 0 3px 0 #0a8ab1;
}
.slot.revealed {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  border-color: #10ac84;
  box-shadow: 0 3px 0 #0a7a5c;
}

.numbers-to-order {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}
.num-chip {
  min-width: 60px;
  height: 60px;
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 4px 0 #c0c0c0;
  transition: all 0.15s;
}
.num-chip:active:not(.used) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c0c0c0;
}
.num-chip.used {
  opacity: 0.38;
  cursor: default;
  transform: translateY(2px);
  text-decoration: line-through;
}
.sort-actions {
  text-align: center;
  margin-top: 14px;
}

/* --- Fill-blank (secuencias) --- */
.sequence {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 10px 0 4px;
}
.seq-num {
  min-width: 50px;
  height: 50px;
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--ink);
  box-shadow: 0 3px 0 #c0c0c0;
}
.seq-num.blank {
  background: #fff8e1;
  border-style: dashed;
  border-color: #feca57;
  color: #ff9500;
}
.seq-num.revealed {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  border-color: #10ac84;
  color: white;
  box-shadow: 0 3px 0 #0a7a5c;
}
.seq-arrow {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  padding: 0 2px;
}
.sequence-hint {
  display: inline-flex;
  margin-top: 4px;
  color: var(--ink-mute);
  font-size: 0.88rem;
}

/* --- Match pairs --- */
.match-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.match-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.match-cell {
  background: white;
  border: 3px solid #e0e0e0;
  border-radius: 14px;
  padding: 12px 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 3px 0 #c0c0c0;
  transition: all 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
}
.match-image {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
}
.match-cell:active:not(.matched) {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #c0c0c0;
}
.match-cell.selected {
  background: linear-gradient(135deg, #feca57, #ff9f43);
  color: white;
  border-color: #ff9f43;
  box-shadow: 0 3px 0 #c96f1c;
  outline: 4px solid rgba(255,255,255,0.9);
  outline-offset: 2px;
}
.match-cell.matched {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  color: white;
  border-color: #10ac84;
  box-shadow: 0 3px 0 #0a7a5c;
  cursor: default;
}
.match-cell.wrong {
  background: linear-gradient(135deg, #ff7675, #d63031);
  color: white;
  border-color: #d63031;
  box-shadow: 0 3px 0 #a42020;
}

/* --- Tap-count (par/impar visual) --- */
.pair-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 4px;
}
.pair-box {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  background: #eaf7ff;
  border: 2px solid #48dbfb;
  border-radius: 12px;
  min-height: 44px;
}
.alone-box {
  display: flex;
  padding: 4px 6px;
  background: #fff4e1;
  border: 2px dashed #ff9f43;
  border-radius: 12px;
  min-height: 44px;
}
.pair-asset {
  width: 34px;
  height: 34px;
}

/* --- Tutorial slide content classes --- */
.tut-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent);
  margin-bottom: 10px;
  text-align: center;
}
.tut-text {
  font-size: 1rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.35;
  margin-bottom: 12px;
  font-weight: 500;
}
.tut-text b { color: var(--ink); }
.tut-visual {
  margin: 14px 0;
  padding: 10px;
  background: #f7f8fc;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 80px;
  width: 100%;
}
.tut-caption {
  font-size: 0.95rem;
  color: var(--ink-soft);
  text-align: center;
  background: #fff8e1;
  padding: 8px 14px;
  border-radius: 14px;
  margin-top: 8px;
}
.tut-caption b { color: var(--accent); }

.lesson-figure {
  margin: 14px 0 8px;
  width: 100%;
}

.lesson-image {
  display: block;
  width: min(100%, 320px);
  max-height: 210px;
  object-fit: contain;
  margin: 0 auto;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.18);
}

.lesson-image-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.lesson-image-row .lesson-image {
  width: 100%;
  max-height: 155px;
}

.tut-pop { animation: pop 0.5s cubic-bezier(0.17, 0.89, 0.32, 1.49) backwards; }

/* Comparar chomping croc animation (used in tutorial slide 2) */
@keyframes chomp {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(1.4); }
}

/* Mini number line (used by Más y Menos tutorial) */
.mini-line {
  position: relative; width: 100%; max-width: 320px; height: 90px; margin: 10px auto;
}
.mini-line .line {
  position: absolute; left: 0; right: 0; top: 50px; height: 4px; background: #2d2d5f; border-radius: 2px;
}
.mini-line .tick {
  position: absolute; top: 42px; width: 3px; height: 20px; background: #2d2d5f; transform: translateX(-1.5px);
}
.mini-line .lab {
  position: absolute; top: 64px; font-family: var(--font-display); font-size: 0.9rem; color: var(--ink); transform: translateX(-50%);
}
.bunny {
  position: absolute; top: 14px; font-size: 1.8rem; transform: translateX(-50%);
  transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.arc {
  position: absolute; top: 28px; height: 24px; border: 2.5px dashed #e91e63; border-bottom: none;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0; animation: arcIn 0.5s;
}
@keyframes arcIn { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* --- Body Explorer: science sticker lab --- */
.body-lab {
  background:
    radial-gradient(circle at 16% 8%, rgba(254, 202, 87, 0.34), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(255, 107, 157, 0.24), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, #f1fffb 100%);
  border: 4px solid var(--ink);
  border-radius: var(--r-card);
  box-shadow: 0 7px 0 rgba(45,45,95,0.25), 0 12px 24px rgba(45,45,95,0.12);
  overflow: hidden;
}

.body-roadmap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(254,202,87,0.72), rgba(29,209,161,0.22)),
    white;
  border-bottom: 4px solid var(--ink);
}

.body-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.68);
  border: 2px solid rgba(45,45,95,0.16);
  border-radius: 14px;
  color: var(--ink-mute);
  font-size: 0.76rem;
  font-weight: 700;
}

.body-step span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  flex: 0 0 auto;
  background: white;
  border: 2px solid rgba(45,45,95,0.18);
  border-radius: 50%;
  font-family: var(--font-display);
}

.body-step b {
  line-height: 1.05;
}

.body-step.current {
  background: white;
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(45,45,95,0.18);
}

.body-step.current span {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.body-step.done {
  background: #e8faf5;
  border-color: #10ac84;
  color: #0a7a5c;
}

.body-step.done span {
  background: #10ac84;
  border-color: #10ac84;
  color: white;
}

.body-lab-progress {
  padding: 10px 14px;
  background: #fff8e1;
  border-bottom: 3px dashed rgba(45,45,95,0.22);
  color: var(--star-shadow);
  font-family: var(--font-display);
  font-size: 1.15rem;
  text-align: center;
}

.body-lab-grid {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.body-map-card {
  position: relative;
  display: grid;
  min-height: 340px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.85), transparent 24%),
    linear-gradient(180deg, #eaf7ff 0%, #e8faf5 100%);
  border: 3px solid var(--ink);
  border-radius: var(--r-panel);
  overflow: hidden;
  touch-action: manipulation;
}

.body-map-card::before,
.body-map-card::after {
  content: '';
  position: absolute;
  border: 3px dashed rgba(45,45,95,0.18);
  border-radius: 999px;
  pointer-events: none;
}

.body-map-card::before {
  width: 210px;
  height: 210px;
  top: 28px;
}

.body-map-card::after {
  width: 190px;
  height: 270px;
  bottom: 20px;
  transform: rotate(-7deg);
}

.body-map-label {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 10px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 rgba(45,45,95,0.18);
  color: var(--ink);
  font-family: var(--font-display);
  padding: 6px 10px;
}

.body-map-hint {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 10px;
  background: #fff8e1;
  border: 3px solid rgba(255,149,0,0.65);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 7px 10px;
  box-shadow: 0 3px 0 rgba(201,111,28,0.22);
}

.body-map {
  position: relative;
  z-index: 1;
  width: min(100%, 238px);
  height: auto;
  overflow: visible;
}

.body-part {
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
}

.body-line {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
  pointer-events: none;
}

.body-part.bone { fill: #fff7d8; }
.body-part.muscle { fill: #ff6b9d; }
.body-part.heart { fill: #d63031; }
.body-part.skin { fill: #ffd8b6; pointer-events: none; }
.body-part.ghost { opacity: 0.86; pointer-events: none; }

.target-zone {
  cursor: pointer;
  stroke-width: 4;
  filter: drop-shadow(0 0 5px rgba(255,255,255,0.72));
  transition: filter 0.15s, transform 0.15s, opacity 0.15s, stroke-width 0.15s;
}

.target-zone:hover,
.target-zone:focus-visible {
  filter: brightness(1.12) saturate(1.15) drop-shadow(0 0 8px rgba(255,149,0,0.7));
  outline: none;
  stroke: #ff9500;
  stroke-width: 6;
  transform: scale(1.05);
}

.tap-target {
  fill: transparent;
  stroke: transparent;
  pointer-events: all;
  cursor: pointer;
}

.target-zone.done {
  fill: #1dd1a1;
  animation: body-pop 0.5s ease;
}

.target-zone.wrong {
  animation: body-shake 0.35s ease;
}

.body-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.body-mission,
.body-fact,
.body-feedback,
.body-action {
  background: white;
  border: 3px solid var(--ink);
  border-radius: var(--r-panel);
  box-shadow: 0 4px 0 rgba(45,45,95,0.18);
}

.body-mission,
.body-fact,
.body-feedback {
  padding: 14px;
}

.body-kicker {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.body-mission h3,
.body-fact h4 {
  color: var(--ink);
  font-family: var(--font-display);
  line-height: 1.05;
  margin: 0;
}

.body-mission h3 { font-size: 1.55rem; }
.body-fact h4 { font-size: 1.35rem; }

.body-mission p,
.body-fact p {
  color: var(--ink-soft);
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 8px 0 0;
}

.body-fact-figure {
  margin: -2px -2px 10px;
  overflow: hidden;
  border-radius: 16px;
  background: #f7f8fc;
}

.body-fact-figure img {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.body-action {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.body-part-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.body-primary,
.body-chip,
.body-answer {
  border: 3px solid var(--ink);
  border-radius: 16px;
  cursor: pointer;
  font-family: var(--font-display);
  transition: all 0.15s;
  position: relative;
}

.body-primary {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  color: white;
  font-size: 1.04rem;
  min-height: 54px;
  padding: 12px 14px;
  box-shadow: 0 4px 0 #0a7a5c;
}

.body-primary.quiet {
  background: white;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(45,45,95,0.22);
}

.body-word-bank,
.body-quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.body-chip,
.body-answer {
  min-height: 52px;
  background: white;
  color: var(--ink);
  font-size: 1rem;
  padding: 10px 8px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.22);
}

.body-chip.selected {
  background: #feca57;
  color: white;
  transform: translateY(2px);
  box-shadow: 0 2px 0 #c96f1c;
  outline: 4px solid rgba(255,255,255,0.92);
  outline-offset: 2px;
}

.body-chip.done {
  background: #e8faf5;
  border-color: #10ac84;
  color: #0a7a5c;
  box-shadow: 0 4px 0 rgba(10,122,92,0.28);
}
.body-chip.done::after {
  content: "✓";
  margin-left: 5px;
}

.body-answer.correct {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  border-color: #10ac84;
  color: white;
  box-shadow: 0 4px 0 #0a7a5c;
}

.body-answer.wrong {
  background: linear-gradient(135deg, #ff7675, #d63031);
  border-color: #d63031;
  color: white;
  box-shadow: 0 4px 0 #a42020;
}

.body-primary:active,
.body-chip:active,
.body-answer:active {
  transform: translateY(2px);
}

.body-feedback {
  min-height: 48px;
  color: var(--ink-mute);
  font-weight: 700;
  line-height: 1.3;
}
.body-feedback:empty {
  display: none;
}

.body-feedback.good {
  color: #0a7a5c;
  background: #e8faf5;
}

.body-feedback.try {
  color: #a42020;
  background: #fff0f0;
}

@keyframes body-pop {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.14); }
}

@keyframes body-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

@keyframes body-target-breathe {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255,255,255,0.72)); }
  50% { filter: drop-shadow(0 0 10px rgba(254,202,87,0.85)); }
}

@media (hover: hover) {
  .card:hover,
  .option:hover:not(.correct):not(.wrong),
  .num-chip:hover:not(.used),
  .match-cell:hover:not(.matched),
  .body-primary:hover,
  .body-chip:hover,
  .body-answer:hover {
    filter: brightness(1.03);
  }
}

@media (hover: none) {
  .target-zone:not(.done) {
    animation: body-target-breathe 2.2s ease-in-out infinite;
  }
}

@media (min-width: 720px) {
  body[data-view="menu"] .header {
    padding-top: 14px;
    padding-bottom: 20px;
  }

  body[data-view="menu"] .title {
    font-size: 1.9rem;
  }

  body[data-view="menu"] .menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  body[data-view="menu"] .card {
    min-height: 154px;
    padding: 22px 12px 18px;
  }

  body[data-view="menu"] .card-image {
    width: 78px;
    height: 78px;
  }

  body[data-view="menu"] .menu.home .card {
    min-height: 320px;
    padding: 14px 14px 16px;
  }

  body[data-view="menu"] .menu.home .card-image {
    width: 100%;
    height: auto;
    margin-bottom: 12px;
  }

  body[data-view="menu"] .card-title {
    font-size: 1.05rem;
  }

  body[data-view="lesson"][data-lesson-type="body-explorer"] .body-lab-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 1fr);
    align-items: start;
  }

  body[data-view="lesson"][data-lesson-type="body-explorer"] .body-map-card {
    min-height: 520px;
  }

  body[data-view="lesson"][data-lesson-type="body-explorer"] .body-map {
    width: min(100%, 282px);
  }
}

@media (max-width: 380px) {
  body {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }

  .screen-header {
    padding: 9px 10px;
    gap: 6px;
  }

  .btn-back {
    min-width: 82px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .btn-skip {
    min-width: 58px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .header-spacer {
    flex-basis: 58px;
  }

  .options.three {
    gap: 8px;
  }

  .option {
    min-height: 60px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 1.28rem;
  }

  .mission-title {
    font-size: 1.18rem;
  }

  .mission-stats {
    grid-template-columns: 1fr;
  }

  .mission-pill.streak {
    grid-column: auto;
  }

  .body-roadmap {
    grid-template-columns: 1fr;
  }

  .body-word-bank,
  .body-quiz-options,
  .body-part-list {
    grid-template-columns: 1fr;
  }

  .lesson-image-row {
    grid-template-columns: 1fr;
  }

  .tut-content,
  .question-box {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mission-progress span,
  .mission-feedback.good,
  .mission-feedback.try {
    animation: none;
    transition: none;
  }

  .target-zone.done,
  .target-zone.wrong,
  .target-zone:not(.done) {
    animation: none;
  }

  .juice-piece,
  .juice-combo,
  .juice-surprise {
    animation: none;
    display: none;
  }
}

/* --- Juice layer: confetti + combo callouts --- */
.juice-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 9999;
}

.juice-piece {
  position: absolute;
  font-size: 1.65rem;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255,255,255,0.92);
  transform: translate(-50%, -50%);
  animation: juice-fly 1050ms cubic-bezier(0.18, 0.74, 0.42, 1) forwards;
  will-change: transform, opacity;
}

@keyframes juice-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  10% { opacity: 1; }
  60% {
    transform: translate(calc(-50% + var(--jx)), calc(-50% + var(--jy))) scale(1.1) rotate(var(--jr));
  }
  100% {
    opacity: 0;
    /* gravity-style drop: tack on +220px of y past the fan apex */
    transform: translate(calc(-50% + var(--jx)), calc(-50% + var(--jy) + 220px)) scale(0.9) rotate(calc(var(--jr) * 1.4));
  }
}

.juice-combo {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 14px 28px 16px;
  background: rgba(255,255,255,0.96);
  border: 4px solid var(--ink, #2d2d5f);
  border-radius: 26px;
  box-shadow: 0 8px 0 rgba(45,45,95,0.22), 0 14px 30px rgba(45,45,95,0.18);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
  animation: juice-combo-in 0.34s cubic-bezier(0.17, 0.89, 0.32, 1.49) forwards;
  text-align: center;
}

.juice-combo.out {
  animation: juice-combo-out 0.3s ease-in forwards;
}

.juice-combo-label {
  display: block;
  font-size: 1.4rem;
  line-height: 1;
  background: linear-gradient(90deg, #e91e63, #ff9f43, #feca57, #1dd1a1, #48dbfb, #a55eea);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: juice-rainbow 1.4s linear infinite;
  text-shadow: 0 2px 0 rgba(255,255,255,0.8);
}

.juice-combo-count {
  display: block;
  font-size: 3.2rem;
  line-height: 0.95;
  color: var(--accent, #e91e63);
  text-shadow:
    3px 3px 0 #fff,
    4px 4px 0 rgba(0,0,0,0.18);
}

.juice-combo-pop  { transform: translate(-50%, -50%) rotate(-3deg); }
.juice-combo-big  { transform: translate(-50%, -50%) rotate(-4deg); }
.juice-combo-hot  {
  transform: translate(-50%, -50%) rotate(-5deg);
  border-color: #ff6b9d;
  box-shadow:
    0 0 0 6px rgba(255,107,157,0.18),
    0 8px 0 rgba(255,107,157,0.45),
    0 14px 30px rgba(233,30,99,0.32);
}
.juice-combo-max  {
  transform: translate(-50%, -50%) rotate(-6deg);
  border-color: #feca57;
  background: linear-gradient(135deg, #fff8e1 0%, #ffffff 60%);
  box-shadow:
    0 0 0 8px rgba(255,159,67,0.2),
    0 10px 0 rgba(255,107,157,0.55),
    0 18px 40px rgba(233,30,99,0.35);
  animation: juice-combo-in 0.34s cubic-bezier(0.17, 0.89, 0.32, 1.49) forwards,
             juice-combo-shake 0.34s ease-in-out 0.34s 2;
}

@keyframes juice-combo-in {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.4) rotate(-12deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  100% { opacity: 1; }
}

@keyframes juice-combo-out {
  0%   { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.2) rotate(0deg); }
}

@keyframes juice-combo-shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(-6deg); }
  25%      { transform: translate(-52%, -50%) rotate(-8deg); }
  75%      { transform: translate(-48%, -50%) rotate(-4deg); }
}

@keyframes juice-rainbow {
  from { background-position: 0% 0; }
  to   { background-position: 200% 0; }
}

/* Variable-ratio surprise banner (rare bonus on correct answers). */
.juice-surprise {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  background: linear-gradient(135deg, #feca57, #ff9f43);
  color: white;
  border: 4px solid var(--ink, #2d2d5f);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow:
    0 0 0 6px rgba(255,255,255,0.55),
    0 8px 0 #c96f1c,
    0 14px 30px rgba(201,111,28,0.32);
  text-shadow: 0 2px 0 rgba(0,0,0,0.18);
  animation: juice-surprise-in 0.4s cubic-bezier(0.17, 0.89, 0.32, 1.49) forwards,
             juice-surprise-wiggle 0.32s ease-in-out 0.4s 2;
}

.juice-surprise.out {
  animation: juice-combo-out 0.3s ease-in forwards;
}

.juice-surprise-gift {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.18));
}

@keyframes juice-surprise-in {
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(0.4) rotate(-18deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(3deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

@keyframes juice-surprise-wiggle {
  0%, 100% { transform: translate(-50%, -50%) rotate(-2deg); }
  50%      { transform: translate(-50%, -50%) rotate(2deg); }
}

/* --- Daily streak chip (home header) --- */
.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  background: linear-gradient(135deg, #ff9f43, #e91e63);
  color: white;
  padding: 7px 13px;
  border-radius: var(--r-chip);
  font-weight: 800;
  font-size: 0.95rem;
  min-height: 38px;
  box-shadow: 0 4px 0 #a42020, 0 6px 12px rgba(228,77,42,0.22);
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

/* Author-level `display: inline-flex` outranks the UA's [hidden] rule;
   restore the expected "hidden = invisible" behavior. */
.streak-chip[hidden] { display: none; }

/* Streak tiers — color escalates with consecutive days. */
.streak-chip.tier-bronze {
  background: linear-gradient(135deg, #ff9f43, #e91e63);
  animation: streak-chip-pulse 1.8s ease-in-out infinite;
}
.streak-chip.tier-silver {
  background: linear-gradient(135deg, #ff6b9d, #d63031);
  box-shadow: 0 4px 0 #a42020, 0 0 0 4px rgba(255,107,157,0.25), 0 8px 18px rgba(214,48,49,0.32);
  animation: streak-chip-pulse 1.4s ease-in-out infinite;
}
.streak-chip.tier-gold {
  background: linear-gradient(135deg, #feca57, #ff9f43);
  color: #5b3a00;
  box-shadow:
    0 4px 0 #c96f1c,
    0 0 0 4px rgba(255,239,170,0.55),
    0 8px 22px rgba(254,202,87,0.55);
  animation: streak-chip-pulse 1.1s ease-in-out infinite,
             streak-chip-shine 3s linear infinite;
}

@keyframes streak-chip-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes streak-chip-shine {
  0%   { filter: brightness(1) saturate(1); }
  50%  { filter: brightness(1.18) saturate(1.2); }
  100% { filter: brightness(1) saturate(1); }
}

@media (prefers-reduced-motion: reduce) {
  .streak-chip.tier-bronze,
  .streak-chip.tier-silver,
  .streak-chip.tier-gold {
    animation: none;
  }
}

.streak-chip.cold {
  background: linear-gradient(135deg, #c0c4d4, #8e93ab);
  box-shadow: 0 4px 0 #5b6079, 0 6px 12px rgba(0,0,0,0.12);
}

.streak-chip .flame {
  font-size: 1.05rem;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.18));
}

.header-stats {
  display: inline-flex;
  align-items: center;
}

/* --- Trophy room stats + sections --- */
.screen-trophies .trophy-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.trophy-stat {
  background: white;
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 10px 8px 9px;
  text-align: center;
  box-shadow: 0 4px 0 rgba(45,45,95,0.18);
}

.trophy-stat-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.trophy-stat-label {
  margin-top: 4px;
  color: var(--ink-mute);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.trophy-section {
  margin-bottom: 18px;
}

.trophy-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 6px;
}

.trophy-section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.05rem;
}

.trophy-section-title .card-image {
  width: 28px;
  height: 28px;
}

.trophy-section-count {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--ink-mute);
  padding: 4px 10px;
  background: white;
  border: 2px solid rgba(45,45,95,0.16);
  border-radius: 999px;
  box-shadow: 0 2px 0 rgba(45,45,95,0.12);
}

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  padding: 12px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.7) 0 12px, rgba(255,248,225,0.7) 12px 24px);
  border: 3px dashed rgba(45,45,95,0.22);
  border-radius: 18px;
}

/* Header stats buttons reset (they used to be plain divs). */
.stars-counter,
.streak-chip {
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.stars-counter:active,
.streak-chip:active { transform: translateY(2px); }

/* --- Home welcome (first-visit empty state) --- */
.home-welcome {
  margin: 4px 0 12px;
  padding: 14px 18px 16px;
  background:
    radial-gradient(circle at 18% 18%, rgba(254,202,87,0.28), transparent 38%),
    radial-gradient(circle at 82% 80%, rgba(72,219,251,0.28), transparent 36%),
    white;
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 5px 0 rgba(45,45,95,0.18), 0 8px 22px rgba(45,45,95,0.08);
  text-align: center;
}

.home-welcome-kicker {
  display: inline-block;
  font-family: var(--font-display);
  color: var(--accent);
  font-size: 1.45rem;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-shadow: 0 2px 0 rgba(255,255,255,0.8);
}

.home-welcome p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.3;
  font-weight: 600;
}

.home-welcome p b {
  color: var(--ink);
}

/* --- Daily challenge tile (home) --- */
.daily-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 4px 0 14px;
  padding: 12px 16px 14px;
  background:
    linear-gradient(135deg, rgba(254,202,87,0.95), rgba(255,107,157,0.92));
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 6px 0 rgba(45,45,95,0.22), 0 12px 24px rgba(45,45,95,0.16);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s;
  animation: daily-tile-glow 2.4s ease-in-out infinite;
}

.daily-tile::before {
  content: '';
  position: absolute;
  inset: -40px -50%;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.18) 0 12px,
    transparent 12px 36px
  );
  animation: daily-tile-shimmer 8s linear infinite;
  pointer-events: none;
}

.daily-tile:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(45,45,95,0.22), 0 7px 14px rgba(45,45,95,0.16); }

.daily-tile.done {
  animation: none;
  background: linear-gradient(135deg, rgba(29,209,161,0.92), rgba(10,172,132,0.88));
}
.daily-tile.done::before { display: none; }

.daily-kicker {
  position: absolute;
  top: 10px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  box-shadow: 0 2px 0 rgba(45,45,95,0.2);
  z-index: 2;
}

.daily-tile.done .daily-kicker {
  background: #fff8e1;
  color: #0a7a5c;
}

.daily-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e91e63;
  box-shadow: 0 0 0 4px rgba(233,30,99,0.22);
  animation: daily-dot-pulse 1.4s ease-in-out infinite;
}

.daily-tile.done .daily-dot {
  background: #10ac84;
  box-shadow: 0 0 0 4px rgba(16,172,132,0.22);
  animation: none;
}

.daily-art {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  width: 86px;
  height: 86px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.22);
  display: grid;
  place-items: center;
  overflow: hidden;
  transform: rotate(-3deg);
}

.daily-art img {
  width: 96%;
  height: 96%;
  object-fit: contain;
}

.daily-body {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  color: white;
  text-shadow: 0 2px 0 rgba(45,45,95,0.32);
}

.daily-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.05;
  margin-bottom: 4px;
}

.daily-status {
  display: inline-block;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.32);
  border: 2px solid rgba(255,255,255,0.5);
  text-shadow: none;
  color: white;
}

.daily-status.done {
  background: rgba(255,255,255,0.92);
  color: #0a7a5c;
  border-color: white;
}

@keyframes daily-tile-glow {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(254,202,87,0.45),
      0 6px 0 rgba(45,45,95,0.22),
      0 12px 24px rgba(45,45,95,0.16);
  }
  50% {
    box-shadow:
      0 0 0 8px rgba(254,202,87,0),
      0 6px 0 rgba(45,45,95,0.22),
      0 16px 30px rgba(254,202,87,0.42);
  }
}

@keyframes daily-tile-shimmer {
  from { transform: translateX(-30%); }
  to   { transform: translateX(30%); }
}

@keyframes daily-dot-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  .daily-tile,
  .daily-tile::before,
  .daily-dot { animation: none; }
}

/* --- Resume tile (home, last-played quick shortcut) --- */
.resume-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 14px;
  padding: 12px 16px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.18), 0 7px 14px rgba(45,45,95,0.08);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.15s;
}

.resume-tile:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(45,45,95,0.18), 0 4px 8px rgba(45,45,95,0.08);
}

.resume-arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  color: white;
  border-radius: 50%;
  border: 2px solid #0a7a5c;
  box-shadow: 0 3px 0 rgba(10,122,92,0.45);
  font-family: var(--font-display);
  font-size: 1rem;
  padding-left: 3px;
}

.resume-body {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.resume-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.resume-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Sticker shelf (subject + home) --- */
.sticker-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  padding: 14px;
  margin: 6px 0 16px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.7) 0 12px, rgba(255,248,225,0.7) 12px 24px);
  border: 3px dashed rgba(45,45,95,0.22);
  border-radius: 18px;
}

.sticker-shelf-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.sticker-shelf-title small {
  font-family: var(--font-body);
  color: var(--ink-mute);
  font-weight: 700;
}

.sticker-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,0.55);
  border: 3px dashed rgba(45,45,95,0.22);
  border-radius: 16px;
  display: grid;
  place-items: center;
  padding: 8px;
  transition: transform 0.18s;
}

.sticker-slot.unlocked {
  background: white;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(45,45,95,0.18), 0 7px 14px rgba(45,45,95,0.08);
  transform: rotate(-3deg);
}

.sticker-slot.unlocked:nth-child(even) { transform: rotate(2.5deg); }
.sticker-slot.unlocked:nth-child(5n)   { transform: rotate(-4deg); }
.sticker-slot.unlocked:hover           { transform: rotate(0deg) scale(1.05); }

.sticker-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,0.14));
}

.sticker-slot.locked img {
  filter: grayscale(1) opacity(0.28);
}

.sticker-slot .sticker-new {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #1dd1a1;
  color: white;
  font-family: var(--font-display);
  font-size: 0.65rem;
  padding: 3px 7px;
  border-radius: 999px;
  border: 2px solid white;
  box-shadow: 0 2px 0 #0a7a5c;
  animation: pop 0.4s cubic-bezier(0.17, 0.89, 0.32, 1.49) backwards;
}

/* --- Takeaway card on summary (pedagogical reinforcement) --- */
.summary-takeaway {
  margin: 14px -4px 18px;
  padding: 12px 14px;
  background: #f5f9ff;
  border: 3px solid rgba(72,219,251,0.45);
  border-radius: 16px;
  text-align: left;
  display: grid;
  gap: 4px;
}

.summary-takeaway-kicker {
  display: inline-block;
  align-self: start;
  background: white;
  color: #0a8ab1;
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.8px;
  padding: 3px 9px;
  border: 2px solid rgba(72,219,251,0.6);
  border-radius: 999px;
  text-transform: uppercase;
}

.summary-takeaway p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

/* --- Trophy recent runs (parent-facing log) --- */
.trophy-recent {
  margin: 18px 0 8px;
}

.recent-runs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recent-run {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 rgba(45,45,95,0.16);
}

.recent-run-title {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.1;
}

.recent-run-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--ink-mute);
  font-weight: 700;
}

.recent-run-score {
  background: #fff8e1;
  color: #c96f1c;
  padding: 2px 8px;
  border-radius: 999px;
  border: 2px solid rgba(255,159,67,0.45);
}

.recent-run-stars {
  color: #ff9500;
  letter-spacing: 1px;
  font-size: 0.95rem;
}

.recent-run-time {
  color: var(--ink-mute);
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: lowercase;
}

/* --- Trophy settings + sound toggle --- */
.trophy-settings {
  margin-top: 8px;
  padding: 12px 14px;
  background: white;
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 rgba(45,45,95,0.18);
}

.trophy-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
}

.trophy-toggle > span:first-child {
  flex: 1;
}

.trophy-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.trophy-toggle-switch {
  position: relative;
  width: 56px;
  height: 30px;
  flex: 0 0 auto;
  background: #d0d6e6;
  border: 3px solid var(--ink);
  border-radius: 999px;
  transition: background 0.2s;
  box-shadow: inset 0 2px 0 rgba(0,0,0,0.08);
}

.trophy-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 2px 0 rgba(45,45,95,0.25);
  transition: transform 0.2s cubic-bezier(0.17, 0.89, 0.32, 1.49);
}

.trophy-toggle input[type="checkbox"]:checked + .trophy-toggle-switch {
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
}

.trophy-toggle input[type="checkbox"]:checked + .trophy-toggle-switch::after {
  transform: translateX(24px);
}

.trophy-toggle input[type="checkbox"]:focus-visible + .trophy-toggle-switch {
  outline: 3px solid #ff6b9d;
  outline-offset: 3px;
}

/* --- Next-lesson auto-queue button on summary --- */
.summary-next-slot {
  margin: 8px 0 14px;
  min-height: 0;
}

.btn-nav.next-lesson {
  width: 100%;
  padding: 16px 14px;
  font-size: 1.15rem;
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  color: white;
  border-color: #0a8ab1;
  box-shadow: 0 5px 0 #0a6b8c, 0 8px 18px rgba(10,138,179,0.22);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  animation: next-lesson-glow 2.2s ease-in-out infinite;
}

.btn-nav.next-lesson::before {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 30%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: next-lesson-sweep 2.4s linear infinite;
}

.btn-nav.next-lesson:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0a6b8c, 0 4px 10px rgba(10,138,179,0.18);
}

@keyframes next-lesson-glow {
  0%, 100% { box-shadow: 0 5px 0 #0a6b8c, 0 8px 18px rgba(10,138,179,0.22); }
  50%      { box-shadow: 0 5px 0 #0a6b8c, 0 12px 28px rgba(72,219,251,0.55); }
}

@keyframes next-lesson-sweep {
  from { left: -40%; }
  to   { left: 130%; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-nav.next-lesson,
  .btn-nav.next-lesson::before { animation: none; }
}

/* --- Perfect-run badge on summary --- */
.summary-perfect {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -8px auto 16px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #1dd1a1, #10ac84);
  color: white;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  box-shadow: 0 4px 0 #0a7a5c, 0 6px 14px rgba(16,172,132,0.28);
  animation: pop 0.5s cubic-bezier(0.17, 0.89, 0.32, 1.49) 0.15s backwards;
}

.summary-perfect b {
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* --- Sticker reveal modal (first 3-star clear on a lesson) --- */
.sticker-reveal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.45), rgba(45,45,95,0.55));
  backdrop-filter: blur(3px);
  cursor: pointer;
  animation: sticker-reveal-fade 0.32s ease forwards;
}

.sticker-reveal-card {
  position: relative;
  background:
    radial-gradient(circle at 28% 18%, rgba(254,202,87,0.28), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(72,219,251,0.24), transparent 35%),
    white;
  border: 4px solid var(--ink);
  border-radius: 28px;
  padding: 26px 28px 22px;
  text-align: center;
  box-shadow:
    0 10px 0 rgba(45,45,95,0.25),
    0 22px 50px rgba(45,45,95,0.28);
  max-width: 320px;
  width: 100%;
  animation: sticker-reveal-in 0.55s cubic-bezier(0.17, 0.89, 0.32, 1.49) forwards;
  transform-origin: center;
}

.sticker-reveal-card::before {
  content: '';
  position: absolute;
  inset: -14px;
  border: 4px dashed rgba(254,202,87,0.7);
  border-radius: 34px;
  pointer-events: none;
  animation: sticker-reveal-spin 8s linear infinite;
}

.sticker-reveal-kicker {
  font-family: var(--font-display);
  letter-spacing: 1.5px;
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 8px;
  text-shadow: 0 2px 0 rgba(255,255,255,0.9);
}

.sticker-reveal-art {
  margin: 8px auto 10px;
  width: 56%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: white;
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 6px 0 rgba(45,45,95,0.2);
  overflow: hidden;
  transform: rotate(-4deg);
  animation: sticker-reveal-wobble 1.8s ease-in-out 0.55s infinite;
}

.sticker-reveal-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.16));
}

.sticker-reveal-name {
  font-family: var(--font-display);
  color: var(--ink);
  font-size: 1.25rem;
  margin: 4px 0 8px;
}

.sticker-reveal-hint {
  color: var(--ink-mute);
  font-size: 0.85rem;
  font-weight: 700;
}

@keyframes sticker-reveal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes sticker-reveal-in {
  0%   { transform: scale(0.4) rotate(-25deg); opacity: 0; }
  60%  { transform: scale(1.1) rotate(4deg);   opacity: 1; }
  100% { transform: scale(1)   rotate(0deg);   opacity: 1; }
}

@keyframes sticker-reveal-wobble {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg) scale(1.04); }
}

@keyframes sticker-reveal-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sticker-reveal,
  .sticker-reveal-card,
  .sticker-reveal-card::before,
  .sticker-reveal-art {
    animation: none;
  }
}
