/* ==========================================================================
   DevPath — design tokens
   Signature: segmented progress blocks + the learning path drawn as a route.
   ========================================================================== */
:root {
  --ink: #0D1222; --panel: #151B30; --raised: #1C2440; --line: #2B3558; --line-soft: #222A47;
  --text: #E7EAF6; --muted: #98A2C3; --faint: #6A7397;
  --indigo: #7B83FF; --violet: #A98BFF; --blue: #49B8FF;
  --pass: #34D399; --warn: #F4B740; --fail: #FF6B81;
  --accent-grad: linear-gradient(120deg, var(--indigo), var(--violet));
  --glass: rgba(21, 27, 48, .72);
  --shadow: 0 10px 30px -12px rgba(3, 6, 20, .7);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --side-w: 248px; --top-h: 60px; --bottom-h: 64px;
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  color-scheme: dark;
}
[data-theme="light"] {
  --ink: #F4F6FC; --panel: #FFFFFF; --raised: #EEF1FA; --line: #D5DBEE; --line-soft: #E4E8F5;
  --text: #151A2E; --muted: #4E5878; --faint: #7A84A6;
  --indigo: #4F55E0; --violet: #7A55E6; --blue: #0B7FC2;
  --pass: #0E9F6E; --warn: #B7791F; --fail: #D6334E;
  --glass: rgba(255, 255, 255, .78);
  --shadow: 0 10px 28px -14px rgba(30, 40, 90, .25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text); font-family: var(--font);
  font-size: clamp(15px, .9rem + .15vw, 16.5px); line-height: 1.6; -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(1200px 500px at 85% -10%, rgba(123, 131, 255, .10), transparent 60%),
                    radial-gradient(800px 400px at -10% 110%, rgba(169, 139, 255, .07), transparent 60%);
  background-attachment: fixed; min-height: 100vh;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s3); letter-spacing: -.015em; font-weight: 600; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.2rem, 1.05rem + .6vw, 1.5rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 var(--s3); }
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .88em; background: var(--raised); border: 1px solid var(--line-soft); padding: .08em .35em; border-radius: 4px; }
strong { font-weight: 600; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--indigo); color: #fff; padding: .5rem 1rem; border-radius: var(--r-sm); }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.ic-sm { width: 15px; height: 15px; vertical-align: -2px; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: var(--s5) 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--s4) var(--s3);
  border-right: 1px solid var(--line-soft); background: var(--glass); backdrop-filter: blur(14px);
  display: flex; flex-direction: column; gap: var(--s3);
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.1rem; padding: .4rem .5rem; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; flex: none; background:
  linear-gradient(#0D1222, #0D1222) 4px 11px / 4px 6px no-repeat,
  linear-gradient(#0D1222, #0D1222) 9px 8px / 4px 9px no-repeat,
  linear-gradient(#0D1222, #0D1222) 14px 5px / 4px 12px no-repeat, var(--accent-grad); }
.side-track { padding: .55rem .7rem; border: 1px solid var(--line-soft); border-radius: var(--r); font-size: .82rem; display: grid; }
.side-track span { color: var(--muted); }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a, .sheet-grid a {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; font-size: .93rem; transition: background .15s, color .15s;
}
.sidebar nav a:hover, .sheet-grid a:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.sidebar nav a[aria-current], .sheet-grid a[aria-current] { background: var(--raised); color: var(--text); box-shadow: inset 3px 0 0 var(--indigo); }
.nav2 { padding-top: var(--s3); border-top: 1px solid var(--line-soft); }
.side-level { margin-top: auto; padding: .7rem; border: 1px solid var(--line-soft); border-radius: var(--r); font-size: .82rem; display: grid; gap: .4rem; }
.lvl-row { display: flex; justify-content: space-between; gap: .5rem; }
.lvl-bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.lvl-bar i { display: block; height: 100%; background: var(--accent-grad); border-radius: 3px; transition: width .6s ease; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5); background: var(--glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-soft);
}
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: .5rem; background: var(--raised); border: 1px solid var(--line-soft); border-radius: 999px; padding: 0 .9rem; color: var(--muted); }
.search:focus-within { border-color: var(--indigo); }
.search input { flex: 1; background: none; border: 0; color: var(--text); font: inherit; padding: .5rem 0; outline: none; min-width: 0; }
.sync-pill { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 500; color: var(--muted); padding: .3rem .7rem; border: 1px solid var(--line-soft); border-radius: 999px; white-space: nowrap; }
.sync-pill:hover { text-decoration: none; color: var(--text); }
.sync-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync-pill[data-state="synced"] i, .sync-pill[data-state="idle"] i { background: var(--pass); }
.sync-pill[data-state="syncing"] i { background: var(--blue); animation: pulse 1s infinite; }
.sync-pill[data-state="pending"] i { background: var(--warn); }
.sync-pill[data-state="offline"] i { background: var(--warn); }
.sync-pill[data-state="offline"] { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.sync-pill[data-state="error"] i { background: var(--fail); }
.sync-pill[data-state="local"] i { background: var(--violet); }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-soft); background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--text); background: var(--raised); }
#main { flex: 1; padding: var(--s5) var(--s5) var(--s7); width: 100%; max-width: 1180px; margin: 0 auto; outline: none; }
.mobile-only, .mobile-search { display: none; }
.bottomnav { display: none; }
.sheet { display: none; }

body.bare .sidebar, body.bare .topbar, body.bare .bottomnav { display: none; }
body.bare .app { grid-template-columns: 1fr; }
body.bare #main { max-width: none; padding: 0; }
body.focus-mode .sidebar { display: none; }
body.focus-mode .app { grid-template-columns: 1fr; }
body.focus-mode .bottomnav { display: none !important; }

/* ---------- Primitives ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
.page-head p { color: var(--muted); max-width: 62ch; margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: var(--s2); display: flex; gap: .4rem; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: grid; gap: var(--s3); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.between { justify-content: space-between; }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--r-lg); padding: var(--s5); min-width: 0; }
.card.tight { padding: var(--s4); }
.card.glass { background: var(--glass); backdrop-filter: blur(12px); }
.card h2, .card h3 { margin-bottom: var(--s2); }
.card-link { display: block; color: inherit; transition: border-color .15s, transform .15s; }
.card-link:hover { text-decoration: none; border-color: var(--line); transform: translateY(-1px); }
.sub { color: var(--muted); font-size: .9rem; }
.kv { display: flex; justify-content: space-between; gap: var(--s3); padding: .45rem 0; border-bottom: 1px solid var(--line-soft); font-size: .93rem; }
.kv:last-child { border-bottom: 0; }
.stat { display: grid; gap: .1rem; }
.stat b { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }

.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font: inherit; font-weight: 600; font-size: .93rem;
  padding: .6rem 1.05rem; border-radius: var(--r); cursor: pointer; border: 1px solid transparent; transition: transform .1s, background .15s, border-color .15s, opacity .15s; text-decoration: none; white-space: nowrap;
}
.btn { background: var(--accent-grad); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active, .btn-ghost:active { transform: scale(.97); }
.btn.danger { background: var(--fail); }
.btn.pass { background: var(--pass); color: #04261A; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--raised); text-decoration: none; }
.btn-ghost.on { border-color: var(--indigo); color: var(--indigo); }
.btn[disabled], .btn-ghost[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.sm { padding: .3rem .65rem; font-size: .82rem; border-radius: var(--r-sm); }
.wide { width: 100%; }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 500; padding: .12rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.diff-easy { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, transparent); }
.diff-medium { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.diff-hard { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); }
.chip.ok { color: var(--pass); border-color: color-mix(in srgb, var(--pass) 40%, transparent); }
.chip.bad { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); }

label { font-weight: 500; font-size: .9rem; display: block; margin-bottom: .3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .6rem .75rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px color-mix(in srgb, var(--indigo) 25%, transparent); }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field { margin-bottom: var(--s4); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .85rem; font-weight: 500; background: transparent; color: var(--muted); border: 0; padding: .35rem .75rem; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.err { color: var(--fail); font-size: .88rem; min-height: 1.2em; }

/* ---------- Segmented progress blocks (signature) ---------- */
.blocks { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 10px; min-width: 80px; }
.blocks i { background: var(--line-soft); border-radius: 2px; }
.blocks i.on { background: linear-gradient(120deg, var(--indigo), var(--violet)); }
.blocks.lg { height: 16px; gap: 4px; }
.blocks.lg i { border-radius: 3px; }
.blocks.sm { height: 6px; gap: 2px; }
.prog-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 3.2rem; align-items: center; gap: var(--s3); padding: .4rem 0; font-size: .93rem; }
.prog-row a { color: var(--text); }
.prog-row .num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- Learning path route ---------- */
.route { position: relative; display: grid; gap: var(--s3); padding-left: 38px; }
.route::before { content: ""; position: absolute; left: 13px; top: 18px; bottom: 18px; width: 2px; background: var(--line); border-radius: 1px; }
.station { position: relative; }
.station::before {
  content: attr(data-n); position: absolute; left: -38px; top: 18px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: .78rem; font-weight: 600; background: var(--ink); border: 2px solid var(--line); color: var(--muted);
}
.station.started::before { border-color: var(--indigo); color: var(--indigo); }
.station.done::before { content: "✓"; background: var(--accent-grad); border-color: transparent; color: #fff; }
.station.current .card { border-color: color-mix(in srgb, var(--indigo) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--indigo) 30%, transparent), var(--shadow); }
.station .card { display: grid; grid-template-columns: 1fr auto; gap: var(--s2) var(--s4); align-items: center; }
.station .meta { display: flex; gap: var(--s2); flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.station .blocks { grid-column: 1 / -1; }

/* ---------- Dashboard ---------- */
.hello { padding: var(--s6); position: relative; overflow: hidden; }
.hello h1 { margin-bottom: var(--s1); }
.hello .bigbar { margin: var(--s4) 0 var(--s2); }
.continue { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s4); margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line-soft); }
.goal-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.goal { display: grid; grid-template-columns: 26px 1fr auto; gap: var(--s3); align-items: center; padding: .6rem .7rem; border-radius: var(--r); border: 1px solid var(--line-soft); }
.goal .tick { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; }
.goal.done .tick { background: var(--pass); border-color: var(--pass); color: #04261A; }
.goal.done .gtext { color: var(--muted); }
.goal.done .glabel { text-decoration: line-through; text-decoration-color: var(--faint); }
.goal .gtext small { display: block; color: var(--muted); text-decoration: none; }
.weak-item { display: grid; grid-template-columns: 1fr auto; gap: .2rem var(--s3); align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.weak-item:last-child { border-bottom: 0; }
.acc { font-variant-numeric: tabular-nums; font-weight: 600; }
.acc.bad { color: var(--fail); } .acc.mid { color: var(--warn); } .acc.good { color: var(--pass); }
.streak-num { font-size: 2.4rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; display: flex; align-items: center; gap: .4rem; }
.streak-num .ic { width: 30px; height: 30px; color: var(--warn); }
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: var(--s3); }
.week-dots span { display: grid; gap: 4px; justify-items: center; font-size: .72rem; color: var(--faint); }
.week-dots i { width: 100%; aspect-ratio: 1; max-width: 30px; border-radius: 6px; background: var(--line-soft); }
.week-dots i.on { background: var(--accent-grad); }
.week-dots i.today { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------- Lesson ---------- */
.lesson-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s5); align-items: start; }
.lesson-body { max-width: 74ch; }
.lesson-body section { margin-bottom: var(--s6); }
.lesson-body h2 { font-size: 1.2rem; margin-top: 0; display: flex; align-items: center; gap: .5rem; }
.lesson-body p, .lesson-body li { color: color-mix(in srgb, var(--text) 92%, var(--muted)); }
.lesson-body ul, .lesson-body ol { padding-left: 1.3rem; margin: 0 0 var(--s3); }
.lesson-body li { margin-bottom: .3rem; }
.callout { border-left: 3px solid var(--indigo); background: color-mix(in srgb, var(--indigo) 8%, transparent); border-radius: 0 var(--r) var(--r) 0; padding: var(--s4) var(--s5); }
.callout.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.callout.pass { border-color: var(--pass); background: color-mix(in srgb, var(--pass) 7%, transparent); }
.callout > :last-child { margin-bottom: 0; }
.terms { display: grid; gap: 0; margin: 0; }
.terms div { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: var(--s3); padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.terms dt { font-weight: 600; }
.terms dd { margin: 0; color: var(--muted); }
.lesson-aside { position: sticky; top: calc(var(--top-h) + 16px); display: grid; gap: var(--s3); }
.toc a { display: block; color: var(--muted); font-size: .88rem; padding: .25rem 0; }
.toc a:hover { color: var(--text); }
.lesson-foot { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; align-items: center; padding: var(--s4) 0; border-top: 1px solid var(--line-soft); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: var(--s4); overflow-x: auto; scrollbar-width: none; }
.tabs button { font: inherit; font-weight: 500; font-size: .92rem; background: none; border: 0; color: var(--muted); padding: .6rem .9rem; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--indigo); }

/* ---------- Code ---------- */
.code { border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; margin: 0 0 var(--s3); background: #0A0E1B; }
[data-theme="light"] .code { background: #1A1F33; }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: .3rem .4rem .3rem .8rem; font-size: .75rem; color: #8B93B5; border-bottom: 1px solid rgba(255,255,255,.06); }
.code-bar .btn-ghost { color: #C5CBE6; border-color: rgba(255,255,255,.12); }
.code pre { margin: 0; padding: var(--s4); overflow-x: auto; }
.code code { background: none; border: 0; padding: 0; color: #DDE2F7; font-size: .86rem; line-height: 1.6; white-space: pre; }

/* ---------- Quiz ---------- */
.quiz { max-width: 760px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s3); font-size: .9rem; color: var(--muted); flex-wrap: wrap; }
.q-text { font-size: 1.12rem; font-weight: 500; line-height: 1.5; margin-bottom: var(--s4); }
.options { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.opt {
  display: grid; grid-template-columns: 30px 1fr; gap: var(--s3); align-items: start; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .75rem .9rem; cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.opt:hover:not([disabled]) { border-color: var(--indigo); background: var(--raised); }
.opt .letter { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .82rem; font-weight: 600; border: 1px solid var(--line); color: var(--muted); }
.opt.picked { border-color: var(--indigo); background: color-mix(in srgb, var(--indigo) 10%, var(--panel)); }
.opt.picked .letter { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.opt.right { border-color: var(--pass); background: color-mix(in srgb, var(--pass) 10%, var(--panel)); }
.opt.right .letter { background: var(--pass); border-color: var(--pass); color: #04261A; }
.opt.wrong { border-color: var(--fail); background: color-mix(in srgb, var(--fail) 9%, var(--panel)); }
.opt.wrong .letter { background: var(--fail); border-color: var(--fail); color: #fff; }
.opt[disabled] { cursor: default; }
.opt code { font-size: .85em; }
.explain { margin-top: var(--s4); }
.quiz-nav { display: flex; justify-content: space-between; gap: var(--s3); margin-top: var(--s5); flex-wrap: wrap; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.palette button { aspect-ratio: 1; font: inherit; font-size: .82rem; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; position: relative; }
.palette button.answered { background: color-mix(in srgb, var(--indigo) 22%, var(--panel)); color: var(--text); border-color: color-mix(in srgb, var(--indigo) 50%, transparent); }
.palette button.flagged::after { content: ""; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.palette button.current { outline: 2px solid var(--blue); outline-offset: 1px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem; padding: .3rem .7rem; border-radius: var(--r-sm); border: 1px solid var(--line); }
.timer.low { color: var(--fail); border-color: var(--fail); }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: var(--s5); align-items: start; }
.exam-side { position: sticky; top: calc(var(--top-h) + 16px); }
.score-ring { --v: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--ring, var(--indigo)) calc(var(--v) * 1%), var(--line-soft) 0); }
.score-ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.score-ring b { font-size: 1.8rem; }
.score-ring span { font-size: .78rem; color: var(--muted); }
.review-q { border: 1px solid var(--line-soft); border-radius: var(--r); padding: var(--s4); }
.review-q.rv-ok { border-left: 3px solid var(--pass); }
.review-q.rv-bad { border-left: 3px solid var(--fail); }
.review-q.rv-skip { border-left: 3px solid var(--faint); }
.answer-line { font-size: .9rem; margin: .2rem 0; }

/* ---------- Lists / tables ---------- */
.list { display: grid; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item a.title { color: var(--text); font-weight: 500; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: color-mix(in srgb, var(--indigo) 70%, transparent); }
.chart .bar.hl { fill: var(--violet); }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font); }
.chart .val { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .threshold { stroke: var(--warn); stroke-dasharray: 4 4; }
.chart .line { fill: none; stroke: var(--indigo); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--indigo); stroke: var(--panel); stroke-width: 2; }
.chart .dot.bad { fill: var(--fail); }

/* ---------- Badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); }
.badge { display: grid; grid-template-columns: 48px 1fr; gap: var(--s3); align-items: center; padding: var(--s4); border-radius: var(--r-lg); border: 1px solid var(--line-soft); background: var(--panel); }
.badge .bi { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.5rem; background: var(--raised); filter: grayscale(1); opacity: .5; }
.badge.got .bi { filter: none; opacity: 1; background: color-mix(in srgb, var(--violet) 22%, var(--raised)); }
.badge strong { display: block; font-size: .95rem; }
.badge small { color: var(--muted); display: block; line-height: 1.35; }
.badge .blocks { margin-top: .4rem; }

/* ---------- Feedback / overlays ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--blue); color: var(--text); padding: .7rem 1rem; border-radius: var(--r); box-shadow: var(--shadow); font-size: .9rem; }
.toast.ok { border-left-color: var(--pass); } .toast.error { border-left-color: var(--fail); } .toast.warn { border-left-color: var(--warn); }
.modal-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(5, 8, 20, .6); display: grid; place-items: center; padding: var(--s4); opacity: 0; transition: opacity .2s; backdrop-filter: blur(3px); }
.modal-wrap.in { opacity: 1; }
.modal { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow); transform: translateY(10px) scale(.98); transition: transform .2s; max-height: 90vh; overflow: auto; }
.modal-wrap.in .modal { transform: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s4); flex-wrap: wrap; }
.xp-burst { position: fixed; z-index: 95; left: 50%; top: 124px; transform: translateX(-50%); font-weight: 700; color: #fff; background: var(--accent-grad); padding: .35rem .9rem; border-radius: 999px; pointer-events: none; box-shadow: var(--shadow); }
.ach-pop { position: fixed; z-index: 96; left: 50%; top: 24px; transform: translateX(-50%); display: flex; gap: .9rem; align-items: center; background: var(--panel); border: 1px solid color-mix(in srgb, var(--violet) 60%, transparent); padding: .8rem 1.1rem; border-radius: var(--r-lg); box-shadow: 0 0 0 4px color-mix(in srgb, var(--violet) 15%, transparent), var(--shadow); min-width: 260px; }
.ach-pop .ach-icon { font-size: 1.9rem; }
.ach-pop span { display: block; color: var(--muted); font-size: .85rem; }
.empty { text-align: center; padding: var(--s7) var(--s4); color: var(--muted); max-width: 520px; margin: 0 auto; }
.empty h3 { color: var(--text); }
.boot { min-height: 60vh; display: grid; place-items: center; }
.boot .blocks { width: 180px; }
.skel-wrap { display: grid; gap: var(--s4); }
.skel { height: 96px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--panel) 25%, var(--raised) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.skel:first-child { height: 150px; }

/* ---------- Landing / auth ---------- */
.landing { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.land-nav { display: flex; justify-content: space-between; align-items: center; padding: var(--s4) clamp(1rem, 5vw, 4rem); }
.land-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: clamp(2rem, 5vw, 5rem); align-items: center; padding: var(--s6) clamp(1rem, 5vw, 4rem); max-width: 1280px; margin: 0 auto; width: 100%; }
.land-hero h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 4rem); line-height: 1.04; letter-spacing: -.04em; margin-bottom: var(--s4); max-width: 14ch; }
.land-hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 48ch; margin-bottom: var(--s5); }
.term { background: #0A0E1B; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); font-family: var(--mono); font-size: .86rem; color: #C9CFEA; }
.term-bar { display: flex; gap: 6px; padding: .6rem .8rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: #2B3558; }
.term-body { padding: var(--s4) var(--s5); display: grid; gap: .55rem; }
.term-line { display: grid; grid-template-columns: 9.5rem 1fr 3rem; gap: .8rem; align-items: center; }
.term-line .blocks { height: 9px; }
.term-line .pc { text-align: right; color: #8B93B5; }
.term-prompt { color: #8B93B5; } .term-prompt b { color: #A9B0FF; font-weight: 400; }
.land-modules { padding: var(--s6) clamp(1rem, 5vw, 4rem) var(--s7); max-width: 1280px; margin: 0 auto; width: 100%; }
.land-modules ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); padding: 0; list-style: none; counter-reset: m; }
.land-modules li { counter-increment: m; padding: var(--s4); border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--panel); }
.land-modules li::before { content: counter(m); color: var(--indigo); font-weight: 600; margin-right: .6rem; font-variant-numeric: tabular-nums; }
.land-modules li small { display: block; color: var(--muted); margin-top: .2rem; }
.land-foot { padding: var(--s5); text-align: center; color: var(--faint); font-size: .85rem; border-top: 1px solid var(--line-soft); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--s5) var(--s4); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { margin-bottom: var(--s4); padding-left: 0; }
.divider { display: flex; align-items: center; gap: var(--s3); color: var(--faint); font-size: .82rem; margin: var(--s4) 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
.notice { font-size: .88rem; padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); background: color-mix(in srgb, var(--violet) 8%, transparent); margin-bottom: var(--s4); }

/* ---------- Coding lab ---------- */
.editor { font-family: var(--mono); font-size: .88rem; min-height: 260px; background: #0A0E1B; color: #DDE2F7; border-color: var(--line); tab-size: 4; white-space: pre; }
.runner-box { border: 1px dashed var(--line); border-radius: var(--r); padding: var(--s4); font-size: .9rem; color: var(--muted); }
.hint { border: 1px solid var(--line-soft); border-radius: var(--r); padding: var(--s3) var(--s4); margin-bottom: var(--s2); }

/* ---------- Search ---------- */
.result-group { margin-bottom: var(--s5); }
.result { display: block; padding: var(--s3) var(--s4); border: 1px solid var(--line-soft); border-radius: var(--r); margin-bottom: var(--s2); color: var(--text); background: var(--panel); }
.result:hover { border-color: var(--line); text-decoration: none; }
.result small { color: var(--muted); display: block; }
mark { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

.pal-details summary { cursor: pointer; color: var(--muted); font-size: .88rem; margin-bottom: .6rem; list-style-position: inside; }
@media (min-width: 901px) { .pal-details summary { display: none; } }
