/* Kids-first design layer: global tokens and every shared component. Load order matters: later files refine earlier ones (see docs/STRUCTURE.md). */
/* ==========================================================================
   ✨  ZUNO KIDS-FIRST DESIGN LAYER  ✨
   Warm, playful, high-energy — optimized for children ages 8–14.
   All overrides are additive; nothing above is removed.
   ========================================================================== */

/* ---------- 1. GLOBAL DESIGN TOKENS ---------- */
:root {
  --page:     #f4f0ff;
  --bg:       #fffefb;
  --card:     #ffffff;
  --ink:      #1a1135;
  --muted:    #6b6494;
  --line:     #e8e2f5;
  --y:        #ffc107;
  --y-soft:   #fff3c4;
  --y-deep:   #c87800;
  --navy:     #3730a3;
  --coral:    #f05a47;
  --purple:   #8b5cf6;
  --good:     #16a34a;
  --bad:      #dc2626;
  --good-bg:  #dcfce7;
  --bad-bg:   #fee2e2;
  --good-ink: #14532d;
  --bad-ink:  #7f1d1d;
  --radius:   22px;
  --radius-lg: 28px;
  --shadow:   0 4px 6px rgba(59,48,163,.06), 0 12px 32px rgba(59,48,163,.10);
  --shadow-lift: 0 8px 12px rgba(59,48,163,.10), 0 20px 44px rgba(59,48,163,.16);
  --shadow-pop:  0 14px 24px rgba(59,48,163,.22), 0 4px 6px rgba(59,48,163,.12);
  --head: "Nunito", "Lexend", system-ui, sans-serif;
  --body: "Nunito", "Lexend", system-ui, sans-serif;
  --num:  "Nunito", "Inter", system-ui, sans-serif;
  --hero-a: #fde68a;
  --hero-b: #fbbf24;
}

/* ---------- 2. BASE ---------- */
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  background: var(--page);
  color: var(--ink);
}
#app {
  background: var(--bg);
  border-radius: 32px;
  box-shadow: 0 2px 0 rgba(255,255,255,.9) inset, 0 30px 80px -20px rgba(59,48,163,.22);
}

/* ---------- 3. TYPOGRAPHY ---------- */
h1, h2, h3, h4 { font-family: var(--head); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: 2.2rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.18rem; }

.display {
  font-family: var(--head);
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  letter-spacing: -.03em;
  text-transform: none;
  line-height: 1.1;
}
.dash-word { border: 3px solid var(--y); border-radius: 40px; background: none; padding: 0 .28em; font-style: normal; }
.yl { color: var(--y-deep); font-style: normal; }
.eyebrow { font-family: var(--head); font-size: .8rem; font-weight: 700; letter-spacing: .12em; color: var(--y-deep); }
.lead { font-size: 1.15rem; line-height: 1.7; }

/* ---------- 4. BUTTONS ---------- */
button {
  font-family: var(--head);
  font-weight: 800;
  font-size: 1rem;
  border-radius: 16px;
  padding: 13px 26px;
  cursor: pointer;
  border: 0;
  background: var(--y);
  color: var(--ink);
  box-shadow: 0 4px 0 var(--y-deep), 0 6px 18px rgba(255,193,7,.35);
  transition: transform .12s cubic-bezier(.3,1.4,.5,1), box-shadow .12s, filter .1s;
  line-height: 1;
}
button:hover:not(:disabled) { transform: translateY(-3px) scale(1.02); box-shadow: 0 7px 0 var(--y-deep), 0 10px 24px rgba(255,193,7,.45); filter: brightness(1.04); }
button:active:not(:disabled) { transform: translateY(2px) scale(.98); box-shadow: 0 1px 0 var(--y-deep), 0 2px 8px rgba(255,193,7,.2); }
button:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
button.ghost { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: 0 3px 0 #d9d0f0, 0 4px 10px rgba(59,48,163,.10); }
button.ghost:hover:not(:disabled) { background: var(--y-soft); border-color: var(--y); box-shadow: 0 5px 0 #d0c060, 0 6px 14px rgba(59,48,163,.12); }
button.big { font-size: 1.12rem; padding: 16px 34px; border-radius: 18px; }
button.small { font-size: .9rem; padding: 9px 16px; border-radius: 12px; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }

/* ---------- 5. CARDS ---------- */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card.click { cursor: pointer; transition: transform .2s cubic-bezier(.3,1.4,.5,1), box-shadow .2s; border-top: 5px solid var(--y); }
.card.click:hover, .card.click:focus-visible { transform: translateY(-6px) scale(1.015); box-shadow: var(--shadow-lift); outline: none; }
.card.click:hover .big-emoji { animation: k-bounce-emoji .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes k-bounce-emoji { 0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.25) rotate(-10deg); } 70% { transform: scale(1.1) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
.big-emoji { font-size: 3.4rem; line-height: 1.1; display: inline-block; }

/* ---------- 6. NAV ---------- */
.nav { padding: 22px 0 12px; }
.brand { font-family: var(--head); font-weight: 900; font-size: 1.3rem; letter-spacing: -.02em; cursor: pointer; }
.links a { font-family: var(--head); font-weight: 700; color: var(--muted); padding: 7px 16px; border-radius: 99px; transition: background .15s, color .15s; }
.links a:hover { color: var(--ink); background: var(--y-soft); }
.links a.active { color: var(--navy); font-weight: 800; }
.links a.active::after { background: var(--y); width: 20px; height: 4px; border-radius: 2px; bottom: -5px; margin-left: -10px; }

/* ---------- 7. HERO CARDS ---------- */
.hero, .result-hero { background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%); border-radius: var(--radius-lg); border: 2px solid rgba(200,120,0,.18); box-shadow: 0 8px 0 rgba(180,110,0,.25), var(--shadow-lift); }
.hero .avatar { width: 100px; height: 100px; font-size: 3.8rem; border-radius: 50%; background: rgba(255,255,255,.65); box-shadow: 0 6px 20px rgba(180,110,0,.28); cursor: pointer; border: 3px solid rgba(255,255,255,.8); transition: transform .2s cubic-bezier(.3,1.4,.5,1); }
.hero .avatar:hover { transform: scale(1.1) rotate(-4deg); }
.hero h1 { font-family: var(--head); font-weight: 900; font-size: 2.4rem; }
.hero .sub { font-weight: 700; opacity: .9; font-size: 1.05rem; }
.bar { height: 12px; background: rgba(255,255,255,.45); border-radius: 99px; overflow: hidden; }
.bar > i { background: linear-gradient(90deg, var(--navy), #6366f1); border-radius: 99px; transition: width .6s cubic-bezier(.3,1.4,.5,1); }
.hero .bar > i { background: var(--navy); }
.chip { background: rgba(255,255,255,.75); border: 1.5px solid rgba(255,255,255,.5); border-radius: 99px; padding: 4px 14px; font-family: var(--head); font-weight: 700; font-size: .95rem; }
.result-hero .score { font-family: var(--head); font-size: 4.8rem; font-weight: 900; line-height: 1; letter-spacing: -.03em; }

/* ---------- 8. UNIT CARDS ---------- */
.ucard { border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .2s cubic-bezier(.3,1.4,.5,1), box-shadow .2s; }
.ucard::before { height: 5px; }
.ucard:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); }
.ucard.now { border-color: var(--y); box-shadow: 0 0 0 4px var(--y-soft), var(--shadow); }
.ucard h3 { font-family: var(--head); font-weight: 800; font-size: 1.15rem; }
.ucard .ribbon { background: var(--navy); font-family: var(--head); font-weight: 700; font-size: .78rem; padding: 4px 14px; border-radius: 99px; }
.ucard .unum { background: var(--y-soft); border: 2px solid var(--y); border-radius: 12px; font-family: var(--head); font-weight: 800; color: var(--y-deep); }

/* ---------- 9. PROGRESS BAR (quiz) ---------- */
.qprog { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
.qprog > i { background: linear-gradient(90deg, var(--y), #fbbf24); border-radius: 99px; transition: width .4s cubic-bezier(.3,1.2,.5,1); box-shadow: 0 0 8px rgba(255,193,7,.5); }

/* ---------- 10. QUESTION CARD ---------- */
.qcard { border-top: 6px solid var(--y); border-radius: var(--radius); padding: 32px 34px; box-shadow: var(--shadow); }
.q { font-family: var(--head); font-size: 1.5rem; font-weight: 800; line-height: 1.4; margin: 8px 0 24px; color: var(--ink); }
.qcard .q { font-size: 1.6rem; }

/* ---------- 11. ANSWER CHOICES ---------- */
.choices { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .choices { grid-template-columns: 1fr; } }
.choice {
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 68px;
  cursor: pointer;
  transition: transform .14s cubic-bezier(.3,1.4,.5,1), border-color .12s, background .12s, box-shadow .14s;
  box-shadow: 0 3px 0 #d9d0f0, 0 4px 10px rgba(59,48,163,.08);
}
.choice:hover:not(:disabled) { border-color: var(--y); background: var(--y-soft); transform: translateY(-3px) scale(1.015); box-shadow: 0 6px 0 #d0c060, 0 8px 20px rgba(255,193,7,.25); }
.choice:active:not(:disabled) { transform: translateY(1px) scale(.99); box-shadow: 0 1px 0 #d9d0f0; }
.choice .k { flex: none; width: 36px; height: 36px; border-radius: 12px; background: var(--y-soft); border: 2px solid var(--y); display: grid; place-items: center; font-family: var(--head); font-size: .95rem; font-weight: 900; color: var(--y-deep); transition: background .12s, border-color .12s; }
.choice.sel { border-color: var(--navy); background: #eef0ff; box-shadow: 0 4px 0 #2e289a, 0 6px 16px rgba(55,48,163,.2); }
.choice.sel .k { background: var(--navy); color: #fff; border-color: var(--navy); }
.choice.right { border-color: var(--good); background: var(--good-bg); color: var(--good-ink); box-shadow: 0 4px 0 #15803d, 0 6px 16px rgba(22,163,74,.25); animation: k-choice-pop .45s cubic-bezier(.3,1.6,.5,1) both; }
.choice.right .k { background: var(--good); color: #fff; border-color: var(--good); }
.choice.wrong { border-color: var(--bad); background: var(--bad-bg); color: var(--bad-ink); box-shadow: 0 4px 0 #b91c1c, 0 6px 16px rgba(220,38,38,.2); animation: k-choice-shake .45s ease both; }
.choice.wrong .k { background: var(--bad); color: #fff; border-color: var(--bad); }
@keyframes k-choice-pop  { 0% { transform: scale(.97); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes k-choice-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- 12. FEEDBACK PANEL ---------- */
.feedback { border-radius: 18px; padding: 18px 20px; margin-top: 20px; display: flex; gap: 16px; align-items: center; animation: rise .3s ease both; border: 2px solid transparent; }
.feedback.ok { background: var(--good-bg); color: var(--good-ink); border-color: #86efac; }
.feedback:not(.ok) { background: var(--bad-bg); color: var(--bad-ink); border-color: #fca5a5; }
.feedback b { font-family: var(--head); font-size: 1.2rem; font-weight: 800; }

/* ---------- 13. LESSON ---------- */
.learn-grid .lesson { padding: 36px 40px; font-size: 1.08rem; }
.lesson h3 { font-family: var(--head); font-weight: 800; font-size: 1.28rem; margin: 28px 0 10px; }
.lesson h3::before { width: 10px; height: 26px; background: var(--y); border-radius: 5px; }
.lesson .intro { font-family: var(--head); font-size: 1.15rem; font-weight: 700; background: linear-gradient(135deg, var(--y-soft), #fff8e1); border-radius: 18px; padding: 16px 20px; border-left: 6px solid var(--y); margin: 12px 0 20px; }
.lesson .recap { background: linear-gradient(135deg, var(--navy), #4338ca); color: #fff; border-radius: 18px; padding: 20px 24px; margin: 24px 0 8px; border: 2px solid rgba(255,255,255,.15); }
.lesson .recap b { color: var(--y); background: none; }
.lesson .tip { background: #e8faf0; border: 2px solid #86efac; border-radius: 16px; }
.lesson .warn { background: #fff7ed; border: 2px solid #fdba74; border-radius: 16px; }
.lesson b { background: linear-gradient(transparent 64%, rgba(255,193,7,.4) 64%); }
.coach-card { background: linear-gradient(160deg, var(--y-soft), #fffef5); border: 2px solid #fde68a; border-radius: var(--radius); padding: 24px; text-align: center; gap: 14px; box-shadow: var(--shadow); }
.coach-card .bubble { font-family: var(--head); font-weight: 700; font-size: 1.05rem; background: #fff; border: 2px solid var(--y); border-radius: 18px; padding: 12px 16px; box-shadow: 0 4px 10px rgba(180,110,0,.15); }

/* ---------- 14. SEGMENT PROGRESS (step dots) ---------- */
.segs i { height: 14px; border-radius: 99px; background: var(--line); transition: background .3s, transform .2s; }
.segs i.done { background: linear-gradient(90deg, var(--y), #fbbf24); box-shadow: 0 0 6px rgba(255,193,7,.4); }
.segs i.cur { background: linear-gradient(90deg, var(--y) 50%, var(--line) 50%); box-shadow: 0 0 0 4px var(--y-soft); }
.segs i.done:hover { transform: scaleY(1.5); }

/* ---------- 15. BADGES ---------- */
.badge .ic { font-size: 2.2rem; width: 68px; height: 68px; border-radius: 50%; background: var(--y-soft); border: 3px solid var(--y); box-shadow: 0 4px 0 var(--y-deep); transition: transform .2s cubic-bezier(.3,1.6,.5,1), box-shadow .2s; }
.badge:not(.locked) .ic:hover { transform: scale(1.18) rotate(-8deg); box-shadow: 0 6px 0 var(--y-deep), 0 8px 20px rgba(255,193,7,.35); }
.bd-chip { width: 44px; height: 44px; border-radius: 50%; font-size: 1.25rem; border: 3px solid var(--y); background: var(--y-soft); box-shadow: 0 3px 0 var(--y-deep); transition: transform .2s cubic-bezier(.3,1.6,.5,1), box-shadow .2s; }
.bd-chip:hover, .bd-chip:focus-visible { transform: translateY(-4px) scale(1.18); box-shadow: 0 7px 0 var(--y-deep), 0 8px 18px rgba(255,193,7,.3); outline: 0; }
.bd-chip.lock { border: 2px dashed var(--line); box-shadow: none; opacity: .4; }

/* ---------- 16. STREAK & GOAL ---------- */
.sdot { border-radius: 12px; background: var(--y-soft); min-height: 52px; transition: transform .15s; }
.sdot.on { background: linear-gradient(135deg, #fde68a, #fbbf24); box-shadow: 0 3px 0 var(--y-deep); }
.sdot.on:hover { transform: translateY(-2px); }
.ring { background: conic-gradient(var(--y) calc(var(--p) * 1%), #e8e2f5 0); box-shadow: 0 4px 10px rgba(255,193,7,.3); }
.ring::before { inset: 10px; }

/* ---------- 17. PILLS ---------- */
.pill { font-family: var(--head); font-weight: 700; border-radius: 99px; padding: 3px 14px; }
.pill.mastered { background: #dcfce7; color: #15803d; border: 2px solid #86efac; }
.pill.getting  { background: var(--y-soft); color: #92400e; border: 2px solid #fcd34d; }
.pill.needs    { background: #fee2e2; color: #991b1b; border: 2px solid #fca5a5; }
.pill.now      { background: #ede9fe; color: var(--navy); border: 2px solid #c4b5fd; }

/* ---------- 18. TOAST & EFFECTS ---------- */
.xpfloat { font-family: var(--head); font-weight: 900; font-size: 1.7rem; color: var(--y-deep); text-shadow: 0 2px 0 #fff, 0 4px 0 rgba(0,0,0,.1); }
.toast { font-family: var(--head); font-weight: 800; font-size: 1.05rem; background: var(--navy); border-radius: 20px; padding: 14px 24px; box-shadow: 0 6px 0 #1e1b8a, var(--shadow-pop); }
#buddy .say { font-family: var(--head); font-weight: 700; font-size: 1rem; border: 2.5px solid var(--y); border-radius: 20px; padding: 12px 16px; box-shadow: 0 4px 0 var(--y-deep), var(--shadow); }

/* ---------- 19. CRUMBS & FORMS ---------- */
.crumbs { font-family: var(--head); font-weight: 700; }
.crumbs a:hover { background: var(--y-soft); color: var(--ink); }
.crumbs b { background: var(--y-soft); color: var(--ink); font-weight: 800; }
input, select { font-family: var(--head); font-size: 1rem; font-weight: 600; padding: 12px 16px; border-radius: 14px; border: 2.5px solid var(--line); background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { border-color: var(--y); box-shadow: 0 0 0 4px rgba(255,193,7,.22); outline: none; }

/* ---------- 20. QUICK-CHECK DOTS ---------- */
.checkdots i { width: 18px; height: 18px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.checkdots i.ok  { background: var(--good); transform: scale(1.2); }
.checkdots i.bad { background: var(--bad); }
.checkdots i.cur { outline: 3px solid var(--y); outline-offset: 2px; }

/* ---------- 21. BANNER & SUBJECT ---------- */
.banner { border-radius: var(--radius-lg); border: 2px solid transparent; padding: 36px 40px; box-shadow: var(--shadow); }
.banner .display { font-family: var(--head); font-weight: 900; }
.banner-art .bigicon { font-size: 8rem; filter: drop-shadow(0 20px 16px rgba(0,0,0,.20)); animation: bob 4s ease-in-out infinite; }
.tier { font-family: var(--head); font-size: 1.4rem; font-weight: 800; margin: 32px 0 12px; }
.tier span { background: var(--navy); color: #fff; font-size: .8rem; font-weight: 800; padding: 4px 14px; border-radius: 99px; letter-spacing: .06em; }

/* ---------- 22. DASH STAT CARDS ---------- */
.dcard { border-radius: var(--radius); border: 2px solid var(--line); box-shadow: var(--shadow); transition: transform .18s cubic-bezier(.3,1.4,.5,1), box-shadow .18s; }
.dcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.dcard h3 { font-family: var(--head); font-weight: 800; font-size: 1.05rem; }

/* ---------- 23. ACCENTS ---------- */
html[data-accent=blue]   { --y:#38bdf8; --y-soft:#e0f2fe; --y-deep:#0369a1; --hero-a:#bae6fd; --hero-b:#7dd3fc; }
html[data-accent=pink]   { --y:#f472b6; --y-soft:#fce7f3; --y-deep:#be185d; --hero-a:#fbcfe8; --hero-b:#f9a8d4; }
html[data-accent=green]  { --y:#4ade80; --y-soft:#dcfce7; --y-deep:#16a34a; --hero-a:#bbf7d0; --hero-b:#86efac; }
html[data-accent=violet] { --y:#a78bfa; --y-soft:#ede9fe; --y-deep:var(--purple); --hero-a:#ddd6fe; --hero-b:#c4b5fd; }

/* ---------- 24. RESPONSIVE ---------- */
@media (max-width: 860px) {
  #app { border-radius: 0; box-shadow: none; }
  .qcard { padding: 22px; }
  .learn-grid .lesson { padding: 24px; }
  .choices { gap: 12px; }
  .choice { padding: 16px 18px; min-height: 60px; font-size: 1rem; }
  .q { font-size: 1.35rem; }
  .qcard .q { font-size: 1.45rem; }
  .banner { padding: 24px 22px; }
}
@media (max-width: 560px) {
  .choice { min-height: 56px; border-radius: 14px; }
  .q { font-size: 1.25rem; }
  body { font-size: 16px; }
  .hero h1 { font-size: 1.9rem; }
  .result-hero .score { font-size: 3.8rem; }
  button.big { font-size: 1.05rem; padding: 14px 28px; }
}

/* ---------- 25. ANIMATIONS ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
#app > * { animation: rise .38s cubic-bezier(.3,1.2,.5,1) both; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1.2deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: .55; } 50% { transform: scale(.65) rotate(25deg); opacity: 1; } }

/* ---------- 26. REDUCE MOTION ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation: none !important; transition: none !important; }

/* ---------- 27. LARGE TEXT ---------- */
html[data-text=l]  { font-size: 113%; }
html[data-text=xl] { font-size: 127%; }
html[data-text] body { font-size: 1rem; }

/* ---------- 28. SCROLLBAR ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--page); }
::-webkit-scrollbar-thumb { background: #c4b5fd; border-radius: 99px; border: 2px solid var(--page); }
::-webkit-scrollbar-thumb:hover { background: var(--navy); }

/* ===== END KIDS-FIRST LAYER ===== */
#update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 90; background: #14142b; color: #fff; padding: 10px 14px 10px 18px; border-radius: 999px; font: 600 .95rem Lexend, system-ui, sans-serif; display: flex; gap: 12px; align-items: center; box-shadow: 0 10px 28px rgba(20,20,43,.35); }
#update-bar button { border: 0; background: #ffd23f; color: #14142b; border-radius: 999px; padding: 8px 14px; font: 800 .9rem Lexend, system-ui, sans-serif; cursor: pointer; min-height: 0; box-shadow: none; text-shadow: none; letter-spacing: 0; }
