:root {
  --ground: #FFF7EE;
  --card: #FFFFFF;
  --line: #F0E4D6;
  --line-2: #D9CBBB;
  --ink: #2B2240;
  --ink-2: #3D3356;
  --muted: #6B6177;
  --muted-2: #5A5066;
  --teal: #1F7A6D;
  --teal-dark: #14574D;
  --teal-soft: #E3F3EF;
  --coral: #C2482F;
  --coral-dark: #8E2F1D;
  --coral-soft: #FBE6E0;
  --sand: #F3EADF;
  --gold: #FFD98A;
  --head: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 17px; }
button, input { font: inherit; color: inherit; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
.loading, .oops { padding: 48px; font-size: 20px; }

.screen { max-width: 1280px; margin: 0 auto; padding: 32px 48px; min-height: 100vh; display: flex; flex-direction: column; gap: 24px; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 28px; padding: 28px 32px; }
.stack { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.center { text-align: center; }
.center-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.title { font-family: var(--head); font-weight: 700; font-size: 32px; line-height: 1.15; margin: 0; }
.big-title { font-size: 40px; }
.h2 { font-family: var(--head); font-weight: 600; font-size: 22px; margin: 0; }
.muted { color: var(--muted); }
.strong { font-weight: 800; }
.small { font-size: 14px; color: var(--muted); font-weight: 700; }
.light { color: #DDF2EC; }
.lead { font-size: 19px; color: var(--muted-2); margin: 0; }
.eyebrow { font-size: 15px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #CFC6E0; }
.eyebrow.dark { color: var(--muted); }
.good-text { color: var(--teal-dark); }
.bad-text { color: var(--coral-dark); }
.coral-text { color: var(--coral); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 14px 30px; border-radius: 18px; border: 3px solid transparent; font-family: var(--head); font-weight: 600; font-size: 22px; cursor: pointer; text-decoration: none; transition: transform .08s ease; }
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .choice:focus-visible, .icon-btn:focus-visible, .swatch:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.btn.primary { background: var(--coral); color: #fff; }
.btn.primary:hover { background: #A93C26; color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn.ghost:disabled { opacity: .45; cursor: default; }
.btn.ghost-light { background: transparent; color: #fff; border-color: #fff; align-self: flex-start; }
.icon-btn { width: 48px; height: 48px; flex: none; border-radius: 14px; background: #fff; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }

/* pills */
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill { display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 8px 16px; font-weight: 800; font-size: 16px; }
.pill-dark { padding: 8px 14px; border-radius: 999px; background: var(--ink-2); font-weight: 700; font-size: 15px; }
.pill-teal { padding: 8px 16px; border-radius: 999px; background: var(--teal-soft); color: var(--teal-dark); font-weight: 800; font-size: 15px; }
.pill-coral { padding: 8px 16px; border-radius: 999px; background: var(--coral-soft); color: var(--coral-dark); font-weight: 800; font-size: 15px; }
.pill-sand { padding: 6px 14px; border-radius: 999px; background: var(--sand); color: var(--muted-2); font-weight: 800; font-size: 14px; }

/* fractions */
.fr { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: .62em; line-height: 1.05; margin: 0 .08em; }
.fr-b { border-top: .12em solid currentColor; padding: .04em .18em 0; }
.mx { display: inline-flex; align-items: center; gap: .12em; white-space: nowrap; }
.how .fr, .steps .fr, .small-q .fr, .hint .fr, .trouble .fr { font-size: .75em; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--head); font-weight: 700; font-size: 26px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.hello { font-weight: 700; font-size: 18px; }
.foot { text-align: center; font-weight: 700; font-size: 15px; }

/* home */
.home-grid { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.pet-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.pet-wrap { display: flex; justify-content: center; }
.pet-name { font-family: var(--head); font-weight: 700; font-size: 34px; }
.xp { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 8px; }
.bar { height: 16px; background: #F3EADF; border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; background: var(--teal); border-radius: 999px; transition: width .6s ease; }
.bar.on-dark { background: var(--teal-dark); }
.bar.on-dark > div { background: var(--gold); }
.bar.thin { height: 12px; }
.bar > .high { background: var(--teal); }
.bar > .mid { background: #8FC9BD; }
.bar > .low { background: var(--coral); }
.stages { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--muted); }
.stage { padding: 6px 12px; border-radius: 999px; border: 2px dashed var(--line-2); }
.stage.past { background: var(--teal-soft); color: var(--teal-dark); border-color: transparent; }
.stage.now { background: var(--teal); color: #fff; border-color: transparent; }
.quest { background: var(--ink); color: #fff; border: 0; display: flex; flex-direction: column; gap: 18px; }
.quest .btn { align-self: flex-start; }
.big { font-family: var(--head); font-weight: 600; font-size: 40px; line-height: 1.1; }
.quest-note { margin: 0; color: #E4DEEF; font-size: 17px; }
.exam { display: flex; flex-direction: column; gap: 16px; }
.exam-when { font-weight: 800; font-size: 18px; color: var(--coral); }
.chapters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.chip-ch { border: 2px dashed var(--line-2); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 15px; }
.chip-ch span { font-size: 12px; font-weight: 700; }
.chip-ch.ready { background: var(--teal); border-color: var(--teal); color: #fff; }
.week { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.days { display: flex; gap: 10px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; color: var(--muted); }
.day .dot { width: 36px; height: 36px; border-radius: 50%; border: 2px dashed var(--line-2); display: flex; align-items: center; justify-content: center; }
.day.done .dot { background: var(--teal); border: 0; }
.day.now { color: var(--coral); }
.day.now .dot { border: 3px solid var(--coral); }

/* setup */
.setup { justify-content: center; align-items: center; }
.setup-card { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.field { width: 100%; display: flex; flex-direction: column; gap: 8px; font-weight: 800; text-align: left; }
.field input { height: 56px; border: 3px solid var(--ink); border-radius: 16px; padding: 0 16px; font-size: 22px; font-weight: 700; background: var(--ground); }
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 16px; border: 3px solid var(--line); background: #fff; cursor: pointer; font-weight: 800; font-size: 14px; }
.swatch.on { border-color: var(--ink); }
.swatch-dot { width: 34px; height: 34px; border-radius: 50%; }

/* quest */
.quest-screen { position: relative; }
.quest-top { display: flex; align-items: center; gap: 24px; }
.segs { flex: 1; display: grid; gap: 8px; }
.seg { height: 14px; border-radius: 999px; background: var(--line); }
.seg.right { background: var(--teal); }
.seg.wrong { background: #E9A493; }
.seg.now { background: var(--coral); }
.count { font-weight: 800; font-size: 18px; flex: none; }
.q-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 30px; padding: 40px 56px; text-align: center; }
.equation { font-family: var(--head); font-weight: 600; font-size: 84px; line-height: 1; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .25em; }
.equation .qmark, .equation .blank { color: var(--coral); }
.equation .blank { display: inline-block; min-width: 1.1em; border-bottom: 6px solid var(--coral); }
.ask { margin: 0; font-weight: 800; font-size: 20px; color: var(--muted-2); }
.word { font-size: 28px; line-height: 1.5; font-weight: 700; max-width: 820px; margin: 0; }
.word .fr { font-size: .7em; }
.small-q { font-size: 19px; text-align: left; color: var(--muted-2); }
.answer { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.boxes { display: flex; align-items: center; gap: 14px; }
.box-whole { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted); }
.boxes input { border: 3px solid var(--ink); border-radius: 16px; text-align: center; font-family: var(--head); font-weight: 600; color: var(--ink); background: var(--ground); }
.boxes input:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px var(--coral-soft); }
.box-whole input { width: 100px; height: 112px; font-size: 60px; }
.box-frac { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.box-frac input { width: 86px; height: 64px; font-size: 36px; }
.frac-line { width: 86px; height: 5px; background: var(--ink); border-radius: 3px; }
.msg { min-height: 1.4em; margin: 0; font-weight: 700; color: var(--coral-dark); font-size: 18px; }
.msg.good { color: var(--teal-dark); }
.hint { margin: 0; max-width: 680px; background: #FFF4D6; border-radius: 16px; padding: 14px 20px; font-size: 18px; font-weight: 700; color: #5C4710; }
.actions { display: flex; gap: 16px; justify-content: center; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 720px; }
.choices.wide { grid-template-columns: 1fr; max-width: 560px; }
.choice { min-height: 88px; border-radius: 20px; border: 3px solid var(--ink); background: #fff; font-family: var(--head); font-weight: 600; font-size: 34px; cursor: pointer; padding: 10px 18px; }
.choices.wide .choice { font-size: 24px; min-height: 64px; }
.choice:hover { background: var(--ground); border-color: var(--coral); }
.buddy { position: absolute; right: 64px; bottom: 48px; display: flex; align-items: flex-end; gap: 8px; pointer-events: none; }
.bubble { background: var(--ink); color: #fff; font-weight: 800; font-size: 15px; padding: 10px 16px; border-radius: 16px 16px 4px 16px; margin-bottom: 56px; }

/* answer screens */
.right-card { gap: 18px; }
.answer-show { font-family: var(--head); font-weight: 600; font-size: 64px; }
.answer-show.good { color: var(--teal-dark); }
.how { margin: 0; max-width: 720px; font-size: 20px; color: var(--muted-2); font-weight: 600; line-height: 1.5; }
.wrong-grid { flex: 1; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; }
.said { border-radius: 22px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.said > span { font-size: 14px; font-weight: 800; }
.said b { font-family: var(--head); font-weight: 600; font-size: 40px; text-align: center; }
.said.bad { background: var(--coral-soft); color: var(--coral-dark); }
.said.bad b { text-decoration: line-through; text-decoration-thickness: 3px; }
.said.good { background: var(--teal-soft); color: var(--teal-dark); }
.steps-card { display: flex; flex-direction: column; gap: 18px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; font-size: 21px; font-weight: 700; line-height: 1.5; }
.num { flex: none; width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.num.coral { background: var(--coral); }
.steps-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-top: 2px solid var(--sand); padding-top: 18px; }

/* done */
.done-screen { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; }
.celebrate { background: var(--teal); color: #fff; border-radius: 32px; padding: 40px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.celebrate-title { font-family: var(--head); font-weight: 700; font-size: 44px; line-height: 1.05; }
.celebrate-sub { font-size: 19px; font-weight: 700; color: #DDF2EC; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 22px 26px; }
.stat b { font-family: var(--head); font-weight: 600; font-size: 44px; line-height: 1; display: flex; align-items: center; gap: 8px; }
.stat small { font-size: 20px; color: var(--muted); font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--ground); border-radius: 16px; font-size: 16px; }
.end { margin-top: auto; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.end p { margin: 0; }

/* dad */
.dad { background: #F7F4F0; max-width: none; }
.dad > * { width: 100%; max-width: 1184px; margin-left: auto; margin-right: auto; }
.dad .card { border: 0; }
.dad-head { align-items: flex-end; }
.dad-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.skills { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 150px; gap: 12px 14px; align-items: center; margin: 16px 0; }
.skill-name { font-weight: 700; font-size: 16px; }
.level { font-weight: 800; font-size: 14px; }
.level.high { color: var(--teal-dark); }
.level.mid { color: var(--muted-2); }
.level.low { color: var(--coral-dark); }
.level.none { color: var(--muted); font-weight: 600; }
.troubles { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.trouble { border: 2px solid #F3D3CA; border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.trouble .small-q { font-size: 16px; }

/* smaller laptops and tablets */
@media (max-width: 960px) {
  .screen { padding: 20px 16px; }
  .home-grid, .done-screen, .wrong-grid, .dad-grid, .three { grid-template-columns: 1fr; }
  .buddy { display: none; }
  .equation { font-size: 56px; }
  .word { font-size: 22px; }
  .q-card { padding: 28px 18px; }
  .choices { grid-template-columns: 1fr; }
  .chapters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .week { flex-direction: column; align-items: flex-start; }
  .skills { grid-template-columns: 1fr; }
  .steps-foot { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
