/* ==========================================================================
   StudyHub – clean, calm revision UI. Light + dark (follows system setting).
   ========================================================================== */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e8ebf4;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e3e7f0;
  --primary: #5046e5;
  --primary-2: #6d64f0;
  --primary-soft: #eef0ff;
  --accent: #f97316;
  --good: #16a34a;
  --good-soft: #e9f9ef;
  --bad: #dc2626;
  --bad-soft: #fdeeee;
  --warn: #d97706;
  --warn-soft: #fff6e6;
  --info-soft: #eaf3ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, .12);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #121a2c;
    --surface-2: #18223a;
    --surface-3: #212d49;
    --text: #e8ecf5;
    --text-2: #c3cad9;
    --muted: #8d99b0;
    --border: #243150;
    --primary: #7b73ff;
    --primary-2: #958eff;
    --primary-soft: #1f2450;
    --good: #34d399;
    --good-soft: #0f2e25;
    --bad: #f87171;
    --bad-soft: #3a1a1f;
    --warn: #fbbf24;
    --warn-soft: #34290f;
    --info-soft: #17284a;
    --shadow-sm: none;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 1em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; }
pre.code { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 10px; overflow-x: auto; margin: .6em 0 1em; text-align: left; line-height: 1.5; font-size: .88rem; }
pre.code code { background: none; padding: 0; color: inherit; white-space: pre; }
.fc-face pre.code, .option pre.code { font-size: .8rem; margin: .4em 0; max-width: 100%; }
kbd { font: 600 .7rem var(--font); padding: .1rem .4rem; border-radius: 5px; border: 1px solid currentColor; opacity: .6; margin-left: .35rem; }
img, svg { max-width: 100%; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding: 28px 0 56px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--primary), #a855f7);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent);
}
.brand-center { justify-content: center; width: 100%; margin-bottom: 20px; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav > a, .nav-user > a {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 550; font-size: .94rem;
}
.nav > a:hover, .nav-user > a:hover { background: var(--surface-2); text-decoration: none; }
.nav > a.active, .nav-user > a.active { background: var(--primary-soft); color: var(--primary); }
.nav-guest { gap: 8px; }
.nav-user { display: flex; align-items: center; gap: 4px; margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--border); }
.nav-user form { margin: 0; }
.avatar {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ec4899); color: #fff; font-weight: 700; font-size: .85rem;
}
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav:not(.nav-guest) {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 16px; box-shadow: var(--shadow-lg);
  }
  .nav.open { display: flex; }
  .nav-user { margin: 8px 0 0; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--border); justify-content: space-between; }
  .nav-guest .btn-ghost { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: 600 .95rem/1.2 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, background .15s ease, box-shadow .15s ease, border-color .15s;
  text-decoration: none !important;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn-primary:hover { background: var(--primary-2); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { filter: brightness(.97); }
.btn-success { background: var(--good); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .86rem; border-radius: 9px; }
.btn-lg { padding: 14px 24px; font-size: 1.02rem; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- cards & layout ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 22px; }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .grid-main { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 30px 0 12px; font-weight: 700; }
.center-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* ---------- alerts, badges, toast ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .94rem; border: 1px solid transparent; transition: opacity .4s; cursor: pointer; }
.alert.fade { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
.alert-success { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--primary); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: .84rem; font-weight: 650; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 9px; font-size: .82rem; font-weight: 650; }
.chip-red { background: var(--bad-soft); color: var(--bad); }
.chip-green { background: var(--good-soft); color: var(--good); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 100;
  padding: 11px 18px; border-radius: 12px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: .92rem; box-shadow: var(--shadow-lg); opacity: 0; transition: .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-success { background: var(--good); color: #fff; }
.toast-error { background: var(--bad); color: #fff; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--text-2); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input:not([type]), textarea, select {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 400 .98rem/1.5 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 80px; }
textarea[readonly] { background: var(--surface-2); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.form-inline { flex-direction: row; }

/* ---------- auth pages ---------- */
.auth-page { background:
  radial-gradient(1000px 500px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
  radial-gradient(800px 500px at 110% 110%, color-mix(in srgb, #ec4899 14%, transparent), transparent 60%),
  var(--bg); }
.auth-wrap { flex: 1; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px; box-shadow: var(--shadow-lg); }
.auth-title { text-align: center; font-size: 1.6rem; margin-bottom: 6px; }
.auth-card .muted.center { margin-bottom: 22px; }
.auth-switch { text-align: center; margin: 20px 0 0; color: var(--muted); font-size: .92rem; }

/* ---------- landing ---------- */
.landing .main { padding-top: 10px; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 56px 0 40px; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); line-height: 1.05; margin: 18px 0; letter-spacing: -.035em; }
.grad { background: linear-gradient(90deg, var(--primary), #a855f7, #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 1.15rem; color: var(--text-2); max-width: 540px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-visual { position: relative; height: 300px; }
.demo-card {
  position: absolute; inset: 20px 10px 20px 30px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: rotate(-2deg);
}
.demo-card-back { transform: rotate(4deg) translate(14px, 8px); background: linear-gradient(135deg, var(--primary), #a855f7); border: 0; opacity: .9; }
.demo-tag { font-size: .78rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.demo-q { font-size: 1.25rem; font-weight: 650; margin: 16px 0 auto; }
.demo-actions { display: flex; gap: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 30px 0 50px; }
.feature { padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.feature h3 { margin: 12px 0 6px; }
.feature p { color: var(--muted); margin: 0; font-size: .94rem; }
.feature-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 24px; } .hero-visual { height: 260px; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat strong { display: block; font-size: 1.5rem; line-height: 1.1; font-weight: 800; }
.stat span { font-size: .82rem; color: var(--muted); }
.stat-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; }
.stat-orange { background: #fff1e6; color: #ea580c; }
.stat-blue { background: #e8f1ff; color: #2563eb; }
.stat-green { background: #e7f8ee; color: #16a34a; }
.stat-purple { background: #f3ebff; color: #9333ea; }
@media (prefers-color-scheme: dark) {
  .stat-orange { background: #3a2312; } .stat-blue { background: #14264a; } .stat-green { background: #0f2e22; } .stat-purple { background: #2a1847; }
}

/* ---------- ring + bar ---------- */
.ring { position: relative; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3.4; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 750; font-size: .8rem; }
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #facc15)); transition: width .4s ease; }

/* ---------- subjects ---------- */
.subject-card {
  display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.subject-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
a.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.subject-card h3 { margin: 0; }
.subject-card p { margin: 2px 0 0; }
.subject-card.is-disabled { opacity: .6; }
.subject-emoji { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; font-size: 1.6rem; flex-shrink: 0; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.subject-emoji-lg { width: 68px; height: 68px; font-size: 2.2rem; border-radius: 18px; }
.subject-hero { border-top: 4px solid var(--accent); }
.subject-hero-top { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.subject-hero h2 { margin: 0; }
.subject-hero h2 a { color: var(--text); }
.subject-banner { display: flex; align-items: center; gap: 20px; margin: 6px 0 20px; flex-wrap: wrap; }
.subject-banner h1 { margin-bottom: 2px; }
.subject-banner p { margin: 0; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.qa-emoji { font-size: 1.3rem; line-height: 1; }
.qa-code { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)) !important; }

/* ---------- Python lab ---------- */
.code-tasks { display: flex; flex-direction: column; gap: 10px; }
.code-task { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-sm); }
.code-task:hover { border-color: var(--accent); text-decoration: none; }
.code-task strong { display: block; }
.code-check { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: transparent; flex-shrink: 0; }
.code-check.is-done { background: var(--good); color: #fff; }
.lvl { font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.lvl-easy { background: var(--good-soft); color: var(--good); }
.lvl-med { background: var(--warn-soft); color: var(--warn); }
.lvl-hard { background: var(--bad-soft); color: var(--bad); }
.lvl-free { background: var(--primary-soft); color: var(--primary); }
.badge-good { background: var(--good-soft); color: var(--good); }
.lab-page .container { max-width: 1400px; }
.lab { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.lab-brief { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.lab-brief-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lab-title { font-size: 1.4rem; margin: 12px 0 10px; }
.lab-text { font-size: .95rem; color: var(--text-2); }
.lab-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.tests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.test-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); font-size: .9rem; }
.test-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-top: 6px; flex-shrink: 0; opacity: .5; }
.test-row.pass .test-dot { background: var(--good); opacity: 1; }
.test-row.fail .test-dot { background: var(--bad); opacity: 1; }
.test-row.running .test-dot { background: var(--warn); opacity: 1; animation: pulse .6s infinite alternate; }
.test-row.fail .test-msg { color: var(--bad); }
.test-row.pass .test-msg { color: var(--good); }
.test-summary { font-weight: 700; margin: 10px 0 0; }
.test-summary.good { color: var(--good); }
.test-summary.bad { color: var(--bad); }
.hint { margin-bottom: 6px; font-size: .92rem; }
.hint summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.hint p { margin: 6px 0 0; }
.lab-sol-btn { margin-top: 16px; }
.lab-work { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); }
.lab-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.lab-toolbar kbd { border-color: rgba(255,255,255,.6); }
.py-status { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.py-status.loading { background: var(--warn-soft); color: var(--warn); }
.py-status.ready { background: var(--good-soft); color: var(--good); }
.py-status.error { background: var(--bad-soft); color: var(--bad); }
.lab-editor .CodeMirror { height: 420px; font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 14px; line-height: 1.55; }
.cm-error-line { background: rgba(244, 63, 94, .18) !important; }
.lab-console-head { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: #1e293b; color: #cbd5e1; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.lab-console-head .btn { margin-left: auto; color: #cbd5e1; border-color: #334155; text-transform: none; letter-spacing: 0; }
.lab-console-head .muted { text-transform: none; letter-spacing: 0; color: #94a3b8; }
.lab-console { margin: 0; min-height: 180px; max-height: 340px; overflow-y: auto; padding: 12px 14px; background: #0f172a; color: #e2e8f0; font: 14px/1.5 ui-monospace, 'Cascadia Code', Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.lab-console.is-running { box-shadow: inset 3px 0 0 #34d399; }
.console-error { color: #fda4af; margin-top: 6px; white-space: pre-wrap; }
.console-done { color: #6ee7b7; margin-top: 6px; font-size: .85rem; }
.console-input-wrap { display: inline; }
.console-input { display: inline-block; width: 50%; min-width: 120px; padding: 0 4px; border: 0; border-bottom: 2px solid #34d399; border-radius: 0; background: transparent; color: #fff; font: inherit; }
.console-input:focus { box-shadow: none; outline: none; border-color: #6ee7b7; }
@media (max-width: 900px) {
  .lab { grid-template-columns: 1fr; }
  .lab-brief { position: static; max-height: none; }
  .lab-editor .CodeMirror { height: 320px; }
}
.quick-actions-lg { margin-bottom: 18px; }
@media (max-width: 640px) { .quick-actions { grid-template-columns: repeat(2, 1fr); } }
.qa {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px;
  border-radius: 12px; background: var(--surface-2); color: var(--text); font-weight: 600; font-size: .9rem;
  border: 1px solid transparent; transition: .15s;
}
.quick-actions-lg .qa { background: var(--surface); border-color: var(--border); padding: 18px; box-shadow: var(--shadow-sm); }
.qa .icon { color: var(--accent); }
.qa small { font-size: .76rem; font-weight: 500; margin-top: -6px; }
.qa:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.qa em { position: absolute; top: 10px; right: 10px; font-style: normal; background: var(--accent); color: #fff; font-size: .75rem; padding: 1px 8px; border-radius: 99px; }
.exam-info { margin-bottom: 8px; padding: 14px 20px; }
.exam-info summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.exam-info ul { margin: 12px 0 0; color: var(--text-2); }

/* ---------- topic list ---------- */
.topic-list { display: flex; flex-direction: column; gap: 10px; }
.topic-row { display: flex; align-items: center; gap: 20px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.topic-main { flex: 1; min-width: 0; }
.topic-main h3 { margin: 2px 0 2px; }
.topic-main h3 a { color: var(--text); }
.topic-main p { margin: 0 0 10px; }
.topic-main .bar { max-width: 360px; }
.topic-spec { font-size: .74rem; font-weight: 700; color: var(--accent); letter-spacing: .04em; text-transform: uppercase; }
.topic-modes { display: grid; grid-template-columns: repeat(4, 74px); gap: 8px; }
.mode {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: .78rem; font-weight: 650; border: 1px solid transparent;
}
.mode:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.mode small { font-size: .7rem; font-weight: 600; color: var(--muted); }
.mode.done small { color: var(--good); }
.topic-main .mastery-cell { max-width: 400px; }

/* ---------- split (right/wrong) bars ---------- */
.sbar { display: flex; height: 8px; width: 150px; max-width: 100%; border-radius: 99px; background: var(--surface-3); overflow: hidden; flex-shrink: 0; }
.sbar span { display: block; height: 100%; transition: width .4s ease; }
.sbar-g { background: #34d399; }
.sbar-r { background: #f43f5e; }
.bar-legend { display: flex; gap: 16px; justify-content: flex-end; margin: 18px 0 -6px; flex-wrap: wrap; }
.bar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 8px; border-radius: 99px; }
.lg-g { background: #34d399; } .lg-r { background: #f43f5e; } .lg-n { background: var(--surface-3); }

/* ---------- topic accordion (subject page) ---------- */
.acc-list { display: flex; flex-direction: column; gap: 14px; }
.acc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.acc[open] { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.acc-head { display: flex; align-items: center; gap: 16px; padding: 22px 26px; cursor: pointer; list-style: none; }
.acc-head::-webkit-details-marker { display: none; }
.acc-chevron { display: grid; place-items: center; color: var(--muted); transition: transform .2s; }
.acc[open] .acc-chevron { transform: rotate(90deg); color: var(--accent); }
.acc-title { flex: 1; min-width: 0; font-size: 1.1rem; color: var(--text); }
.acc-title strong { font-weight: 700; }
.acc[open] .acc-title { color: var(--accent); }
.acc-body { padding: 0 26px 24px 64px; }
.sub-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.sub-item { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px 14px 0; color: var(--text); }
.sub-grid .sub-item { border-right: 1px solid var(--border); padding-left: 20px; }
.sub-grid .sub-item:nth-child(3n+1) { padding-left: 0; }
.sub-grid .sub-item:nth-child(3n) { border-right: 0; }
.sub-item:hover { text-decoration: none; }
.sub-item:hover .sub-name { color: var(--accent); }
.sub-name { font-size: .97rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
@media (max-width: 900px) {
  .sub-grid { grid-template-columns: repeat(2, 1fr); }
  .sub-grid .sub-item, .sub-grid .sub-item:nth-child(3n+1), .sub-grid .sub-item:nth-child(3n) { border-right: 0; padding-left: 0; }
}
@media (max-width: 600px) {
  .acc-head { padding: 18px 16px; gap: 10px; flex-wrap: wrap; }
  .acc-head .acc-bar { width: 100%; margin-left: 28px; }
  .acc-body { padding: 0 16px 18px; }
  .sub-grid { grid-template-columns: 1fr; }
  .sub-name { white-space: normal; }
}

/* ---------- topic picker ---------- */
.picker-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.picker-due { margin-left: auto; font-size: .92rem; display: inline-flex; align-items: center; gap: 8px; }
.picker-list { display: flex; flex-direction: column; gap: 10px; }
.pick {
  display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--border); cursor: pointer; transition: border-color .15s, background .15s;
}
.pick:hover { border-color: var(--accent); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick-box { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border); color: transparent; flex-shrink: 0; transition: .15s; }
.pick:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.pick:has(input:checked) .pick-box { background: var(--accent); border-color: var(--accent); color: #fff; }
.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-title { color: var(--text); }
.pick.is-disabled { opacity: .5; cursor: default; }
.picker-go {
  position: sticky; bottom: 16px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 24px; padding: 14px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
@media (max-width: 600px) { .pick { flex-wrap: wrap; } .pick .sbar { width: 100%; margin-left: 40px; } .picker-due { margin-left: 0; } }

/* ---------- topic hub ---------- */
.topic-hub-top { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.topic-hub-top h2 { margin: 0 0 4px; }
.topic-hub-top p { margin: 0; }
.topic-hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.hub-card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.hub-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); text-decoration: none; }
.hub-card h3 { margin: 4px 0 0; font-size: 1.2rem; }
.hub-card p { margin: 0; flex: 1; }
.hub-card-head { display: flex; align-items: center; justify-content: space-between; }
.hub-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.hub-step { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hub-progress { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.hub-cta { align-self: flex-start; margin-top: 8px; }
.sbar-full { width: 100%; }
.sbar-lg { width: 220px; height: 12px; }
.sub-card { padding: 8px 24px 14px; margin-bottom: 8px; }
@media (max-width: 600px) { .topic-hub-top { flex-direction: column; align-items: flex-start; } .sbar-lg { width: 100%; } }
.mode.done { background: var(--good-soft); color: var(--good); }
@media (max-width: 760px) { .topic-row { flex-direction: column; align-items: stretch; } .topic-modes { grid-template-columns: repeat(4, 1fr); } }

/* ---------- breadcrumbs, tabs, toolbar ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .86rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.crumb-sep { opacity: .5; }
.mode-head { margin-bottom: 18px; }
.mode-head h1 { margin: 4px 0 4px; }
.mode-head p { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); font-weight: 600; font-size: .93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 12px; gap: 2px; }
.segmented a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- study guide ---------- */
.guide-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.toc-sticky { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
.toc-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.guide-toc a { color: var(--muted); font-size: .88rem; padding: 6px 10px; border-left: 2px solid var(--border); line-height: 1.35; }
.guide-toc a:hover { color: var(--text); text-decoration: none; }
.guide-toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 900px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc { display: none; } }
.guide { padding: 32px 36px; font-size: 1.02rem; }
@media (max-width: 640px) { .guide { padding: 22px 18px; } }
.guide section { scroll-margin-top: 90px; }
.guide section + section { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--border); }
.guide h2 { font-size: 1.35rem; }
.guide ul, .guide ol { padding-left: 1.3em; margin: 0 0 1em; }
.guide li { margin-bottom: .4em; }
.guide li::marker { color: var(--accent); }
.callout { border-radius: 12px; padding: 14px 18px; margin: 0 0 1em; border-left: 4px solid; }
.callout p { margin: 0; }
.callout-title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.callout-tip { background: var(--warn-soft); border-color: var(--warn); }
.callout-tip .callout-title { color: var(--warn); }
.callout-note { background: var(--info-soft); border-color: var(--primary); }
.callout-example { background: var(--good-soft); border-color: var(--good); }
.callout-example .callout-title { color: var(--good); }
.how-to { margin-bottom: 20px; font-size: .94rem; }
.terms { display: grid; gap: 8px; margin: 0 0 1em; }
.terms > div { display: grid; grid-template-columns: 200px 1fr; gap: 14px; padding: 10px 14px; background: var(--surface-2); border-radius: 10px; }
.terms dt { font-weight: 700; }
.terms dd { margin: 0; color: var(--text-2); }
@media (max-width: 640px) { .terms > div { grid-template-columns: 1fr; gap: 2px; } }
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 700; font-size: .84rem; color: var(--text-2); }
tr:last-child td { border-bottom: 0; }
.guide-done { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.guide-next-steps { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 22px; }
.pager-link { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); max-width: 48%; }
.pager-link:hover { border-color: var(--accent); text-decoration: none; }
.pager-link small { display: block; color: var(--muted); font-size: .76rem; }
.pager-next { margin-left: auto; text-align: right; }

/* ---------- flashcards ---------- */
.fc-app { max-width: 720px; margin: 0 auto; }
.fc-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.fc-progress .bar { flex: 1; }
.fc-stage { perspective: 1400px; }
.fc-card { display: block; width: 100%; height: 340px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; text-align: center; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-card.no-anim .fc-inner { transition: none; }
.fc-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 34px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow-y: auto;
}
.fc-face p { margin: 0; font-size: 1.3rem; font-weight: 600; line-height: 1.45; }
.fc-back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--accent) 7%, var(--surface))); }
.fc-back p { font-size: 1.1rem; font-weight: 500; }
.fc-tag { display: inline-block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.fc-hint { position: absolute; bottom: 18px; font-size: .8rem; color: var(--muted); }
.fc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.btn-learning { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.btn-gotit { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.btn-learning:hover, .btn-gotit:hover { filter: brightness(.97); }
@media (max-width: 640px) { .fc-card { height: 300px; } .fc-face p { font-size: 1.12rem; } .fc-actions kbd { display: none; } }
.fc-done, .empty, .quiz-result { text-align: center; padding: 40px 24px; }
.done-emoji { font-size: 3rem; margin-bottom: 8px; }
.done-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- quiz ---------- */
.quiz-app { max-width: 760px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.quiz-top .bar { flex: 1; }
.quiz-card { padding: 30px; }
.quiz-q { font-size: 1.3rem; margin: 10px 0 22px; line-height: 1.4; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text); text-align: left;
  font: 500 1rem/1.4 var(--font); cursor: pointer; transition: border-color .15s, background .15s;
}
.option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.option input { display: none; }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.option-letter { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.option.correct { border-color: var(--good) !important; background: var(--good-soft) !important; }
.option.correct .option-letter { background: var(--good); color: #fff; }
.option.wrong { border-color: var(--bad) !important; background: var(--bad-soft) !important; }
.option.wrong .option-letter { background: var(--bad); color: #fff; }
.option:disabled { cursor: default; }
.options-compact .option { padding: 10px 14px; }
.explain { margin-top: 18px; padding: 14px 18px; border-radius: 12px; font-size: .96rem; }
.explain-good { background: var(--good-soft); }
.explain-bad { background: var(--bad-soft); }
.quiz-nav { display: flex; justify-content: flex-end; margin-top: 18px; }
.result-score { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 130px; height: 130px; border-radius: 50%; margin-bottom: 14px; border: 6px solid currentColor; }
.result-score span { font-size: 2rem; font-weight: 800; color: var(--text); }
.result-score small { color: var(--muted); font-weight: 600; }
.grade-good { color: var(--good); }
.grade-ok { color: var(--warn); }
.grade-low { color: var(--bad); }
.grade-none { color: var(--muted); }
.review { text-align: left; margin-top: 30px; }
.review h3 { margin-bottom: 12px; }
.review-item { padding: 14px 0; border-top: 1px solid var(--border); }
.review-q { font-weight: 600; margin-bottom: 6px; }
.review-a { display: flex; flex-direction: column; gap: 2px; font-size: .93rem; margin-bottom: 4px; }
.bad { color: var(--bad); }
.good { color: var(--good); }

/* ---------- exam questions ---------- */
.exam-app { display: flex; flex-direction: column; gap: 18px; }
.xq { padding: 24px 26px; }
.xq-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.xq-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--text); color: var(--bg); font-weight: 800; font-size: .9rem; }
.xq-marks { margin-left: auto; font-weight: 700; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.xq-context { background: var(--surface-2); padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: .95rem; color: var(--text-2); }
.xq-question { font-weight: 600; font-size: 1.05rem; }
.xq-wordcount { margin-top: 6px; text-align: right; }
.xq-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.calc-row { display: flex; flex-direction: column; gap: 10px; }
.calc-final { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.calc-final input { max-width: 180px; }
.xq-scheme { margin-top: 18px; padding: 18px 20px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); }
.xq-scheme h4 { font-size: .9rem; margin: 6px 0 10px; }
.scheme-list { margin: 0 0 12px; padding-left: 1.2em; }
.scheme-ticks { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.scheme-ticks label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 8px 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.scheme-ticks label:has(input:checked) { border-color: var(--good); background: var(--good-soft); }
.scheme-ticks input { margin-top: 3px; flex-shrink: 0; }
.scheme-auto { font-weight: 600; padding: 8px 12px; border-radius: 9px; background: var(--surface); }
.levels { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.level { padding: 10px 14px; background: var(--surface); border-radius: 10px; border: 1px solid var(--border); font-size: .92rem; }
.level p { margin: 4px 0 0; color: var(--text-2); }
.level-pick { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.level-pick select { width: auto; }
.model { margin: 12px 0; }
.model summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.model > div { margin-top: 8px; padding: 12px 16px; background: var(--surface); border-radius: 10px; border-left: 3px solid var(--primary); font-size: .95rem; }
.xq-score { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.xq-score strong { font-size: 1.2rem; }

/* ---------- mock ---------- */
.mock-option { display: flex; flex-direction: column; gap: 6px; color: var(--text); transition: transform .15s, box-shadow .15s; }
.mock-option:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.mock-option h3 { margin: 6px 0 0; font-size: 1.25rem; }
.mock-option .btn { align-self: flex-start; margin-top: 8px; }
.mock-time { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; }
.mock-bar {
  position: sticky; top: 72px; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 18px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.mock-timer { display: inline-flex; align-items: center; gap: 8px; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mock-timer.warn { color: var(--bad); animation: pulse 1s infinite alternate; }
.mock-timer.stopped { color: var(--muted); animation: none; }
.mock-total { margin-left: auto; font-size: 1.05rem; }
.mock-bar .btn { margin-left: auto; }
.mock-total + .btn, .mock-total ~ .btn { margin-left: 0; }
@keyframes pulse { to { opacity: .55; } }
.mock-result { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.mock-result .result-score { margin: 0; }

/* ---------- dashboard bits ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-title { display: block; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; margin-bottom: 12px; }
.day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); font-size: .68rem; font-weight: 700; color: var(--muted); }
.day.on { background: var(--accent); color: #fff; }
.day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: .92rem; }
.activity li:first-child { border-top: 0; }
.activity-kind { font-size: .7rem; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); min-width: 54px; text-align: center; }
.kind-quiz { background: var(--primary-soft); color: var(--primary); }
.kind-exam { background: var(--warn-soft); color: var(--warn); }
.kind-mock { background: var(--good-soft); color: var(--good); }

/* ---------- progress page ---------- */
.progress-summary { display: flex; align-items: center; gap: 32px; margin-bottom: 18px; flex-wrap: wrap; }
.summary-stats { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.summary-stats strong { display: block; font-size: 1.5rem; font-weight: 800; }
.summary-stats span { color: var(--muted); font-size: .85rem; }
.progress-table td { vertical-align: middle; }
.progress-table a { font-weight: 600; }
.w-mastery { width: 180px; }
.mastery-cell { display: flex; align-items: center; gap: 10px; }
.mastery-cell .bar { flex: 1; }
.mastery-cell span { font-weight: 700; font-size: .85rem; width: 38px; text-align: right; }
.tick { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--good-soft); color: var(--good); }
.grade { display: inline-block; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 7px; background: var(--surface-2); }
.progress-table .card, section.card + section.card { margin-top: 18px; }
.mock-chart { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 10px; overflow-x: auto; }
.mock-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; min-width: 48px; }
.mock-val { font-weight: 700; font-size: .82rem; }
.mock-bar-v { flex: 1; width: 30px; background: var(--surface-2); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.mock-bar-v span { display: block; width: 100%; background: linear-gradient(0deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #facc15)); border-radius: 8px; }

/* ---------- footer ---------- */
.footer { padding: 26px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; text-align: center; }
.auth-page .footer { display: none; }

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .card { padding: 18px; }
  .xq { padding: 18px; }
  .quiz-card { padding: 22px 18px; }
  .mock-bar { top: 70px; gap: 10px; padding: 10px 12px; }
  .pager-link { max-width: 100%; }
  .pager { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
