:root {
  --fg: #1c1f24;
  --muted: #66707d;
  --line: #dfe3e9;
  --accent: #2f6feb;
  --ok: #1f7a44;
  --warn-bg: #fff7e6;
  --warn-line: #f0c36d;
  --card: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f6f7f9;
  color: var(--fg);
  font: 16px/1.75 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 24px 18px 96px; }

h1 { font-size: 26px; margin: 8px 0 18px; }
h2 { font-size: 17px; margin: 0; }

.mv { color: var(--muted); font-weight: 400; font-size: 14px; margin-top: -8px; }
.hint, .tip { color: var(--muted); font-size: 14px; }

.consent, .anchor-card, .item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 16px;
}

.consent ul { margin: 8px 0 0; padding-left: 22px; }
.consent li { margin-bottom: 6px; }

.intake { display: grid; gap: 14px; }
.intake label { display: grid; gap: 6px; font-weight: 600; }
.intake select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.intake .agree { display: flex; gap: 9px; align-items: center; font-weight: 400; }

button, .cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.warn {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-line);
  padding: 10px 14px;
  border-radius: 4px;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f6f7f9;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 14px; }

.item h2 { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.item .no {
  background: var(--fg); color: #fff; border-radius: 6px;
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; flex: none;
}
.item .dim { font-size: 14px; font-weight: 500; color: var(--muted); }
.item .save { margin-left: auto; font-size: 15px; color: var(--muted); }
.item.done .save { color: var(--ok); }
.item.pending .save { color: #c2621b; }

details { border-top: 1px solid var(--line); padding: 10px 0; }
details > summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details[open] > summary { color: var(--fg); font-weight: 600; }
.md { padding-top: 8px; overflow-wrap: anywhere; }
.md.answer { background: #fafbfc; border-left: 3px solid var(--line); padding: 10px 14px; border-radius: 0 6px 6px 0; }
.md p { margin: .5em 0; }
.md table { border-collapse: collapse; margin: .8em 0; font-size: 15px; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 10px; }
.md pre { background: #f3f4f6; padding: 10px 12px; border-radius: 6px; overflow-x: auto; font-size: 14px; }
.md code { font-family: ui-monospace, Consolas, monospace; }

fieldset { border: 0; padding: 0; margin: 14px 0 0; }
fieldset legend { font-weight: 600; font-size: 14px; color: var(--muted); margin-bottom: 8px; padding: 0; }

.opt {
  display: grid;
  grid-template-columns: 22px 46px 1fr;
  gap: 10px;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 7px;
  cursor: pointer;
  background: #fff;
}
.opt:hover { border-color: var(--accent); }
.opt input { margin: 0; }
.opt .lv { font-variant-numeric: tabular-nums; font-weight: 700; }
.opt.checked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.checked .lv { color: var(--accent); }

table { width: 100%; border-collapse: collapse; }
.anchor-card td, .anchor-card th { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left; }
.anchor-card .lv { font-weight: 700; width: 56px; }

.final { margin-top: 22px; }
.flash { color: #c2621b; font-size: 14px; }

/* ===== 移动端适配（390px 起步，iPhone 12 Pro 实测） ===== */

@media (max-width: 480px) {
  .wrap { padding: 16px 12px 80px; }
  h1 { font-size: 22px; }
  .consent, .anchor-card, .item { padding: 14px 16px; }

  /* 顶部进度条在窄屏不挤压 */
  .bar { flex-wrap: wrap; gap: 8px; }
  .pill { font-size: 13px; padding: 3px 10px; }

  /* 单选按钮：触控目标至少 44px，纵向堆叠更易点 */
  .opt {
    grid-template-columns: 22px 1fr;
    grid-template-rows: auto auto;
    gap: 6px 10px;
    padding: 12px 14px;
    min-height: 44px;
  }
  .opt .lv { grid-column: 2; font-size: 15px; }
  .opt .lb { grid-column: 1 / -1; font-size: 14px; line-height: 1.5; }

  /* 锚点表格：窄屏横向滚动 */
  .anchor-card { overflow-x: auto; }
  .anchor-card table { min-width: 320px; }

  /* 公式与代码块：横向滚动不撑破布局 */
  .md { overflow-x: auto; }
  .md pre { font-size: 13px; }

  /* 表单控件：全宽易点 */
  .intake select, .intake button { width: 100%; }
  button, .cta { width: 100%; text-align: center; }

  /* 复选框：放大触控区域 */
  .intake .agree { padding: 8px 0; }
  .intake .agree input { width: 20px; height: 20px; }
}

/* 超小屏（320px，iPhone SE 一代）再收紧 */
@media (max-width: 360px) {
  .wrap { padding: 12px 8px 72px; }
  .consent, .anchor-card, .item { padding: 12px 14px; }
}
