/*
 * NIHSS 本地评估工具 — 视觉样式 v2
 *
 * 设计依据：纸质 NIHSS 记分表。左侧记分栏 = 表格的“项目 | 分值格 | 总分格”列；
 * 主区域左右分为“题目”与“评分”。墨蓝负责结构与文字，钴蓝只用于交互与选中；
 * 自动匹配用深墨蓝填充，UN 用琥珀，不一致用红，完成用绿。
 * 精修（v2.1）：顶部墨色压线如印刷表头；评分量表、分数面板与记录单为仅有的“抬起”工作面（--lift）；
 * 提示类信息统一为左侧色条批注；总分格为双线框。不使用渐变、图标或装饰图形。
 * 全部使用系统字体，不加载外部字体、图片或网络资源。
 */

/* ---------- 设计变量 ---------- */
:root {
  --canvas: #ffffff;
  --paper: #f4f6fa;
  --paper-2: #e9edf5;
  --wash: #f8f9fc;
  --line: #dde2eb;
  --line-2: #c5ccda;

  --ink: #101c33;
  --ink-2: #3a4660;
  --ink-3: #5a6580;

  --cobalt: #2347c5;
  --cobalt-deep: #1b39a3;
  --cobalt-cell: #1d3dae;
  --cobalt-soft: #ebf0fd;
  --cobalt-hover: #f4f7fe;
  --cobalt-line: #b6c4f0;

  --auto: #1b2a4e;
  --auto-cell: #142040;
  --auto-soft: #eef1f7;
  --auto-line: #c3cbdd;

  --un: #8a5300;
  --un-cell: #744600;
  --un-soft: #fcf4e4;
  --un-line: #e8cc94;

  --bad: #b3261e;
  --bad-soft: #fdedeb;
  --bad-line: #f0b9b3;

  --ok: #1d6b45;
  --ok-soft: #e7f3ec;
  --ok-line: #a9d3bb;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-num: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --r-box: 4px;
  --r-btn: 8px;
  --r-panel: 10px;

  /* 工作面抬起：一条极细接触阴影 + 一层柔和环境阴影，只用于主要工作面 */
  --lift: 0 1px 2px rgba(16, 28, 51, 0.05), 0 8px 24px -14px rgba(16, 28, 51, 0.2);
  --press: 0 1px 1px rgba(16, 28, 51, 0.04);

  --topbar-h: 60px;
  --rail-w: 288px;
  --gutter: 48px;
  --tap: 48px;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  scroll-padding-bottom: 96px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  overflow-x: hidden;
}

h1, h2, h3, p, ol, ul, dl, dd, figure, fieldset { margin: 0; }
ol, ul { padding: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--cobalt); text-underline-offset: 3px; }
a:hover { color: var(--cobalt-deep); }
::selection { background: #d5defa; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
.offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  padding: 10px 16px; background: var(--ink); color: #fff;
  border-radius: var(--r-btn); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; color: #fff; }

.noscript {
  margin: 40px auto; max-width: 560px; padding: 20px;
  background: var(--bad-soft); border: 1px solid var(--bad-line);
  border-radius: var(--r-panel); color: var(--bad);
}

/* ---------- 按钮 ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-size: 15.5px; font-weight: 600; letter-spacing: 0.01em;
  line-height: 1.25;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.btn[disabled] { color: var(--ink-3); cursor: not-allowed; }
.btn[aria-disabled="true"] { cursor: not-allowed; }

/* 主按钮：顶部一线高光 + 钴蓝投影，触感明确而不浮夸 */
.btn-primary {
  background: var(--cobalt); color: #fff; border-color: var(--cobalt-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(16, 28, 51, 0.16), 0 6px 14px -8px rgba(35, 71, 197, 0.65);
}
.btn-primary:hover { background: var(--cobalt-deep); }
.btn-primary:active { box-shadow: inset 0 1px 2px rgba(10, 20, 60, 0.3); }

.btn-secondary { background: var(--canvas); color: var(--ink); border-color: var(--line-2); box-shadow: var(--press); }
.btn-secondary:hover { border-color: var(--cobalt-line); background: var(--cobalt-hover); }
.btn-secondary[aria-disabled="true"] { color: var(--ink-2); background: var(--wash); border-color: var(--line); box-shadow: none; }

.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--paper); color: var(--ink); }
.btn-quiet[disabled]:hover { background: transparent; }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #95201a; }

.btn-large { min-height: 60px; padding: 0 28px; font-size: 17px; }
.btn-small { min-height: 44px; padding: 0 14px; font-size: 14.5px; }

.btn-link {
  min-height: 0; padding: 2px 0; border: 0; background: none;
  color: var(--cobalt); font-weight: 600; font-size: inherit;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  white-space: normal; text-align: left;
}
.btn-link:hover { color: var(--cobalt-deep); background: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) auto;
  align-items: stretch;
  min-height: 60px;
  background: var(--canvas);
  /* 印刷表头的墨色压线；高度由脚本同步到 --topbar-h */
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.brand {
  display: flex; flex-direction: column; justify-content: center;
  padding: 8px 20px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  min-width: 0;
}
.brand-title {
  font-size: 16.5px; font-weight: 700; letter-spacing: 0.02em; line-height: 1.3;
  color: var(--ink);
  white-space: nowrap;
}
.brand-note {
  display: flex; flex-wrap: wrap; gap: 0 10px;
  font-size: 12px; line-height: 1.5; color: var(--ink-3);
}
.brand-note span:first-child { font-family: var(--font-num); letter-spacing: 0.01em; }
.brand-note span + span { display: inline-flex; align-items: center; gap: 10px; }
.brand-note span + span::before { content: ""; width: 1px; height: 10px; background: var(--line-2); }

.progress {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 0 8px 0 var(--gutter);
  min-width: 0;
}
.progress-count, .pips { display: none; }
.progress-count {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pips { grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 3px; flex: 1 1 auto; min-width: 0; }
.pip { height: 6px; border-radius: 2px; background: var(--line); transition: background-color .15s ease; }
.pip[data-state="scored"] { background: var(--ink); }
.pip[data-state="scored"][data-auto="true"] { background: var(--auto); }
.pip[data-state="un"] { background: var(--un); }
.pip[data-state="conflict"] { background: var(--bad); }
.pip[data-current="true"] { background: var(--cobalt); transform: scaleY(1.67); }

.top-actions { display: flex; align-items: center; gap: 2px; padding: 0 16px 0 4px; }
.top-actions .btn { min-height: 44px; padding: 0 14px; font-size: 15px; }

/* 状态标签 */
.status-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 11px; min-height: 26px;
  border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--canvas); color: var(--ink-2);
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip[data-status="un_reason_missing"],
.status-chip[data-status="complete_un"] { color: var(--un); border-color: var(--un-line); background: var(--un-soft); }
.status-chip[data-status="invalid"],
.status-chip[data-status="inconsistent"] { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.status-chip[data-status="complete"] { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.status-chip[data-status="final"] { color: #fff; border-color: var(--ok); background: var(--ok); }

/* ---------- 主布局 ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  align-items: start;
  min-height: calc(100vh - var(--topbar-h));
}
.main { min-width: 0; padding: 32px var(--gutter) 0; }
.main:focus { outline: none; }
.view { min-width: 0; max-width: 1120px; }

/* ---------- 记分栏（左侧导航） ---------- */
.rail {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  background: var(--paper);
  border-right: 1px solid var(--line);
  min-width: 0;
}
.rail .overview-body { display: flex; flex-direction: column; height: 100%; }

.ov-list {
  list-style: none;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
}
.ov-row.is-family-start { border-top: 1px solid var(--line); }

.ov-item, .ov-review {
  -webkit-appearance: none; appearance: none;
  font: inherit; cursor: pointer; text-align: left;
}
.ov-item {
  position: relative;
  width: 100%;
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: 0 8px;
  min-height: 33px; padding: 0 16px 0 20px;
  border: 0; background: transparent;
  font-size: 14.5px; color: var(--ink);
}
.ov-item:hover { background: var(--paper-2); }
.ov-item:focus-visible { outline-offset: -2px; }
.ov-code {
  font-family: var(--font-num); font-weight: 600; font-size: 14px;
  color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.ov-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-tag { font-size: 12px; font-weight: 600; color: var(--auto); }
.ov-box {
  grid-column: 4;
  display: grid; place-items: center;
  width: 34px; height: 24px;
  border: 1px dashed var(--line-2); border-radius: var(--r-box);
  background: transparent;
  font-family: var(--font-num); font-size: 14px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.ov-item[data-state="scored"] .ov-box { border: 1px solid var(--ink); background: var(--canvas); }
.ov-item[data-auto="true"] .ov-box { border-color: var(--auto); background: var(--auto); color: #fff; }
.ov-item[data-state="un"] .ov-box { border: 1px solid var(--un-line); background: var(--un-soft); color: var(--un); font-size: 11.5px; }
.ov-item[data-state="conflict"] .ov-box { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); font-size: 12px; }
.ov-item[data-state="conflict"] .ov-code { color: var(--bad); }

/* 当前项：像从记分栏中抽出的一张白色纸条，上下各一条细线，左侧钴蓝标记 */
.ov-item[aria-current="step"] {
  background: var(--canvas); font-weight: 600;
  box-shadow: 0 -1px 0 var(--line), 0 1px 0 var(--line);
  z-index: 1;
}
.ov-item[aria-current="step"]:hover { background: var(--canvas); }
.ov-item[aria-current="step"]::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cobalt);
}
.ov-item[aria-current="step"] .ov-code { color: var(--cobalt); }
/* 当前项尚未评分：空格换成钴蓝虚线，提示分数将记在这里 */
.ov-item[aria-current="step"][data-state="missing"] .ov-box { border-color: var(--cobalt); background: var(--cobalt-hover); }

/* 底部：总分格 + 复核入口 */
.ov-foot {
  flex: 0 0 auto;
  padding: 10px 16px 12px 20px;
  border-top: 1px solid var(--line-2);
  display: grid; gap: 10px;
  background: var(--paper);
}
.ov-sum { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; }
.ov-total {
  display: grid; justify-items: center; align-content: center;
  height: 52px;
  border: 1px dashed var(--line-2); border-radius: var(--r-box);
  background: transparent;
}
/* 总分生成后为纸质表格常见的双线框 */
.ov-total[data-ready="true"] {
  border: 1px solid var(--ink); background: var(--canvas);
  box-shadow: inset 0 0 0 2px var(--canvas), inset 0 0 0 3px var(--ink);
}
.ov-total-label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); line-height: 1.3; }
.ov-total-num {
  font-family: var(--font-num); font-size: 24px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--ink-3);
}
.ov-total[data-ready="true"] .ov-total-num { color: var(--ink); }
.ov-sum-lines { display: grid; gap: 1px; font-size: 13px; line-height: 1.45; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ov-sum-lines span:first-child { font-weight: 600; color: var(--ink); }

.ov-review {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ink); border-radius: var(--r-btn);
  background: var(--canvas); color: var(--ink);
  font-size: 15px; font-weight: 600;
  box-shadow: var(--press);
  transition: background-color .12s ease, color .12s ease;
}
.ov-review:hover { background: var(--paper-2); }
.ov-review[aria-current="step"] { background: var(--ink); color: #fff; }
.ov-review-state {
  font-size: 12.5px; font-weight: 500; color: inherit; opacity: .82;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* ---------- 通用排版 ---------- */
.view-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-3);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.view-title {
  font-size: 34px; font-weight: 700; line-height: 1.2; letter-spacing: 0.01em;
  color: var(--ink);
}
.item-heading {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px;
}
.item-code {
  font-family: var(--font-num); font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.item-heading .item-code { font-size: 44px; line-height: 1; letter-spacing: -0.01em; }
.item-heading .item-name { font-size: 30px; font-weight: 600; letter-spacing: 0.02em; }
.title-en { margin-top: 8px; font-size: 14px; color: var(--ink-3); font-family: var(--font-num); }

.side-badge {
  display: inline-flex; align-items: center;
  padding: 0 9px; border-radius: var(--r-box); line-height: 24px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
  color: #fff; background: var(--ink);
}
.materials-tag {
  display: inline-flex; align-items: center;
  padding: 0 9px; border-radius: var(--r-box); line-height: 22px;
  font-size: 12.5px; font-weight: 600;
  color: var(--un); background: var(--un-soft); border: 1px solid var(--un-line);
}

.lede { font-size: 17px; line-height: 1.7; color: var(--ink-2); max-width: 34em; margin-top: 14px; }

.bullets { list-style: none; display: grid; gap: 6px; }
.bullets > li { position: relative; padding-left: 16px; }
.bullets > li::before {
  content: ""; position: absolute; left: 2px; top: 0.72em;
  width: 5px; height: 5px; background: var(--ink-3);
}

.panel { padding-top: 18px; border-top: 1px solid var(--line); }
.panel-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }

.fineprint { font-size: 13px; color: var(--ink-3); line-height: 1.65; margin-top: 20px; }
.fineprint .btn-link { font-size: 13px; }

/* ---------- 表单 ---------- */
.field { margin-top: 24px; }
.field-label { display: block; font-weight: 600; font-size: 14.5px; margin-bottom: 8px; color: var(--ink); }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field-help { margin-top: 6px; font-size: 13.5px; color: var(--ink-3); }
.field-help.is-error { color: var(--bad); font-weight: 600; }

.input {
  -webkit-appearance: none; appearance: none;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-btn);
  background: var(--canvas);
  font-size: 16px;
  color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(16, 28, 51, 0.05);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:hover { border-color: var(--ink-3); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(35, 71, 197, 0.2); }
.input[aria-invalid="true"] { border-color: var(--bad); background: #fffafa; }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.16); }
.textarea { display: block; width: 100%; min-height: 76px; resize: vertical; line-height: 1.55; }
input[type="datetime-local"].input { min-width: 15em; font-variant-numeric: tabular-nums; }

/* ---------- 折叠区：横线分隔的清单，不做卡片 ---------- */
.disclosure { border-top: 1px solid var(--line); }
.disclosure:last-child { border-bottom: 1px solid var(--line); }
.disclosure > summary {
  list-style: none; cursor: pointer;
  min-height: var(--tap);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px;
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: ""; width: 7px; height: 7px; flex-shrink: 0;
  border-right: 1.75px solid var(--ink-2); border-bottom: 1.75px solid var(--ink-2);
  transform: rotate(-45deg); transition: transform .15s ease;
  margin: 0 2px 0 3px;
}
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:hover { color: var(--cobalt); }
.disclosure > summary:focus-visible { outline-offset: -2px; border-radius: var(--r-box); }

.rules-list { padding: 0 4px 16px 40px; display: grid; gap: 6px; color: var(--ink-2); font-size: 15px; }
.rules-list li::marker { font-family: var(--font-num); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.note-details > .textarea, .note-details > .field-help { margin-left: 2px; margin-right: 2px; width: calc(100% - 4px); }
.note-details > .field-help { margin-bottom: 16px; }

.ref-body { padding: 2px 2px 20px 24px; display: grid; gap: 16px; font-size: 15px; color: var(--ink-2); }
.ref-sec + .ref-sec { padding-top: 14px; border-top: 1px solid var(--line); }
.ref-title { font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.ref-defs { display: grid; gap: 8px; }
.ref-def { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.ref-def dt {
  font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--ink); text-align: center;
  border: 1px solid var(--line-2); border-radius: var(--r-box); line-height: 24px; font-size: 14px;
}
.ref-def dd { margin: 0; }

/* ---------- 开始页 ---------- */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(260px, 380px);
  gap: 40px clamp(40px, 5vw, 80px);
  align-items: start;
  padding: 16px 0 56px;
}
.intro .view-title { font-size: 40px; }

/* 记录单：墨色顶线的白色工作面，评估时间在上，开始按钮在下 */
.intro-sheet {
  margin-top: 30px;
  padding: 20px 24px 24px;
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--ink);
  border-radius: var(--r-panel);
  background: var(--canvas);
  box-shadow: var(--lift);
}
.intro-sheet .field { margin-top: 0; }
.intro-actions { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
/* 单一整体按钮，文字居中 */
.btn-start {
  width: 100%; justify-content: center;
  font-weight: 700; letter-spacing: 0.12em;
  padding-left: calc(28px + 0.12em); /* 抵消字距在末字后留下的空隙，使文字真正居中 */
}

/* 侧栏：纸色底的说明区，与白色记录单形成主次 */
.intro-side {
  margin-top: 4px;
  padding: 18px 22px 20px;
  border-radius: var(--r-panel);
  background: var(--paper);
}
.side-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.intro-facts { list-style: none; margin-bottom: 20px; }
.intro-facts li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 15px; color: var(--ink-2);
}
.intro-facts li:first-child { border-top: 0; }
.intro-side .intro-facts li, .intro-side .disclosure { border-color: var(--line-2); }
.intro-side .disclosure { border-bottom: 1px solid var(--line-2); }

/* ---------- 条目页：左题目、右评分 ---------- */
.step {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 660px);
  grid-template-areas:
    "brief answer"
    "ref answer"
    "nav nav";
  grid-template-rows: auto 1fr auto;
  column-gap: clamp(36px, 4vw, 64px);
  align-items: start;
}
.step-brief { grid-area: brief; min-width: 0; }
.step-answer { grid-area: answer; min-width: 0; }
.step-ref { grid-area: ref; min-width: 0; margin-top: 28px; }
.step .stepbar { grid-area: nav; }

/* 评分量表：连续的分段列表 */
.choices { border: 0; padding: 0; margin: 0; min-width: 0; }
.choices-legend {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  width: 100%; padding: 0; margin-bottom: 10px;
  font-weight: 700; font-size: 15px; color: var(--ink);
}
.choices-hint { font-weight: 500; font-size: 13.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.scale {
  border: 1px solid var(--line-2);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--canvas);
  box-shadow: var(--lift);
}
.choice {
  position: relative;
  display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: stretch;
  min-height: 64px;
  cursor: pointer;
  background: var(--canvas);
  transition: background-color .12s ease, color .12s ease;
}
.choice + .choice { border-top: 1px solid var(--line); }
.choice-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.choice-score {
  display: grid; place-items: center;
  border-right: 1px solid var(--line);
  background: var(--wash);
  font-family: var(--font-num); font-weight: 600; font-size: 28px; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.choice-label {
  display: flex; align-items: center;
  padding: 12px 20px;
  font-weight: 600; font-size: 17px; line-height: 1.4; letter-spacing: 0.01em;
  color: var(--ink);
}
.choice-flag {
  display: flex; align-items: center;
  padding-right: 18px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
}

.choice:hover { background: var(--cobalt-hover); }
.choice:hover .choice-score { background: var(--cobalt-soft); }
/* 悬停行在分值格内侧显示一条钴蓝边，指示将要记录的行 */
.choice:not(.is-selected):not(.is-locked):hover .choice-score { box-shadow: inset 3px 0 0 var(--cobalt); color: var(--cobalt-deep); }

/* 选中（手动）：整行钴蓝 */
.choice.is-selected { background: var(--cobalt); color: #fff; }
.choice.is-selected .choice-score { background: var(--cobalt-cell); color: #fff; border-right-color: rgba(255, 255, 255, 0.18); }
.choice.is-selected .choice-label { color: #fff; }
.choice.is-selected .choice-flag { color: #fff; }
.choice.is-selected .choice-flag::before {
  content: ""; width: 10px; height: 5px; margin: -3px 8px 0 0;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.choice.is-selected .choice-flag::after { content: "已选"; }
.choice.is-selected + .choice { border-top-color: transparent; }

/* 键盘焦点：内描边，在选中与未选中行上都清晰 */
.choice-input:focus-visible + .choice-score { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.choice:has(.choice-input:focus-visible) { box-shadow: inset 0 0 0 2px var(--cobalt), inset 0 0 0 4px #fff; z-index: 1; }
.choice:has(.choice-input:focus-visible) .choice-score { outline: none; }

/* 自动匹配锁定：选中行用深墨蓝，其余行不可选但文字保持清晰 */
.choices.is-auto .choice.is-selected { background: var(--auto); }
.choices.is-auto .choice.is-selected .choice-score { background: var(--auto-cell); }
.choices.is-auto .choice.is-selected .choice-flag::after { content: "自动"; }
.choice.is-locked { cursor: not-allowed; background: var(--canvas); }
.choice.is-locked:hover { background: var(--canvas); }
.choice.is-locked .choice-score,
.choice.is-locked:hover .choice-score { background: var(--wash); color: var(--ink-3); }
.choice.is-locked .choice-label { color: var(--ink-2); font-weight: 500; }

/* UN：与计分行以虚线分隔，琥珀色 */
.choice-un, .choice + .choice-un { border-top: 1px dashed var(--line-2); }
.choice-un .choice-score { font-size: 17px; font-weight: 700; letter-spacing: 0.06em; color: var(--un); background: var(--un-soft); }
.choice-un:hover .choice-score { background: var(--un-soft); }
.choice-un:not(.is-selected):not(.is-locked):hover .choice-score { box-shadow: inset 3px 0 0 var(--un); color: var(--un); }
.choice-un.is-selected { background: var(--un); }
.choice-un.is-selected .choice-score { background: var(--un-cell); color: #fff; }

/* 批注类信息（UN 解释、自动匹配、提示、冲突）：左侧 3px 色条 + 浅底，统一一种语言 */
.un-box {
  margin-top: 12px;
  padding: 14px 16px 16px;
  border: 1px solid var(--un-line);
  border-left: 3px solid var(--un);
  border-radius: var(--r-panel);
  background: var(--un-soft);
}
.un-box .field-label { color: var(--un); }

.item-tools { display: flex; justify-content: flex-end; min-height: 44px; }
.item-tools .btn-link { min-height: 44px; font-size: 14px; color: var(--ink-3); font-weight: 500; }
.item-tools .btn-link:hover { color: var(--bad); }

/* 动态提示（仅在触发时出现） */
.dynamic { display: grid; gap: 10px; margin-bottom: 16px; }
.dynamic:empty { display: none; }

.auto-note {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center;
  padding: 12px 16px;
  border-radius: var(--r-panel);
  border: 1px solid var(--auto-line);
  border-left: 3px solid var(--auto);
  background: var(--auto-soft);
  font-size: 14.5px; color: var(--ink-2);
}
.auto-note-title { font-weight: 700; color: var(--auto); font-size: 15px; }
.auto-note-body { grid-column: 1; }
.auto-note-action { grid-column: 2; grid-row: 1 / span 2; min-height: 44px; color: var(--auto); }

.auto-summary {
  padding: 12px 16px;
  border-radius: var(--r-panel);
  border: 1px solid var(--auto-line);
  border-left: 3px solid var(--auto);
  background: var(--auto-soft);
  font-size: 14.5px; color: var(--ink);
}
.auto-summary-title { font-weight: 700; color: var(--auto); margin-bottom: 4px; }
.auto-summary-list { list-style: none; display: grid; gap: 2px; }
.auto-summary-list li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.auto-summary-code, .auto-summary-score { font-family: var(--font-num); font-weight: 700; font-variant-numeric: tabular-nums; }
.auto-summary-score { color: var(--auto); }
.revise-note { font-size: 13.5px; color: var(--ink-3); }

.callout {
  padding: 12px 16px;
  border-radius: var(--r-panel);
  border: 1px solid var(--line);
  background: var(--canvas);
  font-size: 15px;
}
.callout-title { font-weight: 700; margin-bottom: 2px; }
.callout .bullets { margin-top: 6px; }
.callout-hint { border-color: var(--cobalt-line); border-left: 3px solid var(--cobalt); background: var(--cobalt-soft); }
.callout-hint .callout-title { color: var(--cobalt-deep); }
.callout-conflict { border-color: var(--bad-line); border-left: 3px solid var(--bad); background: var(--bad-soft); color: #4d1410; }
.callout-conflict .callout-title { color: var(--bad); }
.callout-conflict .bullets > li::before { background: var(--bad); }
.callout-conflict .btn-link { color: var(--bad); }

/* 计时器：横向仪表 */
.timer {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  grid-template-areas:
    "face main"
    "face actions"
    "help help";
  gap: 4px 16px; align-items: center;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-panel);
  background: var(--canvas);
}
.timer-face { grid-area: face; position: relative; width: 64px; height: 64px; }
.timer-main { grid-area: main; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.timer-actions { grid-area: actions; display: flex; gap: 6px; flex-wrap: wrap; }
.timer-actions .btn { min-height: 44px; padding: 0 14px; font-size: 14.5px; }
.timer-help { grid-area: help; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.timer-ring-bg { fill: none; stroke: var(--line); stroke-width: 6; }
.timer-ring-fg { fill: none; stroke: var(--cobalt); stroke-width: 6; stroke-linecap: butt; transition: stroke-dashoffset .1s linear; }
.timer-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-num); font-size: 17px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.timer-title { font-weight: 700; font-size: 15px; }
.timer-state { font-size: 13.5px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.timer[data-state="running"] { border-color: var(--cobalt-line); background: var(--cobalt-soft); }
.timer[data-state="running"] .timer-state { color: var(--cobalt-deep); }
.timer[data-state="done"] { border-color: var(--un-line); background: var(--un-soft); }
.timer[data-state="done"] .timer-ring-fg { stroke: var(--un); }
.timer[data-state="done"] .timer-state, .timer[data-state="done"] .timer-num { color: var(--un); }
.timer[data-state="stopped"] .timer-ring-fg { stroke: var(--ink-3); }

/* 底部导航带：随工作区吸附在视口底部 */
.stepbar {
  position: sticky; bottom: 0; z-index: 10;
  margin-top: 40px;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  /* 向上的极淡投影，表明内容在其下方滚动 */
  box-shadow: 0 -12px 24px -20px rgba(16, 28, 51, 0.35);
}
.stepbar-inner {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  padding: 12px 0 16px;
}
.stepbar-inner > :first-child { justify-self: start; }
.stepbar-inner > :last-child { justify-self: end; grid-column: 3; }
.stepbar-overview { display: none; }
.stepbar-pos { font-family: var(--font-num); font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.btn-nav {
  flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px;
  min-height: 58px; min-width: 200px; padding: 6px 18px;
}
.btn-nav-next { align-items: flex-end; text-align: right; }
.btn-nav-label { font-size: 15.5px; font-weight: 700; }
.btn-nav-prev .btn-nav-label::before { content: "‹ "; }
.btn-nav-next[data-next] .btn-nav-label::after { content: " ›"; }
.btn-nav-target {
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.btn-nav.btn-primary .btn-nav-target { color: rgba(255, 255, 255, 0.86); }

/* ---------- 复核页 ---------- */
.review {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "side main"
    "extra main"
    "nav nav";
  grid-template-rows: auto auto 1fr auto;
  gap: 0 clamp(36px, 4vw, 56px);
  align-items: start;
}
.review-head { grid-area: head; margin-bottom: 24px; }
.review-side { grid-area: side; display: grid; gap: 16px; min-width: 0; }
.review-main { grid-area: main; min-width: 0; }
.review-extra { grid-area: extra; display: grid; gap: 24px; margin-top: 28px; min-width: 0; }
.review .stepbar { grid-area: nav; }
.review-extra .fineprint { margin-top: 0; }

.score-panel {
  position: relative;
  padding: 18px 20px 20px;
  border: 1px solid var(--line-2);
  border-top: 4px solid var(--line-2);
  border-radius: var(--r-panel);
  background: var(--canvas);
  box-shadow: var(--lift);
}
.score-panel[data-status="complete"] { border-top-color: var(--ok); }
.score-panel[data-status="complete_un"],
.score-panel[data-status="un_reason_missing"] { border-top-color: var(--un); }
.score-panel[data-status="inconsistent"],
.score-panel[data-status="invalid"] { border-top-color: var(--bad); }
.score-panel .status-chip { margin-bottom: 14px; white-space: normal; text-align: left; min-height: 26px; padding-top: 2px; padding-bottom: 2px; }

.score-label { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.score-big { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.score-num {
  font-family: var(--font-num); font-size: 64px; font-weight: 700; line-height: 1.05;
  letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
.score-max { font-family: var(--font-num); font-size: 20px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.score-big-empty .score-num { font-size: 44px; color: var(--ink-3); }
.score-big-empty .score-max { font-family: var(--font); font-size: 15px; font-weight: 600; color: var(--ink-2); }
.score-note { margin-top: 8px; color: var(--ok); font-weight: 600; font-size: 14.5px; }
.score-why { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--ink); }
.score-facts { margin-top: 14px; display: grid; border-top: 1px solid var(--line); }
.fact { padding: 8px 0; min-width: 0; }
.score-facts .fact + .fact { border-top: 1px solid var(--line); }
.fact dt { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.fact dd { margin-top: 1px; font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.finalize { display: grid; gap: 6px; }
.finalize .btn { width: 100%; }
.finalize .field-help:focus { outline: none; }
.finalize .callout { margin-top: 8px; }

/* 复核表：沿用记分表的“项目 | 分值格 | 结果”结构 */
.review-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 15px;
}
@media (hover: hover) {
  .review-table tbody tr:not([data-state="conflict"]):hover { background: var(--wash); }
}
.review-table thead th {
  text-align: left; font-size: 13px; font-weight: 600;
  color: var(--ink-3);
  padding: 8px 12px; border-bottom: 1px solid var(--line-2);
}
.review-table tbody th, .review-table tbody td {
  padding: 12px; vertical-align: top; text-align: left;
  border-bottom: 1px solid var(--line);
}
.review-table tbody tr.is-family-start > * { border-top: 1px solid var(--line-2); }
.review-table tbody th { width: 34%; font-weight: 600; padding-left: 4px; }
.review-table tbody th .item-code { display: inline-block; min-width: 2.6em; font-size: 15px; }
.review-table thead th:first-child { padding-left: 4px; }
.row-score { width: 64px; }
.row-box {
  display: grid; place-items: center;
  width: 40px; height: 30px;
  border: 1px dashed var(--line-2); border-radius: var(--r-box);
  font-family: var(--font-num); font-size: 16px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.review-table tr[data-state="scored"] .row-box { border: 1px solid var(--ink); }
.review-table tr[data-auto="true"] .row-box { border-color: var(--auto); background: var(--auto); color: #fff; }
.review-table tr[data-state="un"] .row-box { border: 1px solid var(--un-line); background: var(--un-soft); color: var(--un); font-size: 13px; }
.review-table tr[data-state="conflict"] .row-box { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.review-table tr[data-state="conflict"] { background: #fff8f7; }
.review-table tr[data-state="missing"] .row-label { color: var(--ink-3); font-weight: 500; }
.row-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; line-height: 30px; }
.row-label { font-weight: 600; color: var(--ink); }
.row-tag {
  display: inline-flex; align-items: center;
  padding: 0 7px; line-height: 20px; border-radius: var(--r-box);
  font-size: 12px; font-weight: 700;
}
.row-tag-auto { color: var(--auto); background: var(--auto-soft); border: 1px solid var(--auto-line); }
.row-tag-conflict { color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad-line); }
.row-meaning { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.row-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; white-space: pre-wrap; }
.row-sub.is-error { color: var(--bad); font-weight: 600; }
.row-rev { color: var(--un); }
.row-auto { color: var(--auto); white-space: normal; }
.row-auto .btn-link { color: var(--auto); font-size: 13.5px; }
.row-action { width: 1%; white-space: nowrap; text-align: right !important; padding-right: 0 !important; }
.row-action .btn { margin-top: -7px; }

.report-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- 对话框 ---------- */
.dialog {
  border: 0; padding: 0;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border-radius: 12px;
  background: var(--canvas);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(16, 28, 51, 0.45), 0 0 0 1px rgba(16, 28, 51, 0.08);
  overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; animation: dlg-in .16s ease-out; }
.dialog::backdrop { background: rgba(16, 28, 51, 0.44); }
.dialog-small { width: min(480px, calc(100vw - 32px)); }
.dialog-wide { width: min(800px, calc(100vw - 32px)); }
.dialog-inner { padding: 22px 24px 24px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -22px -24px 16px; padding: 8px 12px 8px 24px;
  position: sticky; top: -22px; z-index: 2;
  background: var(--canvas);
  border-bottom: 1px solid var(--line);
}
.dialog-title { font-size: 18px; font-weight: 700; }
.dialog-small .dialog-title { margin-bottom: 10px; }
.dialog-small p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.copy-text {
  display: block; width: 100%; margin-top: 12px;
  padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r-btn);
  background: var(--wash); font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  resize: vertical;
}
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 总览抽屉：与记分栏同构，触控尺寸 */
.dialog-sheet { background: var(--paper); }
.dialog-sheet .dialog-inner { padding: 0 0 calc(16px + env(safe-area-inset-bottom)); }
.dialog-sheet .dialog-head { margin: 0; top: 0; background: var(--paper); padding: 8px 8px 8px 20px; }
.dialog-sheet .ov-list { overflow: visible; padding: 6px 0; }
.dialog-sheet .ov-item { min-height: 48px; font-size: 16px; padding-right: 16px; }
.dialog-sheet .ov-box { width: 40px; height: 30px; font-size: 15px; }
.dialog-sheet .ov-foot { border-top: 1px solid var(--line-2); }
.dialog-sheet .ov-review { min-height: 52px; font-size: 16px; }

/* 帮助 */
.help { display: grid; font-size: 15px; color: var(--ink-2); }
.help-sec { padding: 16px 0; border-top: 1px solid var(--line); }
.help-sec:first-child { border-top: 0; padding-top: 4px; }
.help-sec h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.help-sec p + p { margin-top: 8px; }
.help-alert {
  padding: 14px 16px; border: 1px solid var(--un-line); border-left: 3px solid var(--un); border-radius: var(--r-panel);
  background: var(--un-soft); margin-bottom: 4px;
}
.help-alert:first-child { padding-top: 14px; }
.help-alert + .help-sec { border-top: 0; }
.help-alert h3 { color: var(--un); }
.help-list { padding-left: 1.3em; display: grid; gap: 5px; }
.help-list a { overflow-wrap: anywhere; }
.help-small { font-size: 13.5px; color: var(--ink-3); margin-top: 10px; }
.help-version { font-size: 12.5px; color: var(--ink-3); text-align: center; padding-top: 12px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }

.print-root { display: none; }

/* ---------- 响应式 ---------- */

/* 中等宽度：保留记分栏，主区域改单列 */
@media (max-width: 1179px) {
  :root { --rail-w: 264px; --gutter: 36px; }
  .step {
    grid-template-columns: minmax(0, 680px);
    grid-template-areas: "brief" "answer" "ref" "nav";
    grid-template-rows: auto;
  }
  .step-answer { margin-top: 24px; }
  .review {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "side" "main" "extra" "nav";
  }
  .review-main { margin-top: 24px; }
  .intro { grid-template-columns: minmax(0, 1fr); max-width: 640px; }
  .intro-side { margin-top: 0; }
}

/* 粗指针设备（平板）上的记分栏行高满足触控尺寸 */
@media (pointer: coarse) {
  .ov-item { min-height: 44px; }
}

/* 手机与竖屏平板：隐藏记分栏，改为底部抽屉 */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand actions" "progress progress";
    min-height: 0;
  }
  .brand { grid-area: brand; padding: 6px 4px 2px 16px; background: transparent; border-right: 0; }
  .brand-note { display: none; }
  .top-actions { grid-area: actions; padding: 4px 6px 0 0; }
  .progress { grid-area: progress; justify-content: flex-start; gap: 10px; padding: 2px 16px 10px; }
  .progress-count { display: inline; }
  .pips { display: grid; }
  .status-chip { min-height: 24px; padding: 0 9px; font-size: 12.5px; }

  .layout { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 20px 16px 0; }
  .view { max-width: 680px; margin: 0 auto; }

  .step-ref { margin-top: 24px; }
  .item-heading .item-code { font-size: 36px; }
  .item-heading .item-name { font-size: 26px; }
  .view-title { font-size: 28px; }
  .intro .view-title { font-size: 32px; }

  /* 底部操作栏：吸附在视口底部，内容可完整滚动到它上方 */
  .stepbar {
    margin: 28px -16px 0;
    padding: 0 12px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--line-2);
  }
  .stepbar-inner { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; padding: 10px 0; }
  .stepbar-overview { display: inline-flex; min-height: 52px; padding: 0 14px; gap: 6px; }
  .btn-nav { min-width: 0; width: 100%; min-height: 52px; padding: 0 12px; align-items: center; }
  .btn-nav-next { align-items: center; }
  .btn-nav-target { display: none; }
  .stepbar-inner > :first-child, .stepbar-inner > :last-child { justify-self: stretch; }

  .dialog-sheet {
    width: 100vw; max-width: 100vw;
    margin: auto 0 0; max-height: 88vh; max-height: 88dvh;
    border-radius: 14px 14px 0 0;
  }
  .dialog-sheet[open] { animation: sheet-in .2s ease-out; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

@media (max-width: 640px) {
  .brand-title { font-size: 16px; }
  .top-actions .btn { padding: 0 10px; }

  .intro { padding: 4px 0 40px; gap: 28px; }
  .lede { font-size: 16px; }
  .field-row .btn, .field-row .input { width: 100%; }
  input[type="datetime-local"].input { min-width: 0; }
  .intro-sheet { margin-top: 24px; padding: 16px 16px 18px; }
  .intro-actions { margin-top: 16px; padding-top: 16px; }
  .intro-side { padding: 16px 16px 18px; }

  .view-meta { margin-bottom: 8px; font-size: 13px; }
  .title-en { margin-top: 4px; font-size: 13px; }

  .choice { grid-template-columns: 60px minmax(0, 1fr) auto; min-height: 60px; }
  .choice-score { font-size: 26px; }
  .choice-label { padding: 10px 14px; font-size: 16.5px; }
  .choice-flag { padding-right: 14px; font-size: 12.5px; }
  .choice-un .choice-score { font-size: 16px; }

  .auto-note { grid-template-columns: minmax(0, 1fr); }
  .auto-note-action { grid-column: 1; grid-row: auto; justify-self: start; }

  .ref-body { padding-left: 4px; }

  .score-num { font-size: 56px; }

  /* 复核表在窄屏改为分行列表 */
  .review-table, .review-table tbody, .review-table tr, .review-table th, .review-table td { display: block; width: auto !important; }
  .review-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .review-table tbody tr {
    display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 4px 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .review-table tbody tr.is-family-start { border-top: 1px solid var(--line-2); margin-top: -1px; }
  .review-table tbody tr.is-family-start > * { border-top: 0; }
  .review-table tbody th, .review-table tbody td { padding: 0; border: 0; }
  .review-table tbody th { grid-column: 1 / 3; grid-row: 1; padding-left: 0; align-self: center; }
  .review-table .row-action { grid-column: 3; grid-row: 1; align-self: center; }
  .review-table .row-action .btn { margin-top: 0; }
  .review-table .row-score { grid-column: 1; grid-row: 2; }
  .review-table .row-result { grid-column: 2 / 4; grid-row: 2; }

  .report-actions .btn { flex: 1 1 140px; }
  .dialog-inner { padding: 18px 16px 20px; }
  .dialog-head { margin: -18px -16px 12px; padding: 6px 6px 6px 16px; top: -18px; }
  .dialog-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 400px) {
  .label-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .brand-title { font-size: 15px; letter-spacing: 0; }
  .top-actions .btn { padding: 0 8px; font-size: 14.5px; }
  .progress { gap: 8px; }
  .progress-count { font-size: 12.5px; }
  .item-heading { column-gap: 12px; }
  .item-heading .item-code { font-size: 32px; }
  .item-heading .item-name { font-size: 23px; }
  .choice { grid-template-columns: 52px minmax(0, 1fr) auto; }
  .choice-label { padding: 10px 12px; font-size: 16px; }
  .choice-flag { padding-right: 10px; }
  .stepbar-inner { gap: 6px; }
  .stepbar-overview { padding: 0 10px; }
  .stepbar-pos { display: none; }
  .btn-nav { padding: 0 8px; }
  .timer { padding: 12px; gap: 4px 12px; }
}

/* 支持背景模糊时，导航带改为半透明磨砂，滚过的内容隐约可见但不干扰阅读 */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .stepbar {
    background: rgba(255, 255, 255, 0.86);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (forced-colors: active) {
  .choice.is-selected .choice-score { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .ov-box, .row-box, .pip { border: 1px solid CanvasText; }
}

/* ---------- 打印 ---------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { background: #fff !important; color: #000; font-size: 10.5pt; line-height: 1.5; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; font-family: var(--font); }
  .print-root h1 { font-size: 15pt; margin-bottom: 8pt; padding-bottom: 6pt; border-bottom: 1.5pt solid #000; }
  .p-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2pt 16pt; margin-bottom: 10pt; }
  .p-meta .fact { padding: 0; }
  .p-meta dt { font-size: 8.5pt; color: #444; }
  .p-meta dd { font-size: 10.5pt; font-weight: 700; margin: 0; }
  .p-table { width: 100%; border-collapse: collapse; margin-bottom: 10pt; }
  .p-table th, .p-table td { border: 0.75pt solid #777; padding: 3pt 5pt; text-align: left; vertical-align: top; }
  .p-table thead th { background: #eee; font-size: 9pt; }
  .p-table tr { break-inside: avoid; page-break-inside: avoid; }
  .p-code { width: 3.2em; font-weight: 700; white-space: nowrap; }
  .p-sub { font-size: 9pt; color: #333; white-space: pre-wrap; }
  .p-total { font-size: 13pt; font-weight: 700; margin: 6pt 0 4pt; }
  .p-issues { margin-top: 6pt; padding: 4pt 6pt; border: 1pt solid #000; }
  .p-notes { margin-top: 8pt; }
  .p-notes-title { font-weight: 700; }
  .p-pre { white-space: pre-wrap; }
  .p-source { margin-top: 6pt; font-size: 8.5pt; color: #333; overflow-wrap: anywhere; }
  .print-root p { margin: 0; }
}

/* Compact result and locally generated sharing image */
.review-compact{display:block;max-width:820px;margin:0 auto}.summary-card{padding:28px 0}.summary-card .score-big{margin:8px 0 20px}.summary-time{color:#5c6676;font-variant-numeric:tabular-nums}.summary-card h3{margin-top:32px;font-size:18px}.summary-list{list-style:none;margin:0 0 28px;padding:0}.summary-list li{padding:16px 0;border-bottom:1px solid #e5e7eb}.summary-list p{margin:6px 0 0;color:#5c6676}.summary-image{display:block;width:100%;height:auto;border:1px solid #e5e7eb;margin:16px 0}.summary-details{margin:28px 0}.summary-details summary{cursor:pointer;padding:16px 0}.summary-edit{display:block;width:100%;text-align:left;padding:14px;background:white;border:0;border-bottom:1px solid #e5e7eb;color:#18243b;font:inherit}.status-chip[hidden]{display:none!important}.image-preview:empty{display:none}
