:root {
  --bg: #f5f8ff;
  --surface: #ffffff;
  --ink: #1d2433;
  --muted: #5c6780;
  --line: #e2e8f4;
  --brand: #1f6feb;
  --brand-ink: #ffffff;
  --sky: #dbe9ff;
  --good: #1f9d55;
  --good-bg: #e6f7ee;
  --bad: #d64545;
  --bad-bg: #fdecec;
  --warn-bg: #fff6dd;
  --gold: #f2b01e;
  --radius: 16px;
  --shadow: 0 2px 0 rgba(29, 36, 51, .06), 0 8px 24px rgba(31, 111, 235, .08);
  --font: 'Nunito', 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', system-ui, sans-serif;
  --display: 'Baloo 2', 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
a { color: var(--brand); }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 5vw, 46px); }
h2 { font-size: 26px; }
h3 { font-size: 20px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; align-self: center; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 26px; color: var(--ink); letter-spacing: -0.5px; }
.brand-name span { color: var(--brand); }
.brand-sub { color: var(--muted); font-size: 14px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav-user {
  padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--ink);
  font-weight: 700; border: 0; background: transparent;
}
.nav a.active, .nav a:hover, .nav-user:hover { background: var(--sky); }
.nav a.nav-cta { background: var(--brand); color: #fff; }
.nav a.nav-cta:hover { background: #164fae; }
.footer { text-align: center; color: var(--muted); font-size: 14px; padding: 20px 16px; }

/* ---------- Home ---------- */
.hero {
  background: linear-gradient(135deg, #1f6feb 0%, #6b4ce6 60%, #f2994a 130%);
  color: #fff; border-radius: 24px; padding: 32px 28px; margin-bottom: 28px; position: relative; overflow: hidden;
}
.hero p { font-size: 19px; max-width: 640px; margin: 0; opacity: .95; }
.hero h1 { padding-right: 120px; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .18); font-weight: 700; font-size: 15px;
}
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.grade-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.grade-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.grade-card .badge {
  font-family: var(--display); font-weight: 800; font-size: 22px; color: #fff;
  min-width: 48px; height: 48px; padding: 0 10px; border-radius: 14px; display: grid; place-items: center;
}
.grade-card .gname { font-weight: 800; font-size: 18px; margin-top: 6px; }
.grade-card .gmeta { color: var(--muted); font-size: 14px; }
.continue {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--warn-bg); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 24px;
}

/* ---------- Grade page ---------- */
.crumbs { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.crumbs a { text-decoration: none; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 20px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink); font-weight: 700;
  text-decoration: none;
}
.tab .ticon { font-size: 18px; }
.tab.active { color: #fff; border-color: transparent; }
.search { width: 100%; max-width: 360px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); font: inherit; }
.topics { columns: 2 360px; column-gap: 28px; }
.topic { break-inside: avoid; margin-bottom: 22px; background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.topic h3 { display: flex; gap: 10px; align-items: baseline; }
.topic h3 .letter { color: var(--muted); font-size: 16px; }
.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-list li + li { border-top: 1px dashed var(--line); }
.skill-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 2px; text-decoration: none; color: var(--ink);
}
.skill-link:hover .stitle { color: var(--brand); text-decoration: underline; }
.scode { color: var(--muted); font-size: 14px; min-width: 38px; font-variant-numeric: tabular-nums; }
.stitle { flex: 1; }
.sscore {
  font-size: 13px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--sky); color: var(--brand);
}
.sscore.mastered { background: #fff1c7; color: #8a5a00; }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--surface); border-radius: var(--radius); }

/* ---------- Practice ---------- */
.practice { display: grid; grid-template-columns: 1fr 240px; gap: 20px; align-items: start; }
.qcard { background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); min-height: 320px; }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.skill-name { color: var(--muted); font-weight: 700; }
.speak { border: 2px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; }
.prompt { font-size: clamp(20px, 3vw, 26px); font-weight: 700; margin: 10px 0 18px; }
.visual { font-size: clamp(34px, 6vw, 52px); letter-spacing: 4px; line-height: 1.3; margin: 0 0 18px; word-break: break-all; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.opt {
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); font-size: 19px; font-weight: 600; color: var(--ink); min-height: 56px;
}
.opt:hover:not(:disabled) { border-color: var(--brand); background: #f2f7ff; }
.opt.correct { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.answer-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.answer-input {
  font: inherit; font-size: 22px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  width: 220px; max-width: 100%;
}
.answer-input:focus { outline: none; border-color: var(--brand); }
.btn {
  border: 0; border-radius: 12px; padding: 12px 22px; font-weight: 800; font-size: 18px;
  background: var(--brand); color: var(--brand-ink); box-shadow: 0 3px 0 #164fae;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #164fae; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.hint { color: var(--muted); font-size: 14px; margin-top: 8px; }
.feedback { margin-top: 20px; border-radius: 14px; padding: 16px 18px; }
.feedback.good { background: var(--good-bg); color: #145c33; }
.feedback.bad { background: var(--bad-bg); color: #7d1f1f; }
.feedback.note { background: var(--warn-bg); color: #6b4b00; }
.feedback h3 { margin-bottom: 4px; }
.feedback .actions { margin-top: 12px; }

.sidebar { display: grid; gap: 12px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; text-align: center; box-shadow: var(--shadow); }
.stat .label { font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; padding: 4px 8px; border-radius: 8px; display: inline-block; }
.stat .value { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1.1; margin-top: 6px; }
.stat.answered .label { background: #2bb673; }
.stat.time .label { background: #4c8bf5; }
.stat.smart .label { background: #f2994a; }
.zone { font-size: 13px; color: var(--muted); }
.meter { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, #f2994a, #f2b01e); transition: width .4s ease; }

.mastered-banner { text-align: center; padding: 24px 10px; }
.mastered-banner .big { font-size: 72px; }

/* ---------- Progress ---------- */
.progress-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
table.report { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.report th, .report td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.report th { background: #f0f4fc; font-size: 14px; color: var(--muted); }
.report td.num { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---------- Curriculum outline ---------- */
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--sky); color: var(--brand); vertical-align: middle; }
.tag.pending { background: var(--warn-bg); color: #8a5a00; }
.tag.approved { background: var(--good-bg); color: #145c33; }
.tag.rejected { background: var(--bad-bg); color: #7d1f1f; }
.strand { margin: 26px 0 12px; font-size: 22px; color: var(--muted); }
.topic.classroom { background: #f7f9fd; box-shadow: none; border: 1px dashed var(--line); }
.topic.classroom h3 { color: var(--muted); }
details.outcome { margin: -4px 0 8px; font-size: 14px; color: var(--muted); }
details.outcome summary { cursor: pointer; font-weight: 700; }
details.outcome p { margin: 6px 0 0; }
.outcome-tag { display: inline-block; font-size: 13px; font-weight: 700; color: var(--muted); background: #f0f4fc; border-radius: 8px; padding: 2px 8px; }
pre.visual { font-family: inherit; white-space: pre-wrap; }
.visual:has(+ *) { margin-bottom: 18px; }
.grade-card.mine { border-color: var(--gold); }
.curriculum-pick select { background: transparent; color: #fff; border: 0; font: inherit; font-weight: 700; cursor: pointer; max-width: 220px; }
.curriculum-pick select option { color: var(--ink); }
.side-note { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; margin: 0; }

/* ---------- Forms & auth ---------- */
.auth-card { max-width: 460px; margin: 10px auto; background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 620px; }
.stack { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; font-weight: 700; }
.field input, .field select, .filters select {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); }
.field small { font-weight: 400; }
fieldset { border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px 14px; display: grid; gap: 12px; margin: 0; }
legend { font-weight: 800; padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.form-error:empty { display: none; }
.plan-tabs { margin: 8px 0 4px; }
.plan-tabs .tab.active { background: var(--brand); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0 16px; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; box-shadow: none; text-decoration: none; display: inline-block; }
.btn.secondary { text-decoration: none; }
a.btn { text-decoration: none; display: inline-block; }
.row-actions { white-space: nowrap; }
.row-actions .btn + .btn { margin-left: 6px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select { width: auto; }
ul.plain { list-style: none; padding: 0; margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ---------- Account & dashboards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 6px; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; }
.upgrade { border-top: 1px dashed var(--line); padding-top: 12px; margin-top: 12px; }
.upgrade p { margin: 0 0 10px; }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 10px 0 20px; }
.child-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.child-card:hover { border-color: var(--brand); }
.child-card .mini-stats { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #1f6feb, #6b4ce6); color: #fff; font-family: var(--display); font-weight: 800; font-size: 22px; }
tr.off td { color: var(--muted); }
tr.miss td:first-child, tr.ok td:first-child { width: 28px; }
.report select { font: inherit; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); }
.report.history td:nth-child(2) { max-width: 420px; }
h2 { margin-top: 26px; }
.activity { display: flex; align-items: flex-end; gap: 4px; height: 140px; background: var(--surface); border-radius: var(--radius); padding: 14px 14px 26px; box-shadow: var(--shadow); overflow-x: auto; }
.activity .day { flex: 1 0 18px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.activity .day span { width: 100%; max-width: 26px; background: linear-gradient(180deg, #4c8bf5, #1f6feb); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.activity .day small { position: absolute; bottom: -20px; font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 20px; padding: 24px; width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; display: grid; gap: 12px; }
.modal h2 { margin: 0; }
.modal .actions { margin: 4px 0 0; }

@media (max-width: 760px) {
  .practice { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: repeat(3, 1fr); order: -1; }
  .stat { padding: 8px; }
  .stat .value { font-size: 26px; }
  .stat .label { font-size: 11px; }
  .zone { display: none; }
  .qcard { padding: 20px 16px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 22px; }
  .topbar { flex-wrap: wrap; }
  .nav { flex-wrap: wrap; justify-content: flex-start; }
  .auth-card { padding: 20px 16px; }
  .nav a, .nav-user { padding: 6px 8px; font-size: 15px; }
}

/* ---------- TutorSync: provinces, learn tab ---------- */
.hero .hero-mark { position: absolute; right: 28px; top: 24px; width: 96px; height: 96px; opacity: .95; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.province-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 10px; }
.province { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; text-align: left; box-shadow: var(--shadow); }
button.province:hover { border-color: var(--brand); }
.province.on { border-color: var(--brand); background: #eef4ff; }
.province .pcode { font-family: var(--display); font-weight: 800; font-size: 14px; color: #fff; background: #d62828; border-radius: 8px; padding: 2px 7px; }
.province.soon { opacity: .6; box-shadow: none; background: #f7f9fd; flex-wrap: wrap; }
.province.soon .pcode { background: var(--muted); }
.province small { width: 100%; color: var(--muted); font-weight: 600; padding-left: 2px; }
.province .pcheck { margin-left: auto; color: var(--brand); }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }
.linkish.on { font-weight: 800; text-decoration: none; }
.big-ideas { background: #fffaf0; border: 1px solid #f5e1b8; border-radius: var(--radius); padding: 10px 16px; margin: 6px 0 16px; }
.big-ideas summary { font-weight: 800; cursor: pointer; }
.big-ideas ul { margin: 8px 0 0; padding-left: 20px; }
details.outcome ul { margin: 6px 0 0; padding-left: 18px; }
.skill-list li { display: flex; align-items: center; }
.skill-list li .skill-link { flex: 1; }
.learn-link { text-decoration: none; padding: 4px 6px; border-radius: 8px; opacity: .65; }
.learn-link:hover { opacity: 1; background: var(--sky); }
.mode-tabs { margin: 6px 0 14px; }
.mode-tabs .tab { cursor: pointer; }
.mode-tabs .tab.active { background: var(--brand); }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-bottom: 18px; }
.learn .card h2 { margin-top: 0; }
.outcome-text { background: #f0f4fc; border-radius: 12px; padding: 10px 12px; }
.example { border-top: 1px dashed var(--line); padding: 12px 0; }
.example:first-child { border-top: 0; }
.ex-num { font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.prompt.small { font-size: 19px; margin: 4px 0 8px; }
.visual.small { font-size: 28px; margin: 0 0 8px; }
.example details summary, .study-card summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.study-card { background: #f7f9fd; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.study-card summary { color: var(--ink); }
.study-card[open] { background: var(--good-bg); border-color: #bfe8cf; }
.study-card p { margin: 8px 0 0; }
.footer a { color: var(--muted); }
@media (max-width: 760px) {
  .hero .hero-mark { width: 56px; height: 56px; opacity: .35; }
  .hero h1 { padding-right: 0; }
  .province-grid { grid-template-columns: 1fr 1fr; }
}
