:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --ink:#1f2937;
  --muted:#6b7280;
  --line:#e5e7eb;
  --brand:#4f46e5;
  --brand-soft:#eef2ff;
  --ok:#16a34a;
  --ok-soft:#ecfdf5;
  --bad:#dc2626;
  --bad-soft:#fef2f2;
  --warn:#f59e0b;
  --shadow:0 1px 3px rgba(16,24,40,.06),0 8px 24px rgba(16,24,40,.06);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  background:var(--bg);
  color:var(--ink);
  font:15px/1.65 "PingFang SC","Microsoft YaHei","Noto Sans SC",system-ui,-apple-system,sans-serif;
}
a{color:inherit;text-decoration:none}
button{font:inherit;cursor:pointer}

.topbar{
  position:sticky;top:0;z-index:20;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 22px;background:rgba(255,255,255,.88);backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
}
.brand{font-weight:800;font-size:18px;display:flex;align-items:center;gap:8px}
.badge{font-size:12px;font-weight:700;color:var(--brand);background:var(--brand-soft);padding:2px 8px;border-radius:999px}
.top-actions{display:flex;align-items:center;gap:10px}
.gp{font-size:13px;color:var(--muted)}
.ghost{background:#fff;border:1px solid var(--line);border-radius:8px;padding:5px 12px;color:var(--muted)}
.ghost:hover{border-color:var(--brand);color:var(--brand)}

main{max-width:920px;margin:0 auto;padding:24px 20px 60px}
.foot{max-width:920px;margin:0 auto;padding:0 20px 40px;color:var(--muted);font-size:12.5px}

.crumb{font-size:13.5px;color:var(--muted);margin-bottom:14px}
.crumb a:hover{color:var(--brand)}
.crumb .sep{margin:0 6px}

.hero{margin-bottom:22px}
.hero h1{margin:0 0 6px;font-size:24px}
.hero p{margin:0;color:var(--muted)}

.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}

.card{
  background:var(--card);border:1px solid var(--line);border-radius:14px;
  padding:16px 16px 14px;box-shadow:var(--shadow);
}
.card.locked{opacity:.55;filter:grayscale(.4)}
.card h3{margin:0 0 4px;font-size:16.5px}
.card .sub{color:var(--muted);font-size:13px;margin-bottom:12px}
.card-link{display:block;transition:transform .15s,border-color .15s}
.card-link:hover{transform:translateY(-2px);border-color:#c7d2fe}

.bar{height:7px;border-radius:99px;background:#eef0f5;overflow:hidden}
.bar > i{display:block;height:100%;background:linear-gradient(90deg,#6366f1,#22c55e);width:0;transition:width .4s}
.bar-row{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--muted);margin-top:8px}
.bar-row .bar{flex:1}

.grade-title{font-size:23px;font-weight:800;margin:34px 0 4px;padding:2px 0 2px 13px;border-left:5px solid var(--brand);line-height:1.25}
.grade-title:first-of-type{margin-top:8px}
.book-title{font-size:14px;font-weight:800;color:var(--muted);letter-spacing:.08em;margin:30px 0 12px}
.book-title:first-child{margin-top:6px}

.section-item{
  display:flex;align-items:center;gap:14px;
  background:var(--card);border:1px solid var(--line);border-radius:12px;
  padding:13px 16px;margin-bottom:10px;box-shadow:var(--shadow);
}
.section-item .no{
  width:34px;height:34px;flex:0 0 34px;border-radius:10px;background:var(--brand-soft);
  color:var(--brand);font-weight:800;display:grid;place-items:center;font-size:13px;
}
.section-item .meta{flex:1;min-width:0}
.section-item .meta b{display:block;font-size:15px}
.section-item .meta span{font-size:12.5px;color:var(--muted)}
.section-item .state{font-size:12.5px;font-weight:700;padding:3px 10px;border-radius:999px;white-space:nowrap}
.state.done{color:var(--ok);background:var(--ok-soft)}
.state.todo{color:var(--brand);background:var(--brand-soft)}
.state.lock{color:var(--muted);background:#f3f4f6}
.section-item.locked{opacity:.6}
.section-item .go{font-size:13px;font-weight:700;color:var(--brand)}
.section-item:hover:not(.locked){border-color:#c7d2fe}

.lesson h1{margin:0 0 4px;font-size:23px}
.lesson .lead{color:var(--muted);margin:0 0 18px}
.panel{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:18px 20px;box-shadow:var(--shadow);margin-bottom:18px}
.panel h3{margin:0 0 10px;font-size:15.5px;color:var(--brand)}
.panel ul{margin:6px 0;padding-left:20px}
.panel li{margin:5px 0}
.panel .key{background:#fffbeb;border-left:3px solid var(--warn);padding:9px 13px;border-radius:0 8px 8px 0;margin:10px 0}
.formula{font-family:"Cambria Math",Georgia,serif;font-size:17px;background:#f8fafc;border:1px solid var(--line);border-radius:8px;padding:7px 12px;display:inline-block;margin:5px 0}

.btn{
  display:inline-flex;align-items:center;gap:7px;border:none;border-radius:10px;
  padding:10px 20px;background:var(--brand);color:#fff;font-weight:700;
}
.btn:hover{background:#4338ca}
.btn:disabled{background:#c7c9d9;cursor:not-allowed}
.btn.sec{background:#fff;color:var(--brand);border:1px solid #c7d2fe}
.btn.sec:hover{background:var(--brand-soft)}

.viz{background:#fbfcfe;border:1px solid var(--line);border-radius:12px;padding:12px}
.viz .canvas{width:100%;height:auto;display:block;touch-action:none}
.viz-caption{margin-top:8px;font-size:13.5px;color:var(--muted);text-align:center;min-height:20px}
.viz-controls{margin-top:12px;display:flex;flex-wrap:wrap;gap:16px;justify-content:center;font-size:13px;color:var(--muted)}
.viz-controls label{display:flex;align-items:center;gap:8px}
.viz-controls input[type=range]{width:140px;accent-color:var(--brand)}
.viz-controls .val{font-weight:700;color:var(--ink);min-width:28px;display:inline-block;text-align:center}
.shape-tri{fill:#dbeafe;stroke:#2563eb;stroke-width:1.6}
.shape-tri2{fill:#fee2e2;stroke:#dc2626;stroke-width:1.6}
.shape-aux{fill:none;stroke:#94a3b8;stroke-width:1.2;stroke-dasharray:4 4}
.shape-sq-a{fill:#bfdbfe;stroke:#3b82f6;stroke-width:1.2;opacity:.85}
.shape-sq-b{fill:#bbf7d0;stroke:#22c55e;stroke-width:1.2;opacity:.85}
.shape-sq-c{fill:#fecaca;stroke:#ef4444;stroke-width:1.2;opacity:.85}
.axis-main{stroke:#94a3b8;stroke-width:1.6}
.grid{stroke:#eef2f7;stroke-width:1}
.graph-line{stroke:#4f46e5;stroke-width:2.4}
.arrow{stroke:#64748b;stroke-width:2}
.diag{stroke:#f59e0b;stroke-width:1.6;stroke-dasharray:5 4}
.mean-line{stroke:#dc2626;stroke-width:1.6;stroke-dasharray:6 4}
.bar-rect{fill:#818cf8;stroke:#4f46e5;stroke-width:1}
.cell-1{fill:#dbeafe;stroke:#fff;stroke-width:2}
.cell-2{fill:#bfdbfe;stroke:#fff;stroke-width:2}
.cell-3{fill:#c7d2fe;stroke:#fff;stroke-width:2}
.cell-4{fill:#a5b4fc;stroke:#fff;stroke-width:2}
.graph-line2{stroke:#0ea5e9;stroke-width:2.4;fill:none}
.venn-a{fill:#93c5fd;fill-opacity:.45;stroke:#2563eb;stroke-width:1.6}
.venn-b{fill:#86efac;fill-opacity:.45;stroke:#16a34a;stroke-width:1.6}
.area-shade{fill:#4f46e5;fill-opacity:.25;stroke:none}
.vector{stroke:#2563eb;stroke-width:2.4}
.vector2{stroke:#16a34a;stroke-width:2.4}
.sector{fill:#fde68a;stroke:#f59e0b;stroke-width:1.6}
.dice-on{fill:#fca5a5;stroke:#dc2626;stroke-width:1.4}
.dice-off{fill:#f1f5f9;stroke:#e2e8f0;stroke-width:1}
.poly-outline{fill:none;stroke:#1e293b;stroke-width:1.8}
.ray{stroke:#334155;stroke-width:2}
.perp{stroke:#dc2626;stroke-width:1.6}
.tick{stroke:#dc2626;stroke-width:2}
.tick-blue{stroke:#2563eb;stroke-width:2}
.strike{stroke:#dc2626;stroke-width:2.4}
.shade{fill:#22c55e;opacity:.14}
.flow-box{fill:#f1f5f9;stroke:#cbd5e1;stroke-width:1.4}
.flow-box.on{fill:#eef2ff;stroke:#6366f1}
.arrow-head{fill:#64748b}
.arc-a{fill:#bfdbfe;stroke:#2563eb;stroke-width:1}
.arc-b{fill:#bbf7d0;stroke:#16a34a;stroke-width:1}
.arc-c{fill:#fecaca;stroke:#dc2626;stroke-width:1}
.sv-txt{font:600 12.5px "PingFang SC","Microsoft YaHei",sans-serif;fill:#334155}
.sv-txt.big{font-size:14px;fill:#0f172a}
.sv-lbl{font:700 14px Georgia,serif;fill:#1e293b}

.quiz-top{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.quiz-top .qmeta{font-size:13px;color:var(--muted)}
.dots{display:flex;gap:6px}
.dots i{width:22px;height:6px;border-radius:99px;background:#e5e7eb}
.dots i.good{background:var(--ok)}
.dots i.bad{background:var(--bad)}
.dots i.now{background:var(--brand)}

.qbox{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:20px;box-shadow:var(--shadow)}
.qtext{font-size:17px;line-height:1.9;margin-bottom:16px}
.opts{display:grid;gap:10px}
.opt{
  text-align:left;background:#fff;border:1px solid var(--line);border-radius:10px;
  padding:12px 15px;display:flex;align-items:center;gap:11px;transition:all .12s;
}
.opt:hover:not(:disabled){border-color:var(--brand);background:var(--brand-soft)}
.opt .idx{width:24px;height:24px;flex:0 0 24px;border-radius:7px;background:#f1f5f9;color:var(--muted);font-weight:800;font-size:12.5px;display:grid;place-items:center}
.opt.correct{border-color:var(--ok);background:var(--ok-soft)}
.opt.correct .idx{background:var(--ok);color:#fff}
.opt.wrong{border-color:var(--bad);background:var(--bad-soft)}
.opt.wrong .idx{background:var(--bad);color:#fff}
.opt:disabled{cursor:default}
.fill-row{display:flex;gap:10px;flex-wrap:wrap}
.fill-row input{
  flex:1;min-width:180px;font:16px/1.5 inherit;padding:11px 14px;
  border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--ink);
}
.fill-row input:focus{outline:2px solid #c7d2fe;border-color:var(--brand)}

.feedback{margin-top:16px;border-radius:11px;padding:13px 16px;font-size:14.5px}
.feedback.ok{background:var(--ok-soft);border:1px solid #a7f3d0;color:#065f46}
.feedback.bad{background:var(--bad-soft);border:1px solid #fecaca;color:#991b1b}
.feedback b{display:block;margin-bottom:3px}
.actions{margin-top:16px;display:flex;gap:10px;flex-wrap:wrap}

.result{text-align:center;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:34px 20px;box-shadow:var(--shadow)}
.result .score{font-size:46px;font-weight:800;line-height:1.1}
.result.pass .score{color:var(--ok)}
.result.fail .score{color:var(--warn)}
.result h2{margin:10px 0 4px}
.result p{color:var(--muted);margin:0 0 20px}
.review{margin-top:22px;text-align:left;font-size:14px}
.review .line{padding:9px 0;border-bottom:1px dashed var(--line)}
.review .line:last-child{border:none}

.frac{display:inline-flex;flex-direction:column;vertical-align:middle;text-align:center;font-size:.86em;line-height:1.15;margin:0 3px}
.frac .n{border-bottom:1.5px solid currentColor;padding:0 4px}
.frac .d{padding:0 4px}

.gate{max-width:520px;margin:40px auto;background:var(--card);border:1px solid var(--line);border-radius:18px;padding:34px 30px;box-shadow:var(--shadow);text-align:center}
.gate-icon{width:64px;height:64px;margin:0 auto 14px;border-radius:18px;background:linear-gradient(135deg,#6366f1,#22c55e);color:#fff;font:800 30px/64px Georgia,serif}
.gate h1{margin:0 0 6px;font-size:23px}
.gate-sub{color:var(--brand);font-weight:700;font-size:13.5px;margin:0 0 14px}
.gate p{color:var(--muted);font-size:14px;margin:0 0 18px}
.gate-row{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.gate-row input{flex:1;min-width:200px;font:16px/1.5 inherit;padding:11px 14px;border:1px solid var(--line);border-radius:10px}
.gate-row input:focus{outline:2px solid #c7d2fe;border-color:var(--brand)}
.gate-recent{margin-top:16px;font-size:13px;color:var(--muted);display:flex;gap:8px;flex-wrap:wrap;justify-content:center;align-items:center}
.recent-chip{border:1px solid var(--line);background:#fff;border-radius:999px;padding:4px 13px;color:var(--brand);font-size:13px}
.recent-chip:hover{background:var(--brand-soft);border-color:#c7d2fe}
.goal-panel{border-left:4px solid var(--brand)}
.goal-panel p{margin:0;font-size:15px}
.tip-panel{border-left:4px solid var(--warn);background:#fffdf7}
.tip-panel li{margin:6px 0}
.panel-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.panel-head h3{margin:0}
.guide{background:var(--brand-soft);border-radius:9px;padding:10px 14px;font-size:14.5px;margin:0 0 16px}
.eg{border:1px solid var(--line);border-radius:12px;padding:15px 17px;margin-bottom:14px;background:#fff}
.eg:last-child{margin-bottom:0}
.eg-head{margin-bottom:8px}
.eg-tag{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#7c3aed;background:#f5f3ff;border-radius:7px;padding:3px 10px}
.eg-tag i{font-style:normal;font-weight:600;color:#6b7280}
.eg-q{font-size:15.5px;line-height:1.85;margin-bottom:10px}
.eg-opts{display:grid;gap:6px;margin-bottom:10px}
.eg-opt{display:flex;gap:9px;font-size:14.5px;padding:7px 11px;border:1px solid var(--line);border-radius:8px;color:#475569}
.eg-opt.right{border-color:var(--ok);background:var(--ok-soft);color:#065f46;font-weight:600}
.eg-idx{font-weight:800;color:var(--muted)}
.eg-opt.right .eg-idx{color:var(--ok)}
.eg-sol{margin-top:12px;border-top:1px dashed var(--line);padding-top:12px}
.eg-ans{font-weight:700;color:#065f46;margin-bottom:6px}
.eg-exp{font-size:14.5px;line-height:1.8;color:#334155}
.eg-exp b{display:block;margin-bottom:3px;color:var(--brand)}
.qa-card{display:block;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:14px 16px;margin-bottom:10px;box-shadow:var(--shadow);transition:border-color .15s,transform .15s}
.qa-card:hover{border-color:#c7d2fe;transform:translateY(-2px)}
.qa-card-top{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:8px}
.qa-badge{font-size:12px;font-weight:700;padding:2px 9px;border-radius:999px;background:#f3f4f6;color:var(--muted)}
.qa-badge.solved{background:var(--ok-soft);color:var(--ok)}
.qa-sec{font-size:12px;color:var(--brand);background:var(--brand-soft);padding:2px 9px;border-radius:999px}
.qa-title{font-size:16px;font-weight:700;margin-bottom:5px}
.qa-meta{font-size:12.5px;color:var(--muted)}
.qa-question h1{margin:6px 0 6px;font-size:21px}
.qa-body{margin-top:12px;font-size:15.5px;line-height:1.85;white-space:pre-wrap}
.qa-img{max-width:100%;border-radius:10px;border:1px solid var(--line);margin-top:12px;display:block}
.qa-answer{border:1px solid var(--line);border-radius:11px;padding:13px 15px;margin-bottom:10px;background:#fff}
.qa-answer.accepted{border-color:var(--ok);background:var(--ok-soft)}
.qa-atext{margin-top:6px;font-size:15px;line-height:1.8}
.qa-answer .btn{margin-top:10px}
.qa-form{margin-top:14px;border-top:1px dashed var(--line);padding-top:14px}
.qa-form textarea{width:100%;font:15px/1.7 inherit;padding:11px 13px;border:1px solid var(--line);border-radius:10px;resize:vertical;min-height:90px}
.field{margin-bottom:14px}
.field label{display:block;font-size:13.5px;color:var(--muted);margin-bottom:5px}
.field input,.field textarea{width:100%;font:15px/1.5 inherit;padding:10px 12px;border:1px solid var(--line);border-radius:9px}
.field textarea{resize:vertical;min-height:80px}
.toast{position:fixed;right:20px;bottom:20px;background:#111827;color:#fff;padding:10px 16px;border-radius:10px;font-size:14px;opacity:0;transition:opacity .3s;z-index:50}
.toast.show{opacity:1}
.exam-head{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:20px 22px;box-shadow:var(--shadow);margin-bottom:18px;text-align:center}
.exam-head h1{margin:0 0 6px;font-size:22px}
.exam-meta{color:var(--muted);font-size:14px}
.exam-part{margin-bottom:22px}
.exam-part-title{font-size:16px;font-weight:800;color:var(--brand);margin:18px 0 10px;padding-left:10px;border-left:4px solid var(--brand)}
.exam-q{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:16px 18px;margin-bottom:12px;box-shadow:var(--shadow)}
.exam-no{font-weight:800;margin-right:6px}
.exam-q-text{font-size:15.5px;line-height:1.9;margin-bottom:12px}
.exam-score{color:var(--muted);font-size:13px;margin-left:6px}
.exam-q .opt.sel{border-color:var(--brand);background:var(--brand-soft);font-weight:600}
.exam-fb{margin-top:10px;border-radius:10px;padding:11px 14px;font-size:14.5px;display:none}
.exam-fb.ok,.exam-fb.bad{display:block}
.exam-fb.ok{background:var(--ok-soft);border:1px solid #a7f3d0;color:#065f46}
.exam-fb.bad{background:var(--bad-soft);border:1px solid #fecaca;color:#991b1b}
.exam-submit{display:flex;align-items:center;gap:14px;flex-wrap:wrap;margin-top:20px}
.qa-img{max-width:100%;border-radius:10px;border:1px solid var(--line);margin-top:10px;display:block}
.field select{width:100%;font:15px/1.5 inherit;padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:#fff}
.exam-q textarea,.exam-q input{width:100%;font:15px/1.7 inherit;padding:11px 13px;border:1px solid var(--line);border-radius:10px}
.exam-q textarea{resize:vertical;min-height:90px}
.announce{background:#fffbeb;border:1px solid #fde68a;color:#92400e;border-radius:12px;padding:11px 16px;margin-bottom:18px;font-size:14px}
.qbadge{display:inline-block;font-size:12px;font-weight:700;color:#7c3aed;background:#f5f3ff;border-radius:6px;padding:2px 8px;margin-right:8px;vertical-align:middle}
.free-wrap{margin-bottom:10px}
.free-wrap textarea{
  width:100%;font:15px/1.7 inherit;padding:12px 14px;border:1px solid var(--line);
  border-radius:10px;background:#fff;color:var(--ink);resize:vertical;min-height:76px;
}
.free-wrap textarea:focus{outline:2px solid #c7d2fe;border-color:var(--brand)}
.symbol-bar{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:10px 0;padding:9px 11px;background:#f8fafc;border:1px dashed #cbd5e1;border-radius:10px}
.sym-tip{font-size:12.5px;color:var(--muted);margin-right:2px}
.sym{
  min-width:34px;height:32px;padding:0 8px;border:1px solid #cbd5e1;border-radius:8px;
  background:#fff;color:#334155;font-size:14px;line-height:1;
}
.sym:hover{border-color:var(--brand);color:var(--brand);background:var(--brand-soft)}
.grader{margin:6px 0;font-weight:600}
.hidden{display:none}
.mt{margin-top:16px}
