:root {
  color-scheme: light;
  --paper: #f3f7f8;
  --surface: #fff;
  --ink: #18343f;
  --muted: #516773;
  --faint: #627985;
  --accent: #126278;
  --accent-soft: #edf6f8;
  --border: #8197a3;
  --hair: #dce5e9;
  --normal-bg: #e5f2dc;
  --normal-ink: #27500f;
  --high-bg: #fbf3d0;
  --high-ink: #6d5310;
  --s1-bg: #f8e4d4;
  --s1-ink: #8a3d12;
  --s2-bg: #f8d4d4;
  --s2-ink: #8d2424;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip {
  position: fixed; top: 12px; left: 12px; z-index: 5;
  padding: 8px 12px; background: var(--ink); color: #fff; border-radius: 6px;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }
.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.sheet {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: 22px 22px 8px;
}
.kicker { margin: 0 0 8px; font-size: 14px; }
.kicker a { color: var(--accent); font-weight: 600; text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
h1 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 28px); line-height: 1.35; font-weight: 700; }
.sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.rule {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: var(--paper);
  border-inline-start: 3px solid var(--accent);
  color: var(--muted);
  font-size: 14px;
}
.rule b { color: var(--ink); font-weight: 600; }
.query {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin: 0 0 8px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span { grid-column: 1 / -1; }
.field > span, .sex-label { font-size: 14px; font-weight: 600; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
input, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.sex { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sex label {
  position: relative;
  min-height: 48px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-weight: 600;
}
.sex input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.sex label.on, .sex label:has(input:checked) {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sex input:focus-visible + span, .sex label:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; flex-direction: row; justify-content: flex-end; align-items: center; }
.actions button {
  width: auto;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--accent);
}
.actions button:hover { border-color: var(--accent); }
.out { margin-top: 8px; }
.note, .warn {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 14px;
}
.note { background: var(--paper); color: var(--muted); }
.warn { background: #fbf3d0; color: var(--high-ink); }
.warn p, .note p { margin: 0; }
.warn p + p { margin-top: 4px; }
.panel {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--hair);
  border-radius: 10px;
}
.who { margin: 0 0 10px; font-size: 15px; }
.who b { font-weight: 700; }
.verdict { border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.verdict strong { display: block; font-size: 26px; line-height: 1.3; }
.verdict p { margin: 4px 0 0; font-size: 14px; }
.v-normal { background: var(--normal-bg); color: var(--normal-ink); }
.v-highNormal { background: var(--high-bg); color: var(--high-ink); }
.v-stage1 { background: var(--s1-bg); color: var(--s1-ink); }
.v-stage2 { background: var(--s2-bg); color: var(--s2-ink); }
.v-empty { background: var(--paper); color: var(--muted); }
.v-empty strong { font-size: 16px; color: var(--ink); }
.pressures { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.pressure h3 { margin: 0 0 8px; font-size: 16px; }
.reading { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.reading b { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.pcts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.pcts div { background: var(--paper); border-radius: 6px; padding: 8px 2px; text-align: center; }
.pcts b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pcts span { font-size: 12px; color: var(--muted); }
.meter { position: relative; margin: 26px 0 4px; }
.track { display: flex; height: 32px; border-radius: 6px; overflow: hidden; }
.zone {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; padding: 0 2px;
}
.zone.z-normal { background: var(--normal-bg); color: var(--normal-ink); }
.zone.z-highNormal { background: var(--high-bg); color: var(--high-ink); }
.zone.z-stage1 { background: var(--s1-bg); color: var(--s1-ink); }
.zone.z-stage2 { background: var(--s2-bg); color: var(--s2-ink); }
.zone.is-on { box-shadow: inset 0 0 0 2px var(--ink); }
.pin {
  position: absolute; top: -22px; transform: translateX(-50%);
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pin i {
  display: block; width: 2px; height: 40px; margin: 1px auto 0; background: var(--ink);
}
.ticks { position: relative; height: 1.4em; margin-top: 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; transform: translateX(-50%); }
.cuts { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.fixed-note { margin: 6px 0 0; font-size: 13px; color: var(--high-ink); }
.table-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 6px 0 8px; }
.table-head h2 { margin: 0; font-size: 17px; }
.switch { display: flex; gap: 6px; }
.switch button {
  min-height: 40px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--muted);
}
.switch button[aria-pressed="true"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.scroll-hint { margin: 0 0 6px; font-size: 13px; color: var(--faint); }
@media (min-width: 860px) { .scroll-hint { display: none; } }
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -6px 12px; padding: 0 6px 8px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-variant-numeric: tabular-nums; }
caption { text-align: left; caption-side: bottom; padding-top: 8px; color: var(--muted); font-size: 13px; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--hair); text-align: right; white-space: nowrap; background: #fff; }
th { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--paper); }
td.stick, th.stick { position: sticky; left: 0; z-index: 1; text-align: left; box-shadow: 1px 0 0 var(--hair); }
tr.is-current td { background: var(--accent-soft); }
tr.is-current td.stick { background: #e5f3f6; font-weight: 700; }
tr.is-pick { cursor: pointer; }
tr.is-pick:hover td { background: #f8fcfd; }
tr.is-pick.is-current:hover td { background: var(--accent-soft); }
tr.is-pick:hover td.stick, tr.is-pick.is-current:hover td.stick { background: #e5f3f6; }
.badge {
  display: inline-block; margin-left: 6px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600; font-style: normal; vertical-align: 1px;
}
.stick small { display: block; color: var(--muted); font-weight: 400; }
.colophon {
  margin: 18px 4px 0;
  color: var(--muted);
  font-size: 13px;
}
.colophon p { margin: 0 0 8px; }
@media (max-width: 720px) {
  .sheet { padding: 16px 14px 4px; border-radius: 10px; }
  .query, .pressures { grid-template-columns: 1fr; }
  .zone { font-size: 11px; }
  h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
@media print {
  body { background: #fff; }
  .sheet { border: 0; }
  .actions, .skip, .switch { display: none; }
  .verdict, .zone, tr.is-current td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
