/* PyQuest shared styles: tokens, header, buttons, landing, auth, problem list, profile */
:root {
  --bg: #e9e9e3;
  --panel: #fbfbf7;
  --panel-2: #f2f2ec;
  --line: #dddcd3;
  --ink: #15161c;
  --ink-2: #4a4b55;
  --ink-3: #85868f;
  --dark: #16171d;
  --dark-2: #1d1e26;
  --dark-3: #272834;
  --dark-line: #2f303c;
  --lime: #d4f53c;
  --lime-ink: #1a2200;
  --purple: #7c5cff;
  --purple-soft: #ece8ff;
  --orange: #f07a1a;
  --orange-soft: #fdeedd;
  --red: #ff5d5d;
  --red-soft: #ffe3e0;
  --green: #2fbf71;
  --easy: #2fbf71;
  --medium: #f0a01a;
  --hard: #ef4d4d;
  --very-easy: #38bdf8;
  --very-hard: #8b1e3f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 8px 24px rgba(20, 20, 30, .06);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
code, kbd, pre { font-family: var(--mono); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 28px;
  position: relative; z-index: 5;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--dark);
  display: grid; place-items: center; color: var(--lime);
}
.logo-mark svg { width: 24px; height: 24px; }
.nav-links { display: flex; gap: 4px; margin-left: 18px; }
.nav-links a {
  text-decoration: none; font-weight: 600; font-size: 15px; color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px;
}
.nav-links a:hover { background: var(--panel); color: var(--ink); }
.nav-links a.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.spacer { flex: 1; }

.stat-pill {
  display: flex; align-items: center; gap: 14px;
  background: var(--dark); color: #fff; border-radius: 999px;
  padding: 7px 8px 7px 18px; text-decoration: none;
}
.stat-pill .streak { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; white-space: nowrap; }
.stat-pill .streak svg { width: 18px; height: 18px; color: var(--orange); }
.stat-pill .divider { width: 1px; height: 26px; background: #3a3b46; }
.xp-block { display: flex; flex-direction: column; gap: 5px; min-width: 150px; }
.xp-block .xp-labels { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; gap: 12px; color: #e8e8ee; }
.bar { height: 6px; border-radius: 6px; background: #3a3b46; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--lime); border-radius: 6px; transition: width .6s ease; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--purple);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.guest-pill .avatar { background: #555665; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid var(--line); background: var(--panel);
  padding: 11px 20px; border-radius: 14px; font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform .08s ease, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: #fff; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 18px; height: 18px; }
.btn-dark { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn-dark:hover { background: #262733; }
.btn-lime { background: var(--lime); color: var(--lime-ink); border-color: #b8d826; box-shadow: 0 3px 0 #a9c81f; }
.btn-lime:hover { background: #dcfa52; box-shadow: 0 3px 0 #a9c81f; }
.btn-lime:active { box-shadow: 0 1px 0 #a9c81f; transform: translateY(2px); }
.btn-ghost-dark { background: transparent; color: #fff; border-color: #3a3b48; }
.btn-ghost-dark:hover { background: #262733; box-shadow: none; }
.btn-icon { padding: 0; width: 46px; height: 46px; border-radius: 14px; }
.btn-sm { padding: 7px 13px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { padding: 15px 28px; font-size: 17px; border-radius: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px;
  border-radius: 999px; font-weight: 700; font-size: 13.5px; border: 1px solid var(--line); background: var(--panel-2);
  white-space: nowrap;
}
.chip-easy { background: #e3f7ea; border-color: #bfe9cf; color: #17784a; }
.chip-medium { background: var(--orange-soft); border-color: #f6d2ad; color: #a5520d; }
.chip-very-easy { background: #e0f4fd; border-color: #b6e3f8; color: #0b6a94; }
.chip-very-hard { background: #f6e1e8; border-color: #e7b9c8; color: #8b1e3f; }
.chip-hard { background: var(--red-soft); border-color: #f7c3bd; color: #b3261e; }
.chip-xp { background: var(--purple-soft); border-color: #d9d0ff; color: #5a3fe0; }
.chip-solved { background: var(--dark); color: var(--lime); border-color: var(--dark); }
.meter { display: inline-flex; gap: 3px; }
.meter i { width: 7px; height: 15px; border-radius: 3px; background: currentColor; opacity: .22; }
.meter i.on { opacity: 1; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------- landing ---------- */
.landing { max-width: 1180px; margin: 0 auto; padding: 10px 28px 60px; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 50px; align-items: center; padding: 40px 0 70px; }
.eyebrow { font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hero h1 { font-size: 60px; line-height: 1.02; letter-spacing: -.035em; margin: 14px 0 20px; }
.hero h1 mark { background: var(--lime); padding: 0 .12em; border-radius: 10px; }
.hero p.lead { font-size: 19px; color: var(--ink-2); max-width: 520px; margin: 0 0 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-note { margin-top: 18px; font-size: 14px; color: var(--ink-3); }

.mock {
  background: var(--dark); border-radius: 22px; padding: 18px; color: #e6e6ee; box-shadow: 0 30px 60px rgba(20, 20, 30, .25);
  transform: rotate(1.2deg);
}
.mock-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.mock-bar .tab { background: var(--dark-3); padding: 7px 12px; border-radius: 10px; font-family: var(--mono); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); display: inline-block; }
.mock-bar .lang { background: var(--lime); color: var(--lime-ink); padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; }
.mock pre { margin: 0; font-size: 14.5px; line-height: 1.75; padding: 6px 4px 14px; }
.mock .ln { color: #5d5f6e; display: inline-block; width: 26px; }
.tok-kw { color: #c792ea; } .tok-fn { color: var(--lime); } .tok-cm { color: #6f7385; font-style: italic; } .tok-num { color: #f78c6c; } .tok-str { color: #c3e88d; } .tok-bi { color: #82aaff; }
.mock-trail { display: flex; align-items: center; gap: 10px; padding: 14px; background: var(--dark-2); border-radius: 14px; }
.mock-trail .cp { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--lime); color: var(--lime-ink); }
.mock-trail .cp.lock { background: var(--dark-3); color: #9a9bab; }
.mock-trail .dash { flex: 1; border-top: 2px dashed #4a4c5c; }
.mock-msg { margin-top: 12px; display: flex; gap: 10px; align-items: center; font-size: 14px; }
.mock-msg .bubble { background: var(--dark-3); padding: 10px 14px; border-radius: 12px; }

.bit {
  width: 44px; height: 44px; border-radius: 13px; background: var(--lime); position: relative; flex-shrink: 0;
  display: grid; place-items: center;
}
.bit svg { width: 30px; height: 30px; }

.section { padding: 50px 0; }
.section h2 { font-size: 38px; letter-spacing: -.03em; margin: 8px 0 14px; line-height: 1.1; }
.section > p.sub { color: var(--ink-2); font-size: 17px; max-width: 640px; margin: 0 0 30px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { padding: 26px; }
.feature .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--dark); color: var(--lime); margin-bottom: 16px; }
.feature .ic svg { width: 24px; height: 24px; }
.feature h3 { margin: 0 0 8px; font-size: 19px; letter-spacing: -.01em; }
.feature p { margin: 0; color: var(--ink-2); font-size: 15px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.step { padding: 26px; position: relative; }
.step::before {
  counter-increment: step; content: counter(step);
  width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--ink); display: grid; place-items: center;
  font-weight: 800; margin-bottom: 14px;
}
.step h3 { margin: 0 0 6px; font-size: 18px; }
.step p { margin: 0; color: var(--ink-2); font-size: 15px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.tier-card { padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.tier-card h3 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tier-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.tier-card .count { font-family: var(--mono); color: var(--ink-3); font-size: 13px; }
.cta-band {
  background: var(--dark); color: #fff; border-radius: 26px; padding: 46px; display: flex; align-items: center; gap: 30px; margin-top: 30px;
}
.cta-band h2 { color: #fff; margin: 0 0 6px; font-size: 34px; }
.cta-band p { margin: 0; color: #b9bac6; }
footer.foot { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 30px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 90px); display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 430px; padding: 34px; }
.auth-card h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.02em; }
.auth-card p.sub { margin: 0 0 22px; color: var(--ink-2); }
.seg { display: flex; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 22px; }
.seg button { flex: 1; white-space: nowrap; border: 0; background: transparent; padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--dark); color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 700; font-size: 14px; }
.field input {
  font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; outline: none;
}
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(212, 245, 60, .6); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.form-error { background: var(--red-soft); color: #9c1c14; padding: 10px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.auth-card .btn { width: 100%; }
.google-btn { width: 100%; background: #fff; border-color: var(--line); font-weight: 650; }
.google-btn:hover { background: #fff; border-color: #c9c9c0; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; font-weight: 600; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-2); }

/* ---------- problems list ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 6px 28px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 20px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-head h1 { margin: 6px 0 0; font-size: 40px; letter-spacing: -.03em; line-height: 1.1; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin-bottom: 26px; }
.summary { padding: 20px 22px; }
.summary .label { font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.summary .value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 10px; }
.summary .value small { font-size: 15px; color: var(--ink-3); font-weight: 600; }
.summary .bar { background: var(--panel-2); border: 1px solid var(--line); height: 9px; }
.summary.dark { background: var(--dark); color: #fff; border-color: var(--dark); }
.summary.dark .label { color: #9a9bab; }
.summary.dark .bar { background: #33343f; border: 0; }
.summary .continue { margin-top: 12px; }
.bar.easy > span { background: var(--easy); } .bar.medium > span { background: var(--medium); } .bar.hard > span { background: var(--hard); } .bar.very-easy > span { background: var(--very-easy); } .bar.very-hard > span { background: var(--very-hard); }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .seg { margin: 0; }
.toolbar .seg button { padding: 8px 16px; }
.search {
  flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 14px;
}
.search input { border: 0; outline: 0; background: transparent; font: inherit; padding: 11px 0; flex: 1; }
.search svg { width: 18px; height: 18px; color: var(--ink-3); }
select.select { font: inherit; font-weight: 600; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }

.module { margin-bottom: 26px; }
.module-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.module-head h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.module-head .count { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.module-head p { margin: 0; }
.module-intro { color: var(--ink-2); font-size: 14.5px; margin: -4px 0 12px; max-width: 820px; }
.plist { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.prow {
  display: flex; align-items: center; gap: 14px; padding: 13px 16px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; transition: transform .1s, box-shadow .15s;
}
.prow:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.prow .num { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--ink-3); width: 34px; }
.prow .t { flex: 1; font-weight: 650; font-size: 15px; line-height: 1.3; }
.prow .status { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--line); }
.prow .status svg { width: 15px; height: 15px; }
.prow.solved .status { background: var(--dark); border-color: var(--dark); color: var(--lime); }
.prow.started .status { border-color: var(--medium); border-style: dashed; }
.tier-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tier-dot.easy { background: var(--easy); } .tier-dot.medium { background: var(--medium); } .tier-dot.hard { background: var(--hard); } .tier-dot.very-easy { background: var(--very-easy); } .tier-dot.very-hard { background: var(--very-hard); }
.prow .xp { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.empty { text-align: center; color: var(--ink-3); padding: 50px; }

.banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; background: var(--purple-soft);
  border: 1px solid #d9d0ff; margin-bottom: 20px; font-size: 14.5px;
}
.banner .btn { margin-left: auto; }

/* ---------- profile ---------- */
.profile-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; }
.profile-card { padding: 26px; }
.profile-card h2 { margin: 0 0 16px; font-size: 19px; }
.who { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.who .avatar { width: 64px; height: 64px; font-size: 22px; }
.who h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.who .handle { color: var(--ink-3); font-family: var(--mono); font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.kpi b { display: block; font-size: 24px; letter-spacing: -.02em; }
.kpi span { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.mod-progress { display: flex; flex-direction: column; gap: 12px; }
.mod-progress .row { display: grid; grid-template-columns: 1fr 70px; gap: 4px 12px; align-items: center; font-size: 14px; }
.mod-progress .row .bar { grid-column: 1 / -1; background: var(--panel-2); border: 1px solid var(--line); height: 8px; }
.mod-progress .row .n { text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.calendar { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; margin-bottom: 8px; }
.calendar i { aspect-ratio: 1; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); }
.calendar i.on { background: var(--lime); border-color: #b8d826; }
.calendar i.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.recent li a { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); text-decoration: none; font-size: 14px; }
.recent .res { margin-left: auto; font-family: var(--mono); font-size: 12.5px; font-weight: 700; }
.recent .res.ok { color: #17784a; } .recent .res.bad { color: #b3261e; }

@media (max-width: 960px) {
  .hero, .profile-grid { grid-template-columns: 1fr; }
  .features, .steps, .tiers { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 44px; }
  .nav-links { display: none; }
  .cta-band { flex-direction: column; align-items: flex-start; }
}

/* ---------- theme toggle ---------- */
.theme-toggle {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex-shrink: 0; padding: 0;
  transition: background .15s, color .15s;
}
.theme-toggle:hover { color: var(--ink); box-shadow: var(--shadow); }
.theme-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; }
.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* ---------- dark theme ----------
   Tokens first; then the few places that used hard-coded light colours. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f13;
  --panel: #17181f;
  --panel-2: #1f2029;
  --line: #2b2c37;
  --ink: #ececf2;
  --ink-2: #b3b4c2;
  --ink-3: #82838f;
  --dark: #262733;
  --dark-2: #191a21;
  --dark-3: #272834;
  --dark-line: #2f303c;
  --purple-soft: #2a2442;
  --orange-soft: #3a2a17;
  --red-soft: #3d1f1f;
  --very-hard: #d1517a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}
[data-theme="dark"] .btn:hover { background: #22232d; }
[data-theme="dark"] .btn-dark { background: #2e2f3c; border-color: #3a3b4a; }
[data-theme="dark"] .btn-dark:hover { background: #383a49; }
[data-theme="dark"] .btn-lime:hover { background: #dcfa52; }
[data-theme="dark"] .hero h1 mark { color: var(--lime-ink); }
[data-theme="dark"] .mock { box-shadow: 0 30px 60px rgba(0, 0, 0, .55); border: 1px solid var(--line); }
[data-theme="dark"] .cta-band { background: var(--panel); border: 1px solid var(--line); }
[data-theme="dark"] .feature .ic, [data-theme="dark"] .logo-mark { background: #23242e; }
[data-theme="dark"] .chip-easy { background: #13301f; border-color: #1e4a30; color: #6fdc9d; }
[data-theme="dark"] .chip-medium { background: #3a2a14; border-color: #5a3f1a; color: #f5b860; }
[data-theme="dark"] .chip-very-easy { background: #0f2b3a; border-color: #184458; color: #7fd1f7; }
[data-theme="dark"] .chip-very-hard { background: #3a1624; border-color: #5a2338; color: #f08aac; }
[data-theme="dark"] .chip-hard { background: #3d1c1c; border-color: #5c2a2a; color: #ff8f86; }
[data-theme="dark"] .chip-xp { border-color: #3d3466; color: #b6a6ff; }
[data-theme="dark"] .field input, [data-theme="dark"] .google-btn, [data-theme="dark"] .google-btn:hover { background: var(--panel-2); }
[data-theme="dark"] .field input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(212, 245, 60, .25); }
[data-theme="dark"] .form-error { color: #ffb4ab; }
[data-theme="dark"] .banner { border-color: #3d3466; }
[data-theme="dark"] .seg button.on { background: var(--lime); color: var(--lime-ink); }
[data-theme="dark"] .summary.dark { background: #1c1d27; border-color: var(--line); }
[data-theme="dark"] .prow.solved .status { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
[data-theme="dark"] .chip-solved { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }
[data-theme="dark"] .calendar i.on { border-color: var(--lime); }
[data-theme="dark"] .recent .res.ok { color: #6fdc9d; } [data-theme="dark"] .recent .res.bad { color: #ff8f86; }
[data-theme="dark"] .stat-pill { background: #1c1d27; border: 1px solid var(--line); }
[data-theme="dark"] .avatar { color: #fff; }

/* ---------- dashboard ---------- */
.dash-grid { max-width: 1320px; margin: 0 auto; padding: 6px 28px 60px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-hello { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.dash-hello h1 { margin: 6px 0 0; font-size: 36px; letter-spacing: -.03em; line-height: 1.1; }
.dash-hello p { margin: 6px 0 0; color: var(--ink-2); }
.dash-hello .spacer { flex: 1; }
.dash-card { padding: 22px; }
.dash-card h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.dash-card h2 .more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--ink-3); text-decoration: none; }
.dash-card h2 .more:hover { color: var(--ink); }
.dash-stats { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: 18px; }
.dash-stats .dash-card h2 { white-space: nowrap; }

/* solved ring */
.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--panel-2); }
.ring .arc { stroke-linecap: butt; transition: stroke-dasharray .8s ease; }
.ring .center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .center b { font-size: 32px; letter-spacing: -.03em; line-height: 1; }
.ring .center small { font-size: 12.5px; color: var(--ink-3); font-weight: 600; margin-top: 4px; }
.ring-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.ring-legend li { white-space: nowrap; display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; font-size: 13px; padding: 5px 10px; border-radius: 10px; background: var(--panel-2); }
.ring-legend .n { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.ring-legend .n b { color: var(--ink); }

/* big number tiles */
.big { font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1; display: flex; align-items: baseline; gap: 8px; }
.big small { font-size: 15px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.tile-sub { color: var(--ink-2); font-size: 13.5px; margin: 10px 0 0; }
.tile-sub b { color: var(--ink); }
.flame-ic { width: 30px; height: 30px; color: var(--orange); align-self: center; }
.rank-ic { width: 28px; height: 28px; color: var(--purple); align-self: center; }
.week { display: flex; gap: 6px; margin-top: 14px; }
.week span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.week i { width: 100%; max-width: 28px; aspect-ratio: 1; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.week i.on { background: var(--orange); border-color: var(--orange); }
.week i.today { outline: 2px solid var(--ink); outline-offset: 1px; }

/* daily + continue */
.dash-feature { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.pick { padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; position: relative; overflow: hidden; transition: transform .1s, box-shadow .15s; }
.pick:hover { transform: translateY(-2px); }
.pick .eyebrow { font-size: 11.5px; }
.pick h3 { margin: 0; font-size: 20px; letter-spacing: -.02em; line-height: 1.25; }
.pick p { margin: 0; color: var(--ink-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pick .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.pick.daily { background: var(--dark); color: #fff; border-color: var(--dark); }
.pick.daily .eyebrow { color: var(--lime); }
.pick.daily p { color: #b9bac6; }
[data-theme="dark"] .pick.daily { background: linear-gradient(135deg, #22252e, #1b1c24); border-color: var(--line); }

/* topic chips + question list */
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 6px 12px; font-size: 13.5px; font-weight: 650; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; color: var(--ink-2); }
.topic .c { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); background: var(--panel); border-radius: 999px; padding: 1px 7px; }
.topic:hover { color: var(--ink); }
.topic.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.topic.on .c { background: rgba(127, 127, 127, .25); color: inherit; }
.qbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 12px; }
.qbar .search { min-width: 180px; }
.qbar .seg { margin: 0; }
.qbar .seg button { padding: 7px 12px; font-size: 13.5px; }
.qbar .solved-count { font-size: 13.5px; color: var(--ink-2); font-weight: 600; display: flex; gap: 6px; align-items: center; margin-left: auto; }
.qlist { display: flex; flex-direction: column; }
.qrow { display: grid; grid-template-columns: 26px 1fr auto 86px; gap: 14px; align-items: center; padding: 11px 14px; border-radius: 12px; text-decoration: none; font-size: 14.5px; }
.qrow:nth-child(odd) { background: var(--panel-2); }
.qrow:hover { box-shadow: inset 0 0 0 1px var(--line); }
.qrow .st { width: 20px; height: 20px; display: grid; place-items: center; color: var(--green); }
.qrow .st svg { width: 17px; height: 17px; }
.qrow .st.started { color: var(--medium); }
.qrow .tt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow .tt .num { color: var(--ink-3); font-family: var(--mono); font-size: 13px; margin-right: 6px; }
.qrow .mod { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.qrow .diff { font-weight: 700; font-size: 13.5px; text-align: right; }
.diff.very-easy { color: #0b8ac0; } .diff.easy { color: #1a9a5c; } .diff.medium { color: #c27c09; } .diff.hard { color: #d43a3a; } .diff.very-hard { color: var(--very-hard); }
[data-theme="dark"] .diff.very-easy { color: #7fd1f7; } [data-theme="dark"] .diff.easy { color: #4cd38a; } [data-theme="dark"] .diff.medium { color: #f5b041; } [data-theme="dark"] .diff.hard { color: #ff6b6b; }
.qmore { margin-top: 12px; text-align: center; }

/* month calendar */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cal-head b { font-size: 16px; }
.cal-head .spacer { flex: 1; }
.cal-head button { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); padding: 0; }
.cal-head button svg { width: 16px; height: 16px; }
.cal-head button:disabled { opacity: .35; cursor: default; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal .dow { font-size: 11.5px; color: var(--ink-3); font-weight: 700; padding: 4px 0; }
.cal .d { position: relative; aspect-ratio: 1; display: grid; place-items: center; font-size: 13.5px; font-weight: 600; border-radius: 50%; color: var(--ink-2); }
.cal .d.future { color: var(--ink-3); opacity: .55; }
.cal .d.login::after { content: ""; position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--orange); }
.cal .d.solved { background: var(--lime); color: var(--lime-ink); }
.cal .d.solved::after { background: var(--lime-ink); }
.cal .d.practised:not(.solved) { box-shadow: inset 0 0 0 2px var(--lime); color: var(--ink); }
.cal .d.today { outline: 2px solid var(--ink); outline-offset: -1px; color: var(--ink); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.cal-legend span { display: inline-flex; gap: 6px; align-items: center; }
.cal-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* mini leaderboard + activity */
.mini-lb { display: flex; flex-direction: column; gap: 4px; }
.mini-lb .r { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.mini-lb .r.me { background: var(--lime); color: var(--lime-ink); }
.mini-lb .r.me .x { color: var(--lime-ink); }
.mini-lb .r.gap { padding: 0 10px; color: var(--ink-3); line-height: 1; }
.mini-lb .k { font-family: var(--mono); font-weight: 800; font-size: 13px; }
.mini-lb .nm { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-lb .x { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.dash-empty { color: var(--ink-3); font-size: 14px; margin: 0; }
.mods { display: flex; flex-direction: column; gap: 10px; }
.mods .row { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 13.5px; }
.mods .row .n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.mods .row .bar { grid-column: 1 / -1; background: var(--panel-2); height: 6px; }
.mods .row .bar > span { background: var(--purple); }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: 1fr 1fr; }
  .dash-stats > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .dash-grid { padding: 6px 16px 40px; }
  .dash-stats, .dash-feature { grid-template-columns: 1fr; }
  .ring-wrap { flex-direction: column; align-items: stretch; }
  .ring { align-self: center; }
  .qrow { grid-template-columns: 22px 1fr 70px; }
  .qrow .mod { display: none; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .stat-pill .xp-block { display: none; }
}

/* ---------- header: standout Lessons link ---------- */
.nav-links { align-items: center; }
.nav-links a.nav-lessons {
  /* a slightly tilted red/orange ticket: notched ends (mask) + a dashed perforation after the icon */
  --notch: radial-gradient(circle 6px at 0 50%, #0000 97%, #000) left / 51% 100% no-repeat,
           radial-gradient(circle 6px at 100% 50%, #0000 97%, #000) right / 51% 100% no-repeat;
  display: inline-flex; align-items: center; gap: 9px;
  background: linear-gradient(100deg, #ff4b3e, #ff8a1f); color: #fff;
  padding: 9px 18px 9px 14px; margin: 0 8px; border-radius: 6px;
  transform: rotate(-3deg); transition: transform .15s ease, filter .15s ease;
  -webkit-mask: var(--notch); mask: var(--notch);
  text-shadow: 0 1px 0 rgba(120, 20, 0, .25);
}
.nav-links a.nav-lessons svg { width: 17px; height: 17px; padding-right: 9px; box-sizing: content-box; border-right: 2px dashed rgba(255, 255, 255, .65); }
.nav-links a.nav-lessons:hover { background: linear-gradient(100deg, #ff5a4c, #ff9a35); color: #fff; transform: rotate(-1deg) translateY(-1px) scale(1.04); }
.nav-links a.nav-lessons.active { background: linear-gradient(100deg, #f03a2d, #ff7a0f); color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); }

/* ---------- lessons ---------- */
.lessons { max-width: 1240px; margin: 0 auto; padding: 6px 28px 60px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.units { padding: 16px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.units-head { padding: 6px 8px 14px; display: flex; flex-direction: column; gap: 6px; }
.units-head b { font-size: 18px; letter-spacing: -.01em; }
.units-head .bar { background: var(--panel-2); height: 7px; }
.unit-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; text-decoration: none; font-weight: 650; font-size: 14px; line-height: 1.25; }
.unit-link:hover { background: var(--panel-2); }
.unit-link.on { background: var(--dark); color: #fff; }
.unit-link.on small { color: #a8a9b8; }
[data-theme="dark"] .unit-link.on { background: var(--panel-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--lime); }
.unit-n { width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 12.5px; font-weight: 700; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-2); }
.unit-n svg { width: 15px; height: 15px; }
.unit-link.complete .unit-n { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.unit-t { display: flex; flex-direction: column; min-width: 0; }
.unit-t small { font-weight: 600; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.unit-link.small { font-size: 13px; padding: 6px 10px; color: var(--ink-2); }
.units-foot { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.units-foot .eyebrow { padding: 0 10px 6px; font-size: 11.5px; }

.unit { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.unit-hero { padding: 28px; }
.unit-hero h1 { margin: 6px 0 10px; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.unit-hero .desc { color: var(--ink-2); font-size: 16px; }
.unit-hero .desc p { margin: 0 0 6px; }
.unit-progress { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-3); font-weight: 600; }
.unit-progress .bar { flex: 1; min-width: 120px; background: var(--panel-2); height: 8px; }
.desc code, .practice code { font-size: .9em; background: var(--purple-soft); color: #4b32c9; padding: 1px 6px; border-radius: 6px; }
[data-theme="dark"] .desc code { color: #c4b5ff; }
.lesson-list { display: flex; flex-direction: column; gap: 10px; }
.lesson { padding: 0; overflow: hidden; }
.lesson summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; }
.lesson summary::-webkit-details-marker { display: none; }
.lesson summary:hover { background: var(--panel-2); }
.lesson-n { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); }
.lesson-n svg { width: 16px; height: 16px; }
.lesson.done .lesson-n { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.lesson-t { flex: 1; font-weight: 700; font-size: 16.5px; letter-spacing: -.01em; }
.lesson-meta { font-size: 12.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.chev { width: 20px; height: 20px; color: var(--ink-3); transition: transform .15s; }
.chev svg { width: 20px; height: 20px; }
.lesson[open] .chev { transform: rotate(90deg); }
.lesson-body { padding: 4px 22px 22px 66px; }
.lesson-body .desc { font-size: 16px; line-height: 1.65; }
.lesson-body .desc p { margin: 0 0 12px; }
.lesson .concept-example { background: var(--dark); color: #e9e9f0; border-radius: 14px; padding: 14px 18px; margin: 6px 0 16px; }
[data-theme="dark"] .lesson .concept-example { background: #101116; border: 1px solid var(--line); }
.lesson .concept-example h4 { margin: 0 0 8px; color: var(--lime); font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.lesson .concept-example pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; color: #d7d8e2; }
.practice-head { font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.practice-list { display: flex; flex-direction: column; gap: 6px; }
.practice { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; font-weight: 650; font-size: 14.5px; }
.practice:hover { border-color: var(--ink-3); }
.practice .go { margin-left: auto; font-size: 13px; color: var(--ink-3); font-weight: 650; white-space: nowrap; }
.practice.done .go { color: #1a9a5c; }
[data-theme="dark"] .practice.done .go { color: #4cd38a; }
.next-unit { display: flex; align-items: center; gap: 12px; padding: 18px 22px; text-decoration: none; }
.next-unit > span { display: flex; flex-direction: column; flex: 1; }
.next-unit b { font-size: 18px; }
.next-unit svg { width: 22px; height: 22px; }
.next-unit:hover { box-shadow: 0 0 0 2px var(--lime); }

@media (max-width: 960px) {
  .lessons { grid-template-columns: 1fr; padding: 6px 16px 40px; }
  .units { position: static; max-height: none; }
  .units nav { display: flex; overflow-x: auto; gap: 6px; }
  .units nav .unit-link { flex-shrink: 0; max-width: 220px; }
  .units-foot { display: none; }
  .lesson-body { padding: 4px 18px 18px; }
  .lesson-meta { display: none; }
  /* the nav collapses on small screens, so keep Lessons reachable */
  .nav-links { display: flex; margin-left: 0; order: 3; width: 100%; overflow-x: auto; }
  .topbar { flex-wrap: wrap; }
}
