/* ============ 软考学堂 全局样式 ============ */
:root {
  --pri: #2563eb;
  --pri-2: #1d4ed8;
  --pri-soft: #eff6ff;
  --lv1: #10b981;
  --lv2: #3b82f6;
  --lv3: #8b5cf6;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --bad: #dc2626;
  --bad-soft: #fef2f2;
  --warn: #d97706;
  --bg: #f4f6fb;
  --card: #ffffff;
  --txt: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px; line-height: 1.65;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--pri); text-decoration: none; }
main { flex: 1; width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 26px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--txt); }
.brand svg { width: 30px; height: 30px; }
.brand .brand-sub { font-size: 11px; font-weight: 500; color: var(--muted); display: block; line-height: 1; margin-top: 1px; letter-spacing: .5px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--pri-soft); color: var(--pri); }
.nav a.on { background: var(--pri-soft); color: var(--pri); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-user .uname { font-weight: 600; color: var(--txt); }
.nav-user .uname:hover { color: var(--pri); }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; cursor: pointer;
  background: var(--pri); color: #fff; font-size: 15px; font-weight: 600; padding: 10px 22px; border-radius: 10px;
  transition: .15s; text-decoration: none; line-height: 1.3; }
.btn:hover { background: var(--pri-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 13px 30px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost { background: #fff; color: var(--txt); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: var(--bad); }
.btn-danger:hover { background: #b91c1c; }
.btn-block { width: 100%; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-lv1 { background: #ecfdf5; color: #059669; }
.b-lv2 { background: #eff6ff; color: #2563eb; }
.b-lv3 { background: #f5f3ff; color: #7c3aed; }
.b-gray { background: #f1f5f9; color: var(--muted); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-warn { background: #fffbeb; color: var(--warn); }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(226,232,240,.6); }
.card-pad { padding: 22px; }
.sec-title { font-size: 19px; font-weight: 700; margin: 34px 0 16px; display: flex; align-items: center; gap: 9px; }
.sec-title .st-ico { width: 26px; height: 26px; color: var(--pri); flex: none; }

/* ---------- 首页 Hero ---------- */
.hero { background: linear-gradient(135deg, #1e40af 0%, #2563eb 55%, #3b82f6 100%); color: #fff; padding: 58px 0 66px; }
.hero h1 { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.hero .hero-sub { margin: 12px 0 26px; font-size: 16px; opacity: .92; max-width: 620px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px 42px; margin-bottom: 30px; }
.hero-stats .hs-item b { display: block; font-size: 28px; font-weight: 800; }
.hero-stats .hs-item span { font-size: 13px; opacity: .85; }
.hero .btn { background: #fff; color: var(--pri); }
.hero .btn:hover { background: #f0f7ff; }
.hero .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.hero .btn-ghost:hover { background: rgba(255,255,255,.12); }

/* ---------- 科目网格 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 8px 20px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.tab.on { background: var(--pri); border-color: var(--pri); color: #fff; }
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.subj-card { padding: 20px; display: flex; flex-direction: column; gap: 10px; transition: .18s; position: relative; }
.subj-card:hover { transform: translateY(-3px); box-shadow: 0 6px 22px rgba(37,99,235,.13); border-color: #bfdbfe; }
.subj-head { display: flex; align-items: center; gap: 10px; }
.subj-head h3 { font-size: 17px; font-weight: 700; }
.subj-intro { color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 44px; }
.subj-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.subj-meta b { color: var(--pri); font-size: 14px; }

/* ---------- 功能卡 ---------- */
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feat-card { padding: 22px; text-align: center; }
.feat-card .f-ico { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.feat-card h3 { font-size: 16px; margin-bottom: 6px; }
.feat-card p { color: var(--muted); font-size: 13px; }

/* ---------- 页头横幅（内页） ---------- */
.page-hero { background: linear-gradient(135deg, #1e40af, #3b82f6); color: #fff; padding: 34px 0; }
.page-hero h1 { font-size: 26px; font-weight: 800; }
.page-hero .ph-sub { margin-top: 8px; opacity: .9; font-size: 14px; }
.ph-badges { display: flex; gap: 8px; margin-bottom: 10px; }

/* ---------- 信息网格 ---------- */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.info-cell { padding: 16px 18px; }
.info-cell .ic-label { font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.info-cell .ic-val { font-size: 14.5px; font-weight: 600; }

/* ---------- 章节列表 / 入口列表 ---------- */
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: .15s; }
.list-item:hover { border-color: #bfdbfe; background: #fafcff; }
.list-item .li-name { font-weight: 600; font-size: 14.5px; }
.list-item .li-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 快捷入口 ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.quick-card { padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; cursor: pointer; transition: .15s; border: 1px solid var(--line); }
.quick-card:hover { border-color: var(--pri); box-shadow: 0 4px 16px rgba(37,99,235,.1); transform: translateY(-2px); }
.quick-card h3 { font-size: 15.5px; }
.quick-card p { font-size: 12.5px; color: var(--muted); }
.quick-card svg { width: 26px; height: 26px; color: var(--pri); }

/* ---------- 刷题页 ---------- */
.prac-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; padding: 26px 0 40px; }
.prac-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.prac-head h1 { font-size: 20px; font-weight: 700; }
.prac-stat { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat-chip { background: #fff; border: 1px solid var(--line); padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.stat-chip b { color: var(--pri); }
.q-card { padding: 26px; }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.q-meta .fav-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.q-meta .fav-btn.on { color: #d97706; border-color: #fcd34d; background: #fffbeb; }
.q-text { font-size: 16px; font-weight: 500; white-space: pre-wrap; word-break: break-word; line-height: 1.75; margin-bottom: 20px; font-family: inherit; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border: 1.5px solid var(--line); border-radius: 11px; cursor: pointer; background: #fff; transition: .13s; font-size: 15px; }
.opt:hover { border-color: #93c5fd; background: #f8faff; }
.opt .o-letter { flex: none; width: 26px; height: 26px; border-radius: 8px; background: #f1f5f9; color: var(--muted); font-weight: 700; font-size: 13.5px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.opt.sel { border-color: var(--pri); background: var(--pri-soft); }
.opt.sel .o-letter { background: var(--pri); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .o-letter { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .o-letter { background: var(--bad); color: #fff; }
.opt.dim { opacity: .6; cursor: default; }
.analysis { margin-top: 18px; border-radius: 12px; padding: 16px 18px; background: #f8fafc; border: 1px solid var(--line); }
.analysis .an-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.q-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }

/* 答题卡 */
.sheet-card { position: sticky; top: 76px; padding: 18px; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; margin: 12px 0; }
.sheet-item { height: 36px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .12s; }
.sheet-item.answered { background: var(--pri-soft); border-color: #bfdbfe; color: var(--pri); }
.sheet-item.right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.sheet-item.wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.sheet-item.cur { outline: 2.5px solid var(--pri); outline-offset: 1px; }
.sheet-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.sheet-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* 结果卡 */
.result-card { text-align: center; padding: 36px 26px; }
.score-ring { width: 130px; height: 130px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.score-ring b { font-size: 34px; line-height: 1.1; }
.score-ring span { font-size: 12px; opacity: .8; }
.result-card h2 { font-size: 21px; margin-bottom: 8px; }

/* ---------- 考试页 ---------- */
.exam-timer { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: #fff; border-top: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.exam-timer .t-left { font-size: 18px; font-weight: 800; color: var(--pri); font-variant-numeric: tabular-nums; }
.exam-timer .t-left.urgent { color: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.exam-body { padding: 26px 0 80px; }

/* ---------- 知识点页 ---------- */
.know-layout { display: grid; grid-template-columns: 270px 1fr; gap: 22px; align-items: start; padding: 26px 0 40px; }
.know-side { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; padding: 14px; }
.know-side .ks-group { margin-bottom: 6px; }
.know-side .ks-ch { font-weight: 700; font-size: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; display: block; color: var(--txt); }
.know-side .ks-ch:hover { background: var(--pri-soft); color: var(--pri); }
.know-side .ks-ch.on { background: var(--pri); color: #fff; }
.know-side details { margin: 2px 0 8px; }
.know-side summary { font-size: 13px; color: var(--muted); padding: 6px 10px; cursor: pointer; border-radius: 7px; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.know-side summary::-webkit-details-marker { display: none; }
.know-side summary:hover { background: #f1f5f9; }
.know-side summary .arr { transition: .2s; font-size: 10px; }
.know-side details[open] summary .arr { transform: rotate(90deg); }
.know-side .ks-sec { display: block; padding: 6px 10px 6px 22px; font-size: 13px; color: var(--muted); border-radius: 7px; cursor: pointer; }
.know-side .ks-sec:hover, .know-side .ks-sec.on { color: var(--pri); background: var(--pri-soft); }
.know-content { padding: 30px 34px; min-width: 0; }
.know-content h1 { font-size: 22px; margin-bottom: 4px; }
.know-content .kc-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.know-sec { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.know-sec:first-of-type { border-top: none; }
.know-sec h2 { font-size: 18px; margin-bottom: 12px; }

/* ---------- markdown 渲染 ---------- */
.md .md-h { margin: 14px 0 8px; font-weight: 700; color: var(--txt); }
.md h2.md-h { font-size: 16.5px; }
.md h3.md-h { font-size: 15.5px; }
.md h4.md-h { font-size: 14.5px; color: var(--muted); }
.md .md-p { margin: 7px 0; font-size: 14.5px; }
.md .md-ul { margin: 7px 0 7px 4px; padding-left: 20px; }
.md .md-ul li { margin: 4px 0; font-size: 14.5px; }
.md .md-quote { border-left: 3px solid #fbbf24; background: #fffbeb; padding: 8px 14px; border-radius: 0 9px 9px 0; margin: 10px 0; font-size: 13.5px; color: #92400e; }
.md code { background: #eef2f7; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 13px; font-family: Consolas, "Courier New", monospace; color: #be185d; }
.md .md-code { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 10px 0; font-size: 13px; line-height: 1.6; font-family: Consolas, "Courier New", monospace; white-space: pre; }
.md .md-gap { height: 8px; }
.md strong { color: #0f172a; }

/* ---------- 登录页 ---------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 50px 20px;
  background: linear-gradient(160deg, #eef4ff 0%, #f4f6fb 60%); }
.auth-card { width: 100%; max-width: 410px; padding: 34px 32px; }
.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.auth-card .ac-sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.auth-tabs { display: flex; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tabs .at { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-weight: 600; cursor: pointer; color: var(--muted); font-size: 14.5px; }
.auth-tabs .at.on { background: #fff; color: var(--pri); box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; outline: none; transition: .15s; background: #fff; }
.field input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ---------- 个人中心 ---------- */
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-top: 20px; }
.dstat { padding: 18px; text-align: center; }
.dstat b { display: block; font-size: 27px; font-weight: 800; color: var(--pri); }
.dstat.d-ok b { color: var(--ok); }
.dstat.d-bad b { color: var(--bad); }
.dstat.d-warn b { color: var(--warn); }
.dstat span { font-size: 12.5px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .tbl-scroll { overflow-x: auto; }
.progress { height: 7px; background: #eef2f7; border-radius: 99px; overflow: hidden; min-width: 90px; }
.progress i { display: block; height: 100%; background: var(--pri); border-radius: 99px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; padding: 26px; max-width: 420px; width: 100%; }
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal .m-btns { display: flex; gap: 10px; justify-content: flex-end; }
.toast { position: fixed; top: 74px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 22px; border-radius: 10px; font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: .25s; max-width: 88vw; }
.toast.show { opacity: .95; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; margin-bottom: 10px; opacity: .4; }

/* ---------- 页脚 / 备案 ---------- */
.footer { background: #fff; border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0; }
.footer .f-in { max-width: 1120px; margin: 0 auto; padding: 0 20px; text-align: center; color: var(--muted); font-size: 12.5px; }
.beian-links { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.beian-links a { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.beian-links a:hover { color: var(--pri); }
.beian-links img { width: 14px; height: 14px; }
.beian-links .icp-ico { width: 14px; height: 14px; flex: none; }

/* ---------- 加载 ---------- */
.loading { text-align: center; padding: 60px 0; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--pri); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
  .prac-layout, .know-layout { grid-template-columns: 1fr; }
  .sheet-card, .know-side { position: static; max-height: none; }
  .hero h1 { font-size: 26px; }
  .nav { display: none; }
  .know-content { padding: 22px 18px; }
}
@media (max-width: 560px) {
  .subject-grid { grid-template-columns: 1fr; }
  .q-card { padding: 18px; }
  .hero { padding: 40px 0 46px; }
  .hero-stats { gap: 10px 26px; }
  .btn-lg { padding: 12px 22px; font-size: 15px; }
}
