:root {
  --purple: #6B3DF5; --purple-d: #4F26CC; --deep: #2B1470; --yellow: #FFC83D; --yellow-d: #E0A800;
  --green: #2BB673; --green-d: #1F9A5E; --red: #FF4B4B; --red-d: #D93636;
  --bg: #F7F5FF; --card: #fff; --line: #E6E1F7; --ink: #1A1033; --muted: #6E6889;
  --radius: 18px; --shadow: 0 2px 0 var(--line);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Nunito", system-ui, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--purple); text-decoration: none; font-weight: 800; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
button { font: inherit; cursor: pointer; }
input { font: inherit; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 12px 22px;
  font-weight: 900; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; transition: transform .08s, filter .15s; color: #fff; }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none !important; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--purple); box-shadow: 0 4px 0 var(--purple-d); }
.btn.danger { background: var(--red); box-shadow: 0 4px 0 var(--red-d); }
.btn.ghost { background: #fff; color: var(--purple); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.light { background: #fff; color: var(--deep); box-shadow: 0 4px 0 rgba(0,0,0,.15); }
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.btn.lg { padding: 16px 28px; font-size: 16px; }
.btn.full { width: 100%; }
.g-ic { width: 20px; height: 20px; }

/* mascot */
.mascot { display: block; overflow: visible; }
.mascot.small { width: 64px; }
.mascot.big { width: 140px; }
.mascot.huge { width: 200px; }
.bounce .m-head, .mascot.bounce .m-head { animation: hop 1.6s ease-in-out infinite; transform-origin: 250px 320px; }
@keyframes hop { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-22px); } 55% { transform: translateY(-22px) rotate(-3deg); } }
.mood-sad .m-head { animation: none; }
@media (prefers-reduced-motion: reduce) { .m-head { animation: none !important; } }

/* brand */
.brand { display: flex; align-items: center; gap: 8px; color: var(--deep); font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.brand b { color: var(--purple); font-weight: 900; }
.brand-m { width: 40px; }

.demo-banner { background: var(--yellow); color: var(--deep); text-align: center; font-weight: 800; font-size: 13px; padding: 8px 12px; }

/* public pages */
.pub-head { display: flex; justify-content: space-between; align-items: center; max-width: 1080px; margin: 0 auto; padding: 18px 20px; }
.landing { max-width: 1080px; margin: 0 auto; padding: 10px 20px 40px; }
.hero { display: grid; grid-template-columns: 1fr 1.2fr; gap: 30px; align-items: center; padding: 30px 0 40px; }
.hero-art { display: flex; justify-content: center; }
.hero-art .huge { width: min(320px, 70vw); }
.hero h1 { font-size: clamp(36px, 5.5vw, 58px); color: var(--deep); letter-spacing: -.02em; }
.hero h1 span { color: var(--purple); }
.hero p { font-size: 19px; color: var(--muted); max-width: 520px; }
.hero-btns { display: flex; flex-direction: column; gap: 14px; max-width: 360px; margin-top: 22px; }
.cat-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 20px 0; border-top: 2px solid var(--line); border-bottom: 2px solid var(--line); }
.cat-pill { display: flex; gap: 8px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 99px; padding: 8px 16px; font-weight: 800; color: var(--deep); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.feat { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feat-i { font-size: 32px; }
.feat h3 { margin: 8px 0 4px; color: var(--deep); }
.feat p { margin: 0; color: var(--muted); }
.pub-foot { text-align: center; color: var(--muted); padding: 30px; font-size: 14px; }

.auth-wrap { display: flex; justify-content: center; padding: 10px 16px 60px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 2px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: 0 4px 0 var(--line); text-align: center; }
.auth-m { width: 110px; margin: 0 auto 6px; }
.auth-card h1 { color: var(--deep); font-size: 26px; margin-bottom: 18px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; color: var(--deep); }
.auth-card input { border: 2px solid var(--line); background: #FBFAFF; border-radius: 14px; padding: 13px 14px; font-size: 16px; font-weight: 700; color: var(--ink); outline: none; }
.auth-card input:focus { border-color: var(--purple); background: #fff; }
.form-err { color: var(--red); font-weight: 800; font-size: 14px; margin: 0; min-height: 1px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 800; margin: 16px 0; font-size: 13px; text-transform: uppercase; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.switch { margin: 18px 0 0; color: var(--muted); font-weight: 700; }

/* shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; border-right: 2px solid var(--line); background: #fff; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; }
.side .brand { padding: 4px 10px 18px; }
.nav-i { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; color: var(--muted); font-weight: 900; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; border: 2px solid transparent; background: none; text-align: left; }
.nav-i span { font-size: 22px; }
.nav-i:hover { background: var(--bg); }
.nav-i.on { color: var(--purple); background: #F1ECFF; border-color: #D9CCFF; }
.side .nav-i:last-child { margin-top: auto; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; padding: 12px 24px; background: rgba(247,245,255,.92); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
.brand.mob { display: none; margin-right: auto; }
.stats { display: flex; gap: 8px; }
.stat { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 6px 12px; font-weight: 900; font-size: 15px; }
.stat.lit b { color: #FF8A00; }
.stat.dim { filter: grayscale(1); opacity: .7; }
.stat.heart b { color: var(--red); }

.page { max-width: 880px; margin: 0 auto; padding: 24px 20px 100px; }

/* streak card */
.streak-card { display: flex; gap: 20px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 24px; padding: 18px 22px; box-shadow: var(--shadow); }
.streak-card.slim { justify-content: center; margin-bottom: 24px; }
.sc-m .mascot { width: 110px; }
.sc-body { flex: 1; min-width: 0; }
.sc-body h2 { color: var(--deep); font-size: 24px; }
.bubble { position: relative; background: #F1ECFF; border-radius: 16px; padding: 10px 14px; font-weight: 800; color: var(--deep); margin: 10px 0 12px; display: inline-block; }
.week { display: flex; gap: 8px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; color: var(--muted); }
.wd i { width: 34px; height: 34px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 16px; }
.wd.on i { background: #FFF1D6; border-color: #FFC83D; }
.wd.today span { color: var(--purple); }

.continue { display: flex; align-items: center; gap: 14px; margin-top: 16px; background: var(--deep); color: #fff; border-radius: 20px; padding: 14px 18px; }
.continue div { flex: 1; display: flex; flex-direction: column; }
.continue small { opacity: .7; font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.continue b { font-size: 18px; }

.filter-row { margin: 26px 0 16px; display: flex; flex-direction: column; gap: 12px; }
.search { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; font-size: 16px; font-weight: 700; background: #fff; outline: none; }
.search:focus { border-color: var(--purple); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 2px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 14px; font-weight: 800; color: var(--deep); white-space: nowrap; }
.chip.on { background: var(--deep); color: #fff; border-color: var(--deep); }

/* category colours */
[data-color="coding"]  { --c: #6B3DF5; --cd: #4F26CC; --cl: #F1ECFF; }
[data-color="life"]    { --c: #2BB673; --cd: #1F9A5E; --cl: #E3F7EE; }
[data-color="money"]   { --c: #F59E0B; --cd: #C77F05; --cl: #FFF3DC; }
[data-color="science"] { --c: #1CB0F6; --cd: #1393CF; --cl: #E1F4FE; }
[data-color="history"] { --c: #FF4B4B; --cd: #D93636; --cl: #FFE5E5; }
[data-color="gaming"]  { --c: #14B8A6; --cd: #0E9384; --cl: #DDF7F4; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 18px; color: var(--ink); box-shadow: 0 4px 0 var(--line); transition: transform .12s, border-color .12s; }
.card:hover { transform: translateY(-3px); border-color: var(--c); }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.ci { width: 48px; height: 48px; border-radius: 14px; background: var(--cl, #F1ECFF); display: grid; place-items: center; font-size: 26px; }
.tag { font-size: 12px; font-weight: 900; color: var(--c); background: var(--cl); padding: 4px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .04em; }
.card h3 { margin: 14px 0 6px; font-size: 19px; color: var(--deep); }
.card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; font-weight: 600; flex: 1; }
.bar { height: 12px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--purple)); border-radius: 99px; transition: width .4s; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.card-foot small { color: var(--muted); font-weight: 800; }
.card .btn.primary { background: var(--c); box-shadow: 0 4px 0 var(--cd); }
.empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--muted); font-weight: 700; padding: 30px; }

/* course path */
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); }
.unit { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--c); color: #fff; border-radius: 22px; padding: 20px 22px; box-shadow: 0 5px 0 var(--cd); }
.unit small { opacity: .85; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.unit h2 { font-size: 24px; margin: 4px 0; }
.unit p { margin: 0; opacity: .9; font-weight: 700; }
.unit-badge { background: rgba(255,255,255,.2); padding: 10px 14px; border-radius: 12px; font-weight: 900; white-space: nowrap; }
.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 44px 0 20px; }
.node-row { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.node-row.off1 { transform: translateX(60px); } .node-row.off2 { transform: translateX(110px); }
.node-row.offm1 { transform: translateX(-60px); } .node-row.offm2 { transform: translateX(-110px); }
.node { width: 76px; height: 76px; border-radius: 50%; border: 0; font-size: 30px; font-weight: 900; color: #fff; display: grid; place-items: center; transition: transform .08s; }
.node.done { background: var(--yellow); box-shadow: 0 7px 0 var(--yellow-d); color: var(--deep); }
.node.next { background: var(--purple); box-shadow: 0 7px 0 var(--purple-d), 0 0 0 8px #E4DBFF; animation: pulse 1.8s infinite; }
.node.locked { background: #E5E2EF; box-shadow: 0 7px 0 #CFCADF; color: #A29DB8; cursor: not-allowed; font-size: 24px; }
.node:active:not(:disabled) { transform: translateY(5px); box-shadow: none; }
.node.trophy { width: 84px; height: 84px; font-size: 36px; }
.node.trophy.locked { filter: grayscale(1); }
@keyframes pulse { 50% { box-shadow: 0 7px 0 var(--purple-d), 0 0 0 14px rgba(107,61,245,.12); } }
.node-label { font-weight: 800; font-size: 13px; color: var(--muted); max-width: 140px; text-align: center; }
.start-tip { position: absolute; top: -40px; background: #fff; border: 2px solid var(--line); color: var(--purple); font-weight: 900; padding: 6px 12px; border-radius: 12px; animation: float 1.4s ease-in-out infinite; z-index: 1; }
.start-tip::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
@keyframes float { 50% { transform: translateY(-5px); } }
.path-mascot { position: absolute; right: 4%; top: 120px; width: 130px; }

/* profile */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 26px; }
.avatar { width: 84px; height: 84px; border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; font-size: 38px; font-weight: 900; box-shadow: 0 5px 0 var(--purple-d); }
.profile-head h2 { font-size: 28px; color: var(--deep); }
.profile-head p { margin: 4px 0 0; font-weight: 700; }
.sec { color: var(--deep); margin: 6px 0 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 26px; }
.sg { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.sg span { grid-row: span 2; font-size: 28px; }
.sg b { font-size: 22px; color: var(--deep); }
.sg small { color: var(--muted); font-weight: 800; }

/* lesson */
.lesson { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
.l-head { display: flex; align-items: center; gap: 16px; max-width: 980px; width: 100%; margin: 0 auto; padding: 22px 20px; }
.x { background: none; border: 0; font-size: 24px; color: #A29DB8; font-weight: 900; padding: 4px 8px; }
.l-bar { flex: 1; height: 16px; background: #EEEBF7; border-radius: 99px; overflow: hidden; }
.l-bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .35s; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.l-body { flex: 1; max-width: 640px; width: 100%; margin: 0 auto; padding: 10px 20px 160px; }
.q-label { font-size: 22px; font-weight: 900; color: var(--deep); margin: 10px 0 18px; }
.speak { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 24px; }
.l-m { width: 90px; flex: none; }
.l-m.small { width: 72px; }
.speak .bubble { margin: 0; border: 2px solid var(--line); background: #fff; padding: 14px 18px; }
.speak .bubble::before { content: ""; position: absolute; left: -9px; bottom: 18px; width: 14px; height: 14px; background: #fff; border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.speak .bubble h2 { font-size: 19px; font-weight: 800; }
.bubble.big { padding: 18px 20px; }
.bubble.big small { color: var(--purple); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .05em; }
.bubble.big h2 { font-size: 24px; font-weight: 900; margin: 4px 0 8px; }
.bubble.big p { margin: 0; font-weight: 700; color: var(--ink); }
.opts { display: grid; gap: 12px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: flex; align-items: center; gap: 12px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 17px; font-weight: 800; color: var(--ink); box-shadow: 0 4px 0 var(--line); transition: transform .08s; }
.opt:hover:not(:disabled) { background: #FBFAFF; }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.opt kbd { font-family: inherit; font-size: 13px; color: var(--muted); border: 2px solid var(--line); border-radius: 8px; padding: 1px 7px; }
.opt.sel { border-color: var(--purple); background: #F1ECFF; box-shadow: 0 4px 0 #C9B8FF; color: var(--purple); }
.opt.right { border-color: var(--green); background: #E3F7EE; box-shadow: 0 4px 0 #9FDDBE; color: var(--green-d); }
.opt.wrong { border-color: var(--red); background: #FFE5E5; box-shadow: 0 4px 0 #FFB3B3; color: var(--red-d); }
.opt:disabled { cursor: default; }
.type-in { width: 100%; border: 2px solid var(--line); background: #FBFAFF; border-radius: 16px; padding: 16px; font-size: 18px; font-weight: 800; outline: none; }
.type-in:focus { border-color: var(--purple); background: #fff; }
.l-foot { position: fixed; left: 0; right: 0; bottom: 0; border-top: 2px solid var(--line); background: #fff; }
.l-foot-in { max-width: 980px; margin: 0 auto; padding: 20px; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 100px; }
.l-foot .btn { min-width: 160px; }
.l-foot.good { background: #D7F5E6; border-color: transparent; }
.l-foot.bad { background: #FFE0E0; border-color: transparent; }
.verdict { display: flex; flex-direction: column; gap: 2px; }
.verdict b { font-size: 22px; }
.good .verdict { color: var(--green-d); }
.bad .verdict { color: var(--red-d); }
.verdict span { font-weight: 900; }
.verdict small { font-weight: 700; font-size: 14px; opacity: .9; }
.good .btn.primary { background: var(--green); box-shadow: 0 4px 0 var(--green-d); }

/* center screens */
.center-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 30px 20px; }
.center-screen h1 { color: var(--deep); font-size: 34px; }
.center-screen p { max-width: 380px; font-weight: 700; margin: 0; }
.streak-up { color: #FF8A00; font-size: 20px; font-weight: 900 !important; }
.tiles { display: flex; gap: 12px; margin: 10px 0; flex-wrap: wrap; justify-content: center; }
.tile { border-radius: 16px; border: 2px solid; min-width: 120px; overflow: hidden; background: #fff; }
.tile small { display: block; color: #fff; font-weight: 900; text-transform: uppercase; font-size: 12px; padding: 6px; letter-spacing: .05em; }
.tile b { display: block; font-size: 22px; padding: 12px; }
.tile.xp { border-color: var(--yellow); } .tile.xp small { background: var(--yellow); color: var(--deep); }
.tile.acc { border-color: var(--green); } .tile.acc small { background: var(--green); }
.tile.st { border-color: #FF8A00; } .tile.st small { background: #FF8A00; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--deep); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 50; transition: .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red-d); } .toast.good { background: var(--green-d); }

/* mobile */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 10px; }
  .hero p, .hero-btns { margin-left: auto; margin-right: auto; }
  .features { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 2px solid var(--line); z-index: 10; }
  .side .brand { display: none; }
  .nav-i { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 12px; }
  .side .nav-i:last-child { margin-top: 0; }
  .brand.mob { display: flex; }
  .topbar { padding: 10px 14px; }
  .stat { padding: 5px 9px; font-size: 14px; }
  .streak-card { flex-direction: column; text-align: center; }
  .week { justify-content: center; }
  .wd i { width: 30px; height: 30px; }
  .path-mascot { display: none; }
  .node-row.off2 { transform: translateX(70px); } .node-row.offm2 { transform: translateX(-70px); }
  .node-row.off1 { transform: translateX(38px); } .node-row.offm1 { transform: translateX(-38px); }
  .unit { flex-direction: column; align-items: flex-start; }
  .l-foot-in { flex-direction: column; align-items: stretch; min-height: 0; }
  .l-foot .btn { width: 100%; }
  .l-body { padding-bottom: 220px; }
}

/* streak savers + pass rule */
.stat.saver b { color: #1CB0F6; }
.stat.qcount { font-size: 14px; color: var(--muted); }
.saver-note { margin: 10px 0 0; font-size: 13px; font-weight: 800; color: var(--muted); }
.wd.fz i { background: #E1F4FE; border-color: #8FD6FA; }
.saver-up { color: #1393CF; font-size: 18px; font-weight: 900 !important; }
.rule { margin-top: 18px; background: #FFF6DC; border: 2px solid #FFE299; color: var(--deep); border-radius: 16px; padding: 14px 16px; font-weight: 800; }
.l-bar.has-miss i { background: linear-gradient(90deg, var(--green), #F5B83D); }
.review { list-style: none; padding: 0; margin: 6px 0 10px; width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.review li { background: #fff; border: 2px solid #FFC9C9; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.review b { color: var(--deep); }
.review span { color: var(--green-d); font-weight: 800; }
.end-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
