/* ============================================================
   AI 应用开发 · 刷题  —  样式表
   零依赖 / 系统字体栈 / 亮暗双主题
   ============================================================ */

/* ---------- 1. 设计令牌 ---------- */

:root {
  /* 亮色（默认） */
  --bg:            #f6f7f9;
  --bg-grad:       radial-gradient(1200px 520px at 50% -10%, #e8edff 0%, rgba(232,237,255,0) 60%);
  --surface:       #ffffff;
  --surface-2:     #f2f4f7;
  --surface-3:     #e9ecf1;
  --border:        #e3e6ec;
  --border-strong: #ccd2dd;
  --text:          #16181d;
  --text-dim:      #5c6470;
  --text-faint:    #8b93a1;

  --accent:        #3b6ef6;
  --accent-soft:   rgba(59,110,246,.10);
  --accent-fg:     #ffffff;

  --green:         #14915b;
  --green-soft:    rgba(20,145,91,.11);
  --red:           #d4283b;
  --red-soft:      rgba(212,40,59,.10);
  --yellow:        #a9700a;
  --yellow-soft:   rgba(214,150,20,.15);
  --purple:        #7a45d8;
  --purple-soft:   rgba(122,69,216,.11);
  --orange:        #c2620b;
  --orange-soft:   rgba(216,116,20,.13);
  --blue:          #2563d8;
  --blue-soft:     rgba(37,99,216,.11);

  --shadow-sm:  0 1px 2px rgba(16,20,30,.05), 0 1px 3px rgba(16,20,30,.05);
  --shadow-md:  0 2px 4px rgba(16,20,30,.04), 0 8px 24px rgba(16,20,30,.07);
  --shadow-lg:  0 4px 10px rgba(16,20,30,.06), 0 20px 48px rgba(16,20,30,.10);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --tap: 44px;
  --maxw: 1080px;
  --ease: cubic-bezier(.22,.68,.32,1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* 暗色：跟随系统 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0d0f13;
    --bg-grad:       radial-gradient(1200px 520px at 50% -10%, #182444 0%, rgba(24,36,68,0) 60%);
    --surface:       #161a21;
    --surface-2:     #1d222b;
    --surface-3:     #262c37;
    --border:        #272d38;
    --border-strong: #3a4250;
    --text:          #e8ecf3;
    --text-dim:      #a2abba;
    --text-faint:    #737d8d;

    --accent:        #5b8bff;
    --accent-soft:   rgba(91,139,255,.14);
    --accent-fg:     #0b1020;

    --green:         #35d08a;
    --green-soft:    rgba(53,208,138,.13);
    --red:           #ff6b7d;
    --red-soft:      rgba(255,107,125,.13);
    --yellow:        #f0c14b;
    --yellow-soft:   rgba(240,193,75,.14);
    --purple:        #b18bff;
    --purple-soft:   rgba(177,139,255,.14);
    --orange:        #ffa657;
    --orange-soft:   rgba(255,166,87,.14);
    --blue:          #6ba2ff;
    --blue-soft:     rgba(107,162,255,.14);

    --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
    --shadow-md:  0 2px 6px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.35);
    --shadow-lg:  0 6px 14px rgba(0,0,0,.4), 0 24px 56px rgba(0,0,0,.45);
  }
}

/* 手动覆盖：亮 */
:root[data-theme="light"] {
  --bg:            #f6f7f9;
  --bg-grad:       radial-gradient(1200px 520px at 50% -10%, #e8edff 0%, rgba(232,237,255,0) 60%);
  --surface:       #ffffff;
  --surface-2:     #f2f4f7;
  --surface-3:     #e9ecf1;
  --border:        #e3e6ec;
  --border-strong: #ccd2dd;
  --text:          #16181d;
  --text-dim:      #5c6470;
  --text-faint:    #8b93a1;
  --accent:        #3b6ef6;
  --accent-soft:   rgba(59,110,246,.10);
  --accent-fg:     #ffffff;
  --green:         #14915b;  --green-soft:  rgba(20,145,91,.11);
  --red:           #d4283b;  --red-soft:    rgba(212,40,59,.10);
  --yellow:        #a9700a;  --yellow-soft: rgba(214,150,20,.15);
  --purple:        #7a45d8;  --purple-soft: rgba(122,69,216,.11);
  --orange:        #c2620b;  --orange-soft: rgba(216,116,20,.13);
  --blue:          #2563d8;  --blue-soft:   rgba(37,99,216,.11);
  --shadow-sm:  0 1px 2px rgba(16,20,30,.05), 0 1px 3px rgba(16,20,30,.05);
  --shadow-md:  0 2px 4px rgba(16,20,30,.04), 0 8px 24px rgba(16,20,30,.07);
  --shadow-lg:  0 4px 10px rgba(16,20,30,.06), 0 20px 48px rgba(16,20,30,.10);
  color-scheme: light;
}

/* 手动覆盖：暗 */
:root[data-theme="dark"] {
  --bg:            #0d0f13;
  --bg-grad:       radial-gradient(1200px 520px at 50% -10%, #182444 0%, rgba(24,36,68,0) 60%);
  --surface:       #161a21;
  --surface-2:     #1d222b;
  --surface-3:     #262c37;
  --border:        #272d38;
  --border-strong: #3a4250;
  --text:          #e8ecf3;
  --text-dim:      #a2abba;
  --text-faint:    #737d8d;
  --accent:        #5b8bff;
  --accent-soft:   rgba(91,139,255,.14);
  --accent-fg:     #0b1020;
  --green:         #35d08a;  --green-soft:  rgba(53,208,138,.13);
  --red:           #ff6b7d;  --red-soft:    rgba(255,107,125,.13);
  --yellow:        #f0c14b;  --yellow-soft: rgba(240,193,75,.14);
  --purple:        #b18bff;  --purple-soft: rgba(177,139,255,.14);
  --orange:        #ffa657;  --orange-soft: rgba(255,166,87,.14);
  --blue:          #6ba2ff;  --blue-soft:   rgba(107,162,255,.14);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --shadow-md:  0 2px 6px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.35);
  --shadow-lg:  0 6px 14px rgba(0,0,0,.4), 0 24px 56px rgba(0,0,0,.45);
  color-scheme: dark;
}

/* ---------- 2. 基础 ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;          /* 移动端绝不横向滚动 */
}

body {
  background: var(--bg-grad), var(--bg);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 18px 72px;
  padding-left:  max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 3. 通用按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform .16s var(--ease), background-color .16s var(--ease),
              border-color .16s var(--ease), box-shadow .16s var(--ease), opacity .16s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-fg);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); border-color: transparent; }

.btn-ghost { background: transparent; box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; border-radius: var(--r-sm); }

.btn-icon {
  width: var(--tap); height: var(--tap);
  min-height: var(--tap);
  padding: 0;
  border-radius: var(--r-md);
  font-size: 18px;
  line-height: 1;
}

/* ---------- 4. 首页 · 头部 ---------- */

.head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 12px 0 26px;
}
.head-text { flex: 1 1 auto; min-width: 0; }
.head h1 {
  margin: 0;
  font-size: clamp(24px, 5.2vw, 33px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.head h1 .dot { color: var(--accent); }
.head p {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 14.5px;
}

/* ---------- 5. 总览统计 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 26px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.stat-v {
  font-size: clamp(20px, 4.6vw, 26px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.stat-k {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat.is-wrong .stat-v { color: var(--red); }
.stat.is-acc   .stat-v { color: var(--green); }

/* ---------- 6. 章节卡片 ---------- */

.sec-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  width: 100%;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card:active { transform: translateY(-1px); }

.card-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.card-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  font-size: 21px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.card-h { min-width: 0; flex: 1 1 auto; }
.card-h b {
  display: block;
  font-size: 16.5px;
  font-weight: 650;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.card-h span { font-size: 12.5px; color: var(--text-faint); }

.bar {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  transition: width .5s var(--ease);
}
.bar.is-done > i { background: linear-gradient(90deg, var(--green), var(--accent)); }

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.card-meta .acc { font-weight: 600; }

/* ---------- 7. 全局入口 ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.actions .btn { flex: 1 1 190px; }

.hint {
  margin: 12px 2px 0;
  font-size: 12.5px;
  color: var(--text-faint);
}
.hint kbd {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.empty {
  padding: 44px 22px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  color: var(--text-dim);
}
.empty b { display: block; font-size: 17px; color: var(--text); margin-bottom: 8px; }
.empty code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
}

/* ---------- 8. 答题页 · 顶栏 ---------- */

.qtop { margin-bottom: 18px; }
.qtop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.qtop-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 620;
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qtop-prog {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text-dim);
}
.qtop-prog b { color: var(--text); font-size: 16px; }

/* ---------- 9. 题目卡 ---------- */

.qcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 22px;
  animation: slide-in .32s var(--ease);
}
@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-single   { color: var(--blue);   background: var(--blue-soft);   border-color: var(--blue-soft); }
.badge-multiple { color: var(--purple); background: var(--purple-soft); border-color: var(--purple-soft); }
.badge-fill     { color: var(--orange); background: var(--orange-soft); border-color: var(--orange-soft); }
.badge-easy     { color: var(--green);  background: var(--green-soft);  border-color: var(--green-soft); }
.badge-medium   { color: var(--yellow); background: var(--yellow-soft); border-color: var(--yellow-soft); }
.badge-hard     { color: var(--red);    background: var(--red-soft);    border-color: var(--red-soft); }
.badge-sec {
  color: var(--text-faint);
  background: transparent;
  border-color: var(--border);
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stem {
  font-size: clamp(17px, 3.6vw, 20px);
  font-weight: 560;
  line-height: 1.7;
  letter-spacing: -.005em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 20px;
}

/* 行内填空 */
.fill-inline {
  display: inline-block;
  min-width: 130px;
  max-width: 100%;
  min-height: 38px;
  margin: 0 4px;
  padding: 2px 10px;
  font-size: .94em;
  font-weight: 600;
  color: var(--orange);
  text-align: center;
  background: var(--orange-soft);
  border: none;
  border-bottom: 2px solid var(--orange);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: box-shadow .16s var(--ease);
}
.fill-inline::placeholder { color: var(--text-faint); font-weight: 400; }
.fill-inline:focus { outline: none; box-shadow: 0 0 0 3px var(--orange-soft); }
.fill-inline:disabled { opacity: 1; -webkit-text-fill-color: var(--orange); }

/* 填空判定态 */
.fill-inline.is-correct {
  color: var(--green);
  background: var(--green-soft);
  border-bottom-color: var(--green);
  -webkit-text-fill-color: var(--green);
}
.fill-inline.is-wrong {
  color: var(--red);
  background: var(--red-soft);
  border-bottom-color: var(--red);
  -webkit-text-fill-color: var(--red);
  text-decoration: line-through;
}

.fill-standalone { margin: 0 0 18px; }
.fill-standalone .fill-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.fill-standalone .fill-inline {
  display: block;
  width: 100%;
  margin: 0;
  min-height: var(--tap);
  text-align: left;
  font-size: 16px;
  border: 1px solid var(--border-strong);
  border-bottom: 2px solid var(--orange);
  border-radius: var(--r-md);
}

/* ---------- 10. 选项 ---------- */

.opts { display: flex; flex-direction: column; gap: 10px; }

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 11px 14px;
  text-align: left;
  background: var(--surface-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  transition: background-color .16s var(--ease), border-color .16s var(--ease),
              transform .16s var(--ease), color .16s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(:disabled):not(.is-picked) { background: var(--surface-3); transform: translateX(2px); }
.opt:active:not(:disabled) { transform: scale(.995); }
.opt:disabled { cursor: default; }

.opt-key {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--text-dim);
  transition: inherit;
}
.opt-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.opt-mark {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

/* 多选：选中未判定 */
.opt.is-picked {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.opt.is-picked .opt-key { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* 判定态 */
.opt.is-correct {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.opt.is-correct .opt-key { background: var(--green); border-color: var(--green); color: #fff; }

.opt.is-wrong {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}
.opt.is-wrong .opt-key { background: var(--red); border-color: var(--red); color: #fff; }

.opt.is-missed {
  background: transparent;
  border-style: dashed;
  border-color: var(--green);
  color: var(--green);
}
.opt.is-missed .opt-key { border-color: var(--green); color: var(--green); }

.opt.is-dim { opacity: .55; }

/* 判定动画 */
@keyframes pulse-ok {
  0%   { transform: scale(1); }
  45%  { transform: scale(1.022); }
  100% { transform: scale(1); }
}
@keyframes shake-no {
  0%, 100% { transform: translateX(0); }
  18%  { transform: translateX(-6px); }
  38%  { transform: translateX(5px); }
  58%  { transform: translateX(-3px); }
  80%  { transform: translateX(2px); }
}
.anim-ok { animation: pulse-ok .3s var(--ease); }
.anim-no { animation: shake-no .3s var(--ease); }

.submit-row { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.submit-row .btn { flex: 1 1 auto; }

/* ---------- 11. 解析卡 ---------- */

.exp {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  animation: expand .34s var(--ease);
  overflow: hidden;
}
@keyframes expand {
  from { opacity: 0; transform: translateY(-6px); max-height: 0; padding-top: 0; padding-bottom: 0; }
  to   { opacity: 1; transform: none; max-height: 1400px; }
}
.exp.is-ok { border-color: var(--green); background: var(--green-soft); }
.exp.is-no { border-color: var(--red);   background: var(--red-soft); }

.exp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.exp.is-ok .exp-head { color: var(--green); }
.exp.is-no .exp-head { color: var(--red); }

.exp-ref {
  margin: 0 0 10px;
  font-size: 14.5px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.exp-ref b { color: var(--green); }

.exp-body {
  margin: 0;
  font-size: 15px;
  line-height: 1.78;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.exp-src {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- 12. 底栏导航 ---------- */

.qnav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.qnav .btn { flex: 1 1 0; }

/* ---------- 13. 结果页 ---------- */

.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 28px 22px;
  text-align: center;
  animation: slide-in .32s var(--ease);
}
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 4px auto 8px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 11; }
.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset .9s var(--ease);
}
.ring-txt {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 2px;
}
.ring-pct {
  font-size: 40px; font-weight: 750; letter-spacing: -.03em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring-sub { font-size: 12.5px; color: var(--text-faint); }

.result h2 { margin: 6px 0 4px; font-size: 21px; font-weight: 700; letter-spacing: -.015em; }
.result .cheer { margin: 0 auto; max-width: 46ch; color: var(--text-dim); font-size: 14.5px; }
.result .score { margin: 10px 0 0; font-size: 15px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.result .score b { color: var(--text); font-size: 17px; }

.wrongs { margin-top: 26px; text-align: left; }
.wrongs > h3 {
  margin: 0 0 10px;
  font-size: 13px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint);
}
.wrong-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: 8px;
}
.wrong-item p {
  flex: 1 1 auto; min-width: 0; margin: 0;
  font-size: 14.5px; line-height: 1.55;
  overflow-wrap: anywhere;
}
.wrong-item .btn { flex: 0 0 auto; }

.result-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 24px;
}
.result-actions .btn { flex: 1 1 150px; }

/* ---------- 14. 响应式 ---------- */

@media (max-width: 900px) {
  .grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .app { padding: 16px 14px 56px; }
  .grid  { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .qcard { padding: 18px 15px; border-radius: var(--r-lg); }
  .result { padding: 22px 15px; }
  .actions .btn { flex: 1 1 100%; }
  .head { flex-wrap: wrap; }
  .wrong-item { flex-wrap: wrap; }
  .wrong-item .btn { width: 100%; }
  .qtop-name { font-size: 14.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
 * 简答题（type: qa）—— 不判分，点开即看
 * ========================================================== */

.badge-qa { color: var(--purple, #7C5CBF); background: var(--purple-soft, rgba(124,92,191,.12));
            border-color: var(--purple-soft, rgba(124,92,191,.12)); }

.qa-veil {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  padding: 20px; border: 1px dashed var(--line-2, var(--line));
  border-radius: 12px; background: var(--surface-2, transparent);
}
.qa-hint { margin: 0; color: var(--muted); font-size: 14px; }

.qa-ans { margin-top: 4px; }

/* 一句话答案：衬线体拉开层次 —— 这是面试时真正开口说的那句 */
.qa-one {
  font-family: Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  font-size: 17px; line-height: 1.7; color: var(--text);
  border-left: 3px solid var(--accent, var(--blue));
  padding: 2px 0 2px 15px; margin: 0 0 16px;
}
.qa-body { color: var(--text-2, var(--muted)); font-size: 15px; line-height: 1.75; }
.qa-body p  { margin: 0 0 10px; }
.qa-body ul { margin: 0 0 12px; padding-left: 20px; }
.qa-body li { margin-bottom: 5px; }
.qa-body b  { color: var(--text); font-weight: 650; }
.qa-body u  { text-decoration: none; background: linear-gradient(transparent 62%, var(--accent-soft, rgba(124,92,191,.2)) 0); }
.qa-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .1em .4em;
}
.qa-body table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; display: block; overflow-x: auto; }
.qa-body th {
  text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 0 10px 6px; border-bottom: 1px solid var(--line-2, var(--line));
  white-space: nowrap;
}
.qa-body td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.qa-body tr:last-child td { border-bottom: 0; }
.qa-body td:first-child { color: var(--text); }
.qa-body .good { color: var(--green, #2C6E49); }
.qa-body .warn { color: var(--orange, #8A6410); }
.qa-body .bad  { color: var(--red, #A33A2A); }
.qa-body .danger {
  background: var(--red-soft, rgba(163,58,42,.10)); border-left: 3px solid var(--red, #A33A2A);
  padding: 10px 13px; border-radius: 0 6px 6px 0;
}
.qa-body .chain { display: flex; flex-direction: column; margin: 0 0 12px; }
.qa-body .chain-step {
  position: relative; padding: 8px 12px 8px 15px;
  border-left: 2px solid var(--line-2, var(--line));
}
.qa-body .chain-step::before {
  content: ""; position: absolute; left: -5px; top: 16px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2, var(--line));
}

.qa-plus {
  margin-top: 14px; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); font-size: 14px; color: var(--text-2, var(--muted));
}
.qa-plus-h {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent, var(--blue)); font-weight: 700; margin-bottom: 6px;
}
.qa-plus b { color: var(--text); }
.qa-ans .exp-src { display: inline-block; margin-top: 14px; }

/* 「已掌握」标记 —— 简答题专用 */
.qa-veil-btns { display: flex; gap: 10px; flex-wrap: wrap; }

.qa-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.qa-foot .exp-src { margin-top: 0; }

.btn-master {
  font-size: 13.5px; padding: 7px 14px; white-space: nowrap;
}
.btn-master.is-on {
  color: var(--green, #2C6E49);
  background: var(--green-soft, rgba(44,110,73,.12));
  border-color: var(--green-soft, rgba(44,110,73,.28));
  font-weight: 600;
}
.btn-master.is-on:hover { opacity: .85; }

/* 独立的「已掌握」标记按钮 —— 常驻卡片顶部，与答案展开与否无关 */
.badges { align-items: center; }

.master-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line-2, var(--line));
  background: var(--surface, transparent);
  color: var(--muted);
  font-family: inherit; font-size: 12.5px; line-height: 1.4;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.master-btn:hover { color: var(--green, #2C6E49); border-color: var(--green, #2C6E49); }
.master-btn .master-ico { font-size: 12px; line-height: 1; }

.master-btn.is-on {
  color: var(--green, #2C6E49);
  background: var(--green-soft, rgba(44,110,73,.12));
  border-color: transparent;
  font-weight: 600;
}
.master-btn.is-on:hover { opacity: .8; }
.master-btn:focus-visible { outline: 2px solid var(--green, #2C6E49); outline-offset: 2px; }

@media (max-width: 560px) {
  .master-btn { margin-left: 0; }
}

/* ============================================================
 * 简答题作答 + AI 批改
 * ========================================================== */

.qa-input {
  width: 100%; box-sizing: border-box; resize: vertical; min-height: 108px;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line-2, var(--line));
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 15px; line-height: 1.7;
}
.qa-input::placeholder { color: var(--muted); }
.qa-input:focus { outline: none; border-color: var(--blue, #4B62E8);
  box-shadow: 0 0 0 3px var(--blue-soft, rgba(75,98,232,.15)); }
.qa-input:disabled { opacity: .6; }

.qa-input-foot { display: flex; justify-content: flex-end; margin: 6px 0 12px; }
.qa-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.qa-judging {
  display: flex; align-items: center; gap: 9px; margin: 0 0 14px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 14px;
}
.spin {
  width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid var(--line-2, var(--line));
  border-top-color: var(--blue, #4B62E8);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2.4s; } }

.qa-err {
  margin: 0 0 14px; padding: 11px 14px; border-radius: 10px; font-size: 14px;
  background: var(--red-soft, rgba(163,58,42,.10));
  color: var(--red, #A33A2A);
  border-left: 3px solid var(--red, #A33A2A);
}

/* ── 批改结果 ── */
.judge {
  margin: 0 0 14px; padding: 16px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.judge-top { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.judge-score {
  font-size: 30px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.judge-score i { font-size: 14px; font-weight: 500; font-style: normal;
  margin-left: 3px; opacity: .65; }
.judge-verdict { font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }

.judge-a .judge-score, .judge-a .judge-verdict { color: var(--green, #2C6E49); }
.judge-b .judge-score, .judge-b .judge-verdict { color: var(--blue, #4B62E8); }
.judge-c .judge-score, .judge-c .judge-verdict { color: var(--orange, #8A6410); }
.judge-d .judge-score, .judge-d .judge-verdict { color: var(--red, #A33A2A); }
.judge-a .judge-verdict { background: var(--green-soft, rgba(44,110,73,.12)); }
.judge-b .judge-verdict { background: var(--blue-soft, rgba(75,98,232,.12)); }
.judge-c .judge-verdict { background: var(--orange-soft, rgba(138,100,16,.12)); }
.judge-d .judge-verdict { background: var(--red-soft, rgba(163,58,42,.12)); }

.judge-comment { margin: 0 0 14px; font-size: 15px; color: var(--text); line-height: 1.7; }

.judge-sec { margin-bottom: 11px; }
.judge-sec b { display: block; font-size: 11.5px; letter-spacing: .08em;
  margin-bottom: 5px; font-weight: 700; }
.judge-sec ul { margin: 0; padding-left: 19px; font-size: 14px;
  color: var(--text-2, var(--muted)); line-height: 1.7; }
.judge-sec li { margin-bottom: 3px; }
.judge-sec.is-hit b    { color: var(--green,  #2C6E49); }
.judge-sec.is-missed b { color: var(--orange, #8A6410); }
.judge-sec.is-wrong b  { color: var(--red,    #A33A2A); }

.judge-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

/* 详细的问题描述 —— 常驻，说清这题在考什么 */
.qa-detail {
  margin: -4px 0 18px; padding: 11px 14px;
  border-left: 3px solid var(--line-2, var(--line));
  background: var(--surface-2);
  border-radius: 0 8px 8px 0;
  font-size: 14px; line-height: 1.75; color: var(--text-2, var(--muted));
}

/* 答题提示 —— 默认折叠，先自己想，卡住了再点开 */
.qa-tip { margin: 0 0 14px; }
.qa-tip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px dashed var(--line-2, var(--line));
  background: transparent; color: var(--muted);
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.qa-tip-btn:hover { color: var(--orange, #8A6410); border-color: var(--orange, #8A6410); }
.qa-tip.is-open .qa-tip-btn {
  border-style: solid; color: var(--orange, #8A6410);
  border-color: var(--orange-soft, rgba(138,100,16,.3));
  background: var(--orange-soft, rgba(138,100,16,.08));
}
.qa-tip-body {
  margin: 10px 0 0; padding: 12px 14px; border-radius: 8px;
  background: var(--orange-soft, rgba(138,100,16,.08));
  font-size: 14px; line-height: 1.75; color: var(--text-2, var(--muted));
  border-left: 3px solid var(--orange, #8A6410);
}

/* 我的回答 / 参考答案 切换 */
.qa-tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin: 0 0 16px;
  border-radius: 10px; background: var(--surface-2);
}
.qa-tab {
  padding: 7px 16px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.qa-tab:hover { color: var(--text); }
.qa-tab.is-on {
  background: var(--surface); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.qa-tab:focus-visible { outline: 2px solid var(--blue, #4B62E8); outline-offset: 1px; }

/* 已看过答案后，「我的回答」页不需要虚线框那种「未作答」的暗示 */
.qa-veil.is-plain { border: 0; padding: 0; background: transparent; }
