/* Magic Math — kid app styles. Pink, glittery, big touch targets for iPad. */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --pink: #ff5fa2;
  --pink-deep: #e83e8c;
  --pink-soft: #ffd3e8;
  --pink-mist: #fff0f7;
  --lav: #c9a7ff;
  --purple: #8b52e0;
  --purple-deep: #6a33c2;
  --gold: #f7c341;
  --gold-deep: #e0a21a;
  --mint: #43c59e;
  --ink: #4b2257;
  --ink-soft: #7d5a88;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(214, 68, 150, .18), 0 2px 6px rgba(139, 82, 224, .12);
  --radius: 28px;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round", system-ui, sans-serif;
}

/* ── Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.9) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 8%, rgba(255,255,255,.8) 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 60% 70%, rgba(255,255,255,.8) 0 2px, transparent 3px),
    radial-gradient(circle at 30% 85%, rgba(255,255,255,.7) 0 1.5px, transparent 2.5px),
    linear-gradient(160deg, #ffe3f1 0%, #f6dcff 45%, #ffe9f4 100%);
  background-size: 180px 180px, 220px 220px, 260px 260px, 200px 200px, 100% 100%;
  background-attachment: fixed;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
h1, h2 { margin: 0; line-height: 1.15; }
main { max-width: 1060px; margin: 0 auto; padding: 16px 20px 40px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
b { color: var(--pink-deep); }

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  background: rgba(255, 240, 247, .82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 2px solid rgba(255, 95, 162, .15);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 22px; color: var(--pink-deep); }
.brand img { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(214,68,150,.3); }
.top-title { font-weight: 800; font-size: 19px; color: var(--purple-deep); white-space: nowrap; }
.spacer { flex: 1; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; font-size: 26px; line-height: 1;
  background: #fff; box-shadow: 0 3px 10px rgba(214,68,150,.2);
  display: grid; place-items: center; flex: none;
}
.icon-btn:active { transform: scale(.92); }
.back-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 52px; padding: 10px 22px 10px 18px; border-radius: 999px;
  font-size: 21px; font-weight: 800; color: #fff; white-space: nowrap;
  background: linear-gradient(180deg, #b98cf5, var(--purple));
  box-shadow: 0 4px 0 var(--purple-deep), 0 6px 14px rgba(139,82,224,.3), inset 0 2px 0 rgba(255,255,255,.35);
}
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--purple-deep); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 10px 16px; border-radius: 999px; font-size: 19px; font-weight: 800;
  background: linear-gradient(180deg, #fff6d8, #ffe39a); color: #9a6a00;
  box-shadow: 0 3px 10px rgba(224,162,26,.3), inset 0 2px 0 rgba(255,255,255,.8);
}
.pill b { color: #9a6a00; }
.sync-dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; flex: none; }
.sync-dot.ok { background: var(--mint); }
.sync-dot.syncing { background: var(--gold); animation: pulse 1s infinite; }
.sync-dot.offline { background: #f29a9a; }
.progress { flex: 1; height: 16px; border-radius: 999px; background: #fff; box-shadow: inset 0 2px 4px rgba(139,82,224,.15); overflow: hidden; min-width: 60px; }
.progress.big { height: 22px; margin-top: 14px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pink), var(--lav)); transition: width .4s ease; }

/* ── Candy buttons ─────────────────────────────────────── */
.candy {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 60px; padding: 14px 28px; border-radius: 999px;
  font-size: 22px; font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #ff8cc0 0%, var(--pink) 55%, var(--pink-deep) 100%);
  box-shadow: 0 6px 0 #c42c74, 0 10px 20px rgba(232,62,140,.35), inset 0 3px 0 rgba(255,255,255,.45);
  transition: transform .08s, box-shadow .08s;
}
.candy:active { transform: translateY(4px); box-shadow: 0 2px 0 #c42c74, 0 4px 10px rgba(232,62,140,.3), inset 0 3px 0 rgba(255,255,255,.45); }
.candy.gold { background: linear-gradient(180deg, #ffe08a, var(--gold) 55%, var(--gold-deep)); color: #6b4200; box-shadow: 0 6px 0 #b77f00, 0 10px 20px rgba(224,162,26,.35), inset 0 3px 0 rgba(255,255,255,.5); }
.candy.gold:active { box-shadow: 0 2px 0 #b77f00; }
.candy.ghost { background: #fff; color: var(--purple-deep); box-shadow: 0 6px 0 #dcc8f7, 0 8px 16px rgba(139,82,224,.15); }
.candy.ghost:active { box-shadow: 0 2px 0 #dcc8f7; }

/* ── Home ──────────────────────────────────────────────── */
.hero { position: relative; border-radius: 34px; overflow: hidden; box-shadow: var(--shadow); border: 5px solid #fff; }
.hero-img { display: block; width: 100%; height: 330px; object-fit: cover; object-position: center 35%; }
.hero-greet {
  position: absolute; left: 20px; right: 20px; bottom: 18px;
  background: rgba(255,255,255,.88); border-radius: 24px; padding: 14px 22px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hero-greet h1 { font-size: 34px; color: var(--pink-deep); }
.hero-greet p { margin: 4px 0 0; font-size: 19px; color: var(--ink-soft); }

.topic { margin-top: 26px; }
.topic-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.topic-emoji { width: 62px; height: 62px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; box-shadow: var(--shadow); }
.topic-head h2 { font-size: 30px; color: var(--purple-deep); }
.topic-head p { margin: 2px 0 0; color: var(--ink-soft); font-size: 17px; }

.path { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.stop {
  position: relative; display: flex; gap: 16px; align-items: center; text-align: left;
  padding: 18px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
  border: 4px solid transparent; transition: transform .12s;
}
.stop:active { transform: scale(.98); }
.stop-badge { width: 72px; height: 72px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 38px; background: linear-gradient(135deg, var(--pink-soft), #eadcff); }
.stop-num { font-size: 14px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--pink); }
.stop-title { font-size: 23px; font-weight: 800; color: var(--ink); }
.stop-status { margin-top: 6px; font-size: 15px; color: var(--ink-soft); }
.stop.locked { opacity: .55; filter: grayscale(.4); }
.stop.passed { border-color: #ffe39a; }
.stop.passed .stop-badge { background: linear-gradient(135deg, #fff1c2, #ffd76a); }
.stop.current { border-color: var(--pink); animation: glow 2.2s ease-in-out infinite; }
.you-here { position: absolute; right: -6px; top: -16px; display: flex; align-items: center; gap: 4px; background: var(--pink); color: #fff; font-weight: 800; font-size: 13px; padding: 4px 10px 4px 4px; border-radius: 999px; box-shadow: 0 4px 10px rgba(232,62,140,.35); }
.you-here img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; background: var(--pink-mist); color: var(--pink-deep); font-weight: 800; font-size: 14px; border: 2px solid var(--pink-soft); }
.chip.big { font-size: 20px; padding: 8px 16px; }

.home-foot { display: flex; justify-content: center; gap: 16px; margin-top: 30px; flex-wrap: wrap; }
.link-btn { padding: 12px 22px; border-radius: 999px; background: #fff; font-weight: 800; font-size: 18px; color: var(--purple-deep); text-decoration: none; box-shadow: var(--shadow); }
.link-btn.subtle { font-size: 15px; color: var(--ink-soft); box-shadow: none; background: rgba(255,255,255,.6); }

/* ── Level ─────────────────────────────────────────────── */
.level-head { display: flex; align-items: center; gap: 18px; margin: 6px 0 16px; }
.big-emoji { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 54px; background: #fff; box-shadow: var(--shadow); border: 5px solid var(--pink-soft); flex: none; }
.eyebrow { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--pink); }
.level-head h1 { font-size: 38px; color: var(--purple-deep); }

.buddy-say { display: flex; align-items: center; gap: 12px; margin: 8px 0 18px; }
.buddy-say.center { justify-content: center; }
.buddy-say img { width: 78px; height: 78px; border-radius: 50%; border: 4px solid #fff; box-shadow: var(--shadow); flex: none; animation: bob 3s ease-in-out infinite; }
.bubble { position: relative; background: #fff; border-radius: 22px; padding: 14px 18px; font-size: 19px; box-shadow: var(--shadow); max-width: 640px; }
.bubble::before { content: ''; position: absolute; left: -10px; top: 50%; margin-top: -10px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }

.step-card { display: flex; gap: 18px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.step-num { width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 26px; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--pink), var(--purple)); }
.step-main { flex: 1; min-width: 0; }
.step-main h2 { font-size: 27px; color: var(--purple-deep); margin-bottom: 6px; }
.step-main h2 small { font-size: 15px; color: var(--ink-soft); font-weight: 700; margin-left: 8px; }
.step-main p { font-size: 18px; color: var(--ink-soft); margin: 0 0 14px; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.lesson-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 16px 12px; border-radius: 22px; background: var(--pink-mist); border: 3px solid var(--pink-soft);
}
.lesson-card:active { transform: scale(.97); }
.lesson-card .le { font-size: 44px; }
.lesson-card b { font-size: 19px; color: var(--ink); }
.lesson-card small { font-size: 14px; color: var(--ink-soft); }
.lesson-card.next { border-color: var(--pink); animation: glow 2.2s ease-in-out infinite; }
.lesson-card.done { background: #effbf5; border-color: #b6ebd4; }
.check { position: absolute; top: -10px; right: -10px; width: 34px; height: 34px; border-radius: 50%; background: var(--mint); color: #fff; font-weight: 900; font-size: 20px; display: grid; place-items: center; border: 3px solid #fff; }

/* ── Run: slides ───────────────────────────────────────── */
.run { max-width: 1000px; }
.slide { padding: 30px 28px; text-align: center; max-width: 820px; margin: 10px auto; }
.slide-emoji { font-size: 70px; line-height: 1; margin-bottom: 8px; animation: bob 3s ease-in-out infinite; }
.slide h1 { font-size: 36px; color: var(--purple-deep); margin-bottom: 10px; }
.say { font-size: 22px; line-height: 1.45; color: var(--ink); margin: 8px auto 14px; max-width: 680px; }
.say.small { font-size: 18px; color: var(--ink-soft); }
.example { font-size: 56px; font-weight: 900; color: var(--ink); margin: 12px 0; }
.q-mark { color: var(--lav); }
.ex-ans { color: var(--pink-deep); animation: pop .4s ease; display: inline-block; }
.reveal-steps { list-style: none; padding: 0; margin: 0 auto 20px; max-width: 560px; }
.reveal-steps li { font-size: 24px; font-weight: 700; background: var(--pink-mist); border-radius: 18px; padding: 12px 16px; margin: 8px 0; animation: slideIn .35s ease; }
.trick-book { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; text-align: left; margin: 10px 0 16px; }
.trick-mini { background: var(--pink-mist); border-radius: 16px; padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.trick-mini span { grid-row: span 2; font-size: 26px; }
.trick-mini b { font-size: 16px; }
.trick-mini small { font-size: 13px; color: var(--ink-soft); }
.equation { font-size: 28px; font-weight: 700; margin: 16px 0 6px; }
.tag { display: inline-block; padding: 2px 12px; border-radius: 12px; font-weight: 900; color: #fff; }
.tag.g { background: var(--pink); }
.tag.e { background: var(--purple); }
.tag.x { background: var(--gold-deep); }
.detective-steps { list-style: none; padding: 0; margin: 10px auto 16px; max-width: 520px; text-align: left; }
.detective-steps li { font-size: 23px; margin: 10px 0; display: flex; align-items: center; gap: 12px; }
.story-demo { font-size: 22px; line-height: 1.8; background: var(--pink-mist); border-radius: 20px; padding: 14px 18px; margin: 12px auto; max-width: 680px; }
.clue-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0; }

/* ── Run: pictures ─────────────────────────────────────── */
.groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 12px 0; }
.group { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 2px; max-width: 176px; min-width: 64px; min-height: 64px; padding: 10px; border-radius: 50%/40%; background: #fff; border: 4px dashed var(--pink-soft); transition: all .2s; }
.groups.many .group { max-width: 140px; padding: 6px; }
.pic { font-size: 28px; line-height: 1.1; }
.groups.many .pic { font-size: 22px; }
.group.hl-group { border-color: var(--pink); background: var(--pink-mist); border-style: solid; animation: pop .5s ease; }
.pic.hl-each { filter: drop-shadow(0 0 6px var(--purple)); animation: wiggle .8s ease infinite; }
.array { display: inline-flex; flex-direction: column; gap: 6px; background: #fff; border: 4px dashed var(--pink-soft); border-radius: 20px; padding: 12px 16px; }
.array .row { font-size: 34px; letter-spacing: 6px; }

/* ── Run: questions ────────────────────────────────────── */
.quiz { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; margin-top: 10px; }
.quiz.no-pad { grid-template-columns: 1fr; max-width: 820px; margin-left: auto; margin-right: auto; }
.q-card { padding: 24px; text-align: center; min-height: 340px; display: flex; flex-direction: column; justify-content: center; }
.q-count { font-size: 15px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
.fact { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 88px; font-weight: 900; margin: 22px 0; color: var(--ink); }
.fact .op { color: var(--pink); }
.ans-box {
  display: inline-grid; place-items: center; min-width: 1.6em; padding: 0 .2em;
  border-radius: 20px; border: 5px dashed var(--lav); color: var(--lav); background: #fbf7ff;
}
.fact .ans-box { min-width: 1.9em; }
.ans-box.filled { border-style: solid; border-color: var(--purple); color: var(--purple-deep); }
.ans-box.right { border-color: var(--mint); color: #1e8f6c; background: #effbf5; animation: pop .4s ease; }
.ans-box.saved { border-color: var(--lav); color: var(--purple-deep); background: #f4ecff; }
.q-prompt { font-size: 26px; font-weight: 800; margin: 12px 0 0; }
.story { font-size: 27px; line-height: 1.65; text-align: left; margin: 14px 4px; }
.num { display: inline-block; font: inherit; font-weight: 900; min-width: 1.6em; padding: 0 .3em; margin: 0 .1em; border-radius: 12px; background: #fbf7ff; border: 3px solid #e6d8fb; color: var(--purple-deep); }
.num.g { background: var(--pink); border-color: var(--pink); color: #fff; }
.num.e { background: var(--purple); border-color: var(--purple); color: #fff; }
.num.x { background: #eee; border-color: #ddd; color: #aaa; text-decoration: line-through; }
.answer-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 24px; }
.answer-line .ans-box { font-size: 48px; font-weight: 900; min-width: 2.2em; min-height: 1.35em; }
.answer-line.tap { background: #fff7d6; border-radius: 18px; padding: 12px; }
.stage-prompt { font-size: 22px; }
.eq { font-size: 40px; font-weight: 900; }
.hint-btn { margin: 16px auto 0; padding: 10px 20px; border-radius: 999px; font-size: 18px; font-weight: 800; color: #9a6a00; background: #fff6d8; border: 2px solid #ffe39a; }

.helper { display: flex; gap: 14px; align-items: flex-start; text-align: left; margin-top: 18px; padding: 14px; border-radius: 22px; background: #fff9e6; border: 3px solid #ffe39a; animation: slideIn .35s ease; }
.helper img { width: 60px; height: 60px; border-radius: 50%; border: 3px solid #fff; flex: none; }
.helper-title { font-size: 19px; font-weight: 800; margin-bottom: 4px; }
.helper ol { margin: 0; padding-left: 22px; font-size: 21px; line-height: 1.5; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: rgba(255,255,255,.6); padding: 14px; border-radius: var(--radius); position: sticky; top: 90px; }
.key {
  height: 86px; border-radius: 24px; font-size: 40px; font-weight: 900; color: var(--purple-deep);
  background: linear-gradient(180deg, #fff, #f7efff); box-shadow: 0 6px 0 #dcc8f7, 0 8px 14px rgba(139,82,224,.15);
}
.key:active { transform: translateY(4px); box-shadow: 0 2px 0 #dcc8f7; }
.key.del { color: var(--ink-soft); font-size: 34px; }
.key.ok { color: #fff; background: linear-gradient(180deg, #ff8cc0, var(--pink-deep)); box-shadow: 0 6px 0 #c42c74, 0 8px 14px rgba(232,62,140,.3); }
.key.ok:active { box-shadow: 0 2px 0 #c42c74; }

.timer { display: flex; align-items: center; gap: 12px; max-width: 1000px; margin: 0 auto 6px; }
.timer-track { flex: 1; height: 12px; border-radius: 999px; background: #fff; overflow: hidden; }
.timer-fill { height: 100%; width: 0; background: linear-gradient(90deg, #b9f0dc, #ffe39a, #ffc2dd); border-radius: 999px; transition: width 1s linear; }
#timer-text { font-weight: 800; font-size: 18px; color: var(--ink-soft); min-width: 150px; text-align: right; }

/* ── Results ───────────────────────────────────────────── */
.result-card { padding: 30px; text-align: center; max-width: 760px; margin: 10px auto; }
.result-emoji { font-size: 80px; animation: bob 3s ease-in-out infinite; }
.result-card h1 { font-size: 36px; color: var(--purple-deep); margin: 6px 0; }
.earned { display: inline-block; margin: 10px 0; padding: 10px 20px; border-radius: 999px; font-size: 24px; font-weight: 900; color: #9a6a00; background: linear-gradient(180deg, #fff6d8, #ffe39a); animation: pop .6s ease; }
.result-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 16px; }
.score-ring {
  --p: 0; width: 170px; height: 170px; margin: 0 auto 10px; border-radius: 50%;
  background: conic-gradient(var(--lav) calc(var(--p) * 1%), #f1e8fb 0);
  display: grid; place-items: center;
}
.score-ring.pass { background: conic-gradient(var(--pink) calc(var(--p) * 1%), #fde3ef 0); }
.score-ring span { width: 132px; height: 132px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 44px; font-weight: 900; color: var(--purple-deep); }
.unlock-banner { margin: 12px auto; padding: 14px 20px; border-radius: 20px; font-size: 22px; background: linear-gradient(90deg, #fff1c2, #ffd3e8); animation: pop .6s ease; }
.missed { padding: 22px 26px; max-width: 760px; margin: 18px auto; }
.missed h2 { font-size: 26px; color: var(--purple-deep); margin-bottom: 8px; }
.missed ul { list-style: none; padding: 0; margin: 0; }
.missed li { padding: 12px 0; border-top: 2px dashed var(--pink-soft); }
.m-fact { font-size: 26px; font-weight: 800; }
.m-said { font-size: 17px; color: var(--ink-soft); font-weight: 600; }
.m-trick { font-size: 18px; color: var(--ink-soft); margin-top: 2px; }

/* ── Stickers ──────────────────────────────────────────── */
.sticker-head { padding: 24px; text-align: center; max-width: 760px; margin: 10px auto; }
.sticker-head h1 { font-size: 38px; color: var(--pink-deep); }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; max-width: 900px; margin: 20px auto; }
.sticker { aspect-ratio: 1; border-radius: 26px; display: grid; place-items: center; font-size: 56px; background: rgba(255,255,255,.55); border: 3px dashed #e8d3f5; opacity: .6; }
.sticker.got { background: #fff; border: 4px solid #fff; box-shadow: var(--shadow); opacity: 1; animation: pop .5s ease; }

/* ── FX layer ──────────────────────────────────────────── */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti { position: absolute; will-change: transform, opacity; }
.toast {
  position: absolute; left: 50%; top: calc(86px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 22px 10px 10px; border-radius: 999px; background: #fff;
  font-size: 22px; font-weight: 800; color: var(--pink-deep);
  box-shadow: 0 12px 30px rgba(214,68,150,.3); border: 3px solid var(--pink-soft);
  animation: toastIn .35s cubic-bezier(.2,1.4,.4,1);
}
.toast img { width: 50px; height: 50px; border-radius: 50%; flex: none; }
.toast.big { font-size: 26px; padding: 14px 26px 14px 14px; background: linear-gradient(90deg, #fff, #fff0f7); border-color: var(--pink); }
.toast.big img { width: 64px; height: 64px; }
.toast.out { opacity: 0; transform: translate(-50%, -20px); transition: all .4s ease; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(75,34,87,.35); display: grid; place-items: center; padding: 16px; }
.modal { padding: 26px; text-align: center; max-width: 420px; animation: pop .3s ease; }
.modal img { width: 90px; height: 90px; border-radius: 50%; }
.modal h2 { font-size: 28px; color: var(--purple-deep); margin: 8px 0; }
.modal p { font-size: 19px; color: var(--ink-soft); }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Animations ────────────────────────────────────────── */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -24px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes glow { 0%, 100% { box-shadow: var(--shadow), 0 0 0 0 rgba(255,95,162,.35); } 50% { box-shadow: var(--shadow), 0 0 0 10px rgba(255,95,162,0); } }
@keyframes pulse { 50% { opacity: .4; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 860px) {
  .quiz { grid-template-columns: 1fr; }
  .pad { position: static; max-width: 520px; width: 100%; margin: 0 auto; }
  .key { height: 76px; }
  .fact { font-size: 68px; gap: 12px; }
}
@media (max-width: 600px) {
  main { padding: 12px 16px 32px; }
  .topbar { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .brand span, .top-title { display: none; }
  .back-btn { font-size: 18px; padding: 8px 16px 8px 12px; min-height: 46px; }
  .hero-img { height: 220px; }
  .hero-greet h1 { font-size: 24px; }
  .hero-greet p { font-size: 16px; }
  .lesson-grid { grid-template-columns: 1fr; }
  .path { grid-template-columns: 1fr; }
  .fact { font-size: 52px; }
  .story { font-size: 22px; }
  .slide h1, .result-card h1 { font-size: 28px; }
  .example { font-size: 42px; }
  .step-card { flex-direction: column; }
}
