:root {
  --bg: #f5f7fa; --card: #ffffff; --ink: #1e293b; --muted: #64748b;
  --line: #e2e8f0; --brand: #dc2626; --brand-dark: #b91c1c;
  --green: #16a34a; --amber: #d97706; --blue: #2563eb; --purple: #7c3aed;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
.layout { display: flex; min-height: 100vh; }

/* 侧栏 */
.sidebar { width: 230px; background: #fff; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand-title { font-size: 20px; font-weight: 800; color: var(--brand); }
.brand-sub { font-size: 12px; color: var(--muted); margin: 2px 0 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { text-decoration: none; color: var(--ink); padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: #fef2f2; }
.nav a.active { background: var(--brand); color: #fff; }
.sb-stats { margin-top: auto; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.sb-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.sb-row b { text-align: right; }
.sb-row b.small { font-weight: 600; font-size: 12px; color: var(--muted); }
.sb-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }

/* 主区 */
.main { flex: 1; }
.topbar { padding: 18px 28px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 20px; }
#content { padding: 22px 28px 60px; max-width: 980px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h3 { font-size: 16px; margin-bottom: 10px; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 0; line-height: 1.6; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.kpi { text-align: center; padding: 16px; }
.kpi-n { font-size: 30px; font-weight: 800; color: var(--brand); }
.kpi-l { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* 今日 */
.today-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.d-badge { display: inline-block; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; margin-bottom: 6px; }
.ring { font-size: 18px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.task { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px; cursor: pointer; }
.task:hover { background: #fff8f8; }
.task.done { opacity: .55; }
.task.done .t-text { text-decoration: line-through; }
.task.sm { padding: 7px 9px; font-size: 13.5px; }
.slot { flex-shrink: 0; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f1f5f9; color: var(--muted); white-space: nowrap; }
.tag-morning { background:#fff7ed; color:#c2410c; } .tag-evening { background:#eff6ff; color:#1d4ed8; }
.tag-commute { background:#f0fdf4; color:#15803d; } .tag-noon { background:#fdf4ff; color:#a21caf; }
.tag-block { background:#fef9c3; color:#a16207; }
.t-text { flex: 1; line-height: 1.55; }
.t-min { color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* 得分率 */
.rate-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 10px; margin-bottom: 9px; }
.rate-name { font-size: 13.5px; }
.rate-bar { height: 10px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.rate-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.rate-val { text-align: right; font-weight: 700; font-size: 13px; }
.rate-val.good { color: var(--green); } .rate-val.warn { color: var(--amber); } .rate-val.bad { color: var(--brand); }

/* 打卡 */
.checkin-row { display: flex; gap: 8px; }
.checkin-row input { flex: 1; }
input, textarea, select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; background: #fff; }
input:focus, textarea:focus { outline: 2px solid #fecaca; border-color: var(--brand); }
textarea { width: 100%; resize: vertical; margin-top: 6px; }

/* 按钮 */
.btn { border: none; background: var(--brand); color: #fff; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--brand-dark); }
.btn-green { background: var(--green); } .btn-green:hover { background: #15803d; }
.btn-red { background: #991b1b; } .btn-red:hover { background: #7f1d1d; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); } .btn-ghost:hover { background: #f8fafc; }
.btn-sm { padding: 5px 11px; font-size: 13px; }

/* 题卷列表 */
.paper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; cursor: pointer; transition: border-color .15s; }
.paper-row:hover { border-color: var(--brand); }
.paper-name { font-weight: 700; margin-bottom: 3px; }
.qtags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.qtag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.pill-gray { background: #f1f5f9; color: var(--muted); }
.pill-green { background: #dcfce7; color: var(--green); }
.pill-amber { background: #fef3c7; color: var(--amber); }
.pill-red { background: #fee2e2; color: var(--brand); }
.pill-blue { background: #dbeafe; color: var(--blue); }
.pill-purple { background: #f3e8ff; color: var(--purple); }

/* 做题页 */
.do-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.do-meta { color: var(--muted); font-size: 13px; }
.timer-card { display: flex; align-items: center; gap: 14px; justify-content: space-between; flex-wrap: wrap; }
.q-block { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.q-no { font-weight: 800; }
.scenario { background: #f8fafc; border-radius: 8px; padding: 12px 14px; line-height: 1.7; font-size: 14px; margin-bottom: 14px; }
.sub { border-top: 1px dashed var(--line); padding: 14px 0 6px; }
.sub-q { font-weight: 600; margin-bottom: 4px; line-height: 1.6; }
.self-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.self-label { font-size: 13px; font-weight: 700; color: var(--brand); }
.score-btns { display: flex; gap: 5px; flex-wrap: wrap; }
.score { border: 1px solid var(--line); background: #fff; border-radius: 7px; min-width: 36px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.score:hover { border-color: var(--brand); }
.score.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.ref { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.ref.hidden { display: none; }
.ref-label { font-size: 12px; font-weight: 800; color: var(--green); margin: 4px 0; }
.ref-body { line-height: 1.7; font-size: 14px; }
.ref-pts { margin: 4px 0 8px 18px; font-size: 13px; color: #166534; }
.ref-pts li { margin-bottom: 3px; }

/* 错因本 */
.mistake { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.mistake.resolved { opacity: .6; }
.mk-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; }
.mk-stem { font-weight: 600; line-height: 1.6; }
.mk-ans, .mk-got { font-size: 13.5px; margin-top: 6px; line-height: 1.6; }
.mk-ans b { color: var(--green); } .mk-got b { color: var(--brand); }
.mk-ops { margin-top: 10px; display: flex; gap: 8px; }

/* 模板 */
.tpl-steps { margin: 8px 0 12px 20px; line-height: 1.9; }
.kw-row { display: flex; gap: 7px; flex-wrap: wrap; }
.kw { font-size: 12px; background: #fef2f2; color: var(--brand); padding: 3px 10px; border-radius: 99px; font-weight: 600; }

/* 真题拆解（模板页） */
.case-wrap { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.case-box { border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; padding: 0; overflow: hidden; }
.case-box[open] { background: #fff; border-color: #cbd5e1; }
.case-box > summary { cursor: pointer; padding: 11px 14px; font-size: 14px; font-weight: 700; color: #334155; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; user-select: none; }
.case-box > summary:hover { background: #f1f5f9; }
.case-flag { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 6px; background: #eff6ff; color: #2563eb; white-space: nowrap; }
.case-flag.hot { background: #fef2f2; color: #dc2626; }
.case-count { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: auto; white-space: nowrap; }
.case-box > summary::after { content: '▸'; color: #94a3b8; font-size: 12px; }
.case-box[open] > summary::after { content: '▾'; }
.case-insight { margin: 0 14px 10px; padding: 10px 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 13.5px; line-height: 1.7; color: #78350f; }
.case-sec { margin: 0 14px 10px; font-size: 13.5px; line-height: 1.7; color: #334155; }
.case-sec > b { display: block; margin-bottom: 5px; font-size: 13px; color: #0f172a; }
.case-steps { margin: 0 0 0 18px; padding: 0; }
.case-steps li { margin-bottom: 4px; }
.case-traps { margin: 0 0 0 18px; padding: 0; }
.case-traps li { margin-bottom: 4px; color: #9f1239; }
.kw-sig { background: #f0f9ff; color: #0369a1; }
.exam-item { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; background: #fff; }
.exam-item > summary { cursor: pointer; padding: 9px 12px; font-size: 13px; font-weight: 700; color: #1e293b; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.exam-item > summary:hover { background: #f8fafc; }
.exam-stem { font-weight: 500; color: #475569; font-size: 12.5px; }
.exam-ask { padding: 2px 12px 8px; font-size: 12.5px; color: #475569; line-height: 1.9; }
.ask-pill { display: inline-block; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 99px; padding: 1px 9px; margin: 2px 3px 0 0; font-size: 12px; }
.exam-map { padding: 2px 12px 8px; font-size: 13px; line-height: 1.7; color: #334155; }
.exam-map ul { margin: 4px 0 0 18px; padding: 0; }
.exam-map li { margin-bottom: 5px; }
.exam-map li::marker { color: var(--brand); }
.exam-ref { margin: 0 12px 10px; padding: 8px 11px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; font-size: 12.5px; line-height: 1.7; color: #14532d; }
.exam-block { margin: 0 12px 10px; border-radius: 8px; padding: 0; overflow: hidden; }
.exam-block b { display: block; padding: 6px 12px 0; font-size: 12.5px; }
.exam-block pre { margin: 4px 12px 10px; padding: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.8; color: #1e293b; }
.exam-original { background: #f8fafc; border: 1px solid #e2e8f0; }
.exam-original b { color: #334155; }
.exam-answer { background: #f0fdf4; border: 1px solid #bbf7d0; }
.exam-answer b { color: #15803d; }
.exam-answer pre { color: #14532d; }
.ans-fold { margin: 4px 12px 10px; border: 1px dashed #fca5a5; border-radius: 8px; background: #fffbeb; }
.ans-fold > summary { cursor: pointer; padding: 8px 12px; font-size: 12.5px; font-weight: 700; color: #b45309; user-select: none; }
.ans-fold > summary:hover { background: #fef3c7; border-radius: 8px; }
.ans-fold[open] > summary { border-bottom: 1px dashed #fcd34d; }
.ans-fold .exam-block, .ans-fold .exam-ref { margin: 10px 12px; }



/* 卡片 */
.study { text-align: center; padding: 22px 12px; }
.study-meta { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.study-q { font-size: 18px; font-weight: 700; line-height: 1.6; margin-bottom: 18px; min-height: 58px; }
.study-a { background: #f0fdf4; border-radius: 10px; padding: 14px; font-size: 15px; line-height: 1.8; margin: 12px 0; }
.grade-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.grade { border: none; border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 700; cursor: pointer; color: #fff; }
.g1 { background: #dc2626; } .g3 { background: #f59e0b; } .g4 { background: #3b82f6; } .g5 { background: #16a34a; }
.hidden { display: none; }
.good { color: var(--green); font-weight: 700; padding: 8px 0; }

/* 云资料 */
.lib-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; text-decoration: none; color: var(--ink); }
.lib-row:hover { border-color: var(--brand); background: #fff8f8; }
.lib-name { font-weight: 700; margin-bottom: 4px; }
.lib-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin-right: 7px; }
.lib-open { flex-shrink: 0; font-size: 13px; color: var(--brand); font-weight: 600; white-space: nowrap; }
.lib-ops { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }
.lib-dl { font-size: 12.5px; padding: 4px 10px; border-radius: 7px; background: #059669; color: #fff; font-weight: 700; text-decoration: none; white-space: nowrap; }
.lib-dl:hover { background: #047857; }
.small { font-size: 12px; }

/* 计划 */
.phase { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 15px; margin-bottom: 9px; font-size: 14px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; margin-bottom: 10px; }
.day.today { border: 2px solid var(--brand); box-shadow: 0 2px 10px rgba(220,38,38,.1); }
.day.alldone { opacity: .6; }
.day-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.day-theme { font-weight: 600; flex: 1; min-width: 150px; }

/* 自动评分 */
.autograde { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.autograde.deep { background: #fdf4ff; border-color: #e9d5ff; }
.autograde.deep .ag-badge, .autograde.deep .ag-score, .autograde.deep .ag-cov { color: #86198f; }
.ag-badge { font-size: 12px; font-weight: 800; color: #4338ca; margin-right: 8px; }
.ag-score { font-size: 18px; font-weight: 800; color: #4338ca; margin-right: 10px; }
.ag-cov { font-size: 12.5px; color: #6366f1; }
.ag-detail { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; font-size: 13px; line-height: 1.6; }
.ag-ok { color: #15803d; }
.ag-miss { color: #dc2626; }
.ag-tip { color: #7c3aed; }
.deep-areas { border-color: #e9d5ff; background: #fdfaff; }

/* 危险区 */
.danger { border-color: #fecaca; background: #fffafa; }

/* toast */
#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1e293b; color: #fff; padding: 10px 22px; border-radius: 99px; font-size: 14px; opacity: 0; transition: .25s; pointer-events: none; z-index: 99; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  #content { padding: 14px; }
}
