/* ============ 设计变量 ============ */
:root {
  --bg: #f5f6fa;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #fbfbfe;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #6b7a90;
  --line: #e6e9f2;
  --line-strong: #d5dae8;

  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef0ff;
  --primary-ink: #3730a3;

  --green: #10b981;
  --green-soft: #e8f8f2;
  --green-ink: #047857;

  --red: #ef4444;
  --red-soft: #fdeeee;
  --red-ink: #b91c1c;

  --amber: #f59e0b;
  --amber-soft: #fef4e3;
  --amber-ink: #b45309;

  --blue: #3b82f6;
  --blue-soft: #eaf2fe;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.18), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, 0.32);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6dbe8; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px;
  border-radius: 12px;
}
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(140deg, #6366f1, #4f46e5 55%, #4338ca);
  box-shadow: 0 8px 18px -8px rgba(79, 70, 229, 0.8);
  flex: none;
}
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: -0.02em; }
.brand-text small { font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item .nav-ico { width: 20px; height: 20px; display: grid; place-items: center; flex: none; }
.nav-item .nav-ico svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-ink); font-weight: 650; }
.nav-item.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-badge {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--red); color: #fff;
}

.nav-badge[hidden] { display: none; }

/* 收藏星标 */
.star-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border: none; border-radius: 8px;
  background: transparent; color: #b8bfd2; cursor: pointer; flex: none;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.star-btn:hover { background: var(--primary-soft); color: var(--primary); }
.star-btn:active { transform: scale(0.92); }
.star-btn.active { color: var(--amber); }
.star-btn.active svg { fill: currentColor; }
.star-btn:disabled { opacity: 0.5; cursor: default; }
.star-btn svg { pointer-events: none; }
.qr-fav { display: inline-flex; align-items: center; margin-left: auto; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; }
.streak-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 12px;
  background: var(--amber-soft); color: var(--amber-ink);
  font-size: 13px; font-weight: 600;
}
.streak-ico { font-size: 15px; }
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }

.main { min-width: 0; }
.main-inner { max-width: 1080px; margin: 0 auto; padding: 34px 40px 80px; }

.tabbar { display: none; }

/* ============ 通用组件 ============ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.25; }
.page-head .sub { margin-top: 5px; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
}
.btn:hover { border-color: #c3cadb; background: var(--surface-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary {
  background: linear-gradient(160deg, #5b52ea, #4f46e5 40%, #4338ca);
  border-color: transparent; color: #fff;
  box-shadow: 0 10px 22px -12px rgba(79, 70, 229, 0.9);
}
.btn-primary:hover { background: linear-gradient(160deg, #4f46e5, #4338ca); border-color: transparent; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); }
.btn-soft:hover { background: #e3e6ff; border-color: transparent; }
.btn-danger-soft { background: var(--red-soft); border-color: transparent; color: var(--red-ink); }
.btn-danger-soft:hover { background: #fbe0e0; border-color: transparent; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--bg-soft); color: var(--text-2);
}
.chip-primary { background: var(--primary-soft); color: var(--primary-ink); }
.chip-green { background: var(--green-soft); color: var(--green-ink); }
.chip-red { background: var(--red-soft); color: var(--red-ink); }
.chip-amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip-blue { background: var(--blue-soft); color: #1d4ed8; }
.chip-violet { background: #ede9fe; color: #5b21b6; }

.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg-soft); gap: 3px; }
.segmented button {
  border: 0; background: transparent; color: var(--muted);
  height: 32px; padding: 0 14px; border-radius: 9px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ============ 概览 ============ */
.hero-card {
  position: relative; overflow: hidden;
  padding: 26px 28px;
  border-radius: 20px;
  background: linear-gradient(120deg, #4f46e5 0%, #5b52ea 45%, #7c6ff5 100%);
  color: #fff;
  box-shadow: 0 22px 44px -26px rgba(79, 70, 229, 0.85);
  margin-bottom: 18px;
}
.hero-card::after {
  content: ""; position: absolute; right: -60px; top: -70px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.28), transparent 70%);
}
.hero-card::before {
  content: ""; position: absolute; right: 90px; bottom: -90px;
  width: 190px; height: 190px; border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
}
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; position: relative; z-index: 1; }
.hero-date { font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.78; }
.hero-title { font-size: 23px; font-weight: 720; letter-spacing: -0.02em; margin-top: 4px; }
.hero-desc { font-size: 13.5px; opacity: 0.82; margin-top: 4px; }
.hero-progress { margin-top: 20px; display: flex; gap: 26px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-progress .hp-item strong { display: block; font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }
.hero-progress .hp-item span { font-size: 12px; opacity: 0.75; }
.hero-cta { margin-top: 20px; display: flex; gap: 10px; position: relative; z-index: 1; flex-wrap: wrap; }
.hero-cta .btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255,255,255,0.25); color: #fff; backdrop-filter: blur(4px); }
.hero-cta .btn:hover { background: rgba(255, 255, 255, 0.24); border-color: rgba(255,255,255,0.35); }
.hero-cta .btn-white { background: #fff; color: var(--primary-ink); border-color: #fff; }
.hero-cta .btn-white:hover { background: #f4f4ff; border-color: #f4f4ff; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { padding: 17px 18px; border-radius: 15px; background: var(--surface); border: 1px solid var(--line); }
.stat-card .stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-card .stat-value { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; margin-top: 8px; line-height: 1; }
.stat-card .stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-card .stat-foot { margin-top: 7px; font-size: 12px; color: var(--muted); }
.stat-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.stat-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.resume-banner {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; margin-bottom: 16px;
  border: 1px solid #ded9ff; border-radius: 14px;
  background: linear-gradient(100deg, #f3f1ff, #fbfaff);
}
.resume-banner .rb-main { flex: 1; min-width: 0; }
.resume-banner strong { font-size: 14px; }
.resume-banner p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 13px; }
.section-head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }
.section-head .link { font-size: 13px; color: var(--primary); font-weight: 600; cursor: pointer; }

.chapter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.chapter-card { padding: 17px 18px; border-radius: 15px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: all 0.16s ease; }
.chapter-card:hover { border-color: #cfc9ff; box-shadow: var(--shadow); transform: translateY(-2px); }
.chapter-card .cc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chapter-card .cc-name { font-weight: 680; font-size: 14.5px; }
.chapter-card .cc-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.chapter-card .cc-bar { margin-top: 12px; height: 6px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.chapter-card .cc-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #4f46e5); transition: width 0.4s ease; }

/* ============ 练习设置 ============ */
.practice-setup { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.setup-panel { padding: 24px; }
.setup-row { margin-bottom: 20px; }
.setup-row:last-child { margin-bottom: 0; }
.setup-label { font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center; }
.setup-label .muted { font-weight: 500; font-size: 12px; }

.chapter-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.chapter-pick button {
  text-align: left; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface);
  cursor: pointer; transition: all 0.14s ease; font-size: 13.5px; color: var(--text-2);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.chapter-pick button:hover { border-color: #c7c1ff; background: #fcfbff; }
.chapter-pick button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); font-weight: 650; }
.chapter-pick button .n { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.chapter-pick button.active .n { color: var(--primary-ink); opacity: 0.8; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  height: 34px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.14s ease;
}
.pill:hover { border-color: #c7c1ff; }
.pill.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }

.hint-box { padding: 14px 16px; border-radius: 13px; background: var(--surface-2); border: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.hint-box strong { color: var(--text-2); }

/* ============ 答题 ============ */
.answer-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.answer-title { font-size: 15px; font-weight: 700; }
.answer-meta { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.answer-meta .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); display: inline-block; }

.progress-line { height: 7px; border-radius: 99px; background: #e8eaf3; overflow: hidden; margin-bottom: 20px; }
.progress-line span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #4f46e5); transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1); }

.nav-dots { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 18px; }
.nav-dot {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 650;
  cursor: pointer; transition: all 0.13s ease;
}
.nav-dot:hover { border-color: #c7c1ff; }
.nav-dot.done-correct { background: var(--green-soft); border-color: #b9ecd9; color: var(--green-ink); }
.nav-dot.done-wrong { background: var(--red-soft); border-color: #f8cccc; color: var(--red-ink); }
.nav-dot.current { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); color: var(--primary-ink); }
.nav-dots.nav-compact { display: block; }
.nav-jump {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line);
}
.nav-jump .select-sm { width: auto; min-width: 132px; padding: 7px 10px; font-size: 12.5px; }

.question-card { padding: 26px 28px; }
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.stem { font-size: 17px; line-height: 1.75; font-weight: 560; color: var(--text); white-space: pre-wrap; }
.q-kp { font-size: 12px; color: var(--muted); margin-top: 4px; }

.material-card {
  margin: 0 0 16px; padding: 15px 17px; border-radius: 13px;
  background: #faf9ff; border: 1px solid #ece8ff;
  font-size: 14px; line-height: 1.8; color: var(--text-2);
}
.material-card .mc-title { font-size: 12px; font-weight: 700; color: var(--primary-ink); letter-spacing: 0.04em; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }

.options { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 15px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; transition: all 0.14s ease; text-align: left; width: 100%;
  font-size: 14.5px; color: var(--text-2); line-height: 1.55;
}
.option:hover { border-color: #c9c3ff; background: #fdfcff; }
.option .key {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-2);
  transition: all 0.14s ease;
}
.option.active { border-color: var(--primary); background: var(--primary-soft); }
.option.active .key { background: var(--primary); color: #fff; }
.option.correct { border-color: #34d399; background: var(--green-soft); }
.option.correct .key { background: var(--green); color: #fff; }
.option.wrong { border-color: #f87171; background: var(--red-soft); }
.option.wrong .key { background: var(--red); color: #fff; }
.option:disabled { cursor: default; }

.judge-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 20px; }
.judge-btn {
  height: 62px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 15.5px; font-weight: 650; color: var(--text-2);
  cursor: pointer; transition: all 0.14s ease; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.judge-btn:hover { border-color: #c9c3ff; }
.judge-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.judge-btn.correct { border-color: #34d399; background: var(--green-soft); color: var(--green-ink); }
.judge-btn.wrong { border-color: #f87171; background: var(--red-soft); color: var(--red-ink); }

.fill-row { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.fill-item { display: flex; align-items: center; gap: 10px; }
.fill-item .fi-no { font-size: 12px; color: var(--muted); font-weight: 600; width: 42px; flex: none; }
.fill-item input {
  flex: 1; height: 44px; padding: 0 14px; border-radius: 11px;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  font-size: 14px; font-family: inherit; color: var(--text); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fill-item input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); }
.fill-item input:disabled { background: var(--surface-2); color: var(--muted); }

.short-row { margin-top: 20px; }
.short-row .short-input { width: 100%; box-sizing: border-box; min-height: 118px; font-size: 14.5px; }
.short-row .short-input:disabled { background: var(--surface-2); color: var(--text-2); }
.self-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.feedback.pending { background: var(--primary-soft); border-color: #c7d2fe; }
.feedback.pending .feedback-head { color: var(--primary-ink); }

.answer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.answer-foot .hint { font-size: 12px; color: var(--muted); }
.answer-foot .keys { display: flex; gap: 6px; }
.kbd { padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }

.feedback { margin-top: 20px; padding: 18px 20px; border-radius: 14px; border: 1px solid; animation: pop 0.22s ease; }
.feedback.ok { background: var(--green-soft); border-color: #b7ebd8; }
.feedback.no { background: var(--red-soft); border-color: #f6c9c9; }
.feedback-head { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; }
.feedback.ok .feedback-head { color: var(--green-ink); }
.feedback.no .feedback-head { color: var(--red-ink); }
.feedback .fb-body { margin-top: 10px; font-size: 13.5px; line-height: 1.8; color: var(--text-2); }
.feedback .fb-answer { font-weight: 650; }
.feedback .fb-exp { margin-top: 8px; padding-top: 9px; border-top: 1px dashed rgba(15, 23, 42, 0.12); color: var(--text-2); }
.feedback .fb-state { margin-top: 9px; display: flex; gap: 7px; flex-wrap: wrap; }

@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 交卷 ============ */
.summary-card { padding: 34px 30px; text-align: center; }
.score-ring {
  width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 18px;
  display: grid; place-items: center; position: relative;
}
.score-ring .inner {
  width: 116px; height: 116px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center;
}
.score-ring strong { font-size: 34px; font-weight: 780; letter-spacing: -0.04em; line-height: 1; }
.score-ring small { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.summary-title { font-size: 20px; font-weight: 720; letter-spacing: -0.02em; }
.summary-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.summary-stats { display: flex; justify-content: center; gap: 34px; margin: 22px 0 24px; flex-wrap: wrap; }
.summary-stats .s-item strong { display: block; font-size: 21px; font-weight: 740; }
.summary-stats .s-item span { font-size: 12px; color: var(--muted); }
.summary-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.review-list { margin-top: 18px; text-align: left; }
.review-item { display: flex; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; }
.review-item .ri-mark { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; margin-top: 1px; }
.review-item .ri-mark.ok { background: var(--green-soft); color: var(--green-ink); }
.review-item .ri-mark.no { background: var(--red-soft); color: var(--red-ink); }
.review-item .ri-stem { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ 错题本 ============ */
.wrong-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.ws-card { padding: 15px 17px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.ws-card .ws-n { font-size: 23px; font-weight: 750; letter-spacing: -0.03em; }
.ws-card .ws-l { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.ws-card.hot { border-color: #fbd5a5; background: linear-gradient(150deg, #fffaf1, #ffffff); }
.ws-card.hot .ws-n { color: var(--amber-ink); }

.wrong-list { display: flex; flex-direction: column; gap: 10px; }
.wrong-item { padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; gap: 16px; align-items: flex-start; transition: all 0.14s ease; }
.wrong-item:hover { border-color: #d8d3ff; box-shadow: var(--shadow-sm); }
.wrong-item .wi-main { flex: 1; min-width: 0; }
.wrong-item .wi-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.wrong-item .wi-stem { font-size: 14px; color: var(--text-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wrong-item .wi-meta { font-size: 12px; color: var(--muted); margin-top: 7px; display: flex; gap: 14px; flex-wrap: wrap; }
.wrong-item .wi-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }

.empty {
  padding: 46px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--surface-2);
}
.empty .empty-ico { font-size: 34px; opacity: 0.55; margin-bottom: 8px; }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 3px; }
.empty p { font-size: 13px; }

/* ============ 题库 ============ */
.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.input, .select, textarea.input {
  height: 40px; padding: 0 13px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-family: inherit; font-size: 13.5px; color: var(--text); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1); }
.input.search { flex: 1; min-width: 180px; max-width: 330px; }
textarea.input { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.6; }
.modal-body textarea.input, .modal-body #imp-bank-name { width: 100%; box-sizing: border-box; }

.q-row { padding: 15px 18px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 9px; }
.q-row .qr-head { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.q-row .qr-stem { font-size: 14px; color: var(--text-2); line-height: 1.65; }
.q-row .qr-no { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 5px; }

#imp-target { display: flex; flex-wrap: wrap; }
#imp-target button { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.q-row .qr-opts { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.q-row .qr-answer { margin-top: 9px; font-size: 12.5px; color: var(--green-ink); background: var(--green-soft); padding: 7px 11px; border-radius: 9px; display: none; }
.q-row.open .qr-answer { display: block; }
.q-row .qr-foot { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.pager-jump { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; border-left: 1px solid var(--line); }
.pager .input-page { width: 68px; height: 34px; padding: 0 8px; text-align: center; font-size: 13px; }

/* ============ 统计 ============ */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 150px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; height: 100%; }
.bar-stack { width: 100%; max-width: 40px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.bar-seg { width: 100%; border-radius: 7px 7px 3px 3px; background: var(--primary); transition: height 0.4s ease; min-height: 2px; }
.bar-seg.miss { background: #e3e6f5; border-radius: 3px 3px 7px 7px; }
.bar-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bar-value { font-size: 11.5px; font-weight: 650; color: var(--text-2); }

.acc-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.acc-row:last-child { border-bottom: 0; }
.acc-row .ar-name { width: 110px; flex: none; font-size: 13.5px; font-weight: 600; }
.acc-row .ar-bar { flex: 1; height: 9px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.acc-row .ar-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #6366f1, #4f46e5); }
.acc-row .ar-num { width: 74px; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.table tr:last-child td { border-bottom: 0; }

/* ============ 弹层 / Toast ============ */
.modal-root:empty { display: none; }
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 22px;
  animation: fade 0.16s ease;
}
.modal {
  width: min(680px, 100%); max-height: 86vh; overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: rise 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 9px; }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 14px);
  z-index: 120; padding: 11px 18px; border-radius: 11px;
  background: #0f172a; color: #fff; font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all 0.22s ease; max-width: min(520px, 90vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #b91c1c; }
.toast.ok { background: #047857; }

/* ============ 骨架屏 ============ */
.skeleton-wrap { padding: 10px 0; }
.skeleton { height: 120px; border-radius: 16px; background: linear-gradient(90deg, #eceef6 25%, #f5f6fa 37%, #eceef6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .main-inner { padding: 26px 24px 90px; }
  .grid-4, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-setup { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); padding: 4px 10px; border-radius: 10px; font-weight: 600; }
  .tabbar a.active { color: var(--primary); }
  .tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .main-inner { padding: 20px 16px 96px; }
  .page-head h1 { font-size: 22px; }
  .question-card { padding: 20px 18px; }
  .wrong-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-pick { grid-template-columns: minmax(0, 1fr); }
  .judge-row { grid-template-columns: 1fr; }
  .hero-card { padding: 22px; }
}

/* ============ 题库切换 ============ */
.bank-switch { padding: 0 12px 10px; }
.bank-current {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; cursor: pointer; text-align: left; color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.bank-current:hover { border-color: #c7ccf5; box-shadow: 0 2px 10px rgba(79, 70, 229, 0.08); }
.bank-ico {
  width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; flex: none;
}
.bank-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bank-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bank-meta small { font-size: 10.5px; color: var(--muted); }
.bank-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank-chevron { width: 14px; height: 14px; margin-left: auto; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.bank-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.bank-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff;
}
.bank-row:hover { border-color: #c7ccf5; }
.bank-row.active { border-color: var(--primary); background: var(--primary-soft); cursor: default; }
.bank-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.bank-row-main strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bank-row-main small { color: var(--muted); font-size: 12px; }
.bank-del { color: var(--muted); font-size: 13px; }
.bank-del.danger { color: var(--red); border-color: rgba(239, 68, 68, 0.3); background: #fff1f1; }
.bank-new { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 14px; }
.bank-new .input { min-width: 0; }

/* ============ 移动端 ============ */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
button, a, .option, .judge-btn, .pill, .chapter-pick button, .segmented button { touch-action: manipulation; }
.mobile-bar { display: none; }

@media (max-width: 860px) {
  :root { --tabbar-h: 62px; }

  /* ---- 顶栏：品牌 + 当前题库 + 更多 ---- */
  .mobile-bar {
    display: flex; align-items: center; gap: 9px;
    position: sticky; top: 0; z-index: 70;
    padding: calc(8px + env(safe-area-inset-top)) 13px 8px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .mb-brand { display: flex; align-items: center; gap: 7px; color: var(--text); text-decoration: none; flex: none; }
  .mb-mark { width: 28px; height: 28px; border-radius: 9px; box-shadow: 0 5px 12px -7px rgba(79, 70, 229, 0.9); }
  .mb-mark svg { width: 16px; height: 16px; stroke-width: 2.8; }
  .mb-brand strong { font-size: 15px; letter-spacing: -0.02em; }
  .mb-bank {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 10px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  }
  .mb-bank-label { font-size: 10px; color: var(--muted); flex: none; }
  .mb-bank strong { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
  .mb-chevron { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
  .mb-menu-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); display: grid; place-items: center; flex: none; }
  .mb-menu-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
  .mb-menu {
    position: absolute; right: 12px; top: calc(100% - 4px); min-width: 172px;
    padding: 6px; border-radius: 13px; background: #fff;
    border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 90;
  }
  .mb-menu[hidden] { display: none; }
  .mb-menu button { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; background: transparent; border-radius: 9px; font-size: 13.5px; font-weight: 550; color: var(--text-2); }
  .mb-menu button[hidden] { display: none; }
  .mb-menu button:active { background: var(--surface-2); }

  .main-inner { padding: 16px 14px calc(88px + env(safe-area-inset-bottom)); }
  .has-answer-foot .main-inner { padding-bottom: calc(152px + env(safe-area-inset-bottom)); }
  .focus-mode .main-inner { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

  /* ---- 页头 ---- */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 18px; }
  .page-head h1 { font-size: 21px; }
  .page-head .sub { font-size: 12.5px; margin-top: 3px; }
  .page-head .page-actions { justify-content: flex-end; gap: 8px; }
  .page-head .page-actions-chips { justify-content: flex-start; }
  .page-actions-split .btn { flex: 1; min-width: 0; padding: 0 10px; }

  /* 导入弹层：格式选择 2 列，最后一个占整行 */
  #imp-format { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #imp-format button { width: 100%; }
  #imp-format button:last-child { grid-column: 1 / -1; }
  #imp-text { height: 172px; min-height: 172px; }

  /* ---- 题库 / 错题本筛选 ---- */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; margin-bottom: 14px; }
  .toolbar .search, .toolbar .select { width: 100%; min-width: 0; }
  .toolbar-bank { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar-bank .search { grid-column: 1 / -1; }
  .toolbar-wrong .segmented { width: 100%; }

  /* ---- 分段控件：一行放得下时不拆字 ---- */
  .segmented { display: flex; flex-wrap: wrap; width: 100%; gap: 4px; }
  .segmented button { flex: 1 1 auto; min-width: 64px; padding: 0 10px; white-space: nowrap; font-size: 12.5px; }

  /* ---- 练习设置 ---- */
  .practice-setup { gap: 14px; }
  .setup-panel { padding: 18px 16px; }
  .setup-row { margin-bottom: 17px; }
  .setup-label { display: block; margin-bottom: 8px; }
  .setup-label .muted { display: block; margin-top: 2px; }
  .chapter-pick { grid-template-columns: 1fr; gap: 7px; }
  .chapter-pick button { padding: 10px 12px; font-size: 14px; border-radius: 10px; }
  .pill { height: 36px; padding: 0 14px; }

  /* ---- 答题 ---- */
  .answer-top { align-items: flex-start; gap: 8px; margin-bottom: 10px; }
  .answer-title { font-size: 14.5px; }
  .answer-meta { gap: 8px; font-size: 11.5px; flex-wrap: wrap; }
  .answer-top .page-actions { gap: 6px; }
  .answer-top .page-actions .btn { height: 32px; padding: 0 10px; font-size: 12px; }
  .progress-line { height: 6px; margin-bottom: 12px; }
  .nav-jump { gap: 8px; padding: 9px 12px; }
  .nav-jump .muted.tiny { display: none; }
  .nav-jump .select-sm { min-width: 0; flex: 1; max-width: 150px; }
  .question-card { padding: 18px 16px; }
  .q-meta { gap: 6px; margin-bottom: 10px; }
  .q-meta .q-index { display: none; }
  .q-meta .chip { font-size: 11px; padding: 3px 8px; }
  .q-meta .stars { font-size: 11px; }
  .stem { font-size: 16.5px; line-height: 1.8; line-break: strict; word-break: break-word; }
  .options { gap: 8px; margin-top: 16px; }
  .option { padding: 13px 13px; font-size: 14.5px; border-radius: 11px; }
  .judge-btn { height: 50px; margin-top: 16px; }
  .short-row { margin-top: 16px; }
  .short-row .short-input { font-size: 15px; min-height: 118px; }
  .feedback { padding: 15px 15px; margin-top: 16px; }

  /* ---- 底部固定操作栏（提交 / 上一题 / 交卷） ---- */
  .answer-foot {
    position: fixed; left: 0; right: 0;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    z-index: 55; margin: 0; padding: 10px 14px;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 26px -24px rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
  }
  .answer-foot .hint { display: none; }
  .answer-foot > div:last-child { width: 100%; gap: 8px !important; }
  .answer-foot .btn { flex: 1; height: 44px; font-size: 14px; }
  .focus-mode .answer-foot { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  /* ---- 专注模式：练习中隐藏顶栏与底栏 ---- */
  .focus-mode .tabbar, .focus-mode .mobile-bar { display: none !important; }

  /* ---- 弹层：底部抽屉 ---- */
  .modal-mask { padding: 0; place-items: end center; }
  .modal {
    width: 100%; max-width: 600px; max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 18px 18px 0 0;
  }
  .modal-head { padding: 15px 18px; }
  .modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
  .modal-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .bank-list { max-height: 42vh; }

  /* ---- Toast 抬高，避开底栏与固定操作栏 ---- */
  .toast { bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); }
  .has-answer-foot .toast { bottom: calc(var(--tabbar-h) + 76px + env(safe-area-inset-bottom)); }
  .focus-mode .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* ---- 首页 ---- */
  .hero-card { padding: 20px 18px; border-radius: 18px; }
  .hero-top { gap: 10px; }
  .hero-title { font-size: 21px; }
  .hero-desc { font-size: 12.5px; }
  .hero-top .chip { flex: none; white-space: nowrap; padding: 3px 8px; font-size: 11px; }
  .hero-progress { gap: 18px; margin-top: 16px; }
  .hero-progress .hp-item strong { font-size: 20px; }
  .hero-cta { margin-top: 16px; gap: 8px; flex-wrap: nowrap; }
  .hero-cta .btn { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 8px; font-size: 12.5px; }
  .hero-cta .btn svg { width: 15px; height: 15px; }
  .streak-chip { white-space: nowrap; }
  .chapter-grid { grid-template-columns: 1fr; gap: 10px; }
  .chapter-card { padding: 15px 16px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 14px 14px; }
  .stat-card .stat-value { font-size: 23px; }
  .grid-2 { grid-template-columns: 1fr; }

  /* ---- 错题本 / 收藏 / 题库列表 ---- */
  .wrong-summary { gap: 8px; }
  .wrong-item { padding: 12px; gap: 10px; }
  .wi-side { flex-direction: row; align-items: center; }
  .star-btn { width: 36px; height: 36px; }
  .star-btn svg { width: 18px; height: 18px; }
  .qr-meta { gap: 6px; }
  .qr-opts { gap: 6px 12px; }
  .pager { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .pager .pager-jump { width: 100%; justify-content: center; }
  .input-page { width: 64px; }

  /* ---- 表单：16px 避免移动浏览器聚焦时自动放大 ---- */
  .input, .select, textarea.input { font-size: 16px; }
}

@media (max-width: 370px) {
  .mb-bank-label { display: none; }
  .mb-brand strong { display: none; }
}

