/* ============================================================
   Maths Adventure — gamified IB Grade 1 & 2 maths app
   Kid-friendly, colourful, animated. No external CSS deps.
   ============================================================ */

:root {
  --font-head: 'Baloo 2', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', 'Trebuchet MS', system-ui, -apple-system, sans-serif;

  --c-number: #3b82f6;       /* blue   */
  --c-pattern: #f59e0b;      /* amber  */
  --c-measure: #10b981;      /* green  */
  --c-shape: #ec4899;        /* pink   */
  --c-data: #8b5cf6;         /* violet */

  --ink: #1f2540;
  --ink-soft: #5a6080;
  --paper: #ffffff;
  --bg: #eef3ff;
  --good: #16a34a;
  --bad: #ef4444;
  --gold: #f5b50a;

  --shadow: 0 8px 22px rgba(40, 50, 110, 0.14);
  --shadow-lg: 0 16px 40px rgba(40, 50, 110, 0.22);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 10% -5%, #ffe7a8 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #c9e6ff 0%, transparent 50%),
    radial-gradient(800px 700px at 50% 120%, #ffd6ef 0%, transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; }

a { color: inherit; }

/* ---------------- Top bar + HUD ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(120deg, #6d5dfc, #8a5cf6 45%, #c44ee0);
  color: #fff;
  box-shadow: 0 4px 18px rgba(80, 60, 180, .35);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 1.35rem; white-space: nowrap; }
.brand-logo { font-size: 1.7rem; animation: bob 3s ease-in-out infinite; }
.brand-accent { color: #ffe27a; }

.hud { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.hud-item {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.18);
  border: 2px solid rgba(255,255,255,.28);
  padding: 4px 11px; border-radius: 999px;
  font-weight: 800; font-size: .98rem;
  backdrop-filter: blur(4px);
}
.hud-level { position: relative; padding-right: 14px; }
.hud-avatar { font-size: 1.3rem; }
.hud-level-badge { font-size: .82rem; }
.hud-xpbar { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 4px; background: rgba(0,0,0,.2); border-radius: 4px; overflow: hidden; }
.hud-xpfill { height: 100%; width: 0%; background: linear-gradient(90deg, #ffe27a, #ffd24a); transition: width .6s cubic-bezier(.2,.9,.3,1.3); }
.hud-sound { background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.28); color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 1.1rem; cursor: pointer; }
.hud-sound:hover { background: rgba(255,255,255,.32); }

.menu-toggle { display: none; background: rgba(255,255,255,.2); border: 0; color: #fff; font-size: 1.4rem; border-radius: 12px; padding: 4px 10px; cursor: pointer; }

.topnav {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 10px; position: sticky; top: 58px; z-index: 40;
  background: rgba(255,255,255,.82); backdrop-filter: blur(8px);
  border-bottom: 2px solid #e6ebff;
}
.nav-link {
  text-decoration: none; color: var(--ink); font-weight: 800;
  padding: 8px 14px; border-radius: 999px; background: #fff;
  border: 2px solid #e3e8ff; transition: .15s; font-size: .95rem;
}
.nav-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c9d2ff; }
.nav-link.active { background: linear-gradient(120deg,#6d5dfc,#c44ee0); color: #fff; border-color: transparent; }

/* ---------------- Layout ---------------- */
.app { max-width: 1080px; margin: 0 auto; padding: 22px 18px 60px; }

.footer { text-align: center; color: var(--ink-soft); font-size: .85rem; padding: 18px; }

/* ---------------- Buttons ---------------- */
.btn {
  font-family: var(--font-head); font-weight: 700; font-size: 1.05rem;
  border: 0; border-radius: 16px; padding: 12px 22px; cursor: pointer;
  background: linear-gradient(120deg,#6d5dfc,#a64ff0); color: #fff;
  box-shadow: 0 6px 0 #4b3fc4, var(--shadow); transition: .08s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #4b3fc4, var(--shadow); }
.btn.btn-good { background: linear-gradient(120deg,#22c55e,#16a34a); box-shadow: 0 6px 0 #0f7a37, var(--shadow); }
.btn.btn-good:active { box-shadow: 0 2px 0 #0f7a37; }
.btn.btn-soft { background: #fff; color: var(--ink); box-shadow: 0 5px 0 #d7ddf5, var(--shadow); }
.btn.btn-soft:active { box-shadow: 0 2px 0 #d7ddf5; }
.btn.btn-amber { background: linear-gradient(120deg,#fbbf24,#f59e0b); box-shadow: 0 6px 0 #b9760a, var(--shadow); }
.btn-lg { font-size: 1.2rem; padding: 15px 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------------- Hero (home) ---------------- */
.hero {
  background: linear-gradient(120deg, #fff 0%, #fff 100%);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: center;
  position: relative; overflow: hidden;
}
.hero::before { content: "➗✖️➕➖"; position: absolute; right: -10px; top: -18px; font-size: 3rem; opacity: .08; letter-spacing: 6px; }
.hero h1 { font-size: 2.3rem; margin: 0 0 6px; background: linear-gradient(120deg,#6d5dfc,#c44ee0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 1.08rem; color: var(--ink-soft); margin: 6px 0 16px; }
.hero-art { font-size: 6rem; text-align: center; animation: bob 4s ease-in-out infinite; }

.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.stat-chip { background: #f3f5ff; border: 2px solid #e6ebff; border-radius: 14px; padding: 8px 14px; font-weight: 800; }
.stat-chip small { display: block; font-weight: 700; color: var(--ink-soft); font-size: .72rem; }

/* ---------------- Section headers ---------------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 30px 0 14px; font-size: 1.6rem; }
.section-title .pill { font-size: .8rem; background: #fff; border: 2px solid #e6ebff; border-radius: 999px; padding: 3px 12px; color: var(--ink-soft); font-family: var(--font-body); font-weight: 800; }

/* ---------------- Strand group ---------------- */
.strand-group { margin: 22px 0; }
.strand-head { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; margin-bottom: 10px; padding-left: 6px; border-left: 6px solid var(--accent, #6d5dfc); }

/* ---------------- Module cards / map ---------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.card {
  background: var(--paper); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; position: relative;
  border-top: 7px solid var(--accent, #6d5dfc); transition: .15s;
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.card .card-num { position: absolute; top: 10px; right: 12px; font-weight: 800; color: #c3c9ef; font-family: var(--font-head); }
.card .card-icon { font-size: 2.6rem; }
.card h3 { margin: 2px 0; font-size: 1.12rem; }
.card .card-blurb { color: var(--ink-soft); font-size: .9rem; flex: 1; }
.card .card-stars { font-size: 1.1rem; letter-spacing: 2px; }
.card .card-strand { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); }
.card.done::after { content: "✓"; position: absolute; top: 10px; left: 12px; width: 26px; height: 26px; background: var(--good); color: #fff; border-radius: 50%; display: grid; place-items: center; font-weight: 900; box-shadow: var(--shadow); }
.card .card-cta { margin-top: 6px; font-weight: 800; color: var(--accent); font-family: var(--font-head); }

/* ---------------- Module page ---------------- */
.crumb { color: var(--ink-soft); font-weight: 700; margin-bottom: 10px; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

.module-head {
  background: var(--paper); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 18px; border-top: 8px solid var(--accent,#6d5dfc); position: relative; overflow: hidden;
}
.module-head .mh-icon { font-size: 3.6rem; }
.module-head h1 { margin: 0; font-size: 1.8rem; }
.module-head .mh-strand { color: var(--accent); font-weight: 800; text-transform: uppercase; font-size: .8rem; letter-spacing: .5px; }
.module-head .mh-stars { margin-left: auto; font-size: 1.5rem; letter-spacing: 3px; text-align: right; }
.module-head .mh-stars small { display:block; font-size:.7rem; color: var(--ink-soft); font-family: var(--font-body); font-weight: 800; }

/* Tabs */
.tabs { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.tab {
  border: 0; cursor: pointer; font-family: var(--font-head); font-weight: 700; font-size: 1rem;
  padding: 11px 20px; border-radius: 14px 14px 0 0; background: #e7ecff; color: var(--ink-soft);
  border-bottom: 4px solid transparent; transition: .12s;
}
.tab:hover { background: #dde4ff; }
.tab.active { background: var(--paper); color: var(--ink); border-bottom-color: var(--accent); box-shadow: var(--shadow); }

.panel { background: var(--paper); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 22px; box-shadow: var(--shadow); animation: fadeIn .25s ease; }

/* Learn content blocks */
.lesson { font-size: 1.06rem; line-height: 1.6; }
.lesson h2 { font-size: 1.45rem; margin: 22px 0 8px; color: var(--accent); }
.lesson h3 { font-size: 1.18rem; margin: 18px 0 6px; }
.lesson p { margin: 8px 0; }
.lesson ul, .lesson ol { margin: 8px 0; padding-left: 24px; }
.lesson li { margin: 4px 0; }
.lesson b, .lesson strong { color: var(--ink); }

.objectives { background: #f3f7ff; border: 2px dashed #b9c8ff; border-radius: 16px; padding: 12px 16px 12px 18px; margin: 0 0 18px; }
.objectives h4 { margin: 0 0 6px; color: #4b50c4; }
.objectives ul { margin: 0; padding-left: 22px; }

.tip { background: linear-gradient(120deg,#fff7df,#fff0c2); border-left: 6px solid var(--gold); border-radius: 12px; padding: 12px 16px; margin: 14px 0; }
.tip::before { content: "💡 "; }
.tip b:first-child { color: #b8860b; }

.note { background: #eefcf3; border-left: 6px solid var(--good); border-radius: 12px; padding: 12px 16px; margin: 14px 0; }
.warn { background: #fff0f0; border-left: 6px solid var(--bad); border-radius: 12px; padding: 12px 16px; margin: 14px 0; }
.warn::before { content: "⚠️ "; }

.keyword { background: #efeaff; border: 2px solid #d8ccff; border-radius: 10px; padding: 1px 8px; font-weight: 800; color: #6b46e0; white-space: nowrap; }

/* Visual helpers */
.visual { background: #f7f9ff; border: 2px solid #e6ebff; border-radius: 16px; padding: 16px; margin: 14px 0; text-align: center; }
.visual .big { font-size: 2rem; letter-spacing: 4px; }
.tenframe { display: inline-grid; grid-template-columns: repeat(5, 36px); gap: 4px; margin: 8px; }
.tenframe span { width: 36px; height: 36px; border: 2px solid #94a3d8; border-radius: 8px; display: grid; place-items: center; font-size: 1.2rem; background: #fff; }
.tenframe span.fill { background: #ffd24a; border-color: #e0a800; }
.counters { font-size: 1.8rem; letter-spacing: 3px; }

/* --- Word-problem callout: every lesson opens with one (CPA: concrete first) --- */
.wordproblem { background: #fff7e6; border: 2px dashed #f0b429; border-radius: 16px; padding: 16px 18px; margin: 14px 0; font-size: 1.05rem; line-height: 1.5; }
.wordproblem .wp-tag { display: inline-block; background: #f0b429; color: #5a3e00; font-weight: 800; font-size: .8rem; padding: 2px 10px; border-radius: 999px; margin-bottom: 8px; }
.wordproblem .wp-emoji { font-size: 1.6rem; }

/* --- Number line --- */
.numberline { display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: wrap; margin: 14px 0; }
.numberline span { min-width: 34px; height: 34px; display: grid; place-items: center; border-top: 3px solid #94a3d8; position: relative; font-weight: 700; }
.numberline span.mark { background: #ffd24a; border-radius: 8px; border-top: 3px solid #e0a800; }

/* --- Bar model (Singapore style) --- */
.barmodel { display: flex; gap: 4px; margin: 14px auto; justify-content: center; flex-wrap: wrap; }
.barmodel .bar { min-width: 48px; padding: 12px 14px; border-radius: 10px; color: #fff; font-weight: 800; display: grid; place-items: center; }
.barmodel .bar.a { background: #5b8def; } .barmodel .bar.b { background: #2bb673; } .barmodel .bar.whole { background: #8b5cf6; }

/* --- Account / auth screens --- */
.account-wrap { max-width: 560px; margin: 0 auto; }
.auth-card { background: #fff; border: 2px solid #e6ebff; border-radius: 16px; padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.auth-card label { display: block; font-weight: 700; margin: 8px 0; color: var(--ink-soft); }
.auth-card input[type=email], .auth-card input[type=password], .auth-card input[type=text] {
  width: 100%; box-sizing: border-box; padding: 12px 14px; border: 2px solid #cfd8ff; border-radius: 12px; font-size: 1rem; margin-top: 4px; }
.auth-msg { min-height: 1.2em; color: var(--c-shape); font-weight: 700; text-align: center; }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin: 14px 0; }
.child-card { background: #fff; border: 3px solid #e6ebff; border-radius: 16px; padding: 16px 10px; cursor: pointer; display: grid; gap: 4px; place-items: center; transition: .15s; font: inherit; }
.child-card:hover { border-color: #b9c6ff; transform: translateY(-2px); }
.child-card.active { border-color: #22c55e; background: #f0fff6; }
.child-emoji { font-size: 2.2rem; }
.child-name { font-weight: 800; font-size: 1.05rem; }
.child-on { color: #16a34a; font-weight: 800; font-size: .85rem; }
.child-pick { color: var(--ink-soft); font-size: .8rem; }

/* --- Freemium: locked cards + paywall --- */
.card.locked { opacity: .9; position: relative; }
.card.locked .card-icon { filter: grayscale(.5); }
.card-lock { position: absolute; top: 10px; right: 12px; font-size: 1.3rem; }
.paywall { max-width: 720px; margin: 0 auto; text-align: center; }
.pw-emoji { font-size: 3rem; }
.pw-sub { font-size: 1.1rem; color: var(--ink-soft); max-width: 560px; margin: 6px auto 18px; }
.pw-plans { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.pw-plan { background: #fff; border: 3px solid #e6ebff; border-radius: 18px; padding: 20px 26px; min-width: 200px; position: relative; box-shadow: var(--shadow); }
.pw-plan.pw-best { border-color: #22c55e; }
.pw-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: #22c55e; color: #fff; font-weight: 800; font-size: .75rem; padding: 3px 12px; border-radius: 999px; }
.pw-plan-name { font-weight: 800; color: var(--ink-soft); }
.pw-price { font-size: 2rem; font-weight: 800; margin: 6px 0 12px; } .pw-price small { font-size: .9rem; color: var(--ink-soft); font-weight: 600; }
.pw-perks { display: grid; gap: 6px; max-width: 380px; margin: 14px auto; text-align: left; font-weight: 600; }
.pw-note { color: var(--ink-soft); }
.pw-free { margin-top: 22px; padding-top: 16px; border-top: 2px dashed #e6ebff; }

/* --- Legal pages --- */
.legal { max-width: 720px; margin: 0 auto; }
.legal h2 { margin-top: 1.4em; }
.legal-nav { font-weight: 700; margin-bottom: 10px; }
.legal-foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid #e6ebff; color: var(--ink-soft); font-size: .9rem; }
.footer-links { margin-top: 6px; }
.footer-links a { color: inherit; text-decoration: underline; margin: 0 2px; }

/* --- Print worksheet button --- */
.module-tools { display: flex; justify-content: flex-end; margin: 6px 0 -4px; }
.btn-print { font-size: .9rem; }

/* --- Pie chart (data lesson) --- */
.piechart { width: 130px; height: 130px; border-radius: 50%; margin: 10px auto; box-shadow: var(--shadow); }

/* --- Curriculum alignment line on home hero --- */
.align-line { font-size: .95rem; color: var(--ink-soft); background: #fff; display: inline-block; padding: 6px 12px; border-radius: 999px; border: 2px solid #e6ebff; margin-top: 4px; }

/* --- Placement quiz ("Find my level") --- */
.placement { max-width: 560px; margin: 0 auto; text-align: center; }
.place-q { font-size: 1.4rem; font-weight: 800; margin: 18px 0; }
.place-opt { min-width: 90px; }
.place-result { font-size: 1.8rem; margin: 12px 0; }

/* --- Landing page (logged-out) --- */
body.landing .topnav, body.landing .hud, body.landing .menu-toggle { display: none !important; }
body.landing .app { padding-top: 8px; }

/* Two-column hero */
.lp-hero2 { position: relative; display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f7ecff 50%, #eafff4 100%);
  border-radius: 28px; padding: 34px 34px; margin: 8px 0 10px; overflow: hidden; }
.lp-blob { position: absolute; border-radius: 50%; filter: blur(8px); opacity: .35; z-index: 0; }
.lp-blob-a { width: 200px; height: 200px; background: #b9c6ff; top: -60px; right: -40px; }
.lp-blob-b { width: 160px; height: 160px; background: #ffd24a; bottom: -50px; left: -30px; opacity: .25; }
.lp-hero-left, .lp-hero-right { position: relative; z-index: 1; }
.lp-badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lp-chip { font-size: .82rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.lp-chip-heart { background: #ffe3ef; color: #c2185b; }
.lp-chip-ib { background: #e3ecff; color: #3b5bdb; }
.lp-hero2 h1 { font-size: 2.5rem; line-height: 1.12; margin: 6px 0 12px; }
.lp-hl { color: #e84a8a; }
.lp-lede { font-size: 1.12rem; color: var(--ink-soft); margin: 0 0 18px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-microtrust { margin-top: 12px; font-size: .85rem; color: var(--ink-soft); }

/* Live sample card (hero right) */
.lp-sample-card { background: #fff; border-radius: 22px; padding: 22px; text-align: center; box-shadow: 0 16px 40px rgba(60,60,120,.16); transform: rotate(-1.2deg); }
.lp-sample-tag { display: inline-block; background: #efe9ff; color: #6b4bd6; font-weight: 800; font-size: .8rem; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px; }
.lss-q { font-size: 1.5rem; font-weight: 800; margin: 8px 0 16px; line-height: 1.4; }
.lss-opts { display: flex; gap: 10px; justify-content: center; }
.lss-opts .btn { min-width: 66px; }
.lss-fb { margin-top: 14px; font-weight: 700; color: var(--ink-soft); min-height: 1.4em; }

/* Centered peek row (no ugly gaps) */
.lp-peek { grid-template-columns: repeat(auto-fit, minmax(190px, 220px)); justify-content: center; }

@media (max-width: 780px) {
  .lp-hero2 { grid-template-columns: 1fr; text-align: center; padding: 24px 18px; }
  .lp-badge-row, .lp-cta { justify-content: center; }
  .lp-hero2 h1 { font-size: 2rem; }
  .lp-sample-card { transform: none; margin-top: 8px; }
}
.lp-h { text-align: center; margin: 34px 0 6px; }
.lp-sub { text-align: center; color: var(--ink-soft); margin: 0 0 14px; }
.lp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.lp-tile { background: #fff; border: 2px solid #e6ebff; border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.lp-tile-ic { font-size: 2rem; } .lp-tile b { display: block; margin: 6px 0 4px; } .lp-tile p { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.lp-strands { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0; }
.lp-strands span { background: #fff; border: 2px solid #e6ebff; border-radius: 999px; padding: 6px 14px; font-weight: 700; }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.lp-step { background: #fff; border: 2px solid #e6ebff; border-radius: 16px; padding: 18px; text-align: center; box-shadow: var(--shadow); }
.lp-num { width: 38px; height: 38px; border-radius: 50%; background: var(--c-number); color: #fff; font-weight: 800; display: grid; place-items: center; margin: 0 auto 8px; font-size: 1.2rem; }
.lp-step p { color: var(--ink-soft); font-size: .95rem; margin: 6px 0 0; }
.lp-price { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.lp-plan { background: #fff; border: 3px solid #e6ebff; border-radius: 18px; padding: 18px 30px; text-align: center; position: relative; box-shadow: var(--shadow); }
.lp-plan-best { border-color: #22c55e; }
.lp-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: #22c55e; color: #fff; font-weight: 800; font-size: .72rem; padding: 3px 10px; border-radius: 999px; }
.lp-plan-name { color: var(--ink-soft); font-weight: 700; }
.lp-plan-amt { font-size: 1.8rem; font-weight: 800; } .lp-plan-amt small { font-size: .85rem; color: var(--ink-soft); font-weight: 600; }
.lp-foot { text-align: center; color: var(--ink-soft); font-size: .9rem; margin: 22px 0 8px; }
.lp-foot a { color: inherit; }

.dtable { width: 100%; border-collapse: collapse; margin: 14px 0; overflow: hidden; border-radius: 12px; box-shadow: var(--shadow); }
.dtable th, .dtable td { border: 1px solid #e3e8ff; padding: 9px 12px; text-align: center; }
.dtable th { background: var(--accent); color: #fff; font-family: var(--font-head); }
.dtable tr:nth-child(even) td { background: #f6f8ff; }

/* Worked examples */
.example { background: #f7f9ff; border: 2px solid #e6ebff; border-radius: 18px; padding: 16px 18px; margin: 14px 0; }
.example .ex-q { font-weight: 800; font-size: 1.12rem; margin-bottom: 8px; }
.example .ex-q .ex-tag { background: var(--accent); color: #fff; border-radius: 8px; padding: 2px 10px; font-size: .8rem; margin-right: 8px; font-family: var(--font-head); }
.example ol.steps { margin: 8px 0; padding-left: 22px; }
.example ol.steps li { margin: 6px 0; }
.example .ex-ans { margin-top: 10px; background: #eafff1; border: 2px solid #b6f0c9; border-radius: 12px; padding: 8px 14px; font-weight: 800; color: var(--good); }
.example .ex-ans::before { content: "✅ Answer: "; }

/* ---------------- Quiz ---------------- */
.quiz-intro { text-align: center; padding: 10px; }
.quiz-intro .quiz-emoji { font-size: 3.5rem; }
.quiz-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.quiz-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.qdot { width: 14px; height: 14px; border-radius: 50%; background: #d8def5; }
.qdot.done { background: var(--good); }
.qdot.wrong { background: var(--bad); }
.qdot.current { background: var(--accent); transform: scale(1.3); }
.combo { margin-left: auto; font-weight: 800; color: var(--gold); font-family: var(--font-head); }

.question { font-size: 1.4rem; font-weight: 800; margin: 6px 0 16px; line-height: 1.4; }
.q-visual { text-align: center; font-size: 1.6rem; margin: 6px 0 14px; }

.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.option {
  border: 3px solid #e3e8ff; background: #fff; border-radius: 16px; padding: 16px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; cursor: pointer; transition: .12s;
  box-shadow: 0 4px 0 #e0e5fb;
}
.option:hover:not(.locked) { transform: translateY(-3px); border-color: var(--accent); }
.option.correct { background: #eafff1; border-color: var(--good); box-shadow: 0 4px 0 #bdeccd; }
.option.wrong { background: #fff0f0; border-color: var(--bad); box-shadow: 0 4px 0 #f5c6c6; animation: shake .35s; }
.option.locked { cursor: default; }

.input-answer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.input-answer input { font-family: var(--font-head); font-size: 1.5rem; padding: 12px 16px; border: 3px solid #e3e8ff; border-radius: 14px; width: 160px; text-align: center; }
.input-answer input:focus { outline: none; border-color: var(--accent); }

.feedback { margin-top: 16px; border-radius: 16px; padding: 14px 18px; font-size: 1.05rem; animation: fadeIn .2s; }
.feedback.good { background: #eafff1; border: 2px solid #b6f0c9; }
.feedback.bad { background: #fff0f0; border: 2px solid #f5c6c6; }
.feedback .fb-title { font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; display: block; margin-bottom: 4px; }
.feedback.good .fb-title { color: var(--good); }
.feedback.bad .fb-title { color: var(--bad); }

/* Quiz result */
.result { text-align: center; padding: 16px; }
.result .result-emoji { font-size: 5rem; animation: pop .5s; }
.result h2 { font-size: 2rem; margin: 6px 0; }
.result .score-big { font-size: 1.4rem; font-weight: 800; }
.result .stars-earned { font-size: 3rem; letter-spacing: 6px; margin: 8px 0; }
.result .reward-line { font-size: 1.1rem; font-weight: 800; color: var(--gold); }

/* ---------------- Adventure map (grade page) ---------------- */
.map-intro { background: var(--paper); border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow); margin-bottom: 18px; }

/* ---------------- Shop / Trophies ---------------- */
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; }
.tile { background: var(--paper); border-radius: 18px; padding: 16px; text-align: center; box-shadow: var(--shadow); border: 3px solid transparent; position: relative; }
.tile.locked { opacity: .55; filter: grayscale(.7); }
.tile.owned { border-color: var(--good); }
.tile .tile-emoji { font-size: 3rem; }
.tile .tile-name { font-weight: 800; margin: 6px 0; }
.tile .tile-cost { color: var(--ink-soft); font-weight: 800; }
.tile .tile-lock { position: absolute; top: 8px; right: 10px; font-size: 1.2rem; }

.badge { background: var(--paper); border-radius: 18px; padding: 16px; text-align: center; box-shadow: var(--shadow); border: 3px dashed #e3e8ff; }
.badge.earned { border-style: solid; border-color: var(--gold); background: linear-gradient(160deg,#fffdf5,#fff6da); }
.badge .badge-emoji { font-size: 2.6rem; filter: grayscale(1); opacity: .5; }
.badge.earned .badge-emoji { filter: none; opacity: 1; animation: pop .4s; }
.badge .badge-name { font-weight: 800; margin-top: 6px; }
.badge .badge-desc { font-size: .82rem; color: var(--ink-soft); }

/* ---------------- Mascot ---------------- */
.mascot { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; align-items: flex-end; gap: 8px; max-width: 320px; }
.mascot-bubble {
  background: #fff; border: 3px solid #ffd24a; border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow-lg);
  font-weight: 700; font-size: .95rem; position: relative; transition: .2s; max-width: 240px;
}
.mascot-bubble.hide { display: none; }
.mascot-char { background: #fff; border: 3px solid #ffd24a; width: 60px; height: 60px; border-radius: 50%; font-size: 2rem; cursor: pointer; box-shadow: var(--shadow-lg); animation: bob 3.5s ease-in-out infinite; }
.mascot-char:hover { transform: scale(1.08); }

/* ---------------- Reward popup ---------------- */
.reward-layer { position: fixed; inset: 0; z-index: 80; pointer-events: none; display: none; align-items: center; justify-content: center; }
.reward-layer.show { display: flex; }
.reward-pop { background: #fff; border-radius: 26px; padding: 26px 34px; text-align: center; box-shadow: var(--shadow-lg); animation: pop .4s; border: 4px solid var(--gold); pointer-events: auto; }
.reward-pop .rp-emoji { font-size: 4rem; }
.reward-pop h2 { margin: 6px 0; }

/* ---------------- Confetti ---------------- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti { position: absolute; width: 12px; height: 12px; top: -20px; opacity: .9; animation: fall linear forwards; }

/* ---------------- Help / generic prose ---------------- */
.prose { background: var(--paper); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); line-height: 1.6; }
.prose h1 { margin-top: 0; }
.prose h2 { color: var(--accent, #6d5dfc); margin-top: 22px; }
.prose code { background: #f3f5ff; padding: 2px 7px; border-radius: 6px; font-weight: 700; }

/* ---------------- Support / donation ---------------- */
.support-ribbon {
  display: block; text-decoration: none; color: var(--ink);
  background: linear-gradient(120deg,#fff7df,#ffeec2); border: 2px solid #ffd98a;
  border-radius: 16px; padding: 12px 18px; margin: 16px 0 4px; font-weight: 700;
  box-shadow: var(--shadow); transition: .15s;
}
.support-ribbon:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.support-ribbon .sr-go { color: #b8860b; font-weight: 800; white-space: nowrap; }

/* name-capture card */
.name-card {
  display: flex; gap: 16px; align-items: center;
  background: linear-gradient(120deg, #efeaff, #fde6ff); border: 3px solid #d8ccff;
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.name-card .nc-emoji { font-size: 3rem; animation: bob 3s ease-in-out infinite; }
.name-card .nc-body { flex: 1; }
.name-card h2 { margin: 0 0 8px; color: #6b46e0; }
.name-card .input-answer input { width: 220px; }

.dono-amounts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 18px; }
.amt-chip {
  font-family: var(--font-head); font-weight: 700; font-size: 1.1rem; cursor: pointer;
  border: 3px solid #e3e8ff; background: #fff; border-radius: 14px; padding: 10px 18px;
  box-shadow: 0 4px 0 #e0e5fb; transition: .12s;
}
.amt-chip:hover { transform: translateY(-2px); border-color: var(--c-data); }
.amt-chip.active { background: #f0e9ff; border-color: var(--c-data); box-shadow: 0 4px 0 #d9c9ff; }
.amt-other { font-weight: 800; }
.amt-other input { font-family: var(--font-head); font-size: 1.1rem; width: 110px; padding: 9px 12px; border: 3px solid #e3e8ff; border-radius: 14px; }
.amt-other input:focus { outline: none; border-color: var(--c-data); }

.dono-pay { text-align: center; }
.dono-or { color: var(--ink-soft); font-weight: 700; margin: 14px 0 10px; }
.dono-qr { width: 220px; height: 220px; border-radius: 16px; border: 3px solid #eee; background: #fff; }
.dono-qr-fallback { color: var(--ink-soft); font-weight: 700; }
.dono-upiid { margin-top: 14px; font-weight: 800; }
.dono-upiid code { background: #f3f5ff; padding: 4px 10px; border-radius: 8px; }
.dono-upiid .btn { padding: 6px 12px; font-size: .9rem; margin-left: 6px; }

/* video chips */
.videos { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; }
.video-link {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
  background: #fff5f5; border: 2px solid #ffd2d2; border-radius: 14px; padding: 12px 16px; transition: .12s; font-weight: 700;
}
.video-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.video-link .vl-play { font-size: 1.6rem; color: #ff3b3b; }
.video-link .vl-meta small { display: block; color: var(--ink-soft); font-weight: 700; }

/* ---------------- Difficulty levels ---------------- */
.level-pick { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.level-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 130px;
  background: #fff; color: var(--ink); border: 3px solid var(--lvl, #6d5dfc);
  box-shadow: 0 5px 0 #e0e5fb, var(--shadow); padding: 14px 18px;
}
.level-btn:active { box-shadow: 0 2px 0 #e0e5fb; }
.level-btn .lvl-ic { font-size: 1.8rem; }
.level-btn .lvl-name { font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; }
.level-btn .lvl-stars { font-size: .95rem; letter-spacing: 1px; }
.lvl-tag { background: #eef0ff; border: 2px solid #d8ddff; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 800; font-family: var(--font-body); }

/* Smart Practice button */
.smart-pick { display: flex; justify-content: center; margin: 8px 0 6px; }
.smart-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; background: linear-gradient(120deg,#ff9a3c,#ff5db1); box-shadow: 0 6px 0 #c23f86, var(--shadow); }
.smart-btn:active { box-shadow: 0 2px 0 #c23f86; }
.smart-btn small { font-family: var(--font-body); font-weight: 700; font-size: .72rem; opacity: .95; }
.level-or { text-align: center; color: var(--ink-soft); font-weight: 800; margin: 8px 0; }

/* Parent Zone */
.parent-focus { background: var(--paper); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); margin: 16px 0; border-left: 8px solid var(--c-shape); }
.parent-focus h2 { margin: 0 0 4px; }
.parent-sub { color: var(--ink-soft); margin: 0 0 12px; font-weight: 600; }
.parent-sec { background: var(--paper); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin: 14px 0; border-left: 8px solid #ccc; }
.parent-sec.sec-low { border-left-color: var(--bad); }
.parent-sec.sec-ok { border-left-color: var(--gold); }
.parent-sec.sec-great { border-left-color: var(--good); }
.parent-sec h2 { margin: 0 0 4px; font-size: 1.25rem; }
.parent-row { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; background: #f7f9ff; border: 2px solid #e6ebff; border-radius: 14px; padding: 10px 14px; margin: 8px 0; transition: .12s; }
.parent-row:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: #c9d2ff; }
.parent-row .pr-ic { font-size: 1.8rem; }
.parent-row .pr-main { flex: 1; }
.parent-row .pr-main b { display: block; }
.parent-row .pr-main small { color: var(--ink-soft); font-weight: 700; }
.parent-row .pr-go { font-weight: 800; color: var(--c-shape); font-family: var(--font-head); white-space: nowrap; }
.voice-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.voice-row label { font-weight: 800; min-width: 56px; }
.voice-row select { font-family: var(--font-body); font-weight: 700; padding: 9px 12px; border: 2px solid #e3e8ff; border-radius: 12px; max-width: 320px; }
.voice-row .btn { padding: 8px 14px; }
.voice-cur { color: var(--ink-soft); font-weight: 800; }

/* Tic-Tac-Toe */
.ttt-status { text-align: center; font-weight: 800; font-size: 1.3rem; margin: 14px 0; min-height: 1.5em; font-family: var(--font-head); }
.ttt-board { display: grid; grid-template-columns: repeat(3, 92px); gap: 8px; justify-content: center; margin: 12px auto; }
.ttt-cell { width: 92px; height: 92px; font-size: 3rem; border: 3px solid #c9d2ff; background: #fff; border-radius: 16px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 5px 0 #e0e5fb; transition: .1s; }
.ttt-cell:hover:not(.filled) { background: #eef0ff; transform: translateY(-2px); }
.ttt-cell:active:not(.filled) { transform: translateY(2px); box-shadow: 0 2px 0 #e0e5fb; }
.ttt-cell.filled { cursor: default; }
.ttt-locked { font-weight: 800; color: var(--ink-soft); align-self: center; }

/* read-aloud speaker button on questions */
.qspeak { border: 0; background: #eef0ff; border-radius: 50%; width: 34px; height: 34px; font-size: 1rem; cursor: pointer; vertical-align: middle; box-shadow: var(--shadow); }
.qspeak:hover { background: #dfe3ff; transform: scale(1.08); }

/* ---------------- Interactive question types ---------------- */
.tapgrid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 8px 0; }
.tapchip {
  font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; cursor: pointer;
  border: 3px solid #e3e8ff; background: #fff; border-radius: 16px; padding: 14px 20px; min-width: 60px;
  box-shadow: 0 4px 0 #e0e5fb; transition: .12s;
}
.tapchip:hover:not(.locked):not(.used) { transform: translateY(-3px); border-color: var(--accent, #6d5dfc); }
.tapchip.sel { background: #e7ecff; border-color: var(--c-number); box-shadow: 0 4px 0 #c7d2ff; }
.tapchip.correct { background: #eafff1; border-color: var(--good); }
.tapchip.wrong { background: #fff0f0; border-color: var(--bad); }
.tapchip.locked { cursor: default; }

.order-tray { min-height: 56px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  background: #f7f9ff; border: 2px dashed #c9d2ff; border-radius: 14px; padding: 10px; margin-bottom: 12px; }
.order-hint { color: var(--ink-soft); font-weight: 700; }
.order-item { font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; background: #fff; border: 2px solid var(--c-number); border-radius: 10px; padding: 6px 14px; }

.buildframe { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; justify-content: center; margin: 10px auto; }
.bcell { width: 52px; height: 52px; border: 3px solid #94a3d8; border-radius: 10px; background: #fff; font-size: 1.5rem; cursor: pointer; display: grid; place-items: center; }
.bcell.on { background: #fff7df; border-color: var(--gold); }
.build-count { text-align: center; font-weight: 800; font-size: 1.1rem; margin-top: 6px; }

.fracbar { display: grid; gap: 4px; max-width: 420px; margin: 12px auto; height: 70px; }
.fseg { border: 3px solid #94a3d8; background: #fff; cursor: pointer; border-radius: 8px; }
.fseg.on { background: var(--c-shape); border-color: #c0337f; }

.clockwrap { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; }
.clocksvg { width: 180px; height: 180px; }
.clock-steppers { display: flex; gap: 18px; }
.cstep { text-align: center; font-weight: 800; }
.cstep .btn { padding: 6px 14px; font-size: 1.2rem; }
.cstep b { display: inline-block; min-width: 32px; font-size: 1.3rem; }

.matchwrap { display: flex; gap: 18px; justify-content: center; }
.matchcol { display: flex; flex-direction: column; gap: 10px; flex: 1; max-width: 230px; }
.matchL, .matchR {
  font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; cursor: pointer; text-align: left;
  border: 3px solid #e3e8ff; background: #fff; border-radius: 14px; padding: 12px 14px; box-shadow: 0 4px 0 #e0e5fb;
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.matchL.sel { border-color: var(--c-number); background: #e7ecff; }
.matchL .ml-val { color: var(--c-shape); font-weight: 800; }
.matchR:hover { transform: translateY(-2px); border-color: var(--c-shape); }

/* area / perimeter grid */
.gridwrap { display: flex; justify-content: center; margin: 12px 0; }
.areagrid { display: grid; gap: 2px; background: #dfe5ff; padding: 4px; border-radius: 10px; }
.gcell { width: 34px; height: 34px; border: 1px solid #c3ccf5; background: #fff; cursor: pointer; border-radius: 4px; padding: 0; }
.gcell:hover { background: #eef0ff; }
.gcell.on { background: var(--c-shape); border-color: #c0337f; }

/* ---------------- Watch & Learn player ---------------- */
.watch-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  background: linear-gradient(120deg, #fff1d6, #ffe0f0); border: 3px solid #ffd24a;
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.watch-banner small { display: block; color: var(--ink-soft); font-weight: 700; }

.walk { text-align: center; }
.walk-stage {
  min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f7f9ff, #eef1ff); border: 2px solid #e3e8ff; border-radius: 18px; padding: 22px;
}
.walk-stage.fade { animation: fadeIn .4s ease; }
.walk-caption { font-size: 1.25rem; font-weight: 800; color: var(--ink); margin: 16px auto 6px; max-width: 640px; min-height: 2.4em; }
.walk-dots { display: flex; gap: 8px; justify-content: center; margin: 6px 0 14px; }
.walk-dots .wd { width: 12px; height: 12px; border-radius: 50%; background: #d8def5; }
.walk-dots .wd.done { background: var(--c-shape); }
.walk-dots .wd.on { background: var(--accent, #6d5dfc); transform: scale(1.35); }
.walk-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.walk-controls .walk-play { min-width: 64px; font-size: 1.3rem; }

/* column-addition visual used by the walkthrough */
.wt-big { font-family: var(--font-head); font-weight: 800; font-size: 2.6rem; color: var(--ink); }
.wt-big.ans { color: var(--good); }
.wt-grid { display: inline-grid; grid-template-columns: repeat(3, 1.15em); gap: 4px 8px; font-family: var(--font-head); font-weight: 800; font-size: 2.8rem; line-height: 1; }
.wt-grid span { display: grid; place-items: center; }
.wt-grid .carry { font-size: 1.3rem; color: var(--bad); align-self: end; }
.wt-grid .plus { color: var(--ink-soft); }
.wt-grid .rule { grid-column: 1 / -1; border-top: 5px solid var(--ink); height: 0; margin: 2px 0; }
.wt-grid .ans { color: var(--good); }
.wt-grid .hl { background: #fff3b0; border-radius: 8px; }
.wt-grid .pop { animation: pop .45s ease; }
.wt-grid .carryin { animation: carryUp .8s ease; }
.wt-note { margin-top: 14px; font-size: 1.5rem; font-weight: 800; color: var(--c-number); }
@keyframes carryUp { from { transform: translateY(34px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------------- Animations ---------------- */
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes fadeIn { from{opacity:0; transform:translateY(6px)} to{opacity:1; transform:none} }
@keyframes pop { 0%{transform:scale(.4); opacity:0} 70%{transform:scale(1.15)} 100%{transform:scale(1); opacity:1} }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

/* ---------------- Responsive ---------------- */
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-art { font-size: 4rem; }
  .brand-text { display: none; }
  .menu-toggle { display: block; }
  .topnav { display: none; flex-direction: column; align-items: stretch; }
  .topnav.open { display: flex; }
  .hud-item { font-size: .85rem; padding: 3px 8px; }
  .module-head { flex-wrap: wrap; }
  .module-head .mh-stars { margin-left: 0; width: 100%; text-align: left; }
}
