/* ============ Phonics Check Buddy — styles (Wonderword) ============ */

:root {
  /* ---- Surfaces ---- */
  --paper: #FFF7EC;
  --paper-2: #FBEEDC;
  --card: #FFFDF8;
  /* ---- Ink ---- */
  --ink: #22254B;
  --ink-soft: #5B5F86;
  --hair: rgba(34, 37, 75, 0.14);
  /* ---- Brand ---- */
  --coral: #FF6B4A;        /* fill */
  --coral-deep: #E24E2E;   /* button edge (non-text) */
  --coral-ink: #C0341A;    /* TEXT on light: kickers, overlines, links */
  /* ---- Play / accent ---- */
  --teal: #2BB7C4;
  --teal-edge: #1B8C97;
  --yellow: #FFC53D;
  --yellow-edge: #E0A213;
  /* ---- Feedback ---- */
  --green: #12B886;        /* reward fills (ink content) */
  --green-deep: #0C8F6A;   /* correct-mark fill (white glyph) */
  --green-ink: #0B6B50;    /* success TEXT on light */
  --rose: #EF4E5B;         /* soft error accent / left borders */
  --rose-deep: #D8293A;    /* danger + wrong-mark fill (white label) */
  --rose-ink: #C42233;     /* error TEXT on light */
  /* ---- Radius ---- */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;
  /* ---- Shadow: hard offsets on surfaces; ONE soft lift for overlays ---- */
  --flat: 3px 3px 0 rgba(34, 37, 75, 0.13);
  --flat-lg: 5px 5px 0 rgba(34, 37, 75, 0.15);
  --lift: 0 14px 34px rgba(34, 37, 75, 0.20);  /* modals + consent sheet only */
  /* ---- Fonts ---- */
  --font-display: 'Fredoka';
  --font-body: 'Andika';

  /* ---- Back-compat aliases (old token names → Wonderword values) ---- */
  --radius-lg: var(--r-lg);
  --radius-md: var(--r-md);
  --radius-sm: var(--r-sm);
  --card-bg: var(--card);
  --purple: var(--coral);
  --purple-dark: var(--coral-ink);
  --pink: var(--coral-ink);
  --blue: var(--teal);
  --correct: var(--green-deep);
  --wrong: var(--rose-deep);
  --shadow-soft: var(--flat);
  --shadow-pop: var(--flat);

  /* ---- Safe-area insets (kept) ---- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-body), system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Static, non-blended paper grain — sits behind all app content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}
/* Grain OFF on the play screen — the reading word is sacred. */
body.playing::before { display: none; }

/* Icon utilities — inherit the current text colour so inline SVGs
   (in buttons, chips, rows) take the colour of their container. */
.i-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-fine {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button {
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.screen {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  padding-bottom: calc(16px + var(--safe-bottom));
  animation: screenIn .35s ease both;
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

#screen-home {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ============ Topbar ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 8px;
}
.topbar--home { justify-content: flex-end; }

.icon-btn {
  background: var(--card);
  border: none;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--flat);
  color: var(--ink);
  transition: transform .12s ease;
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; }

#app.muted .icon-off { display: inline; }
#app.muted .icon-on { display: none; }
#app:not(.muted) .icon-off { display: none; }
#app:not(.muted) .icon-on { display: inline; }

/* ============ Home screen ============ */
.home-hero {
  text-align: center;
  padding: 4px 20px 6px;
}
.home-mascot {
  width: min(38vw, 170px);
  height: min(38vw, 170px);
  margin: 0 auto 6px;
  transform-origin: 50% 90%;
}
.home-mascot svg { width: 100%; height: 100%; }
@keyframes mascotSway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}
/* Idle breathing sway — only when motion is welcome (spec §08). */
@media (prefers-reduced-motion: no-preference) {
  .home-mascot { animation: mascotSway 4s ease-in-out infinite; }
}

.app-title {
  font-family: var(--font-display), system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 8vw, 42px);
  line-height: 1.05;
  margin: 4px 0 6px;
  color: var(--ink);
}
.app-title span { color: var(--coral); }

.app-subtitle {
  color: var(--ink-soft);
  font-size: clamp(14px, 3.6vw, 17px);
  max-width: 34ch;
  margin: 0 auto;
}

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px 16px 6px;
}
@media (max-width: 420px) {
  .home-actions { grid-template-columns: 1fr; }
}

.big-btn {
  border: none;
  border-radius: var(--r-lg);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--flat-lg);
  min-height: 132px;
  justify-content: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.big-btn:active { transform: translate(2px, 2px); box-shadow: var(--flat); }
.big-btn--practice { background: var(--yellow); }
.big-btn--test { background: var(--teal); }
.big-btn__emoji {
  width: 46px;
  height: 46px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
}
.big-btn__emoji svg { width: 100%; height: 100%; }
.big-btn__label {
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 21px;
  margin-top: 2px;
  color: var(--ink);
}
.big-btn__sub { font-size: 12.5px; color: var(--ink); font-weight: 700; }

.section-heading {
  font-family: var(--font-display), sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 18px 20px 6px;
}

.home-history { padding-bottom: 20px; flex: 1; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

/* Row tier — flat hairline rows with a coloured leading chip. */
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  border-radius: var(--r-md);
  padding: 11px 14px;
  box-shadow: none;
  font-size: 14px;
}
.history-item__lead {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--ink);
}
.history-item__lead svg { width: 22px; height: 22px; }
.history-item__lead--test { background: var(--teal); }
.history-item__lead--practice { background: var(--yellow); }
.history-item__main { flex: 1; min-width: 0; }
.history-item__mode {
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  color: var(--ink);
}
.history-item__date { color: var(--ink-soft); font-size: 12px; }
.history-item__score {
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  background: var(--teal);
  color: var(--ink);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  font-size: 14px;
}
.history-item__score--practice {
  background: var(--yellow);
  color: var(--ink);
}
.history-clear {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--coral-ink);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: underline;
  padding: 6px;
}

/* ============ Empty states (shared block) ============ */
.empty {
  background: var(--card);
  border: 2px dashed var(--hair);
  border-radius: var(--r-lg);
  padding: 20px 18px;
  text-align: center;
}
.empty__silrow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 0 0 12px;
}
.empty__sil {
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty__sil svg { width: 70%; opacity: .35; }
.empty__icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  opacity: .4;
  color: var(--ink);
}
.empty__icon svg { width: 100%; height: 100%; }
.empty__title {
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 2px;
  color: var(--ink);
}
.empty__sub {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}

/* Empty-history block spans the flex list cleanly. */
.history-empty { align-self: stretch; }

/* ============ Year selector (home) ============ */
.home-years {
  text-align: center;
  padding: 6px 16px 2px;
}
.home-years__label {
  display: block;
  font-family: var(--font-display), sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.year-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.year-chip {
  font-family: var(--font-display), sans-serif;
  border: 2.5px solid var(--ink);
  background: var(--card);
  color: var(--ink);
  border-radius: var(--r-pill);
  padding: 9px 17px;
  min-height: 44px;
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: 0 3px 0 rgba(34, 37, 75, 0.15);
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.year-chip:active { transform: translateY(2px); }
/* Mix-up chip: inline shuffle icon + label. */
.year-chip--mix {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.year-chip--mix svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.year-chip--selected {
  background: var(--coral);
  border-color: var(--coral-deep);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--coral-deep);
}

/* Older papers (pre-2022): quieter, but padded transparent hit → 44px. */
.year-chip--older {
  position: relative;
  border-color: var(--ink-soft);
  color: var(--ink-soft);
  font-size: 13.5px;
  padding: 7px 14px;
  min-height: 40px;
  box-shadow: none;
}
.year-chip--older::after {
  content: "";
  position: absolute;
  inset: -4px;
}
.year-chip--older.year-chip--selected {
  background: var(--coral);
  border-color: var(--coral-deep);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--coral-deep);
}

.year-chips-divider {
  flex-basis: 100%;
  width: 100%;
  text-align: center;
  font-family: var(--font-display), sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 8px 0 2px;
}

/* ============ For grown-ups link (home) ============ */
.home-guide-link {
  text-align: center;
  padding: 12px 16px 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.text-link-btn {
  background: none;
  border: none;
  color: var(--coral-ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  padding: 8px 10px;
}
.home-guide-link a.text-link-btn { text-decoration: underline; }

/* ============ Monster friends (home) ============ */
.home-stickers { padding-bottom: 4px; }
.sticker-count {
  margin: 0 20px 6px;
  font-family: var(--font-display), sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.sticker-empty {
  margin: 0 16px 8px;
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  padding: 0 16px;
}
/* Die-cut sticker tiles. */
.sticker-cell {
  background: var(--card);
  border: 3px solid #fff;
  outline: 1px solid var(--hair);
  border-radius: var(--r-md);
  padding: 8px;
  box-shadow: var(--flat);
  aspect-ratio: 1 / 1;
}
.sticker-cell svg { width: 100%; height: 100%; display: block; }
.sticker-cell--wobble { animation: stickerWobble .5s ease; }
@keyframes stickerWobble {
  0%,100% { transform: rotate(0) scale(1); }
  25% { transform: rotate(-8deg) scale(1.06); }
  50% { transform: rotate(8deg) scale(1.08); }
  75% { transform: rotate(-4deg) scale(1.04); }
}

/* ============ For grown-ups screen ============ */
.topbar-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display), sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.icon-btn--spacer {
  background: none;
  box-shadow: none;
  pointer-events: none;
}
.guide-wrap {
  flex: 1;
  padding: 6px 16px 20px;
  overflow-y: auto;
}
.guide-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--flat-lg);
  padding: 24px 20px;
  max-width: 560px;
  margin: 0 auto;
}
.guide-title {
  font-family: var(--font-display), sans-serif;
  font-size: clamp(22px, 6vw, 28px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 12px;
}
.guide-card h3 {
  font-family: var(--font-display), sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--coral-ink);
  margin: 20px 0 8px;
}
.guide-card ul {
  margin: 0;
  padding-left: 20px;
}
.guide-card li {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 7px;
}
.guide-source {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 22px 0 6px;
  font-weight: 700;
}
.guide-disclaimer {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}
.guide-actions {
  margin-top: 20px;
  text-align: center;
}

/* ============ Intro screen ============ */
#screen-intro, #screen-practicedone {
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.intro-card {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--flat-lg);
  padding: 34px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.intro-monsters {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.intro-monsters svg { width: 56px; height: 56px; }
.intro-title {
  font-family: var(--font-display), sans-serif;
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 8px;
}
.intro-subtitle {
  color: var(--ink-soft);
  font-size: 15px;
  margin-bottom: 22px;
}

/* ============ Pill buttons (chunky, pressable) ============ */
.pill-btn {
  font-family: var(--font-display), sans-serif;
  border: none;
  border-radius: var(--r-pill);
  padding: 14px 28px;
  font-weight: 600;
  font-size: 16px;
  background: var(--coral);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--coral-deep);
  transition: transform .08s ease, box-shadow .08s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}
.pill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-deep); }
.pill-btn svg { width: 20px; height: 20px; }
.pill-btn--go { background: var(--coral); color: var(--ink); box-shadow: 0 4px 0 var(--coral-deep); }
.pill-btn--go:active { box-shadow: 0 1px 0 var(--coral-deep); }
.pill-btn--outline {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(34, 37, 75, 0.2), inset 0 0 0 2px var(--ink);
}
.pill-btn--outline:active {
  box-shadow: 0 1px 0 rgba(34, 37, 75, 0.2), inset 0 0 0 2px var(--ink);
}
.pill-btn--danger { background: var(--rose-deep); color: #fff; box-shadow: 0 4px 0 #9E1523; }
.pill-btn--danger:active { box-shadow: 0 1px 0 #9E1523; }
.pill-btn--small { padding: 10px 18px; font-size: 14px; min-height: 0; }

/* ============ Card / play screen ============ */
.progress-track {
  flex: 1;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  max-width: 60vw;
}
.progress-dot {
  /* Flexible: dots shrink to always fit the track width without clipping */
  flex: 0 1 11px;
  min-width: 5px;
  max-width: 11px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(34, 37, 75, 0.18);
  transition: background .2s ease, transform .2s ease;
}
.progress-dot.filled {
  background: var(--coral);
  transform: scale(1.15);
}
.progress-dot.current {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(43, 183, 196, 0.3);
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  position: relative;
  min-height: 0;
}

.word-card {
  position: relative;
  background: var(--card);
  width: 100%;
  max-width: 520px;
  min-height: 42vh;
  border-radius: var(--r-lg);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 rgba(34, 37, 75, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 8px;
  animation: cardPop .32s cubic-bezier(.2,1.4,.4,1) both;
}
@keyframes cardPop {
  from { opacity: 0; transform: scale(.9) translateY(14px); }
  to { opacity: 1; transform: none; }
}
.word-card.wobble-correct { animation: wobbleCorrect .5s ease; }
.word-card.wobble-wrong { animation: wobbleWrong .4s ease; }
@keyframes wobbleCorrect {
  0%,100% { transform: none; }
  25% { transform: rotate(-2.5deg) scale(1.02); }
  50% { transform: rotate(2.5deg) scale(1.03); }
  75% { transform: rotate(-1.5deg) scale(1.01); }
}
@keyframes wobbleWrong {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.card-monster {
  width: min(30vw, 130px);
  height: min(30vw, 130px);
}
.card-monster svg { width: 100%; height: 100%; }

.word-text {
  font-family: var(--font-display), system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 15vw, 96px);
  line-height: 1;
  margin: 6px 0 0;
  color: var(--ink);
  letter-spacing: .005em;
  word-break: break-word;
  text-align: center;
  max-width: 100%;
}
.word-kind {
  font-family: var(--font-display), sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

.hint-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 3px 0 var(--yellow-edge);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hint-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--yellow-edge); }

.hint-popover {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-md);
  padding: 16px 18px;
  max-width: 480px;
  width: 100%;
  margin-top: 12px;
  text-align: center;
  font-size: 14.5px;
  line-height: 1.5;
  box-shadow: var(--lift);
}
.hint-popover p { margin: 0 0 10px; }

.encourage {
  min-height: 22px;
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  color: var(--coral-ink);
  margin-top: 12px;
  text-align: center;
  font-size: 15px;
}

/* ============ Mark bar ============ */
.mark-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 16px calc(6px + var(--safe-bottom));
}
.undo-link {
  background: none;
  border: none;
  color: var(--coral-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  padding: 4px 10px;
}
.mark-buttons {
  display: flex;
  gap: 24px;
  align-items: center;
}
.mark-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .08s ease;
}
.mark-btn:active { transform: scale(.9); }
.mark-btn svg { width: 34px; height: 34px; }
.mark-btn--correct {
  background: var(--green-deep);
  box-shadow: 0 5px 0 #075640;
}
.mark-btn--wrong {
  background: var(--rose-deep);
  box-shadow: 0 5px 0 #9E1523;
}
.adult-hint {
  color: var(--ink-soft);
  font-size: 11.5px;
  margin: 2px 0 0;
  text-align: center;
}

/* star burst */
.burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.burst-star {
  position: absolute;
  width: 22px;
  height: 22px;
  animation: burstFly .7s ease-out forwards;
}
.burst-star svg { width: 100%; height: 100%; display: block; }
@keyframes burstFly {
  0% { transform: translate(-50%,-50%) scale(0.3); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1.1); opacity: 0; }
}

/* ============ Results screen ============ */
#screen-results {
  align-items: center;
  padding: 20px 16px;
  position: relative;
  overflow: hidden;
}
#confettiCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.results-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  text-align: center;
  margin: 0 auto;
}
.results-monster {
  width: min(34vw, 150px);
  height: min(34vw, 150px);
  margin: 6px auto 4px;
}
.results-monster svg { width: 100%; height: 100%; }
.results-score {
  font-family: var(--font-display), sans-serif;
  font-size: clamp(30px, 9vw, 48px);
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0;
}
.results-praise {
  font-family: var(--font-display), sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--green-ink);
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.results-praise svg { width: 20px; height: 20px; flex: 0 0 auto; }
.results-adultnote {
  color: var(--ink-soft);
  font-size: 12.5px;
  margin-bottom: 18px;
}

/* Newly earned sticker reveal */
.results-stickers {
  margin: 6px auto 14px;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--r-md);
  max-width: 320px;
  box-shadow: var(--flat);
}
.results-stickers__title {
  margin: 0 0 8px;
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--coral-ink);
}
.results-stickers__grid {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.results-sticker {
  width: 84px;
  height: 84px;
  background: var(--card);
  border: 3px solid #fff;
  outline: 1px solid var(--hair);
  border-radius: var(--r-md);
  padding: 6px;
}
.results-sticker svg { width: 100%; height: 100%; display: block; }
.results-sticker--pop {
  animation: stickerPop .55s cubic-bezier(.2,1.5,.4,1) both;
}
@keyframes stickerPop {
  0% { opacity: 0; transform: scale(.2) rotate(-12deg); }
  70% { opacity: 1; transform: scale(1.12) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

.review-panel {
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--hair);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 14px 0;
}
.review-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.review-chip {
  background: var(--paper-2);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-family: var(--font-display), sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.review-section-title {
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  color: var(--ink);
  margin: 14px 0 6px;
  font-size: 14.5px;
}
.review-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--hair);
  font-size: 14.5px;
}
.review-row:last-child { border-bottom: none; }
.review-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.review-mark--correct { background: var(--green-deep); color: #fff; }
.review-mark--wrong { background: var(--rose-deep); color: #fff; }
.review-word { font-family: var(--font-display), sans-serif; font-weight: 600; }
.review-type { color: var(--ink-soft); font-size: 11.5px; }

.review-misses { margin-top: 18px; }
.review-misses h3 {
  font-family: var(--font-display), sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  margin: 0 0 8px;
}
.miss-item {
  background: var(--paper-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 13.5px;
}
.miss-item strong { color: var(--ink); }
.miss-item p { margin: 4px 0 0; color: var(--ink-soft); }

.results-actions { margin-top: 20px; }

/* ============ Modal (overlay tier) ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 37, 75, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--lift);
}
.modal-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  color: var(--ink);
  font-size: 20px;
}
.modal-card p { color: var(--ink-soft); margin: 0 0 18px; font-size: 14px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============ Utility ============ */
[hidden] { display: none !important; }

/* Reduced motion — blanket safety net (kept). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Small phones */
@media (max-width: 360px) {
  .progress-track { gap: 3px; }
  .mark-btn { width: 66px; height: 66px; }
  .big-btn { min-height: 116px; padding: 16px 10px; }
  .big-btn__emoji { width: 32px; height: 32px; font-size: 28px; }
}

/* ============ Guides for parents (home) ============ */
.home-guides { padding: 6px 16px 10px; }
.guides-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
/* Flat Row tier. */
.guides-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--hair);
  border-radius: var(--r-md);
  padding: 12px 14px;
  color: var(--ink);
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  box-shadow: none;
}
.guides-list a::after {
  content: "›";
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 18px;
}
.guides-list a:active { transform: scale(.99); }

/* ============ Guide support line ============ */
.guide-support {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 18px 0 0;
  line-height: 1.5;
}
.guide-support a { color: var(--coral-ink); font-weight: 700; }

/* ============ Results support card ============ */
.support-card {
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  margin: 18px auto 0;
  max-width: 420px;
  box-shadow: none;
  text-align: center;
}
.support-card__title {
  margin: 0 0 6px;
  font-family: var(--font-display), sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.support-card__body {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}
.support-card__note {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.pill-btn--kofi {
  display: inline-flex;
  background: var(--coral);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--coral-deep);
}
.pill-btn--kofi:active { box-shadow: 0 1px 0 var(--coral-deep); }
.pill-btn--outline.pill-btn--kofi {
  background: var(--card);
  box-shadow: 0 4px 0 rgba(34, 37, 75, 0.2), inset 0 0 0 2px var(--ink);
}

/* ============ Site footer (ink panel) ============ */
.site-footer {
  margin: 16px 16px 0;
  padding: 18px 20px calc(18px + var(--safe-bottom));
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg);
  text-align: center;
  font-size: 12.5px;
  line-height: 1.9;
}
.site-footer a, .footer-link {
  color: var(--yellow);
  font-weight: 700;
  text-decoration: underline;
}
.footer-link {
  background: none;
  border: none;
  font-size: 12.5px;
  font-family: inherit;
  padding: 0;
}

/* ============ Consent bottom sheet ============ */
.consent-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  border-radius: 20px 20px 0 0;
  padding: 16px calc(18px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(18px + var(--safe-left));
  box-shadow: var(--lift);
  animation: consentIn .3s ease-out both;
}
@keyframes consentIn { from { transform: translateY(100%); } to { transform: none; } }
.consent-bar__inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  justify-content: space-between;
}
.consent-bar__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  flex: 1 1 260px;
}
.consent-bar__text a { color: var(--yellow); font-weight: 700; }
.consent-bar__actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
}
.consent-btn {
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 22px;
  font-family: var(--font-display), sans-serif;
  font-weight: 600;
  font-size: 14px;
  min-height: 44px;
  min-width: 108px;
}
/* Equal visual weight — refusing is as easy as accepting (GDPR). */
.consent-btn--ok { background: var(--green); color: var(--ink); }
.consent-btn--no { background: var(--paper); color: var(--ink); }
