* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e6e8ec;
  --text: #1d2129;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --accent: #2563eb;
  --accent-soft: #eef4ff;
  --teal: #0f9d76;
  --teal-soft: #e8f7f1;
  --amber: #b45309;
  --red: #dc2626;
}
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
.layout { display: flex; min-height: 100vh; }

.sidebar { width: 232px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 24px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; }
.brand-name { font-size: 16px; font-weight: 600; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: none; background: transparent; border-radius: 9px; color: #4b5563; font-size: 14px; cursor: pointer; text-align: left; font-family: inherit; }
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-ico { font-size: 16px; width: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--border); }
.mini-label { font-size: 11px; color: var(--muted); }
.progress-track { height: 5px; background: #eef0f3; border-radius: 3px; margin: 9px 0 7px; overflow: hidden; }
.progress-fill { width: 14.3%; height: 100%; background: var(--accent); border-radius: 3px; }
.mini-text { font-size: 11px; color: var(--faint); }

.main { flex: 1; min-width: 0; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 32px; position: sticky; top: 0; z-index: 10; }
.crumb { font-size: 15px; font-weight: 500; }
.topbar-right { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.topbar-right .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.content { padding: 30px 32px 60px; max-width: 1120px; }

.page { display: none; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { padding: 8px 0 22px; }
.hero-tag { display: inline-block; font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 20px; margin-bottom: 14px; }
.hero h1 { font-size: 27px; font-weight: 600; line-height: 1.4; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 14px; max-width: 780px; }
.page-intro { padding: 4px 0 22px; }
.page-intro h1 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.page-intro p { color: var(--muted); max-width: 800px; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.stat-num { font-size: 30px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.stat-label { font-size: 13px; font-weight: 500; margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--faint); margin-top: 3px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px 24px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.panel-head h2 { font-size: 16px; font-weight: 600; }
.panel-head span { font-size: 12px; color: var(--muted); }

.flow { display: flex; align-items: stretch; gap: 10px; }
.flow-node { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 16px 10px; text-align: center; background: #fafbfc; }
.flow-node.accent { background: var(--teal-soft); border-color: #cfe9df; }
.flow-ico { font-size: 22px; color: var(--accent); margin-bottom: 8px; }
.flow-node.accent .flow-ico { color: var(--teal); }
.flow-t { font-size: 13px; font-weight: 500; }
.flow-s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.flow-arrow { align-self: center; color: var(--faint); font-size: 18px; }
.flow-return { text-align: center; font-size: 12px; color: var(--teal); margin-top: 14px; }

.roadmap { display: grid; gap: 10px; }
.road-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px; }
.road-item.done { background: #f7fbf9; border-color: #dcefe7; }
.road-item.next { background: #fffdf7; border-color: #f2e4c4; }
.road-num { width: 26px; height: 26px; border-radius: 50%; background: #eef0f3; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.road-item.done .road-num { background: var(--teal); color: #fff; }
.road-item.next .road-num { background: var(--amber); color: #fff; }
.road-body { flex: 1; }
.road-t { font-size: 14px; font-weight: 500; }
.road-s { font-size: 12px; color: var(--muted); }
.road-status { font-size: 11px; padding: 3px 9px; border-radius: 20px; background: #eef0f3; color: var(--muted); }
.road-item.done .road-status { background: var(--teal-soft); color: var(--teal); }
.road-item.next .road-status { background: #fbf1d9; color: var(--amber); }

.note-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px; }
.note-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.note-box ul { padding-left: 18px; }
.note-box li { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.curriculum-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; }
.tab { padding: 8px 18px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font-size: 13px; font-family: inherit; color: #4b5563; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.search-input { flex: 1; min-width: 220px; max-width: 340px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; }
.search-input:focus { border-color: var(--accent); }
.kb-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.kb-tree { display: grid; gap: 12px; }
.unit-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.unit-head { padding: 13px 18px; background: #fafbfc; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.unit-head:hover { background: #f3f5f7; }
.unit-caret { color: var(--faint); font-size: 12px; transition: transform .2s; }
.unit-card.open .unit-caret { transform: rotate(90deg); }
.unit-name { font-size: 14px; font-weight: 600; flex: 1; }
.unit-count { font-size: 11px; color: var(--faint); }
.unit-body { display: none; padding: 6px 18px 14px; }
.unit-card.open .unit-body { display: block; }
.chapter-row { border-top: 1px solid #f0f1f3; padding: 11px 0 4px; }
.chapter-name { font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.point-chip { display: inline-flex; align-items: center; gap: 7px; background: #f5f7fa; border: 1px solid #eceff3; border-radius: 6px; padding: 5px 10px; margin: 0 6px 6px 0; font-size: 12px; }
.point-chip .pid { color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; }
.point-chip mark { background: #fff2b8; color: inherit; border-radius: 2px; }
.kb-empty { text-align: center; color: var(--muted); padding: 40px; }

.code-block { background: #1f2430; color: #e5e9f0; border-radius: 9px; padding: 18px 20px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.75; overflow-x: auto; white-space: pre; }
.code-block .k { color: #8ab4f8; }
.code-block .s { color: #a5d6a7; }
.code-block .n { color: #f0b27a; }
.code-block .c { color: #8b93a1; }

.factor-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.factor { border: 1px solid var(--border); border-radius: 9px; padding: 14px 16px; }
.factor-n { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.factor-t { font-size: 13px; font-weight: 500; }
.factor-s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.formula { margin-top: 14px; background: #f8fafc; border-radius: 8px; padding: 11px 14px; font-size: 12px; color: #374151; font-family: ui-monospace, monospace; }

.cause-table { display: grid; gap: 8px; }
.cause-row { display: grid; grid-template-columns: 90px 1fr 1fr; gap: 14px; align-items: center; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; }
.cause-tag { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 6px; text-align: center; color: #fff; }
.cause-sym { font-size: 12px; color: #4b5563; }
.cause-cure { font-size: 12px; color: var(--teal); }

.heatmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.heat-cell { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.heat-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-bar { width: 6px; height: 24px; border-radius: 3px; flex-shrink: 0; }
.c0 { background: #dc2626; } .c1 { background: #ea580c; } .c2 { background: #f59e0b; } .c3 { background: #84cc16; } .c4 { background: #16a34a; }
.heat-legend { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 12px; font-size: 11px; color: var(--muted); }
.heat-legend .lg { width: 16px; height: 8px; border-radius: 2px; }

.type-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.type-card { border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.type-badge { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 20px; margin-bottom: 10px; }
.b1 { background: var(--accent-soft); color: var(--accent); }
.b2 { background: #f3f0ff; color: #6d28d9; }
.type-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.type-card p { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.type-flow { font-size: 11px; color: #374151; background: #f8fafc; border-radius: 6px; padding: 9px 11px; line-height: 1.7; }
.type-note { font-size: 11px; color: var(--teal); margin-top: 9px; }
.storage-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.storage-item { display: flex; gap: 11px; align-items: center; border: 1px solid var(--border); border-radius: 9px; padding: 14px; font-size: 12px; color: var(--muted); line-height: 1.7; }
.storage-item b { color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; }
.st-ico { font-size: 18px; color: var(--accent); }

.gen-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gen-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.gen-ico { font-size: 20px; color: var(--teal); margin-bottom: 8px; }
.gen-t { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.gen-s { font-size: 12px; color: var(--muted); }
.gen-ex { font-size: 11px; color: var(--accent); margin-top: 9px; background: var(--accent-soft); border-radius: 6px; padding: 7px 9px; }
.print-hint { color: var(--teal) !important; }
.paper-wrap { background: #eceff3; border-radius: 10px; padding: 24px; display: flex; justify-content: center; }
.paper { width: 100%; max-width: 680px; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.08); padding: 36px 42px; min-height: 640px; }
.paper-head { border-bottom: 2px solid #1d2129; padding-bottom: 14px; margin-bottom: 20px; }
.paper-title { font-size: 19px; font-weight: 600; text-align: center; }
.paper-sub { font-size: 12px; color: var(--muted); text-align: center; margin-top: 5px; }
.paper-info { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; margin-top: 16px; }
.paper-section { font-size: 13px; font-weight: 600; margin: 20px 0 10px; padding: 6px 10px; background: #f3f5f7; border-left: 3px solid var(--accent); }
.paper-q { padding-left: 22px; }
.paper-q li { font-size: 13px; margin-bottom: 14px; line-height: 1.9; }
.paper-foot { text-align: center; font-size: 11px; color: var(--faint); margin-top: 30px; border-top: 1px dashed #ddd; padding-top: 12px; }

@media (max-width: 900px) {
  .sidebar { width: 72px; padding: 20px 10px; }
  .brand-text, .nav-item { font-size: 0; }
  .nav-item { justify-content: center; }
  .nav-ico { font-size: 18px; }
  .sidebar-foot { display: none; }
  .stats-row, .factor-grid, .gen-grid, .storage-row { grid-template-columns: 1fr 1fr; }
  .type-cards { grid-template-columns: 1fr; }
  .content { padding: 22px 18px 50px; }
  .cause-row { grid-template-columns: 1fr; gap: 4px; }
}

.kb-note { background: #fffdf5; border: 1px solid #f0e0b8; color: #8a5a00; font-size: 12px; border-radius: 8px; padding: 9px 13px; margin-bottom: 12px; }
.unit-pending { font-size: 11px; color: #b45309; background: #fdf3e2; border: 1px solid #f2ddb8; border-radius: 20px; padding: 2px 8px; }

.kb-book { background: #f3f8ff; border: 1px solid #cfe2f7; border-radius: 9px; padding: 10px 13px; margin-bottom: 10px; font-size: 13px; color: #1c3d5a; }
.kb-book-tag { display: inline-block; font-size: 11px; background: #2b6cb0; color: #fff; border-radius: 20px; padding: 1px 8px; margin-right: 7px; vertical-align: 1px; }
.kb-book-meta { color: #6b8299; font-size: 12px; margin-left: 8px; }
.kb-book-note { color: #5b7285; font-size: 12px; margin-top: 4px; line-height: 1.6; }

/* ===== 能力诊断页 ===== */
.concern-wrap { display: flex; gap: 14px; flex-wrap: wrap; }
.concern { flex: 1 1 330px; border: 1px solid #e3e8ee; border-radius: 10px; padding: 13px 15px; background: #fbfdff; }
.concern-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.concern-hd b { font-size: 14.5px; color: #16233a; }
.concern-sub { font-size: 11px; background: #2b6cb0; color: #fff; border-radius: 20px; padding: 2px 9px; }
.concern-st { margin-left: auto; font-size: 11px; color: #b45309; background: #fdf3e2; border: 1px solid #f2ddb8; border-radius: 20px; padding: 2px 9px; }
.concern-lbl { font-size: 11.5px; color: #7a8a9c; margin: 9px 0 4px; letter-spacing: .3px; }
.concern-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: #2d3b4d; line-height: 1.85; }
.concern-need { margin-top: 10px; font-size: 11.5px; color: #4a5c70; background: #eef4fb; border-left: 3px solid #2b6cb0; padding: 7px 10px; border-radius: 0 6px 6px 0; line-height: 1.7; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-chip { font-size: 11.5px; background: #eaf1f9; color: #24557f; border-radius: 20px; padding: 2px 9px; }
.mini-chip.cause { background: #fdeeee; color: #9b2c2c; }

.sk-group { margin-bottom: 20px; }
.sk-group-hd { font-size: 13px; font-weight: 600; color: #16233a; margin-bottom: 7px; padding-left: 9px; border-left: 3px solid #2b6cb0; }
.sk-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sk-table th { background: #f4f7fa; color: #5a6b7e; font-weight: 500; text-align: left; padding: 7px 9px; border-bottom: 1px solid #e3e8ee; font-size: 11.5px; }
.sk-table td { padding: 8px 9px; border-bottom: 1px solid #eef2f6; vertical-align: top; color: #2d3b4d; line-height: 1.65; }
.sk-table tr.sk-high td { background: #fffdf6; }
.sk-name { font-weight: 600; color: #16233a; }
.sk-dim { font-size: 10.5px; color: #9aa9b8; font-weight: 400; margin-top: 2px; }
.sk-sig { color: #55677a; font-size: 11.5px; }
.sk-train { color: #1f5f43; font-size: 11.5px; }
.sk-avoid { color: #9b2c2c; font-size: 11.5px; }
.sk-flag { display: inline-block; font-size: 10px; background: #dc2626; color: #fff; border-radius: 20px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; font-weight: 400; }
.sk-flag.v2 { background: #2b6cb0; }

.print-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.print-card { flex: 1 1 300px; border: 1px solid #e3e8ee; border-radius: 10px; padding: 14px 16px; background: #fff; }
.print-card .pc-tag { display: inline-block; font-size: 11px; background: #1f5f43; color: #fff; border-radius: 20px; padding: 2px 9px; margin-bottom: 8px; }
.print-card h3 { margin: 0 0 7px; font-size: 14px; color: #16233a; }
.print-card p { margin: 0 0 9px; font-size: 12.5px; color: #55677a; line-height: 1.75; }
.print-card .pc-path { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: #2b6cb0; background: #f4f8fd; border-radius: 5px; padding: 5px 8px; }

/* ===== 试卷分析实例 ===== */
.scan-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.scan-thumb { margin: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fafbfc; }
.scan-thumb img { width: 100%; height: 150px; object-fit: cover; object-position: top; display: block; cursor: zoom-in; }
.scan-thumb figcaption { font-size: 12px; color: var(--muted); padding: 8px 11px; text-align: center; }
.scan-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.scan-stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 9px; padding: 12px 14px; }
.scan-stat b { display: block; font-size: 25px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.scan-stat span { font-size: 11.5px; color: var(--muted); }
.scan-subhd { font-size: 13px; font-weight: 600; color: #16233a; margin: 22px 0 11px; padding-left: 9px; border-left: 3px solid var(--accent); }
.scan-causes { display: grid; gap: 9px; }
.scan-cause { position: relative; border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px 9px 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sc-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px 0 0 7px; opacity: .13; }
.scan-cause b { font-size: 12.5px; font-weight: 600; z-index: 1; }
.scan-cause em { font-size: 12px; color: var(--text); font-style: normal; font-weight: 600; }
.scan-cause small { font-size: 11.5px; color: var(--muted); }
.scan-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.scan-table th { background: #f4f7fa; color: #5a6b7e; font-weight: 500; text-align: left; padding: 8px 10px; border-bottom: 1px solid #e3e8ee; font-size: 11.5px; }
.scan-table td { padding: 8px 10px; border-bottom: 1px solid #eef2f6; color: #2d3b4d; vertical-align: top; line-height: 1.5; }
.scan-table td.wrong { color: #b91c1c; }
.scan-table td.right { color: #15803d; font-weight: 500; }
.scan-advice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scan-adv { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 9px; padding: 13px 15px; background: #fffdf8; }
.sa-n { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--amber); color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.scan-adv b { font-size: 13px; }
.scan-adv p { font-size: 12px; color: #55677a; margin-top: 5px; line-height: 1.7; }
.scan-verdict { margin-top: 18px; background: #eef7f2; border-left: 3px solid var(--teal); border-radius: 0 8px 8px 0; padding: 12px 15px; font-size: 12.5px; color: #1f5f43; line-height: 1.75; }
.scan-verdict b { font-weight: 600; }
.scan-lightbox { display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.82); z-index: 100; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.scan-lightbox.open { display: flex; }
.scan-lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.scan-lightbox .lb-x { position: fixed; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.45); background: rgba(0,0,0,.6); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; z-index: 3; display: flex; align-items: center; justify-content: center; padding: 0; }
.scan-lightbox .lb-x:active { background: rgba(255,255,255,.25); }
.lb-hint { position: fixed; top: 18px; left: 16px; color: rgba(255,255,255,.85); font-size: 13px; z-index: 3; pointer-events: none; }

@media (max-width: 900px) {
  .scan-strip, .scan-summary { grid-template-columns: 1fr 1fr; }
  .scan-advice { grid-template-columns: 1fr; }
  .scan-table { font-size: 11px; }
}

/* ============ 错题卡 v2 ============ */
.scan-strip.four { grid-template-columns: repeat(4, 1fr); }
.scan-strip.four .scan-thumb img { height: 132px; }
.scan-hint { font-size: 11.5px; color: var(--faint); margin: -6px 0 16px; }

/* 卷面总览：先看整体框架，再往下看具体错题 */
.po-wrap { display: grid; gap: 12px; margin-bottom: 16px; }
.paper-ov { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.po-head { display: flex; align-items: baseline; gap: 10px; padding: 11px 16px; background: var(--accent-soft); border-bottom: 1px solid #dbe6ff; flex-wrap: wrap; }
.po-head b { font-size: 13px; color: #1e40af; }
.po-head span { font-size: 12px; color: var(--muted); }
.po-body { padding: 11px 16px 13px; display: grid; gap: 9px; }
.po-row { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: start; }
.po-k { font-size: 11.5px; color: var(--faint); padding-top: 2px; }
.po-v { font-size: 12.5px; color: #374151; line-height: 1.7; }
.po-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.po-blk { display: inline-flex; align-items: baseline; gap: 5px; background: #f7f8fa; border: 1px solid var(--border); border-radius: 7px; padding: 3px 8px; }
.po-blk b { font-weight: 500; font-size: 12px; }
.po-blk em { font-style: normal; font-size: 11px; color: var(--faint); }
.po-blk u { text-decoration: none; font-size: 11px; color: var(--amber); background: #fff7ed; border-radius: 4px; padding: 0 4px; }
.po-blk u.po-min { color: var(--red); background: #fef2f2; }
.po-marks { display: flex; flex-wrap: wrap; gap: 6px; }
.po-c { font-style: normal; font-size: 11.5px; border-radius: 20px; padding: 2px 9px; background: #f3f4f6; color: #4b5563; }
.po-c.po-ok { background: var(--teal-soft); color: #0b7a5c; }
.po-c.po-half { background: #fff7ed; color: var(--amber); }
.po-c.po-bad { background: #fef2f2; color: #b91c1c; }
.po-process { color: var(--muted); }
.po-warn { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 7px; padding: 6px 9px; }
/* 判错依据：老师在这题上留下的记号 */
.ec-mark { padding: 10px 16px 0; }
.ec-mark > b { display: block; font-size: 12px; color: #374151; margin-bottom: 5px; }
.ec-mark p { margin: 0; font-size: 12.5px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 7px 10px; line-height: 1.7; }
@media (max-width: 640px) {
  .po-row { grid-template-columns: 52px 1fr; gap: 8px; }
}

.guide-panel { background: #f8fbff; border-color: #dbe7f7; }
.guide-title { font-size: 14px; font-weight: 700; color: #1e40af; margin-bottom: 14px; }
.guide-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gs { display: flex; gap: 10px; }
.gs-n { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.gs b { font-size: 12.5px; color: var(--text); }
.gs p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 4px 0 0; }

.errlist { display: flex; flex-direction: column; gap: 14px; }
.errcard { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.ec-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; background: #fbfcfe; border-bottom: 1px solid var(--border); }
.ec-no { flex: 0 0 26px; height: 26px; border-radius: 8px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 700; }
.ec-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ec-title b { font-size: 13.5px; color: var(--text); }
.ec-title small { font-size: 11.5px; color: var(--faint); }
.ec-tag { flex: 0 0 auto; font-size: 11.5px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.ec-q { padding: 12px 16px 0; font-size: 13.5px; color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; line-height: 1.6; }
.ec-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 11px 16px 0; }
.ec-wrong, .ec-right { border-radius: 8px; padding: 9px 12px; display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.ec-wrong { background: #fef2f2; border: 1px solid #fecaca; }
.ec-right { background: #f0fdf7; border: 1px solid #a7f3d0; }
.ec-wrong span, .ec-right span { font-size: 11px; color: var(--muted); }
.ec-wrong b { font-size: 14px; color: #b91c1c; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ec-right b { font-size: 14px; color: #047857; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ec-why, .ec-steps, .ec-rule { padding: 12px 16px 0; }
.ec-why > b, .ec-steps > b, .ec-rule > b { display: block; font-size: 12px; color: #374151; margin-bottom: 6px; }
.ec-why p { margin: 0; font-size: 12.5px; color: #4b5563; line-height: 1.8; }
.ec-why code, .ec-steps code { background: #f3f4f6; border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.ec-steps ol { margin: 0; padding-left: 20px; }
.ec-steps li { font-size: 12.5px; color: #4b5563; line-height: 1.9; }
.ec-steps li b { color: #047857; }
.ec-rule span { display: block; background: #fffbeb; border-left: 3px solid #f59e0b; border-radius: 0 6px 6px 0; padding: 9px 12px; font-size: 12.5px; color: #78350f; line-height: 1.75; }
.ec-practice { margin: 12px 16px 14px; border-top: 1px dashed var(--border); padding-top: 11px; }
.ec-practice summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--accent); list-style: none; }
.ec-practice summary::-webkit-details-marker { display: none; }
.ec-practice summary::before { content: "▸ "; }
.ec-practice[open] summary::before { content: "▾ "; }
.ec-practice ol { margin: 9px 0 0; padding-left: 20px; }
.ec-practice li { font-size: 12.5px; color: #4b5563; line-height: 2; }
.ec-practice i { font-style: normal; font-weight: 600; color: #047857; }

/* ===== 人工核对：这题其实写对了 ===== */
.ec-head { flex-wrap: wrap; row-gap: 8px; }
.ec-verify {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit; font-size: 11.5px; line-height: 1; white-space: nowrap;
  color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 20px; padding: 7px 12px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.ec-verify:hover { background: #dcfce7; border-color: #86efac; }
.ec-verify:active { transform: translateY(1px); }
.ec-verify .ecv-ico { font-size: 12px; font-weight: 700; }
.ec-verify.is-on { background: #16a34a; border-color: #15803d; color: #fff; }

.errcard.ec-passed { border-color: #cfe9da; background: linear-gradient(180deg, #f8fdfa, #fbfefc); }
.errcard.ec-passed .ec-head { background: #f2fbf6; border-bottom-color: #d9efe3; }
.errcard.ec-passed .ec-no { background: #16a34a; }
.errcard.ec-passed .ec-title b { color: #4b5563; text-decoration: line-through; text-decoration-color: #16a34a; text-decoration-thickness: 2px; }
.errcard.ec-passed .ec-tag { color: #4b7f63; background: #eef7f2; border-color: #cfe9da; }
.errcard.ec-passed .ec-q,
.errcard.ec-passed .ec-cmp,
.errcard.ec-passed .ec-why,
.errcard.ec-passed .ec-steps,
.errcard.ec-passed .ec-rule,
.errcard.ec-passed .ec-practice { opacity: .38; }
.errcard.ec-passed::after {
  content: "已核对 · 孩子其实写对了，这题不再算错题";
  display: block; margin: 0 16px 14px; padding: 8px 12px;
  border-radius: 8px; background: #ecfdf3; border: 1px dashed #86efac;
  color: #166534; font-size: 12.5px;
}

/* 核对进度栏 */
.verify-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  margin: 14px 0 4px; padding: 14px 16px; border-radius: 12px;
  background: linear-gradient(135deg, #f7fbff, #f1f6ff);
  border: 1px solid #dbe7f6;
}
.vb-title { font-size: 13.5px; font-weight: 700; color: #1e3a8a; margin-bottom: 4px; }
.vb-sub { font-size: 12px; color: #4b6285; line-height: 1.65; max-width: 560px; }
.vb-right { display: flex; align-items: center; gap: 16px; flex: 0 0 auto; }
.vb-stat { text-align: center; }
.vb-stat b { display: block; font-size: 22px; line-height: 1.15; color: #b91c1c; }
.vb-stat span { font-size: 11px; color: var(--muted); }
.vb-stat.vb-dim b { color: #16a34a; }
.vb-track { width: 90px; height: 6px; border-radius: 4px; background: #dbe7f6; overflow: hidden; }
.vb-track i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #16a34a, #22c55e); transition: width .3s; }

/* 最终总结 */
.verdict-box { margin-top: 14px; border: 1px solid #dbe7f6; border-radius: 12px; background: #fbfdff; overflow: hidden; }
.vbox-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: #f2f7ff; border-bottom: 1px solid #dbe7f6; }
.vbox-head b { font-size: 13.5px; color: #1e3a8a; }
.vbox-badge { flex: 0 0 auto; font-size: 11.5px; color: #1d4ed8; background: #e0ebfd; border-radius: 20px; padding: 3px 10px; }
.vbox-body { padding: 14px 16px 2px; }
.vbox-lead { font-size: 13px; color: var(--text); line-height: 1.8; margin-bottom: 14px; }
.vbox-lead b { color: #b91c1c; }
.vbox-goal { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.vbox-goal span { font-size: 12px; color: #1e3a8a; background: #eef4ff; border: 1px solid #c7d9f2; border-radius: 8px; padding: 5px 10px; }
.vbox-goal span i { font-style: normal; font-weight: 700; color: #b91c1c; }
.vbox-group { border-left: 3px solid #c7d9f2; padding: 1px 0 1px 11px; margin-bottom: 13px; }
.vbox-group.g-hot { border-left-color: #dc2626; }
.vbox-group.g-warm { border-left-color: #f59e0b; }
.vbox-gt { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--text); }
.vbox-gt em { font-style: normal; font-size: 11.5px; font-weight: 600; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; border-radius: 20px; padding: 2px 8px; }
.vbox-gq { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.vbox-gs { font-size: 12.5px; color: #334155; line-height: 1.75; margin-top: 6px; }
.vbox-gs b { color: #0f766e; }
.vbox-flag { margin: 0 0 13px; padding: 9px 12px; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; font-size: 12.5px; color: #78350f; line-height: 1.7; }
.vbox-empty { text-align: center; padding: 12px 6px 20px; }
.vbox-empty .ve-ico { font-size: 30px; line-height: 1; }
.vbox-empty .ve-t { font-size: 14px; font-weight: 700; color: #166534; margin: 8px 0 5px; }
.vbox-empty .ve-s { font-size: 12.5px; color: var(--muted); line-height: 1.75; max-width: 520px; margin: 0 auto; }
.vbox-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px 13px; border-top: 1px dashed #e2eaf6; }
.vbox-tip { font-size: 11.5px; color: var(--faint); }
.vbox-copy { font-family: inherit; font-size: 12px; color: #1d4ed8; background: #fff; border: 1px solid #c7d9f2; border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.vbox-copy:hover { background: #f2f7ff; }
.vbox-copy.done { color: #166534; border-color: #86efac; background: #f0fdf4; }
.verify-toast { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #fffbeb; border: 1px solid #fde68a; font-size: 12px; color: #78350f; }

@media (max-width: 900px) {
  .scan-strip.four { grid-template-columns: 1fr 1fr; }
  .guide-steps { grid-template-columns: 1fr; }
  .ec-cmp { grid-template-columns: 1fr; }
  .verify-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .vb-right { justify-content: space-between; }
  .vb-sub { max-width: none; }
}

/* ===== 上传入口（顶栏常驻） ===== */
[hidden] { display: none !important; }
.topbar-right { gap: 10px; }
.tb-note { color: var(--muted); }
.upload-cta {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 20px; padding: 8px 15px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .22);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.upload-cta:hover { background: #1d4ed8; box-shadow: 0 3px 12px rgba(37, 99, 235, .3); }
.upload-cta:active { transform: translateY(1px); }
.uc-plus { font-size: 14px; font-weight: 700; margin-top: -1px; }

/* ===== 日期选择 ===== */
.day-nav { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px 14px; margin-bottom: 20px; }
.day-nav-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.day-nav-top b { font-size: 14px; color: var(--text); }
.day-nav-top span { font-size: 12px; color: var(--muted); }
.day-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 9px; }
.day-chip {
  position: relative; text-align: left; font-family: inherit; cursor: pointer;
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px 9px; transition: border-color .15s, background .15s, box-shadow .15s;
}
.day-chip:hover { border-color: #bfd4f5; background: #f7faff; }
.day-chip.is-on { background: var(--accent); border-color: var(--accent); box-shadow: 0 3px 10px rgba(37, 99, 235, .2); }
.dc-d { display: block; font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.dc-m { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.day-chip.is-on .dc-d, .day-chip.is-on .dc-m { color: #fff; }
.day-chip.is-on .dc-m { opacity: .85; }
.dc-tag { position: absolute; top: 8px; right: 9px; font-size: 10px; color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 10px; padding: 1px 6px; }
.day-chip.is-on .dc-tag { background: rgba(255,255,255,.9); border-color: transparent; }
.day-hint { font-size: 11.5px; color: var(--faint); margin-top: 11px; line-height: 1.6; }

.day-empty { background: var(--surface); border: 1px dashed #cbd5e1; border-radius: 12px; padding: 34px 24px; text-align: center; margin-bottom: 20px; }
.day-empty .de-ico { font-size: 28px; color: #94a3b8; line-height: 1; }
.day-empty .de-t { font-size: 14px; font-weight: 600; color: var(--text); margin: 10px 0 6px; }
.day-empty .de-s { font-size: 12.5px; color: var(--muted); line-height: 1.75; max-width: 460px; margin: 0 auto; }

/* ===== 上传弹窗 ===== */
.up-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200; background: rgba(15, 23, 42, .46); display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px); }
.up-dialog { width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 18px 48px rgba(15, 23, 42, .28); }
.up-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.up-head b { font-size: 14.5px; color: var(--text); }
.up-x { width: 28px; height: 28px; border-radius: 8px; border: none; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; font-family: inherit; }
.up-x:hover { background: #f1f5f9; color: var(--text); }
.up-body { padding: 16px 18px 6px; }
.up-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.up-label { font-size: 12.5px; color: var(--muted); }
.up-date { font-family: inherit; font-size: 13px; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fbfcfe; }
.up-date:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.up-pick { border: 1.5px dashed #c7d9f2; border-radius: 11px; background: #f8fbff; padding: 26px 16px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.up-pick:hover, .up-pick.is-drag { border-color: var(--accent); background: #f1f7ff; }
.up-pick-ico { font-size: 24px; color: #93b4e8; line-height: 1; }
.up-pick-t { font-size: 13px; font-weight: 600; color: #1e3a8a; margin: 8px 0 4px; }
.up-pick-s { font-size: 11.5px; color: var(--muted); }
.up-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.up-item { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); height: 108px; background: #f1f5f9; }
.up-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.up-item .ui-x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(15,23,42,.62); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; font-family: inherit; }
.up-item .ui-n { position: absolute; left: 4px; bottom: 4px; font-size: 10px; color: #fff; background: rgba(15,23,42,.6); border-radius: 5px; padding: 1px 5px; }
.up-msg { font-size: 12px; line-height: 1.6; margin: 10px 0 4px; min-height: 17px; color: var(--muted); }
.up-msg.is-err { color: #b91c1c; }
.up-msg.is-ok { color: #047857; }
.up-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 18px 16px; }
.up-btn { font-family: inherit; font-size: 13px; border-radius: 9px; padding: 9px 18px; cursor: pointer; border: 1px solid; transition: background .15s; }
.up-btn-ghost { background: #fff; border-color: var(--border); color: var(--muted); }
.up-btn-ghost:hover { background: #f8fafc; }
.up-btn-main { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.up-btn-main:hover { background: #1d4ed8; }
.up-btn-main:disabled { background: #c7d2e3; border-color: #c7d2e3; cursor: not-allowed; box-shadow: none; }

@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .tb-note { display: none; }
  .day-list { grid-template-columns: 1fr 1fr; }
  .up-list { grid-template-columns: repeat(4, 1fr); }
}

/* ===== 首页入口按钮 ===== */
.hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.hero-upload {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 10px; padding: 13px 22px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .26);
  transition: background .15s, box-shadow .15s, transform .1s;
}
.hero-upload span { font-size: 15px; }
.hero-upload:hover { background: #1d4ed8; box-shadow: 0 6px 18px rgba(37, 99, 235, .32); }
.hero-upload:active { transform: translateY(1px); }
.hero-link {
  font-family: inherit; font-size: 13px; color: var(--accent);
  background: transparent; border: 1px solid #c7d9f2; border-radius: 10px;
  padding: 12px 16px; cursor: pointer; transition: background .15s, border-color .15s;
}
.hero-link:hover { background: var(--accent-soft); border-color: #a9c8f0; }

@media (max-width: 640px) {
  .hero-upload, .hero-link { width: 100%; justify-content: center; }
}

/* ===== 设置 · 大模型接入 ===== */
.ai-why .ai-flow { display: flex; align-items: stretch; gap: 12px; margin: 14px 0 4px; }
.ai-step { flex: 1; display: flex; gap: 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.ai-step-no { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.ai-step-body b { font-size: 13px; }
.ai-step-body p { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.65; }
.ai-arrow { align-self: center; color: var(--faint); font-size: 16px; }
.ai-note { margin-top: 12px; font-size: 12px; color: var(--muted); background: #fffdf5; border: 1px solid #f3e6c8; border-radius: 9px; padding: 11px 13px; line-height: 1.7; }
.ai-note b { color: var(--amber); }

.ai-unlock-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ai-unlock-msg { font-size: 12px; color: var(--muted); }
.ai-unlock-msg code, .ai-tip code { background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; }

.ai-card .panel-head { margin-bottom: 8px; }
.ai-req { font-style: normal; font-size: 10px; font-weight: 600; color: #b91c1c; background: #fee2e2; border-radius: 20px; padding: 2px 8px; margin-left: 6px; vertical-align: 2px; }
.ai-badge { font-size: 11px; padding: 3px 10px; border-radius: 20px; background: #f1f5f9; color: var(--muted); border: 1px solid var(--border); }
.ai-badge.ok { background: var(--teal-soft); color: #047857; border-color: #b8e6d5; }
.ai-badge.warn { background: #fff7ed; color: var(--amber); border-color: #f4d9b0; }
.ai-desc { font-size: 12.5px; color: var(--muted); line-height: 1.75; margin-bottom: 14px; max-width: 820px; }
.ai-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.ai-field { display: block; margin-bottom: 12px; }
.ai-field > span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.ai-input { width: 100%; font-family: inherit; font-size: 13px; color: var(--text); background: #fbfcfd; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.ai-input:focus { border-color: #9dbdf0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); background: #fff; }
.ai-unlock .ai-input { max-width: 280px; }
.ai-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.ai-btn { font-family: inherit; font-size: 13px; border-radius: 9px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--border); background: #fff; color: var(--text); transition: background .15s, border-color .15s; }
.ai-btn:hover { background: #f8fafc; border-color: #d3d9e3; }
.ai-btn-main { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ai-btn-main:hover { background: #1d4ed8; border-color: #1d4ed8; }
.ai-btn:disabled { opacity: .6; cursor: not-allowed; }
.ai-msg { font-size: 12px; color: var(--muted); }
.ai-msg.is-ok { color: #047857; }
.ai-msg.is-err { color: #b91c1c; }
.ai-tip { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 11px; font-size: 11.5px; color: var(--faint); line-height: 1.9; }
.ai-tip b { color: #b91c1c; }
.ai-result { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 14px; }
.ai-res-head { font-size: 12px; color: var(--muted); margin-bottom: 8px; word-break: break-all; }
.ai-res-block { background: #fbfcfd; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.ai-res-block h4 { font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--accent); }
.ai-res-block pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: #334155; max-height: 320px; overflow: auto; }

@media (max-width: 900px) {
  .ai-flow { flex-direction: column; }
  .ai-arrow { transform: rotate(90deg); }
  .ai-grid { grid-template-columns: 1fr; }
}

/* ===== 卷面红框图层（可单独删除） ===== */
.scan-fig .scan-canvas { position: relative; line-height: 0; background: #fff; }
.scan-fig .scan-canvas .scan-img,
.scan-strip.four .scan-fig .scan-canvas .scan-img { width: 100%; height: auto; max-height: none; object-fit: contain; display: block; cursor: zoom-in; }
.scan-box { position: absolute; border: 2px solid #dc2626; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .55); pointer-events: none; }
.scan-box i {
  position: absolute; left: -2px; top: 0; transform: translateY(-100%);
  background: #dc2626; color: #fff; font-style: normal; font-weight: 700;
  font-size: 11px; line-height: 1.45; padding: 0 6px; border-radius: 5px 5px 5px 0;
}
.scan-box.is-off { display: none; }
.scan-canvas.lb-canvas { position: relative; display: inline-block; vertical-align: middle; line-height: 0; background: #fff; max-width: min(100%, 820px); max-height: calc(100vh - 60px); }
.scan-canvas.lb-canvas .scan-img { width: auto; max-width: 100%; max-height: calc(100vh - 60px); height: auto; margin: 0 auto; }
.scan-canvas.lb-canvas .scan-box { border-width: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .55); }
.scan-canvas.lb-canvas .scan-box i { font-size: 12px; line-height: 1.4; padding: 0 7px; left: -2px; border-radius: 5px 5px 5px 0; }

/* ===== 科目切换 ===== */
.subj-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 16px; }
.subj-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.subj-chip {
  font-family: inherit; font-size: 13px; padding: 7px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: #fff; color: #4b5563; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s;
}
.subj-chip:hover { background: #f6f8fb; }
.subj-chip i { font-style: normal; font-size: 11px; background: #eef1f5; border-radius: 10px; padding: 0 6px; color: var(--muted); }
.subj-chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.subj-chip.is-on i { background: rgba(255, 255, 255, .24); color: #fff; }
.subj-empty { text-align: center; padding: 42px 20px 46px; }
.se-ico { font-size: 26px; color: #c6ccd6; }
.se-t { font-size: 15px; font-weight: 600; margin-top: 10px; }
.se-s { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* 科目筛选 / 空态补充 */
.analysis-day.is-subj-hidden { display: none; }
.errcard[hidden] { display: none; }
.scan-thumb[hidden] { display: none; }
.vbox-subj { font-size: 11px; color: var(--faint); }

/* ===== 上传弹窗 · 科目选择 ===== */
.up-subj { display: flex; gap: 8px; flex-wrap: wrap; }
.up-subj-chip { font-family: inherit; font-size: 13px; padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border); background: #fff; color: #4b5563; cursor: pointer; }
.up-subj-chip:hover { background: #f6f8fb; }
.up-subj-chip.is-on { background: var(--accent-soft); border-color: #b9d0f2; color: var(--accent); font-weight: 600; }

/* ===== 待分析日期：按科目列照片 ===== */
.de-photos { margin-top: 18px; text-align: left; }
.de-hd { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.de-group { margin-bottom: 14px; }
.de-gt { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.de-gt i { font-style: normal; font-size: 11px; color: var(--faint); font-weight: 400; }
.de-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.de-thumb { display: block; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; }
.de-thumb img { width: 100%; height: 110px; object-fit: cover; object-position: top; display: block; }
.de-loading { font-size: 12px; color: var(--faint); }

/* ===== 错题清单（编号对应红框，四段式：题目 / 写成 / 正确 / 错因） ===== */
.chk-list { display: flex; flex-direction: column; gap: 9px; margin: 0 0 20px; }
.chk-hd { display: flex; align-items: baseline; gap: 10px; margin-bottom: 2px; flex-wrap: wrap; }
.chk-hd b { font-size: 13px; }
.chk-hd span { font-size: 11.5px; color: var(--faint); }

.chk-item {
  display: flex; align-items: stretch; gap: 12px;
  border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; background: #fff; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.chk-item:hover { background: #f8fafc; border-color: #d3d9e3; }
.chk-item .ci-no {
  flex: 0 0 22px; width: 22px; height: 22px; margin-top: 1px;
  border-radius: 7px; background: #dc2626; color: #fff;
  font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 5px; }
.ci-name { font-size: 12.5px; font-weight: 600; color: #334155; }
.ci-tag { font-size: 10.5px; color: #b91c1c; background: #fef2f2; border-radius: 10px; padding: 2px 8px; white-space: nowrap; }

.ci-q { display: flex; gap: 8px; align-items: baseline; font-size: 13px; line-height: 1.7; color: var(--text); margin-bottom: 4px; word-break: break-word; }
.ci-q > span { flex: 1; min-width: 0; font-weight: 500; }
.ci-ans { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.ci-ans > span { display: inline-flex; align-items: baseline; gap: 6px; }
.ci-ans b { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }
.ci-w b { color: #b91c1c; text-decoration: line-through; text-decoration-color: rgba(185, 28, 28, .45); }
.ci-r b { color: #047857; }
.ci-ar { color: var(--faint); font-size: 12px; }

.chk-item em { font-style: normal; flex: 0 0 auto; font-size: 10.5px; font-weight: 600; color: #64748b; background: #f1f5f9; border-radius: 5px; padding: 1px 6px; }
.ci-ans em { font-size: 10px; }

.ci-box { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding-left: 12px; border-left: 1px dashed var(--border); cursor: pointer; }
.ci-box input { width: 16px; height: 16px; accent-color: #16a34a; cursor: pointer; margin: 0; }
.ci-box i { font-style: normal; font-size: 10.5px; color: var(--faint); white-space: nowrap; }

.chk-item.is-on { background: #f6fdf9; border-color: #bfe3cf; }
.chk-item.is-on .ci-no { background: #16a34a; }
.chk-item.is-on .ci-q > span { color: #94a3b8; text-decoration: line-through; text-decoration-color: rgba(148, 163, 184, .6); }
.chk-item.is-on .ci-w b { color: #94a3b8; text-decoration-color: rgba(148, 163, 184, .6); }
.chk-item.is-on .ci-r b { color: #94a3b8; text-decoration: line-through; text-decoration-color: rgba(148, 163, 184, .6); }
.chk-item.is-on .ci-tag { color: #047857; background: #ecfdf5; }
.chk-item.is-on .ci-box i { color: #047857; font-weight: 600; }
.chk-item.is-on .ci-name { color: #64748b; }
.chk-none { font-size: 12px; color: var(--faint); padding: 8px 0; }

@media (max-width: 900px) {
  .chk-item { gap: 9px; padding: 10px; }
  .ci-q { font-size: 12.5px; }
  .ci-ans { gap: 10px; font-size: 12px; }
  .ci-box { padding-left: 8px; }
  .ci-box i { display: none; }
}

/* 日期卡片上的错题数：跟着核对结果变 */
.day-chip .dc-err { color: #b91c1c; font-weight: 500; }
.day-chip.is-on .dc-err { color: #fff; }
.day-chip .dc-err.is-zero { color: #047857; }
.day-chip.is-on .dc-err.is-zero { color: #d7fbe8; }

/* ===== 照片分析页：就地上传按钮 ===== */
.day-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.day-upload {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--accent); border: 1px solid var(--accent);
  border-radius: 10px; padding: 12px 18px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .24);
  transition: background .15s, transform .1s;
}
.day-upload span { font-size: 16px; line-height: 1; }
.day-upload:hover { background: #1d4ed8; }
.day-upload:active { transform: translateY(1px); }

/* ============================================================
   手机端全面适配（≤640px）
   ============================================================ */
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 14px; }

  /* 布局：侧栏改顶部 */
  .layout { display: block; min-height: 100vh; }
  .sidebar {
    position: sticky; top: 0; z-index: 60; width: auto; height: auto;
    padding: 0; border-right: none; border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(15, 23, 42, .07);
  }
  .brand { padding: 10px 14px 6px; gap: 9px; }
  .brand-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
  .brand-name { font-size: 15px; }
  .brand-sub { display: none; }
  .nav {
    flex-direction: row; align-items: center; overflow-x: auto;
    gap: 6px; padding: 2px 12px 10px; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 auto; width: auto; justify-content: center;
    font-size: 13px; padding: 8px 13px; gap: 6px;
    background: #f1f5f9; border-radius: 18px;
  }
  .nav-item.active { background: var(--accent); color: #fff; }
  .nav-ico { font-size: 14px; }
  .sidebar-foot { display: none; }

  /* 顶栏 */
  .topbar { position: static; height: auto; padding: 10px 14px; }
  .crumb { font-size: 14px; }
  .upload-cta { font-size: 13px; padding: 10px 14px; }
  .uc-plus { font-size: 15px; }

  .content { padding: 14px 12px 44px; }

  /* 面板通用 */
  .panel { padding: 14px 12px; border-radius: 12px; }
  .panel-head h2 { font-size: 15px; }
  .panel-head span { font-size: 11.5px; }
  .page-intro { padding: 14px 12px; }
  .page-intro h1 { font-size: 19px; }
  .page-intro p { font-size: 13px; }

  /* 首页 */
  .hero h1 { font-size: 20px; line-height: 1.45; }
  .hero p { font-size: 13px; }
  .stats-row, .factor-grid, .gen-grid, .storage-row, .scan-summary, .scan-advice,
  .cause-row, .day-list, .type-cards { grid-template-columns: 1fr !important; }

  /* 表格：允许横向滚动且不撑破 */
  .scan-table { font-size: 12px; }
  .scan-table th, .scan-table td { padding: 7px 8px; word-break: break-word; }

  /* 照片分析 */
  .day-nav { padding: 12px 12px; }
  .day-nav-top b { font-size: 14px; }
  .day-nav-top span { font-size: 11.5px; }
  .day-chip { padding: 10px 12px; }
  .day-upload { width: 100%; justify-content: center; }
  .day-hint { font-size: 11.5px; }
  .subj-bar { gap: 7px; margin: 4px 0 12px; }
  .subj-chip { font-size: 12.5px; padding: 8px 13px; }
  .scan-strip.four { grid-template-columns: 1fr 1fr; }
  .scan-strip.four .scan-thumb img, .scan-fig .scan-img { height: auto !important; }
  .scan-fig figcaption { font-size: 11px; }

  /* 错题卡 */
  .ec-head { flex-wrap: wrap; gap: 8px; }
  .ec-title small { font-size: 10.5px; }
  .ec-q { font-size: 13.5px; }
  .ec-verify { width: 100%; justify-content: center; padding: 11px; font-size: 13px; }
  .ec-steps li, .ec-rule span, .ec-why p { font-size: 12.5px; }
  .ec-practice summary { font-size: 12.5px; }

  /* 清单与核对 */
  .chk-item { gap: 8px; }
  .ci-box input { width: 22px; height: 22px; }
  .verify-bar { padding: 12px; }
  .verdict-box { border-radius: 12px; }
  .vb-left, .vb-right { padding: 10px 12px; }

  /* 上传弹窗：贴底弹出，更好按 */
  .up-mask { padding: 0; align-items: flex-end; }
  .up-dialog { max-width: none; max-height: 94vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0); }
  .up-body { padding: 14px 14px 6px; }
  .up-pick { padding: 26px 14px; }
  .up-pick-t { font-size: 14px; }
  .up-date, .ai-input, .login-input { font-size: 16px; } /* 防 iOS 聚焦自动放大 */
  .up-subj-chip { font-size: 13px; padding: 9px 16px; }
  .up-btn { padding: 12px 16px; font-size: 14px; }
  .up-item { height: 96px; }
  .up-list { grid-template-columns: repeat(3, 1fr); }

  /* 卷面放大 */
  .scan-lightbox { padding: 8px; }

  /* 出题与打印 / 设置 */
  .ai-step { padding: 12px; }
  .ai-res-block pre { max-height: 260px; }

  /* 死角修正 */
  .guide-title { font-size: 13.5px; }
  .gs b { font-size: 12.5px; }
  .gs p { font-size: 12px; }
}

/* ===== 自动 AI 分析（上传后实时结果） ===== */
.ai-live { margin-top: 14px; display: grid; gap: 12px; }
.ai-status { background: #fff8e8; border: 1px solid #f2dfb6; border-radius: 9px; padding: 12px 14px; font-size: 13px; color: #7a5b16; line-height: 1.7; }
.ai-status.ai-err { background: #fdf0ef; border-color: #f3c6c3; color: #9c3a33; }
.ai-spin { display: inline-block; width: 13px; height: 13px; border: 2px solid #e0b954; border-top-color: transparent; border-radius: 50%; vertical-align: -2px; margin-right: 8px; animation: ai-rot 1s linear infinite; }
@keyframes ai-rot { to { transform: rotate(360deg); } }
.ai-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; }
.ai-hd { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed var(--border); padding-bottom: 8px; margin-bottom: 9px; }
.ai-hd b { font-size: 13.5px; }
.ai-hd i { font-style: normal; font-size: 12px; color: #b4402f; background: #fdf0ef; border-radius: 99px; padding: 2px 10px; }
.ai-wq { padding: 9px 0; border-bottom: 1px dashed var(--border); }
.ai-wq:last-of-type { border-bottom: 0; }
.ai-wq-n { display: inline-block; font-size: 12px; font-weight: 700; color: #fff; background: #dc2626; border-radius: 5px; padding: 1px 8px; margin-bottom: 5px; }
.ai-q { font-size: 13px; color: #333; line-height: 1.65; margin-bottom: 4px; }
.ai-line { font-size: 12.5px; color: #55677a; line-height: 1.7; margin-top: 3px; }
.ai-line b { color: #222; font-weight: 600; }
.ai-line.ai-bad b { color: #b4402f; }
.ai-line.ai-good b { color: #1f7a4d; }
.ai-adv { margin-top: 10px; background: #eef7f2; border-left: 3px solid var(--teal); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 12.5px; color: #1f5f43; line-height: 1.75; white-space: pre-wrap; }
.ai-adv b { display: block; margin-bottom: 4px; }

@media (max-width: 640px) {
  .ai-card { padding: 11px 12px; }
  .ai-hd b { font-size: 13px; }
  .ai-q, .ai-line, .ai-adv { font-size: 13px; }
}

/* ===== 删除照片按钮（卷面图 / 缩略图右上角） ===== */
.scan-fig { position: relative; }
.de-item { position: relative; }
.ph-del {
  position: absolute; top: 6px; right: 6px; z-index: 5;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(20, 24, 32, 0.62); color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.85);
  font-size: 13px; line-height: 1; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.ph-del:hover, .ph-del:active { background: #dc2626; }
.ph-del.is-busy { opacity: 0.55; cursor: wait; }

/* ===== 上传弹窗：科目必选 + 选照片区锁定态 ===== */
.up-req { font-style: normal; font-size: 11px; color: #b4402f; background: #fdf0ef; border-radius: 99px; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
.up-pick.is-locked { opacity: 0.55; cursor: not-allowed; }
.up-pick.is-locked .up-pick-t { color: #9aa7b5; }

/* ===== 站点登录门 ===== */
.login-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 500; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-mask[hidden] { display: none; }
.login-box { width: 100%; max-width: 340px; background: var(--surface); border-radius: 16px; box-shadow: 0 18px 48px rgba(15, 23, 42, .18); padding: 30px 26px 26px; text-align: center; }
.login-logo { font-size: 38px; line-height: 1; margin-bottom: 12px; }
.login-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.login-row { margin-bottom: 12px; }
.login-input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 14px; color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: #fbfcfe; }
.login-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.login-btn { width: 100%; margin-top: 6px; padding: 11px 18px; font-size: 14px; }
.login-box .up-msg { text-align: left; }

/* ===== AI 分析实时播报清单 ===== */
.ai-live-box { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 12px 14px; }
.ai-live-hd { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.ai-live-item { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px dashed var(--border); font-size: 12.5px; color: var(--text); }
.ai-live-item:first-of-type { border-top: none; }
.ai-live-t { flex: 1; min-width: 0; line-height: 1.45; }
.ai-live-t b { color: var(--text); }
.ai-live-t i { display: block; font-style: normal; color: var(--muted); font-size: 12px; }
.ai-live-sec { flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--accent); background: #eef3ff; border-radius: 99px; padding: 2px 9px; font-size: 12px; }
.ai-live-ok { flex-shrink: 0; width: 18px; text-align: center; color: #047857; font-weight: 700; }
.ai-live-dot { flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; margin: 0 4.5px; }
.ai-live-item.is-done .ai-live-sec { color: var(--muted); background: #f1f5f9; }
.ai-live-item.is-warn .ai-live-ok { color: #b45309; }
.ai-live-item.is-err .ai-live-t i { color: #b91c1c; }
