:root {
  --bg: #F7F5FF;
  --surface: #FFFFFF;
  --ink: #1E1B3A;
  --muted: #6B6886;
  --line: #E7E4F3;
  --brand: #2E2A6B;
  --brand-2: #4B44A8;
  --accent: #F5A524;
  --ring-track: #ECE9F8;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(30, 27, 58, .06), 0 6px 20px rgba(30, 27, 58, .06);
  --font-h: 'Baloo 2', 'Mukta', system-ui, sans-serif;
  --font-b: 'Mukta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12111F; --surface: #1C1A2E; --ink: #EEEDF8; --muted: #A3A0BE; --line: #2D2A45;
    --ring-track: #2D2A45; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior-y: none; }
.nav, .btn, .subj, .row, .stage, .plan-item, .hdr, .chip, .seg button, .av span { -webkit-user-select: none; user-select: none; }
.subj, .row, .stage, .plan-item, .mini, .resume, .links a { transition: transform .12s, background-color .12s; }
.row:active, .stage:active, .plan-item:active, .mini:active, .resume:active { transform: scale(.985); }
.links a:active, .prof-main:active { background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
.nav a { min-height: 52px; justify-content: center; }
.native-app .hdr { box-shadow: 0 2px 10px rgba(0,0,0,.12); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-b);
  font-size: 16px; line-height: 1.5; min-height: 100vh;
  padding-bottom: calc(76px + var(--sab, env(safe-area-inset-bottom)));
}
body.no-nav { padding-bottom: 24px; }
body.no-nav .nav { display: none; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-h); line-height: 1.2; margin: 0 0 .3em; }
h2 { font-size: 1.45rem; } h3 { font-size: 1.12rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .6em; }
button { font: inherit; color: inherit; }

/* header */
.hdr {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--sat, env(safe-area-inset-top))) 16px 10px; background: var(--brand); color: #fff;
}
.hdr h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-logo img { display: block; border-radius: 9px; }
.hdr-back { background: rgba(255,255,255,.14); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 10px; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.hdr-back[hidden] { display: none; }

.view { max-width: 760px; margin: 0 auto; padding: 16px; outline: none; }

/* bottom nav */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + var(--sab, env(safe-area-inset-bottom)));
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 0; border-radius: 12px; color: var(--muted); }
.nav a span { font-size: 1.3rem; filter: grayscale(1); opacity: .7; transition: .15s; }
.nav a small { font-size: .72rem; font-weight: 600; }
.nav a.on { color: var(--brand-2); }
.nav a.on span { filter: none; opacity: 1; transform: translateY(-1px); }
@media (prefers-color-scheme: dark) { .nav a.on { color: #B7B1FF; } }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.grad { background: linear-gradient(135deg, var(--brand) 0%, color-mix(in srgb, var(--st, var(--brand-2)) 55%, var(--brand)) 100%); color: #fff; border: 0; }
.grad p { color: rgba(255,255,255,.9); }
.muted { color: var(--muted); } .muted-w { color: rgba(255,255,255,.8); margin: 0; }
.small { font-size: .85rem; } .fine { font-size: .8rem; color: var(--muted); margin-top: 12px; }
.center { text-align: center; }
.hi { font-weight: 500; opacity: .75; font-size: .9em; }
.grow { flex: 1; min-width: 0; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; font-size: 1.1rem; }
.sec-link { font-family: var(--font-b); font-size: .85rem; color: var(--brand-2); font-weight: 600; }
@media (prefers-color-scheme: dark) { .sec-link { color: #B7B1FF; } }
.intro { margin: 2px 2px 14px; }

/* chips, buttons */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.18); font-size: .8rem; font-weight: 600; }
.chip.soft, .card:not(.grad) .chip { background: color-mix(in srgb, var(--c, var(--brand-2)) 12%, transparent); color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 600; cursor: pointer; min-height: 46px; }
.btn.primary { background: var(--accent); color: #2A1A00; box-shadow: 0 4px 14px rgba(245,165,36,.35); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.light { background: #fff; color: var(--brand); margin-top: 6px; }
.btn.block { width: 100%; margin: 6px 0 12px; }
.btn:active { transform: scale(.98); }

/* progress */
.bar { height: 7px; border-radius: 99px; background: var(--ring-track); overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.ring-t { font-family: var(--font-h); font-weight: 700; font-size: 18px; fill: #fff; }
.card:not(.grad) .ring-t { fill: var(--ink); }

/* home */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello h2 { font-size: 1.6rem; margin: 0; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ring-wrap small { color: rgba(255,255,255,.85); font-size: .75rem; }
.ring-wrap circle:last-child { stroke: var(--accent); }
.hello .ring circle:first-child { stroke: rgba(255,255,255,.2); }
.resume { display: flex; align-items: center; gap: 12px; }
.resume-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; color: #2A1A00; flex: none; }
.resume b, .plan-item b { display: block; }
.resume small, .plan-item small { display: block; font-size: .8rem; }
.plan { display: grid; gap: 0; }
.plan-item { display: flex; align-items: center; gap: 12px; border-left: 4px solid var(--c); }
.plan-item > span:nth-child(2) { flex: 1; }
.go { color: var(--muted); font-size: 1.4rem; }

/* subject grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.subj { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); transition: transform .15s; position: relative; overflow: hidden; }
.subj::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.subj:active { transform: scale(.98); }
.subj-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.45rem; background: color-mix(in srgb, var(--c, var(--brand-2)) 15%, transparent); flex: none; }
.subj-ic.sm { width: 36px; height: 36px; font-size: 1.15rem; border-radius: 11px; }
.subj-ic.lg { width: 58px; height: 58px; font-size: 1.9rem; border-radius: 16px; }
.subj-name { font-family: var(--font-h); font-weight: 700; line-height: 1.2; margin-top: 4px; }
.subj-meta { font-size: .78rem; color: var(--muted); }
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.mini { flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; scroll-snap-align: start; margin: 0; }
.mini b { font-family: var(--font-h); line-height: 1.2; }

/* learn */
.search { display: flex; align-items: center; gap: 10px; padding: 6px 14px; }
.search input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--ink); padding: 10px 0; outline: none; }
.nep-bar { display: flex; gap: 4px; margin-top: 10px; }
.nep-bar span { height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-family: var(--font-h); font-weight: 800; font-size: 1.1rem; }
.stage { display: flex; align-items: center; gap: 14px; border-left: 5px solid var(--c); }
.stage-ic { font-size: 2rem; }
.stage-body { flex: 1; display: flex; flex-direction: column; }
.stage-body b { font-family: var(--font-h); font-size: 1.15rem; }
.stage-body small { font-size: .85rem; }
.row { display: flex; align-items: center; gap: 12px; }
.row b { display: block; line-height: 1.3; }
.row small { display: block; font-size: .8rem; }
.gbadge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-family: var(--font-h); font-weight: 800; font-size: 1.1rem; flex: none; }
.ticks { list-style: none; padding: 0; margin: 6px 0 0; }
.ticks li { position: relative; padding-left: 26px; margin-bottom: 6px; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 25%, transparent); color: #9A5B00; font-size: .7rem; display: grid; place-items: center; font-weight: 800; margin-top: 3px; }
@media (prefers-color-scheme: dark) { .ticks li::before { color: var(--accent); } }

/* course & chapter */
.course-hd { display: flex; gap: 14px; align-items: flex-start; border-top: 5px solid var(--c); }
.chapters { list-style: none; padding: 0; margin: 0; }
.chapters .card { margin-bottom: 8px; padding: 12px 14px; }
.num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-family: var(--font-h); background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex: none; }
.is-done .num { background: #16A34A; color: #fff; }
.is-done b { color: var(--muted); }
.steps { display: grid; gap: 0; }
.step { display: flex; gap: 14px; }
.step-n { width: 32px; height: 32px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-family: var(--font-h); font-weight: 800; flex: none; }
.step ul { margin: 0; padding-left: 18px; }
.step p { margin: 0; }
.tip { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.tip p { margin: 4px 0 0; }
textarea, input, select { font: inherit; color: var(--ink); }
textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg); resize: vertical; }
.pager { display: flex; justify-content: space-between; gap: 10px; }

/* onboarding */
.onboard { max-width: 460px; margin: 0 auto; text-align: center; padding-top: 8px; }
.hero-logo img { border-radius: 26px; box-shadow: 0 10px 30px rgba(46,42,107,.3); }
.brand { font-family: var(--font-h); font-size: 2.2rem; color: var(--brand); margin: 12px 0 0; }
@media (prefers-color-scheme: dark) { .brand { color: #CFCBFF; } }
.tag { font-family: var(--font-h); font-weight: 600; color: var(--accent); font-size: 1.1rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin-bottom: 18px; }
.form { text-align: left; display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: .92rem; }
.form input, .form select { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 12px; font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.av input { position: absolute; opacity: 0; }
.av span { display: grid; place-items: center; aspect-ratio: 1; font-size: 1.5rem; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; background: var(--bg); }
.av input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.av input:focus-visible + span { outline: 2px solid var(--brand-2); }

/* progress */
.hpc-hd { display: flex; gap: 14px; align-items: center; }
.big-av { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: color-mix(in srgb, var(--accent) 20%, var(--surface)); flex: none; }
.big-av.sm { width: 44px; height: 44px; font-size: 1.4rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.stats div { background: var(--bg); border-radius: 14px; padding: 10px 4px; }
.stats b { display: block; font-family: var(--font-h); font-size: 1.35rem; }
.stats small { color: var(--muted); font-size: .75rem; }
.prow { display: grid; grid-template-columns: 1fr auto; padding: 8px 0; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.prow .bar { grid-column: 1 / -1; margin-top: 6px; }
.recent { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recent:last-child { border-bottom: 0; }
.recent b, .recent small { display: block; }

/* me */
.prof { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.prof-main { flex: 1; display: flex; align-items: center; gap: 12px; background: none; border: 0; text-align: left; cursor: pointer; padding: 4px 0; }
.prof-main b, .prof-main small { display: block; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); }
.seg { display: flex; gap: 6px; padding: 6px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 12px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.links { display: grid; padding: 4px 16px; }
.links a, .links button { padding: 13px 0; border-bottom: 1px solid var(--line); text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; cursor: pointer; }
.links .danger { color: #DC2626; border-bottom: 0; }
.prose ul { padding-left: 0; }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--sab, env(safe-area-inset-bottom))); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 20; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
