/* ===== 急危重症评分工具 · 蓝色系 · 移动端 ===== */
:root {
  --blue-900: #0a2f6e;
  --blue-800: #0d3c85;
  --blue-700: #0d47a8;
  --blue-600: #1257d6;
  --blue-500: #1a66e8;
  --blue-300: #7ea4dd;
  --blue-100: #dbe9ff;
  --blue-50: #eef4fc;
  --line: #b9cbe6;
  --line-strong: #8fa9cf;
  --ink: #1c2b3a;
  --muted: #64748b;
  --card-border: #d8e5f7;
  --card-shadow: 0 4px 16px rgba(18, 60, 120, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #e3edfa;
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--blue-50);
  box-shadow: 0 0 40px rgba(13, 55, 120, .12);
}

/* ===== 首页 ===== */
.home-hero {
  background: linear-gradient(140deg, #1a66e8 0%, #0d47a8 75%);
  color: #fff;
  padding: 30px 22px 34px;
  border-radius: 0 0 24px 24px;
}
.home-hero h1 { font-size: 1.4rem; font-weight: 750; letter-spacing: .03em; }
.home-hero p { margin-top: 7px; font-size: .8rem; opacity: .85; letter-spacing: .06em; }
.home-list { padding: 16px 14px 26px; display: flex; flex-direction: column; gap: 12px; }
.scale-card {
  display: flex; align-items: center; gap: 14px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform .06s ease;
}
.scale-card:active { transform: scale(.985); }
.scale-badge {
  width: 54px; height: 54px; flex: none;
  border-radius: 13px;
  background: linear-gradient(140deg, #3b82f6, #0d47a8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .92rem; letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.scale-info { flex: 1; min-width: 0; }
.scale-name { font-size: 1.02rem; font-weight: 650; color: #14324f; }
.scale-sub { font-size: .77rem; color: var(--muted); margin-top: 4px; }
.scale-arrow { color: #9db6dc; font-size: 1.45rem; font-family: serif; flex: none; }
.home-foot { text-align: center; font-size: .7rem; color: #93a8c4; padding: 4px 0 28px; }

/* ===== 评分页头部 ===== */
.page-head {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(140deg, #1a66e8, #0d47a8);
  color: #fff;
  display: flex; align-items: center;
  padding: 8px 10px;
  min-height: 54px;
  box-shadow: 0 2px 12px rgba(10, 40, 100, .3);
}
.back-btn {
  background: none; border: none; color: #fff;
  font-size: 1.7rem; line-height: 1;
  padding: 6px 12px 6px 6px;
  cursor: pointer; font-family: serif;
  margin-left: 2px;
}
.head-title { flex: 1; text-align: center; font-size: 1.05rem; font-weight: 650; padding-right: 56px; }

/* ===== 页面主体 ===== */
.page-body {
  flex: 1;
  padding: 14px 12px 118px;
  display: flex; flex-direction: column; gap: 14px;
}
.form-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 15px 10px 12px;
  box-shadow: var(--card-shadow);
}
.form-title {
  text-align: center;
  font-weight: 700; font-size: .97rem;
  color: var(--blue-700);
  padding: 1px 0 11px;
  letter-spacing: .04em;
}
.form-notes {
  margin-top: 11px;
  padding: 8px 11px;
  background: #f3f8ff;
  border-left: 3px solid var(--blue-300);
  border-radius: 0 8px 8px 0;
  font-size: .71rem;
  color: #4a5f7d;
  line-height: 1.75;
}
.form-notes p + p { margin-top: 3px; }

/* ===== 纸质表格 ===== */
table.paper {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .8rem;
  line-height: 1.45;
}
.paper th, .paper td {
  border: 1px solid var(--line);
  padding: 6px 5px;
  vertical-align: middle;
  text-align: center;
  word-break: break-word;
}
.paper thead th {
  background: linear-gradient(#eaf2fe, #d8e8fd);
  color: var(--blue-800);
  font-weight: 650;
  font-size: .78rem;
  padding: 7px 3px;
  letter-spacing: .02em;
}
.paper td.group {
  background: #f2f7ff;
  font-weight: 600;
  color: var(--blue-700);
  font-size: .74rem;
}
.paper td.vgroup {
  writing-mode: vertical-rl;
  letter-spacing: .28em;
  padding: 8px 2px;
  font-size: .74rem;
}
.paper td.rowlabel {
  background: #fafcff;
  text-align: left;
  font-size: .78rem;
  color: #24425f;
  padding: 7px 8px;
}
.paper td.dash { color: #b6c4d8; font-size: .78rem; }
.paper td.vnum { font-weight: 700; color: var(--blue-800); background: #f7faff; }
.paper td.row-score {
  font-weight: 700; color: var(--blue-700);
  font-size: .92rem; background: #f7faff;
}
.paper td.row-score.mod { color: #b45309; }
.paper td.note-cell { font-size: .7rem; color: #5b7089; text-align: left; padding: 6px 8px; line-height: 1.55; }
.paper td.pts { font-weight: 650; color: var(--blue-800); white-space: nowrap; }
.paper tfoot td {
  background: #e6f0fe;
  font-weight: 700; color: var(--blue-800);
  font-size: .8rem;
  padding: 8px 6px;
}
.paper tfoot .total-cell { font-size: 1.02rem; color: var(--blue-900); }
.paper tr.on td { background: #eaf3ff; }
.paper tr.on td.rowlabel { color: var(--blue-800); font-weight: 600; }
.cellsub { font-size: .64rem; color: var(--muted); line-height: 1.3; display: inline-block; }
.foot-parts { font-size: .76rem; letter-spacing: .02em; }
.foot-parts b { color: var(--blue-900); font-size: .88rem; margin: 0 3px 0 1px; }

/* ===== 勾选格 ===== */
.paper td.ck { padding: 4px 3px; }
.ck label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px;
  min-height: 46px;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
  -webkit-user-select: none; user-select: none;
}
.ck label:active { background: #e3edfd; }
.ck .box {
  width: 22px; height: 22px; flex: none;
  border: 2px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  position: relative;
  transition: background .12s ease, border-color .12s ease;
  box-shadow: inset 0 1px 2px rgba(20, 50, 90, .06);
}
.ck input { position: absolute; opacity: 0; pointer-events: none; }
.ck .txt { font-size: .74rem; line-height: 1.32; color: #243b53; }
.ck label.on { background: #e4efff; }
.ck label.on .box { background: var(--blue-500); border-color: var(--blue-600); }
.ck label.on .box::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(43deg);
}
.ck label.on .txt { color: var(--blue-800); font-weight: 600; }

/* 行内勾选（PSI 评分项目列） */
.item-label {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s ease;
  -webkit-user-select: none; user-select: none;
}
.item-label:active { background: #e9f1fd; }
.item-label .box {
  width: 22px; height: 22px; flex: none;
  border: 2px solid var(--line-strong);
  border-radius: 5px; background: #fff; position: relative;
  box-shadow: inset 0 1px 2px rgba(20, 50, 90, .06);
}
.item-label input { position: absolute; opacity: 0; pointer-events: none; }
.item-label .txt { font-size: .78rem; line-height: 1.4; color: #243b53; }
.item-label.on { background: #eaf3ff; }
.item-label.on .box { background: var(--blue-500); border-color: var(--blue-600); }
.item-label.on .box::after {
  content: "";
  position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(43deg);
}
.item-label.on .txt { color: var(--blue-800); font-weight: 600; }

/* 性别分段选择（PSI） */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; vertical-align: middle; }
.seg label {
  padding: 4px 9px; font-size: .72rem; cursor: pointer;
  color: #34517a; background: #fff;
  transition: background .12s ease;
  display: inline-flex; align-items: center;
  -webkit-user-select: none; user-select: none;
}
.seg label + label { border-left: 1px solid var(--line-strong); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.on { background: var(--blue-500); color: #fff; font-weight: 650; }
.paper td.ctrl { padding: 4px 2px; text-align: center; }
.paper td.age-td { padding: 7px 3px; }
.num-input.psi-age { max-width: 64px; font-size: .95rem; padding: 7px 2px 5px; border-bottom-width: 2.5px; }
.base-hint { font-size: .64rem; font-weight: 600; color: var(--blue-700); white-space: nowrap; }

/* PSI 基本信息弹窗表单 */
.modal-form { padding: 4px 18px 8px; }
.mf-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.mf-row + .mf-row { border-top: 1px dashed #e4eefb; }
.mf-label { font-size: .8rem; color: #24425f; flex: none; width: 64px; text-align: right; }
.mf-quick { display: flex; gap: 7px; flex: 1; flex-wrap: wrap; }
.mf-quick button {
  border: 1px solid var(--line-strong);
  background: #f7faff;
  color: var(--blue-800);
  border-radius: 8px;
  padding: 7px 0;
  font-size: .8rem;
  font-weight: 650;
  min-width: 42px;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: background .12s ease;
}
.mf-quick button:active { background: #d8e8fd; }
.mf-quick button.on { background: var(--blue-500); border-color: var(--blue-600); color: #fff; }
.mf-age-row { align-items: flex-start; }
.mf-age-row .mf-label { padding-top: 14px; }
.mf-age-main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.mf-age-main .psi-age { width: 96px; max-width: 96px; font-size: .95rem; padding: 7px 2px 5px; }
.modal-btns .btn-go:disabled { background: #c4d3ea; color: #eef4fc; }
.modal-btns .btn-go.ready { background: linear-gradient(135deg, #1a66e8, #0d47a8); }

/* 数字输入 */
.num-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.num-input {
  width: 108px;
  border: none;
  border-bottom: 2.5px solid #9db6dc;
  background: #f7faff;
  border-radius: 8px 8px 0 0;
  font-size: 1.12rem; font-weight: 650;
  color: var(--blue-900);
  text-align: center;
  padding: 7px 4px 4px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.num-input:focus { border-color: var(--blue-500); background: #eef5ff; }
.num-unit { font-size: .68rem; color: var(--muted); }
.base-hint { font-size: .72rem; font-weight: 650; color: var(--blue-700); }

/* 休克指数页 */
.formula {
  text-align: center;
  font-size: .88rem; font-weight: 650; color: var(--blue-800);
  padding: 2px 0 12px; letter-spacing: .02em;
}
.formula .fx { font-size: .72rem; font-weight: 400; color: var(--muted); display: block; margin-top: 4px; }
.si-val {
  font-size: 1.5rem; font-weight: 800; color: var(--blue-900);
  font-variant-numeric: tabular-nums;
  background: #f7faff !important;
}
.si-desc { font-size: .7rem; color: var(--muted); }

/* ===== 参考资料折叠卡 ===== */
.ref-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}
.ref-head {
  padding: 13px 15px;
  font-weight: 650; font-size: .88rem; color: var(--blue-700);
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.ref-head .chev { color: #9db6dc; transition: transform .2s ease; font-size: .95rem; }
.ref-card.open .chev { transform: rotate(180deg); }
.ref-body { display: none; border-top: 1px solid #e4eefb; padding: 12px 10px; }
.ref-card.open .ref-body { display: block; }
.ref-body .paper { font-size: .74rem; }
.ref-body td.rc { font-weight: 650; color: var(--blue-800); white-space: nowrap; }
.ref-body td { text-align: left; }
.ref-body td:first-child { text-align: center; }

/* ===== 底部结果栏 ===== */
.result-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: center;
  pointer-events: none;
}
.rb-inner {
  pointer-events: auto;
  width: 100%; max-width: 520px;
  background: linear-gradient(135deg, #1257d6, #0a3d91);
  color: #fff;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(11px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 22px rgba(10, 40, 100, .28);
}
.rb-score { display: flex; flex-direction: column; line-height: 1.12; min-width: 72px; flex: none; }
.rb-label { font-size: .67rem; opacity: .82; letter-spacing: .08em; }
.rb-num { font-size: 1.72rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rb-level { flex: 1; min-width: 0; }
.rb-level .lv {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .77rem; font-weight: 650;
  background: rgba(255, 255, 255, .17);
  line-height: 1.45;
  max-width: 100%;
}
.rb-level .lv.ok { background: #1f9d55; }
.rb-level .lv.info { background: #2f6fd8; }
.rb-level .lv.warn { background: #e8890c; }
.rb-level .lv.danger { background: #e03131; }
.rb-sub { font-size: .68rem; opacity: .88; margin-top: 5px; line-height: 1.45; }
.rb-reset {
  flex: none;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .38);
  color: #fff;
  border-radius: 10px;
  padding: 9px 13px;
  font-size: .77rem;
  cursor: pointer;
  letter-spacing: .05em;
}
.rb-reset:active { background: rgba(255, 255, 255, .28); }

/* ===== 小屏适配 ===== */
@media (max-width: 370px) {
  .page-body { padding: 10px 8px 112px; }
  .form-card { padding: 12px 7px 10px; }
  .ck .txt { font-size: .7rem; }
  .paper { font-size: .76rem; }
  .rb-num { font-size: 1.5rem; }
  .seg label { padding: 6px 11px; font-size: .76rem; }
}

/* ===== 弹窗通用 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(9, 30, 72, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 30px 24px;
}
.modal-mask.alert { background: rgba(64, 10, 12, .52); }
.modal-box {
  width: 100%; max-width: 330px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 18px 50px rgba(8, 30, 80, .35);
  overflow: hidden;
  animation: modal-pop .2s ease;
}
@keyframes modal-pop { from { transform: scale(.92); opacity: 0; } }
.modal-head {
  background: linear-gradient(135deg, #1a66e8, #0d47a8);
  color: #fff; padding: 12px 16px;
  font-weight: 700; font-size: .9rem;
  display: flex; align-items: center; gap: 9px;
  letter-spacing: .04em;
}
.modal-head.alert { background: linear-gradient(135deg, #f04438, #c92a2a); }
.m-ico {
  width: 20px; height: 20px; flex: none;
  border-radius: 50%; background: #fff; color: #0d47a8;
  font-weight: 800; font-size: .82rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-head.alert .m-ico { color: #c92a2a; }
.modal-body { padding: 20px 18px 16px; font-size: .85rem; line-height: 1.8; color: #2a3f5c; text-align: center; }
.modal-body b { color: #0d47a8; }
.modal-body.alert b, .modal-head.alert ~ .modal-body b { color: #c92a2a; }
.modal-btns { display: flex; border-top: 1px solid #e4eefb; }
.modal-btns button {
  flex: 1; border: none; background: none;
  padding: 14px 6px; font-size: .88rem; cursor: pointer;
  letter-spacing: .03em;
}
.modal-btns .btn-stay { color: #5b7089; }
.modal-btns .btn-stay:active { background: #f0f5fd; }
.modal-btns .btn-go { background: linear-gradient(135deg, #1a66e8, #0d47a8); color: #fff; font-weight: 650; }
.modal-btns .btn-go:active { background: #0d47a8; }
