/* ============================================================
   CSP 初赛训练系统 · 主样式
   ============================================================ */
:root {
  --ink: #172033;
  --ink-2: #26324a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf2;
  --line-2: #eef2f8;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef2ff;
  --cyan: #0891b2;
  --cyan-soft: #ecfeff;
  --green: #16a34a;
  --green-soft: #ecfdf3;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --navy: #111c33;
  --navy-2: #172440;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(23, 32, 51, .06);
  --shadow-sm: 0 2px 10px rgba(23, 32, 51, .04);
  --sidebar: 252px;
  --topbar: 70px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; color: #3730a3; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
h2 { font-size: 19px; line-height: 1.4; font-weight: 700; margin-bottom: 10px; }
h3 { font-size: 16px; font-weight: 700; }
img { max-width: 100%; }
code, pre, .mono { font-family: Consolas, "SFMono-Regular", "Courier New", monospace; }
::selection { background: #c7d2fe; color: var(--ink); }

/* ============================ 布局 ============================ */
body:not(.login-body) { padding-left: var(--sidebar); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 80;
  background: linear-gradient(180deg, #111c33 0%, #14213c 58%, #0e182b 100%);
  color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 16px 16px;
  overflow-y: auto; scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; padding: 4px 8px 22px; }
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
  border-radius: 12px; background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: #fff; font-size: 13px; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35); flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 16px; letter-spacing: .02em; }
.brand-text small { font-size: 9px; color: #8194b5; letter-spacing: .11em; margin-top: 4px; }
.side-label { color: #7183a5; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 0 12px 10px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; color: #b5c2d8; border-radius: 10px;
  padding: 10px 12px; font-size: 14.5px; transition: .16s; border: 1px solid transparent;
}
.side-nav a:hover { background: rgba(255,255,255,.055); color: #fff; }
.side-nav a.active {
  background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(99,102,241,.08));
  border-color: rgba(129,140,248,.25); color: #fff;
  box-shadow: inset 3px 0 0 #818cf8;
}
.side-nav .icon { flex: none; opacity: .9; }
.side-card {
  margin-top: auto; margin-bottom: 14px; padding: 14px; border-radius: 12px;
  background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07);
}
.side-card-title { font-size: 12.5px; font-weight: 700; color: #dbeafe; margin-bottom: 6px; }
.side-card p { margin: 0; font-size: 12.5px; line-height: 1.65; color: #8798b7; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 37px; height: 37px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #334155, #475569); color: #fff; font-weight: 700; font-size: 15px; flex: none;
}
.side-user-name { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.side-user-name b { color: #e2e8f0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-name small { color: #7f90ae; font-size: 11.5px; }
.logout-icon { margin-left: auto; color: #8595b0; padding: 5px; border-radius: 6px; display: flex; }
.logout-icon:hover { background: rgba(255,255,255,.08); color: #fff; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar); position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.page-crumb { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.crumb-root { color: var(--muted-2); }
.crumb-sep { color: #cbd5e1; }
.crumb-current { color: var(--ink-2); font-weight: 600; }
.top-action {
  display: inline-flex; align-items: center; gap: 6px; color: var(--primary); font-size: 14px; font-weight: 600;
  background: var(--primary-soft); padding: 7px 12px; border-radius: 9px;
}
.top-action:hover { background: #e0e7ff; color: #3730a3; }
.topbar-date { color: var(--muted-2); font-size: 13px; padding-left: 16px; border-left: 1px solid var(--line); }
.menu-btn { display: none !important; }
.icon-btn { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 7px; color: var(--muted); cursor: pointer; display: inline-flex; }
.icon-btn:hover { color: var(--primary); border-color: #c7d2fe; }

.page { width: 100%; max-width: 1440px; margin: 0 auto; padding: 30px 32px 10px; flex: 1; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14.5px; margin: 0; }
.page-heading-actions { display: flex; align-items: center; gap: 10px; }
.footer {
  display: flex; justify-content: space-between; color: var(--muted-2); font-size: 12.5px;
  border-top: 1px solid var(--line); margin-top: 30px; padding: 18px 0 22px;
}

/* ============================ 卡片 / 网格 ============================ */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 4px; }
.card-pad { padding: 22px 24px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(310px, 1fr); }
.grid-2-1 { grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); }
.section-gap { margin-top: 20px; }

/* 统计卡片 */
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%;
  right: -38px; bottom: -48px; background: currentColor; opacity: .055;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.stat-label { color: var(--muted); font-size: 13.5px; }
.stat-num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0 4px; }
.stat-note { color: var(--muted-2); font-size: 12.5px; }
.stat-card.blue .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-card.cyan .stat-icon { background: var(--cyan-soft); color: var(--cyan); }
.stat-card.green .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card.amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.stat-card.violet .stat-icon { background: var(--violet-soft); color: var(--violet); }
.stat-card.rose .stat-icon { background: var(--red-soft); color: var(--red); }

/* 欢迎横幅 */
.welcome-banner {
  position: relative; overflow: hidden; border-radius: 20px; padding: 28px 30px; margin-bottom: 22px;
  background: linear-gradient(120deg, #182747 0%, #233b6e 55%, #3156a3 100%); color: #fff;
  box-shadow: 0 14px 38px rgba(24, 39, 71, .22);
}
.welcome-banner::before {
  content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  right: -80px; top: -120px; background: radial-gradient(circle, rgba(56,189,248,.35), transparent 65%);
}
.welcome-banner::after {
  content: ""; position: absolute; width: 220px; height: 220px; border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%; right: 90px; bottom: -140px;
}
.welcome-banner h2 { font-size: 24px; margin-bottom: 6px; position: relative; }
.welcome-banner p { color: #c9d7ee; font-size: 14px; margin: 0; position: relative; }
.welcome-meta { display: flex; gap: 26px; margin-top: 20px; position: relative; }
.welcome-meta div { display: flex; flex-direction: column; }
.welcome-meta b { font-size: 21px; }
.welcome-meta small { color: #a9bcd8; font-size: 12px; }
.banner-actions { margin-left: auto; display: flex; gap: 10px; align-items: flex-end; position: relative; }
.banner .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.08); }
.banner .btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 9px 15px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500;
  font-family: inherit; line-height: 1.4; transition: .16s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: linear-gradient(135deg, #4f46e5, #5b5cf0); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.22); }
.btn-primary:hover { background: linear-gradient(135deg, #4338ca, #4f46e5); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: #fca5a5; color: #b91c1c; }
.btn-danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; color: #fff; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: #e0e7ff; color: #3730a3; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); background: #f8fafc; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; gap: 5px; }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-link { background: none; border: none; color: var(--primary); padding: 2px 4px; font-size: 13.5px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.inline-form { display: inline; }
.actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ============================ 徽标 / 表单 ============================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--primary-soft); color: #4338ca; white-space: nowrap;
}
.tag.green { background: var(--green-soft); color: #15803d; }
.tag.red { background: var(--red-soft); color: #b91c1c; }
.tag.amber { background: var(--amber-soft); color: #b45309; }
.tag.gray { background: #f1f5f9; color: #475569; }
.tag.cyan { background: var(--cyan-soft); color: #0e7490; }
.tag.violet { background: var(--violet-soft); color: #6d28d9; }
.tag.rose { background: var(--red-soft); color: #be123c; }
.tag.blue { background: #eff6ff; color: #1d4ed8; }
.tag.lg { font-size: 13px; padding: 4px 11px; }

.fld { display: block; margin-bottom: 16px; }
.fld > span, .fld > label { display: block; font-size: 13.5px; color: #475569; margin-bottom: 6px; font-weight: 600; }
.fld .hint { display: block; font-size: 12.5px; color: var(--muted-2); font-weight: 400; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=email], select, textarea {
  width: 100%; padding: 10px 13px; border: 1px solid #dbe2ee; border-radius: 10px;
  font-family: inherit; font-size: 14.5px; background: #fff; color: var(--ink); transition: .15s;
}
input::placeholder, textarea::placeholder { color: #a3afc2; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #818cf8; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
textarea { resize: vertical; min-height: 80px; }
select { cursor: pointer; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
.row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 18px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.check-line { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: #475569; cursor: pointer; }
input[type=radio], input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }
.input-wrap { position: relative; }
.input-wrap input { padding-left: 40px; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th, table.data td { padding: 13px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
table.data th { background: #f8fafc; color: #64748b; font-weight: 600; font-size: 12.5px; letter-spacing: .02em; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fafbff; }
table.data td.actions { white-space: nowrap; }
table.data .name-cell b { color: var(--ink); }
table.data .name-cell small { display: block; color: var(--muted-2); font-size: 12px; margin-top: 2px; }
.table-empty { text-align: center; color: var(--muted-2); padding: 42px 0; font-size: 14px; }

/* ============================ 提示 / 进度 / 空状态 ============================ */
.flash {
  display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-radius: 11px;
  margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; animation: fadeIn .25s ease;
}
.flash-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.flash-ok { background: var(--green-soft); color: #15803d; border-color: #bbf7d0; }
.flash-bad { background: var(--red-soft); color: #b91c1c; border-color: #fecaca; }
.flash-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.flash-warn { background: var(--amber-soft); color: #b45309; border-color: #fde68a; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.progress { height: 9px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #22d3ee); transition: width .35s; }
.progress.green > span { background: linear-gradient(90deg, #22c55e, #4ade80); }
.progress.amber > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 13.5px; }
.progress-row b { color: var(--ink); }

.empty { text-align: center; color: var(--muted-2); padding: 52px 20px; font-size: 14px; }
.empty .empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #94a3b8; }
.empty b { display: block; color: #475569; margin-bottom: 3px; font-size: 15px; }
.muted { color: var(--muted); font-size: 13.5px; }
.muted-sm { color: var(--muted-2); font-size: 12.5px; }
.right { margin-left: auto; }
.flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.flex-col { flex-direction: column; align-items: stretch; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; } .mt { margin-top: 16px; } .mt-sm { margin-top: 10px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* ============================ 代码块 ============================ */
.codebox {
  background: #0f172a; border: 1px solid #1e293b; border-radius: 12px; overflow: auto;
  margin: 14px 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.code-lines { min-width: max-content; padding: 12px 0; }
.code-line { display: flex; min-height: 23px; font-family: Consolas, "Courier New", Monaco, monospace; font-size: 13.5px; line-height: 1.7; }
.code-line .ln {
  flex: none; width: 52px; text-align: right; padding-right: 14px; color: #52637d;
  user-select: none; border-right: 1px solid #1e293b; margin-right: 14px;
}
.code-line .lc { white-space: pre; color: #dbe7ff; padding-right: 24px; }
.codebox .lc .kw { color: #93c5fd; }
.code-input { font-family: Consolas, "Courier New", monospace !important; font-size: 14px !important; }

/* ============================ 富文本 / 题目 ============================ */
.rich-text { overflow-wrap: anywhere; }
.rich-text p { margin: 7px 0; }
.rich-text img { max-width: 100%; height: auto; border-radius: 6px; }
.rich-text table { border-collapse: collapse; max-width: 100%; margin: 8px 0; }
.rich-text th, .rich-text td { border: 1px solid #dbe2ee; padding: 6px 10px; }
.rich-text pre { background: #f1f5f9; padding: 10px 13px; border-radius: 8px; overflow-x: auto; }
.rich-text code { background: #f1f5f9; border-radius: 4px; padding: 1px 5px; color: #4338ca; font-size: .94em; }
.rich-text blockquote { border-left: 3px solid #c7d2fe; margin: 8px 0; padding: 2px 0 2px 12px; color: #475569; }
.q-content { font-size: 15.5px; line-height: 1.85; }
.program-note { background: #f8fafc; border: 1px solid var(--line); border-left: 3px solid #818cf8; border-radius: 8px; padding: 12px 15px; margin: 14px 0; font-size: 14.5px; }
.program-note-title { font-weight: 700; color: #4338ca; font-size: 13px; margin-bottom: 5px; }

.opts { display: flex; flex-direction: column; gap: 9px; margin: 14px 0; }
.opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; border: 1px solid #e5eaf3;
  border-radius: 10px; cursor: pointer; transition: .14s; background: #fff; font-size: 15px;
}
.opt:hover { border-color: #c7d2fe; background: #fafaff; }
.opt input { margin-top: 5px; flex: none; }
.opt-letter { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; background: #f1f5f9; color: #475569; font-weight: 700; font-size: 12.5px; flex: none; margin-top: 1px; }
.opt-text { flex: 1; line-height: 1.75; }
.opt-text p { margin: 0; }
.opt:has(input:checked) { border-color: #818cf8; background: #f5f6ff; box-shadow: 0 0 0 2px rgba(99,102,241,.08); }
.opt:has(input:checked) .opt-letter { background: var(--primary); color: #fff; }
.opt-correct { border-color: #86efac !important; background: var(--green-soft) !important; }
.opt-correct .opt-letter { background: var(--green) !important; color: #fff !important; }
.opt-wrong { border-color: #fca5a5 !important; background: var(--red-soft) !important; }
.opt-wrong .opt-letter { background: var(--red) !important; color: #fff !important; }
.answer-strip { margin-top: 10px; color: #475569; font-size: 13.5px; background: #f8fafc; border-radius: 8px; padding: 8px 12px; }
.ok { color: var(--green); } .bad { color: var(--red); }

.fill-list { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.fill-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fill-no { color: #64748b; font-size: 13px; min-width: 58px; font-weight: 600; }
.fill-item .inp { flex: 1; min-width: 220px; }
.fill-ans { font-size: 13px; color: #15803d; background: var(--green-soft); border-radius: 6px; padding: 3px 8px; }
.fill-ans.bad { color: #b91c1c; background: var(--red-soft); }
.inp-ok { border-color: #86efac !important; background: #f0fdf4 !important; }
.inp-bad { border-color: #fca5a5 !important; background: #fef2f2 !important; }
.fill-line { margin: 14px 0; }
.correct-answer { margin-top: 10px; border: 1px solid #bbf7d0; background: #f0fdf4; border-radius: 9px; padding: 10px 14px; }
.ca-label { color: #15803d; font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.ca-pre { margin: 0; white-space: pre-wrap; font-family: Consolas, monospace; font-size: 14px; color: #14532d; }

.subq { margin: 16px 0 0; padding: 16px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.subq-wrong { background: #fffafa; border-color: #fecaca; }
.subq-head { display: flex; align-items: flex-start; gap: 10px; }
.subq-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: #e0e7ff; color: #4338ca; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-top: 2px; }
.subq-title { flex: 1; font-weight: 600; font-size: 14.5px; }
.subq-title p { margin: 0; }
.subq-score { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sub-opts { margin: 10px 0 0; gap: 7px; }
.sub-opts .opt { padding: 7px 11px; font-size: 14px; background: #fff; }
.subq-analysis { margin-top: 9px; color: #475569; font-size: 13px; background: #fff; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); }
.sub-result { margin-top: 8px; font-size: 13px; color: #475569; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ============================ 试卷组卷 ============================ */
.build-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.q-pick { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.q-pick:last-child { border-bottom: none; }
.q-pick:hover { background: #fafbff; }
.q-pick label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.q-pick input[type=checkbox] { margin-top: 4px; }
.q-pick-body { flex: 1; min-width: 0; }
.q-pick-title { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.6; }
.q-pick-meta { color: var(--muted-2); font-size: 12.5px; margin-top: 2px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pick-list { max-height: 620px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.paper-q-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line-2);
  background: #fff; border-radius: 9px; margin-bottom: 7px; border: 1px solid var(--line); cursor: grab;
}
.paper-q-row:active { cursor: grabbing; }
.paper-q-row.dragging { opacity: .45; }
.drag-handle { color: #b6c1d2; font-size: 17px; flex: none; cursor: grab; padding: 0 2px; }
.paper-q-main { flex: 1; min-width: 0; }
.paper-q-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.paper-q-meta { color: var(--muted-2); font-size: 12px; display: flex; gap: 7px; align-items: center; margin-top: 1px; }
.score-input { width: 74px !important; padding: 5px 8px !important; text-align: center; font-size: 13.5px !important; }
.pq-actions { display: flex; gap: 4px; align-items: center; }
.pq-actions .btn { padding: 4px 6px; }
.total-bar {
  display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line);
  padding-top: 14px; margin-top: 14px; color: #475569; font-size: 14px;
}
.total-bar b { font-size: 22px; color: var(--primary); }
.q-bank-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-bank-filter select { width: 160px; }
.q-bank-filter input[type=text] { width: 180px; flex: 1; }

/* ============================ 考试 / 结果 ============================ */
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 22px; align-items: start; }
.exam-side { position: sticky; top: calc(var(--topbar) + 18px); }
.timer-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); text-align: center; }
.timer-label { font-size: 12.5px; color: var(--muted); letter-spacing: .08em; }
.timer { font-size: 34px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; line-height: 1.3; letter-spacing: .02em; }
.timer.warn { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.q-nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 14px; }
.q-nav a {
  display: flex; align-items: center; justify-content: center; height: 32px; border-radius: 7px;
  background: #f1f5f9; color: #64748b; font-size: 12.5px; font-weight: 600; transition: .14s;
}
.q-nav a:hover { background: #e0e7ff; color: #4338ca; }
.q-nav a.done { background: #dcfce7; color: #15803d; }
.q-nav a.current { background: var(--primary); color: #fff; }
.exam-progress-note { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.exam-tip { margin-top: 14px; padding: 12px 13px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.q-item { scroll-margin-top: calc(var(--topbar) + 18px); }
.q-head { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; flex-wrap: wrap; }
.q-no { font-weight: 800; color: var(--ink); font-size: 16px; }
.q-score { margin-left: auto; color: var(--muted); font-size: 13px; }
.q-answer-panel { border-top: 1px dashed var(--line); margin-top: 15px; padding-top: 15px; }
.exam-submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 20px; margin-bottom: 30px; }
.exam-submit-bar .muted { margin: 0; }

.result-hero { display: flex; align-items: center; gap: 30px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 26px 30px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.score-ring {
  --pct: 0; --ring: var(--primary); flex: none; width: 132px; height: 132px; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), #eef2f7 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #fff; }
.score-ring .score-inner { position: relative; text-align: center; line-height: 1.1; }
.score-ring .score-inner b { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.04em; }
.score-ring .score-inner small { display: block; color: var(--muted-2); font-size: 12px; margin-top: 4px; }
.result-title h2 { font-size: 22px; margin-bottom: 5px; }
.result-title p { color: var(--muted); margin: 0 0 8px; font-size: 14px; }
.result-metrics { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 13px; }
.result-metrics div { display: flex; flex-direction: column; }
.result-metrics b { font-size: 18px; color: var(--ink); }
.result-metrics small { color: var(--muted-2); font-size: 12px; }
.result-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.analysis-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-top: 15px; }
.analysis-box-title { font-weight: 700; color: #4338ca; font-size: 13px; margin-bottom: 6px; }
.review-filter { display: flex; gap: 9px; align-items: center; margin-bottom: 16px; }

/* ============================ 学生端首页 ============================ */
.student-hero { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 20px; }
.student-greeting { background: linear-gradient(125deg, #172554, #1e3a8a 58%, #2563eb); color: #fff; border-radius: 20px; padding: 28px 30px; position: relative; overflow: hidden; box-shadow: 0 14px 38px rgba(30,58,138,.22); }
.student-greeting::after { content: "AC"; position: absolute; right: 18px; bottom: -38px; font-size: 140px; font-weight: 900; color: rgba(255,255,255,.055); letter-spacing: -.06em; }
.student-greeting h2 { font-size: 25px; margin-bottom: 6px; position: relative; z-index: 1; }
.student-greeting p { color: #bfdbfe; margin: 0; font-size: 14px; position: relative; z-index: 1; }
.student-greeting .greeting-actions { display: flex; gap: 10px; margin-top: 22px; position: relative; z-index: 1; }
.student-greeting .btn-primary { background: #fff; color: #1e3a8a; border-color: #fff; box-shadow: none; }
.student-greeting .btn-primary:hover { background: #eff6ff; color: #172554; }
.student-greeting .btn-ghost { border-color: rgba(255,255,255,.35); color: #fff; background: rgba(255,255,255,.08); }
.progress-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; justify-content: center; }
.progress-card h3 { margin: 0 0 6px; font-size: 15px; }
.progress-ring-sm { width: 84px; height: 84px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: conic-gradient(#22c55e calc(var(--pct) * 1%), #eef2f7 0); position: relative; }
.progress-ring-sm::before { content: ""; position: absolute; inset: 7px; background: #fff; border-radius: 50%; }
.progress-ring-sm b { position: relative; font-size: 18px; }
.progress-card-body { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.paper-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.paper-card { border: 1px solid var(--line); border-radius: 14px; padding: 17px; background: #fff; position: relative; transition: .16s; }
.paper-card:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(79,70,229,.08); }
.paper-card h3 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.5; }
.paper-card .paper-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 8px 0 12px; flex-wrap: wrap; }
.paper-card .btn { width: 100%; }

/* ============================ 错题本 ============================ */
.wrong-top { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(150px, .3fr)); gap: 16px; margin-bottom: 20px; }
.wrong-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow-sm); }
.wrong-stat b { display: block; font-size: 26px; line-height: 1.2; }
.wrong-stat span { color: var(--muted); font-size: 12.5px; }
.wrong-card { border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.wrong-card.mastered { opacity: .8; background: #fcfdfd; }
.wrong-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 12px; }
.wrong-count { color: #b45309; background: var(--amber-soft); border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.wrong-fold { margin-top: 10px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pills a { padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; color: var(--muted); background: #fff; }
.filter-pills a:hover { border-color: #c7d2fe; color: var(--primary); }
.filter-pills a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ============================ 详情 / 统计 ============================ */
.detail-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.detail-avatar { width: 64px; height: 64px; border-radius: 18px; background: linear-gradient(135deg, #4f46e5, #22d3ee); color: #fff; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.detail-hero h2 { margin: 0 0 4px; }
.detail-hero p { margin: 0; color: var(--muted); font-size: 13.5px; }
.detail-stats { display: flex; gap: 30px; margin-left: auto; flex-wrap: wrap; }
.detail-stats div { display: flex; flex-direction: column; }
.detail-stats b { font-size: 23px; }
.detail-stats small { color: var(--muted-2); font-size: 12px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kv-item { background: #f8fafc; border-radius: 10px; padding: 12px 14px; }
.kv-item span { color: var(--muted-2); font-size: 12px; display: block; }
.kv-item b { font-size: 16px; }
.chart-bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 15px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart-bar span.bar { width: 100%; max-width: 38px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #818cf8, #4f46e5); min-height: 3px; }
.chart-bar small { color: var(--muted-2); font-size: 11px; white-space: nowrap; }

/* ============================ 分类管理 ============================ */
.cat-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.cat-row:last-child { border-bottom: none; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; background: #818cf8; flex: none; }
.cat-count { color: var(--muted-2); font-size: 12.5px; margin-left: auto; }

/* ============================ KindEditor 适配 ============================ */
.ke-container { border-radius: 10px !important; border-color: #dbe2ee !important; box-shadow: none !important; }
.ke-toolbar { border-radius: 10px 10px 0 0 !important; background: #f8fafc !important; padding: 4px 5px !important; }
.ke-edit { background: #fff !important; }
.ke-statusbar { border-radius: 0 0 10px 10px !important; }
.ke-container.focus { border-color: #818cf8 !important; box-shadow: 0 0 0 3px rgba(99,102,241,.10) !important; }
.editor-note { font-size: 12px; color: var(--muted-2); margin: 5px 0 8px; }
.editor-note code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.katex { font-size: 1.03em !important; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ============================ 登录页 ============================ */
.login-body {
  min-height: 100vh; margin: 0; background: #0d172a; display: flex; align-items: center; justify-content: center;
  padding: 28px; font-size: 15px; color: var(--ink);
}
.login-shell {
  width: min(1160px, 100%); min-height: 680px; display: grid; grid-template-columns: 1.08fr .92fr;
  border-radius: 24px; overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.4); background: #fff;
}
.login-visual {
  background: radial-gradient(900px 500px at 10% 0%, rgba(79,70,229,.35), transparent 60%),
              radial-gradient(700px 500px at 100% 100%, rgba(6,182,212,.18), transparent 55%),
              linear-gradient(160deg, #101b33, #172a52 62%, #0d172a);
  color: #fff; position: relative; overflow: hidden;
}
.login-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
.login-visual-inner { position: relative; z-index: 1; padding: 46px 52px; height: 100%; display: flex; flex-direction: column; }
.login-brand { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; }
.login-eyebrow { margin-top: 58px; color: #93c5fd; font-size: 12px; letter-spacing: .17em; font-weight: 600; }
.login-visual h1 { font-size: 40px; line-height: 1.24; letter-spacing: -.035em; margin: 12px 0 16px; font-weight: 800; }
.login-desc { color: #b6c7e2; font-size: 14.5px; line-height: 1.9; max-width: 460px; }
.login-features { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.login-feature { display: flex; gap: 13px; align-items: flex-start; }
.lf-icon { flex: none; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #93c5fd; }
.login-feature b { display: block; font-size: 14px; margin-bottom: 1px; }
.login-feature small { color: #8ea4c4; font-size: 12.5px; }
.login-code-deco {
  margin-top: auto; padding: 15px 18px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px;
  background: rgba(0,0,0,.16); color: #8fa6c7; font-family: Consolas, monospace; font-size: 12.5px; line-height: 1.85;
}
.login-code-deco span { color: #c4b5fd; } .login-code-deco em { color: #6ee7b7; font-style: normal; }
.login-form-side { background: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form-wrap { width: 100%; max-width: 370px; }
.login-mobile-brand { display: none; align-items: center; gap: 9px; font-weight: 700; margin-bottom: 30px; }
.login-form-wrap h2 { font-size: 29px; margin-bottom: 6px; letter-spacing: -.03em; }
.login-sub { color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.login-form .fld { margin-bottom: 19px; }
.login-form .fld > span { font-size: 13.5px; }
.login-form input { padding: 12px 13px 12px 42px; background: #fbfcfe; }
.login-form .btn { margin-top: 6px; }
.login-hint { margin-top: 22px; background: #f8fafc; border: 1px dashed #dbe2ee; border-radius: 10px; padding: 12px 14px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.login-hint b { color: #475569; }
.login-hint code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; color: var(--primary); }
.login-copy { color: #b0bac9; font-size: 11.5px; text-align: center; margin: 24px 0 0; }

/* ============================ 响应式 ============================ */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-2-1, .student-hero { grid-template-columns: 1fr; }
  .wrong-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  body:not(.login-body) { padding-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .22s; width: 265px; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-flex !important; }
  .mobile-shade { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 70; }
  .mobile-shade.show { display: block; }
  .topbar { padding: 0 20px; }
  .page { padding: 24px 20px 0; }
  .build-grid { grid-template-columns: 1fr; }
  .exam-layout { grid-template-columns: 1fr; }
  .exam-side { position: static; order: -1; }
  .timer-card { display: flex; align-items: center; gap: 14px; text-align: left; flex-wrap: wrap; }
  .q-nav { margin-top: 0; flex: 1; min-width: 200px; }
  .exam-tip { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; min-height: 0; }
  .login-visual { display: none; }
  .login-form-side { padding: 40px 30px; }
  .login-mobile-brand { display: flex; }
}
@media (max-width: 680px) {
  .page { padding: 18px 14px 0; }
  .topbar { padding: 0 14px; height: 62px; }
  .topbar-date, .top-action span { display: none; }
  .page-heading { margin-bottom: 16px; }
  h1 { font-size: 22px; }
  .card { padding: 17px; border-radius: 14px; }
  .grid-4, .wrong-top { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-num { font-size: 24px; }
  .row, .row-3, .row-4, .form-grid-2 { grid-template-columns: 1fr; }
  .result-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 20px; }
  .result-actions { margin-left: 0; }
  .welcome-meta { gap: 16px; }
  .welcome-banner { padding: 23px; }
  .welcome-banner h2 { font-size: 20px; }
  .detail-stats { margin-left: 0; gap: 20px; }
  .footer { flex-direction: column; gap: 4px; }
  .login-body { padding: 0; }
  .login-shell { border-radius: 0; min-height: 100vh; box-shadow: none; }
  .login-form-side { padding: 34px 22px; }
  .student-greeting { padding: 22px; }
  .student-greeting h2 { font-size: 21px; }
  .chart-bars { gap: 5px; }
  .paper-q-row { flex-wrap: wrap; }
  .paper-q-main { min-width: 140px; }
}

@media print {
  .sidebar, .topbar, .footer, .btn, .exam-side, .review-filter { display: none !important; }
  body { padding-left: 0; background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
