/* ══════════════════════════ Udemy 风格设计令牌 ══════════════════════════
   参照 Udemy 课程播放器与练习测验的视觉语言：
   紫色主色 #A435F0 / 近黑顶栏 #1C1D1F / 1px 灰边 #D1D7DC / 4px 小圆角 /
   标题与按钮统一 700 字重 / 不用阴影，靠描边分层。                        */
:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F7F9FA;
  --surface-3: #E9EDF0;
  --ink: #1C1D1F;
  --ink-2: #3E4143;
  --ink-3: #6A6F73;
  --line: #D1D7DC;
  --line-2: #B6BFC4;
  --accent: #A435F0;
  --accent-dark: #8710D8;
  --accent-ink: #FFFFFF;
  --accent-soft: #F3E9FD;
  --ok: #0E6E4E;
  --ok-soft: #E3F4EC;
  --bad: #B4170A;
  --bad-soft: #FDECE9;
  --warn: #8B5A00;
  --warn-soft: #FDF3E2;
  --mark: #B4690E;
  --radius: 4px;
  --shadow: none;
  --shadow-lg: 0 2px 12px rgba(28,29,31,.28);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --topbar-bg: #1C1D1F;
  --topbar-ink: #FFFFFF;
  --topbar-ink-2: #C0C4C7;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #141416;
  --surface: #1C1D1F;
  --surface-2: #26272B;
  --surface-3: #33353A;
  --ink: #F2F3F5;
  --ink-2: #C7CBCE;
  --ink-3: #9096A0;
  --line: #3A3C41;
  --line-2: #4C4F56;
  --accent: #C38BF7;
  --accent-dark: #A435F0;
  --accent-ink: #1C1D1F;
  --accent-soft: #2E2140;
  --ok: #4FC08A;
  --ok-soft: #14301F;
  --bad: #F08A7E;
  --bad-soft: #351A16;
  --warn: #E0AC5B;
  --warn-soft: #33260F;
  --mark: #E0AC5B;
  --shadow-lg: 0 2px 16px rgba(0,0,0,.6);
  --topbar-bg: #000000;
  --topbar-ink: #FFFFFF;
  --topbar-ink-2: #A8ADB3;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Udemy Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Noto Sans SC", "Hiragino Sans", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ══════════════════════════ 顶栏（Udemy 播放器同款近黑条） ══════════════════════════ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 20px; height: 56px;
  background: var(--topbar-bg); color: var(--topbar-ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 4px;
  background: var(--accent); color: #FFF; font-size: 11px; font-weight: 800; letter-spacing: .02em;
}
.brand-text { font-size: 15px; color: var(--topbar-ink); }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.seg { display: inline-flex; background: rgba(255,255,255,.12); border-radius: 4px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--topbar-ink-2); cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 3px; white-space: nowrap;
}
.seg button:hover { color: #FFF; }
.seg button[aria-pressed="true"] { background: #FFF; color: #1C1D1F; }

/* 复盘页里的 seg 在浅色背景上，需要反过来配色 */
.filters .seg { background: var(--surface-2); border: 1px solid var(--line); padding: 3px; }
.filters .seg button { color: var(--ink-2); }
.filters .seg button:hover { color: var(--ink); background: var(--surface-3); }
.filters .seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg-wide button { padding: 7px 15px; font-size: 14px; }

.icon-btn {
  border: 1px solid transparent; background: transparent; color: var(--topbar-ink-2);
  width: 32px; height: 32px; border-radius: 4px; cursor: pointer; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255,255,255,.14); color: #FFF; }
.run-head .icon-btn, .sheet .icon-btn, .overtime .icon-btn { color: var(--ink-3); }
.run-head .icon-btn:hover, .sheet .icon-btn:hover, .overtime .icon-btn:hover {
  background: var(--surface-2); color: var(--ink);
}

/* ══════════════════════════ 布局 ══════════════════════════ */
.wrap { max-width: 1160px; margin: 0 auto; padding: 32px 24px 80px; }
.wrap-narrow { max-width: 800px; }
.page-head { margin-bottom: 24px; }
.page-head .sub { color: var(--ink-3); margin-top: 8px; font-size: 15px; }
.section-title { margin: 34px 0 14px; font-size: 19px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px;
}
.back-link {
  display: inline-block; color: var(--accent); text-decoration: none;
  font-size: 14px; font-weight: 700; margin-bottom: 16px;
}
.back-link:hover { color: var(--accent-dark); text-decoration: underline; }
.foot-note { margin-top: 12px; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.center-box { text-align: center; padding-top: 96px; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: var(--radius); padding: 10px 18px; font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #FFF; }
.btn-danger:hover { filter: brightness(1.12); background: var(--bad); }
.btn-ghost { border-color: var(--ink); background: transparent; }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link-btn {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 700; padding: 6px 4px;
  text-decoration: underline; text-underline-offset: 4px;
}
.link-btn:hover { color: var(--ink); }
.link-btn.finish { color: var(--accent); }
.link-btn.finish:hover { color: var(--accent-dark); }

/* ══════════════════════════ ① 清单 ══════════════════════════ */
.lib-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.lib-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; min-width: 140px;
}
.lib-stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.lib-stat span { color: var(--ink-3); font-size: 12px; }

.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.test-card {
  display: block; text-align: left; text-decoration: none; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; font: inherit; color: inherit; position: relative;
}
.test-card:hover { border-color: var(--accent); background: var(--surface-2); }
.test-card h3 { margin-bottom: 5px; }
.test-card .tsub { color: var(--ink-3); font-size: 13px; }
.test-card .tmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.test-card .tbest { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.test-card .tbest .pct { font-weight: 700; }
.done-badge {
  position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok); color: #FFF; display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

.tag {
  display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: 11.5px; font-weight: 700;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.tag-multi { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-num { background: var(--ink); color: var(--bg); border-color: transparent; }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag-inline { display: contents; }
.tag-lang { background: var(--accent-soft); color: var(--accent-dark); border-color: transparent; }
.tag-oe { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* ══════════════════════════ ② 信息页 ══════════════════════════ */
.meta-row { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; color: var(--ink-3); font-size: 14px; }
.meta-row b { color: var(--ink); font-weight: 700; }
.prose { line-height: 1.75; color: var(--ink-2); font-size: 15px; }
.prose h4 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--ink); }
.prose h4 ~ h4 { margin-top: 18px; }
.prose ul { margin: 0; padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose li:last-child { margin-bottom: 0; }
.info-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

.info-note {
  background: var(--accent-soft); color: var(--ink-2); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px; font-size: 14px; line-height: 1.7;
  border-left: 4px solid var(--accent);
}
.resume-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--warn-soft); border-left: 4px solid var(--mark); border-radius: var(--radius);
  padding: 15px 18px; margin-bottom: 16px; font-size: 14px;
}
.resume-banner strong { display: block; color: var(--ink); font-weight: 700; }
.resume-banner span { color: var(--ink-2); font-size: 13px; }
.resume-actions { display: flex; gap: 10px; }

.attempt {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px; overflow: hidden;
}
.attempt-head {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 18px;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.attempt-head:hover { background: var(--surface-2); }
.attempt-score { font-size: 21px; font-weight: 700; min-width: 66px; letter-spacing: -.03em; }
.attempt-main { flex: 1; min-width: 0; }
.attempt-main .l1 { font-size: 14.5px; font-weight: 700; }
.attempt-main .l2 { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.attempt-caret { color: var(--ink-3); font-size: 12px; }
.attempt-body { padding: 0 18px 18px; border-top: 1px solid var(--line); }
.attempt-bar { display: flex; height: 8px; border-radius: 2px; overflow: hidden; margin: 16px 0 12px; }
.attempt-bar i { display: block; height: 100%; }
.seg-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.seg-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.attempt-actions { margin-top: 16px; display: flex; gap: 10px; }
.empty {
  border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 30px;
  text-align: center; color: var(--ink-3); font-size: 14px;
}

/* ══════════════════════════ ③ 模式选择 ══════════════════════════ */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.mode-card {
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
}
.mode-card:hover { border-color: var(--accent); background: var(--surface-2); }
.mode-icon { font-size: 24px; margin-bottom: 12px; }
.mode-card h3 { margin-bottom: 8px; }
.mode-card > p { color: var(--ink-2); font-size: 14px; }
.mode-params {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 16px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.mode-params > div { min-width: 0; }
.mode-params dt {
  color: var(--ink-3); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}
.mode-params dd { margin: 3px 0 0; font-size: 15px; font-weight: 700; }
.mode-go { color: var(--accent); font-size: 14px; font-weight: 700; }
.opt-title { margin-bottom: 5px; }
.opt-hint { color: var(--ink-3); font-size: 13.5px; margin-bottom: 14px; }
.opt-count { margin-top: 14px; font-size: 13.5px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  border-radius: var(--radius); padding: 7px 14px; font: inherit; font-size: 13px;
  font-weight: 700; cursor: pointer;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip small { opacity: .75; margin-left: 5px; font-weight: 400; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; }
.switch-row input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--accent); }
.switch-row strong { display: block; font-size: 14.5px; font-weight: 700; }
.switch-row em { color: var(--ink-3); font-size: 13px; font-style: normal; }

/* ══════════════════════════ ④ 答题页 ══════════════════════════ */
.screen-run { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }
.run-head {
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 56px; z-index: 30;
}
.run-head-inner {
  max-width: 1000px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 18px;
}
.qcount {
  font-size: 13.5px; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.progress { flex: 1; height: 6px; background: var(--surface-3); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); width: 0; transition: width .18s ease; }
.run-timer { display: flex; align-items: center; gap: 4px; }
.clock { font: 700 14.5px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.clock.low { color: var(--bad); }
.overtime {
  background: var(--warn-soft); color: var(--warn); font-size: 13.5px;
  padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line);
}
.overtime strong { color: inherit; font-weight: 700; }

.run-body { flex: 1; overflow-y: auto; }
.q-wrap { max-width: 1000px; margin: 0 auto; padding: 30px 24px 44px; }
.q-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.star-btn {
  margin-left: auto; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  border-radius: var(--radius); padding: 6px 13px; font: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.star-btn:hover { border-color: var(--ink); color: var(--ink); }
.star-btn[aria-pressed="true"] { border-color: var(--mark); color: var(--mark); background: var(--warn-soft); }
.star-btn[aria-pressed="true"] .star::before { content: "★"; }
.star-btn .star::before { content: "☆"; }
.star-btn .star { font-size: 15px; }
.star { line-height: 1; }

.q-stem { font-size: 17px; line-height: 1.75; margin-bottom: 24px; white-space: pre-wrap; word-break: break-word; }
.q-options { display: flex; flex-direction: column; gap: 12px; }
.opt {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; font: inherit; font-size: 15px; line-height: 1.65; color: inherit; cursor: pointer;
}
.opt:hover { border-color: var(--ink); background: var(--surface-2); }
.opt-box {
  flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px;
  border: 2px solid var(--ink-3); display: grid; place-items: center;
  font-size: 11px; color: transparent; background: var(--surface);
}
.opt-box.radio { border-radius: 50%; }
.opt-box.check { border-radius: 3px; }
.opt[aria-pressed="true"] { border-color: var(--ink); background: var(--surface-2); }
.opt[aria-pressed="true"] .opt-box { border-color: var(--accent); background: var(--accent); color: #FFF; }
.opt-key { font: 700 13px/1.5 var(--mono); color: var(--ink-3); flex: 0 0 auto; }
.opt-text { flex: 1; min-width: 0; word-break: break-word; }
.opt.locked { cursor: default; }
.opt.locked:hover { background: var(--surface); border-color: var(--line); }
.opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.is-correct .opt-box { border-color: var(--ok); background: var(--ok); color: #FFF; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.is-wrong .opt-box { border-color: var(--bad); background: var(--bad); color: #FFF; }
.opt-flag { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; align-self: center; }
.opt.is-correct .opt-flag { color: var(--ok); }
.opt.is-wrong .opt-flag { color: var(--bad); }

.opt-oe {
  margin: -6px 0 4px 34px; padding: 12px 16px; border-radius: 0 0 var(--radius) var(--radius);
  border-left: 4px solid var(--line-2); background: var(--surface-2);
  font-size: 13.5px; line-height: 1.75; color: var(--ink-2);
  display: flex; gap: 10px; align-items: flex-start;
}
.opt-oe.oe-ok { border-left-color: var(--ok); }
.opt-oe.oe-bad { border-left-color: var(--bad); }
.oe-verdict {
  flex: 0 0 auto; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 3px;
  background: var(--surface-3); color: var(--ink-2);
}
.oe-ok .oe-verdict { background: var(--ok-soft); color: var(--ok); }
.oe-bad .oe-verdict { background: var(--bad-soft); color: var(--bad); }
.oe-text { flex: 1; min-width: 0; word-break: break-word; }

.q-explain {
  margin-top: 24px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px;
}
.q-explain h4 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .06em;
}
.q-explain .x-text {
  font-size: 14.5px; line-height: 1.8; white-space: pre-wrap;
  color: var(--ink-2); word-break: break-word;
}
.refs { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.ref-link {
  font-size: 12.5px; font-weight: 700; text-decoration: none; border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 5px 12px; color: var(--ink-2); background: var(--surface);
}
.ref-link:hover { border-color: var(--accent); color: var(--accent); }

.run-foot {
  position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.run-foot-right { display: flex; gap: 12px; }

/* 浮层 */
.sheet {
  position: fixed; inset: 0; z-index: 60; background: rgba(28,29,31,.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sheet-panel {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  width: min(660px, 100%); max-height: min(78vh, 720px); display: flex; flex-direction: column;
}
.sheet-sm { width: min(500px, 100%); }
.sheet-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { flex: 1; }
.sheet-head select, .filters select, .filters input {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  border-radius: var(--radius); padding: 8px 11px; font: inherit; font-size: 13.5px;
}
.sheet-body { padding: 20px; overflow-y: auto; font-size: 14.5px; line-height: 1.7; color: var(--ink-2); }
.sheet-foot {
  padding: 16px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 12px;
}
.sheet-legend {
  display: flex; gap: 18px; padding: 11px 20px; font-size: 12px; color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.dot-done { background: var(--accent); }
.dot-todo { background: var(--surface-3); border: 1px solid var(--line-2); }
.dot-mark { background: var(--mark); }

.nav-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px; padding: 18px 20px; overflow-y: auto;
}
.nav-cell {
  position: relative; aspect-ratio: 1; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink-2); font: 700 13.5px/1 inherit; cursor: pointer;
  display: grid; place-items: center;
}
.nav-cell:hover { border-color: var(--ink); color: var(--ink); }
.nav-cell.done { background: var(--accent); border-color: var(--accent); color: #FFF; }
.nav-cell.cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.nav-cell .nstar { position: absolute; top: 1px; right: 3px; font-size: 10px; color: var(--mark); }
.nav-cell.done .nstar { color: #FFE08A; }

.pause-veil {
  position: absolute; inset: 0; z-index: 50;
  background: var(--bg); display: grid; place-items: center; padding: 24px;
}
.pause-box { text-align: center; max-width: 440px; }
.pause-icon { font-size: 36px; margin-bottom: 14px; }
.pause-box h2 { margin-bottom: 10px; }
.pause-box p { color: var(--ink-3); font-size: 14.5px; margin-bottom: 24px; }

.submit-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.submit-stat:last-child { border-bottom: 0; }
.submit-stat b { font-weight: 700; color: var(--ink); }
.submit-warn {
  margin-top: 16px; background: var(--warn-soft); color: var(--warn);
  border-left: 4px solid var(--mark); border-radius: var(--radius); padding: 13px 15px; font-size: 13.5px;
}

/* ══════════════════════════ ⑤ 成绩页 ══════════════════════════ */
.result-hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; margin-bottom: 16px;
}
.hero-top { display: flex; align-items: center; gap: 30px; flex-wrap: wrap; }
.ring { position: relative; width: 140px; height: 140px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.15; }
.ring-label b { font-size: 32px; font-weight: 700; letter-spacing: -.04em; }
.ring-label span { display: block; font-size: 11px; color: var(--ink-3); font-weight: 700; }
.hero-main { flex: 1; min-width: 250px; }
.verdict { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.verdict.pass { color: var(--ok); }
.verdict.fail { color: var(--bad); }
.hero-sub { color: var(--ink-3); font-size: 14px; }
.hero-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 14px; margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line);
}
.hero-stat b { display: block; font-size: 23px; font-weight: 700; letter-spacing: -.03em; }
.hero-stat span { color: var(--ink-3); font-size: 12px; }
.delta { font-size: 13px; font-weight: 700; margin-top: 10px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.result-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.result-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.dbar { margin-bottom: 14px; }
.dbar:last-child { margin-bottom: 0; }
.dbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 6px; }
.dbar-top span { color: var(--ink-2); }
.dbar-top b { font-variant-numeric: tabular-nums; font-weight: 700; }
.dbar-track { height: 8px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.dbar-fill { height: 100%; border-radius: 2px; }

/* ══════════════════════════ ⑥ 复盘页 ══════════════════════════ */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { flex: 1; min-width: 190px; }
.result-count { color: var(--ink-3); font-size: 13.5px; margin-bottom: 14px; }
.rv {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 12px; overflow: hidden;
}
.rv.correct { border-left: 4px solid var(--ok); }
.rv.incorrect { border-left: 4px solid var(--bad); }
.rv.skipped { border-left: 4px solid var(--line-2); }
.rv-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px 20px;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.rv-head:hover { background: var(--surface-2); }
.rv-head .rv-q {
  flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rv-body { padding: 4px 20px 22px; }
.rv-body .q-stem { font-size: 15.5px; margin: 12px 0 20px; }
.rv-tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ══════════════════════════ 其他 ══════════════════════════ */
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; margin: 0 auto 16px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; box-shadow: var(--shadow-lg); max-width: 90vw;
}
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 11px 20px; margin: 0; }
.kbd-list dt { white-space: nowrap; }
.kbd-list dd { margin: 0; color: var(--ink-2); font-size: 13.5px; }
kbd {
  display: inline-block; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px;
  padding: 1px 6px; font: 700 12px/1.5 var(--mono); background: var(--surface-2); color: var(--ink);
}

@media (max-width: 760px) {
  h1 { font-size: 24px; }
  .mode-grid, .result-cols { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .seg button { padding: 5px 9px; font-size: 12px; }
  .wrap { padding: 22px 16px 64px; }
  .q-wrap { padding: 22px 16px 34px; }
  .run-head-inner { padding: 10px 16px; gap: 12px; }
  .run-foot { padding: 12px 16px; }
  .run-foot .btn { padding: 10px 13px; }
  .star-btn .star-label { display: none; }
  .hero-top { gap: 20px; }
  .ring { width: 110px; height: 110px; }
  .opt-oe { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══════════════════════════ 触屏适配 ══════════════════════════
   窄屏或触控指针下，把所有可点控件撑到 ≥44px 的可点区域。
   桌面鼠标不受影响，视觉密度保持不变。                              */
@media (max-width: 760px), (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; font-size: 17px; }
  .seg { padding: 3px; }
  .seg button { padding: 10px 12px; min-height: 40px; }
  .brand { min-height: 44px; }
  .link-btn {
    min-height: 44px; padding: 10px 8px;
    display: inline-flex; align-items: center;
  }
  .star-btn { min-height: 40px; padding: 9px 14px; }
  .chip { min-height: 42px; padding: 10px 15px; }
  .nav-cell { min-height: 48px; font-size: 15px; }
  .attempt-head, .rv-head { padding-top: 18px; padding-bottom: 18px; }
  .switch-row { padding: 13px 0; }
  .switch-row input { width: 20px; height: 20px; }
  .btn { min-height: 44px; }
  .filters select, .filters input, .sheet-head select { min-height: 44px; }
  .opt { padding: 16px; }
  .ref-link { min-height: 36px; display: inline-flex; align-items: center; }
}

/* 顶栏在很窄的屏幕上要让出空间：语言切换只留当前项的缩写 */
@media (max-width: 420px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .seg button { padding: 9px 9px; font-size: 12px; }
  .run-head-inner { gap: 10px; }
  .q-wrap { padding: 20px 14px 32px; }
  .wrap { padding: 20px 14px 56px; }
  .run-foot { padding: 10px 14px; gap: 8px; }
  .run-foot-right { gap: 8px; }
  .run-foot .btn { padding: 11px 12px; font-size: 13.5px; }
}

/* ══════════════════════════ Google 登录 ══════════════════════════ */
.auth-box { position: relative; display: flex; align-items: center; }
.btn-google {
  display: inline-flex; align-items: center; gap: 8px;
  background: #FFF; color: #1C1D1F; border: 1px solid #DADCE0;
  border-radius: var(--radius); padding: 8px 14px;
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-google:hover { background: #F5F6F7; }
.btn-google svg { flex: 0 0 auto; }

.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.12); color: var(--topbar-ink);
  border: 0; border-radius: 20px; padding: 4px 12px 4px 4px;
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; max-width: 170px;
}
.user-chip:hover { background: rgba(255,255,255,.2); }
.user-chip img { border-radius: 50%; flex: 0 0 auto; background: var(--surface-3); }
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 70;
  min-width: 232px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; text-align: left;
}
.um-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.um-head strong { display: block; font-size: 14px; font-weight: 700; }
.um-head span { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; }
.um-sync {
  padding: 6px 12px 10px; color: var(--ink-3); font-size: 12px;
}
.um-item {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  border-radius: 3px; padding: 10px 12px; font: inherit; font-size: 13.5px;
  font-weight: 700; color: var(--ink); cursor: pointer;
}
.um-item:hover { background: var(--surface-2); }
.um-danger { color: var(--bad); }

@media (max-width: 760px), (pointer: coarse) {
  .btn-google { min-height: 40px; }
  .user-chip { min-height: 40px; }
  .um-item { min-height: 44px; }
}
@media (max-width: 560px) {
  .btn-google span { display: none; }
  .btn-google { padding: 8px 10px; }
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }
}
