:root {
  color-scheme: light;
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #20223a;
  --muted: #656b82;
  --pink: #e2557f;
  --pink-dark: #c53d67;
  --pink-soft: #ffe9f0;
  --green: #168b63;
  --red: #c43f52;
  --card: rgba(255, 255, 255, .92);
  --piece-empty: #f2edf7;
  --whole-line: #b9a7c4;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, #ffe5f0 0, transparent 28rem),
    radial-gradient(circle at 95% 12%, #e6f7ff 0, transparent 30rem),
    linear-gradient(145deg, #fff6fa, #fffaf2);
}
button { font: inherit; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 20px 0 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.back-link, .done-back { color: var(--pink-dark); font-weight: 850; text-decoration: none; }
.score-pill { display: flex; gap: 6px; align-items: center; padding: 9px 14px; border-radius: 999px; background: white; box-shadow: 0 8px 24px rgba(104, 40, 68, .1); font-size: 17px; }
.screen { animation: arrive .28s ease both; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.done-screen { width: min(760px, 100%); margin: 30px auto 0; text-align: center; }
.hero-icon { display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 15px; border-radius: 28px; background: white; box-shadow: 0 18px 50px rgba(143, 49, 88, .16); font-size: 42px; transform: rotate(-3deg); }
.eyebrow { margin: 0 0 8px; color: var(--pink); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 900; }
h1 { margin: 0; font-size: clamp(38px, 7vw, 64px); line-height: 1; letter-spacing: -.055em; }
.intro { margin: 18px auto 25px; max-width: 610px; color: var(--muted); font-size: 18px; line-height: 1.55; }

.primary-button { min-width: 190px; margin-top: 22px; padding: 15px 28px; border: 0; border-radius: 16px; color: white; background: linear-gradient(135deg, #f2708f, #d9457a); box-shadow: 0 12px 28px rgba(217, 69, 122, .28); font-weight: 900; cursor: pointer; }
.primary-button:hover { transform: translateY(-1px); }

.game-screen { margin-top: 12px; }
.progress-row { display: grid; grid-template-columns: auto minmax(120px, 300px); justify-content: space-between; align-items: center; gap: 18px; margin: 10px 4px 18px; color: #6b5b66; font-size: 13px; font-weight: 850; }
.progress-track { height: 8px; border-radius: 999px; background: rgba(226, 85, 127, .16); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #f2708f, #d9457a); transition: width .3s ease; }

.quiz-panel { position: relative; width: min(720px, 100%); margin: 0 auto; padding: 26px 24px 28px; border: 1px solid rgba(112, 46, 78, .09); border-radius: 28px; background: var(--card); box-shadow: 0 18px 50px rgba(106, 46, 76, .1); text-align: center; transition: box-shadow .2s ease; }
.quiz-panel.answered-correct { box-shadow: 0 18px 50px rgba(22, 139, 99, .22); }
.quiz-panel.answered-wrong { box-shadow: 0 18px 50px rgba(196, 63, 82, .2); }

.tt-title { font-size: clamp(26px, 5.4vw, 40px); font-weight: 900; letter-spacing: .04em; line-height: 1; }
.tt-title small { margin: 0 8px; color: var(--muted); font-size: .42em; text-transform: uppercase; letter-spacing: .14em; vertical-align: middle; }
.tt-pink { color: #ef5f92; } .tt-orange { color: #f79433; } .tt-teal { color: #2bb4c8; } .tt-green { color: #4aab55; }

.instruction { margin: 16px 0 4px; font-size: clamp(17px, 3vw, 21px); font-weight: 850; }

.stage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin: 6px 0 4px; }
.stage-star { color: #ffce3d; font-size: clamp(20px, 4vw, 30px); }
.stage-art { display: grid; place-items: center; min-height: 168px; padding: 10px 0; }
/* Benchmark, compare and equal-parts questions carry no stimulus of their own —
   the question is entirely in the instruction and the two choices. */
.stage-none { min-height: 0; padding: 0; }
.shape-set .piece { stroke-width: 2.5; }
.shape-trapezoid .piece, .shape-triangle .piece { stroke-width: 2.6; }
.stage-art .shape { max-height: 152px; }

.shape { max-width: 100%; overflow: visible; filter: drop-shadow(0 5px 10px rgba(146, 96, 26, .16)); }
.shape .piece { stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
.shape .piece.off { fill: var(--piece-empty); }
.shape .s0 { stop-color: #ffcf63; }
.shape .s1 { stop-color: #f28f16; }
.shape .whole { fill: none; stroke: var(--whole-line); stroke-width: 3; }
.shape-circle .whole { stroke-width: 3.5; }
.shape-circle.dense .piece { stroke-width: 1.8; }

.big-fraction { display: inline-grid; justify-items: center; gap: 6px; padding: 10px 26px; border-radius: 26px; background: linear-gradient(160deg, #fff3f7, #ffe7ef); box-shadow: inset 0 0 0 2px rgba(226, 85, 127, .16); font-size: clamp(50px, 11vw, 78px); font-weight: 900; line-height: .96; color: var(--pink-dark); }
.big-fraction i { width: 100%; min-width: 1.15em; height: 7px; border-radius: 4px; background: currentColor; }

.choice-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.or-badge { order: 1; flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 900; letter-spacing: .1em; }
.choice-row .choice:first-of-type { order: 0; }
.choice-row .choice:last-of-type { order: 2; }
.choice { flex: 1 1 0; max-width: 250px; padding: 16px 14px; border: 3px solid rgba(112, 46, 78, .14); border-radius: 22px; background: white; box-shadow: 0 10px 26px rgba(106, 46, 76, .1); cursor: pointer; transition: transform .15s ease, border-color .15s ease; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--pink); }
.choice:disabled { cursor: default; }
.choice-text .choice span { font-size: clamp(28px, 6vw, 40px); font-weight: 900; letter-spacing: .01em; }
.choice-art .choice { padding: 14px 12px; }
.choice-art .shape { max-height: 108px; }
.choice.correct { border-color: var(--green); background: #ecfaf4; }
.choice.wrong { border-color: var(--red); background: #fdeef0; }

.feedback { min-height: 46px; margin: 16px 4px 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.feedback.good { color: var(--green); }
.feedback.bad { color: var(--red); }
.next-button { margin-top: 4px; }

.correct-sticker { position: absolute; top: -18px; right: -10px; width: clamp(84px, 18vw, 122px); pointer-events: none; animation: pop .38s cubic-bezier(.2, 1.5, .5, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.4) rotate(-14deg); } to { opacity: 1; transform: none; } }
.correct-sticker .star-burst { fill: #ffd84d; }
.correct-sticker .face { fill: #ffe27a; stroke: #e8a92b; stroke-width: 3; }
.correct-sticker .smile { fill: none; stroke: #7a4b12; stroke-width: 5; stroke-linecap: round; }
.correct-sticker .eye { fill: #7a4b12; }
.correct-sticker .confetti { fill: #ef5f92; }
.correct-sticker .c2 { fill: #2bb4c8; }
.correct-sticker .c3 { fill: #4aab55; }
.correct-sticker .c4 { fill: #f79433; }

.review-list { display: grid; gap: 8px; width: min(560px, 100%); margin: 6px auto 0; text-align: left; }
.review-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 11px 15px; border-radius: 16px; background: white; box-shadow: 0 8px 22px rgba(106, 46, 76, .08); font-size: 14px; }
.review-index { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px; background: #f3f0f7; font-weight: 900; font-size: 12px; }
.review-row.ok .review-index { background: #d9f5e8; color: var(--green); }
.review-row.no .review-index { background: #fde3e7; color: var(--red); }
.review-text { color: var(--muted); }
.review-answer { font-weight: 900; }

@media (max-width: 560px) {
  .quiz-panel { padding: 20px 15px 22px; }
  .stage { grid-template-columns: 1fr; }
  .stage-star { display: none; }
  .choice-row { gap: 8px; }
  .choice { padding: 13px 9px; }
  /* Two ten-piece bars side by side leave each piece a few pixels wide on a
     phone, so stack the picture choices and let each one run full width. */
  .choice-art { flex-direction: column; }
  .choice-art .choice { width: 100%; max-width: none; }
  .choice-art .shape { max-height: 84px; }
}
