/* =====================================================================
 * 31 · 单脚站立平衡自测 —— 独立皮肤「静稳态」
 * 配色：松石绿 / 米白 / 珊瑚点；布局：首屏双栏秒表台 + 横向年龄刻度带；
 * 字体层级：等宽超大秒数（44px mono）＋ 11px 全大写微标 ＋ 800 字重标题。
 * 深色由公共导航 #themeToggle 写 <html data-theme="dark"> 驱动。
 * ===================================================================== */

.hg4-p31 {
    --p31-bg: #f7f5ee;
    --p31-surface: #fffdf8;
    --p31-surface2: #f0eee3;
    --p31-ink: #12332e;
    --p31-sub: #4d6660;
    --p31-muted: #879a94;
    --p31-line: #dce5de;
    --p31-accent: #0e7c6b;
    --p31-accent2: #e8735a;
    --p31-soft: rgba(14, 124, 107, .10);
    --p31-okbg: rgba(14, 124, 107, .11);
    --p31-warnbg: rgba(232, 115, 90, .13);
    --p31-on: #ffffff;
    --p31-shadow: 0 14px 40px rgba(19, 60, 52, .08);
    --p31-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --p31-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
    background: var(--p31-bg);
    color: var(--p31-ink);
    font-family: var(--p31-sans);
    font-size: 15px;
    line-height: 1.82;
    letter-spacing: .01em;
    min-height: 60vh;
    padding: 0 0 72px;
    -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] .hg4-p31 {
    --p31-bg: #0c1513;
    --p31-surface: #121f1c;
    --p31-surface2: #0f1a18;
    --p31-ink: #e6f2ed;
    --p31-sub: #adc6bd;
    --p31-muted: #7d9a90;
    --p31-line: #233b34;
    --p31-accent: #4fd1b0;
    --p31-accent2: #ff9b80;
    --p31-soft: rgba(79, 209, 176, .14);
    --p31-okbg: rgba(79, 209, 176, .14);
    --p31-warnbg: rgba(255, 155, 128, .14);
    --p31-on: #08130f;
    --p31-shadow: 0 14px 40px rgba(0, 0, 0, .34);
}
.hg4-p31 *, .hg4-p31 *::before, .hg4-p31 *::after { box-sizing: border-box; }
.hg4-p31 h1, .hg4-p31 h2, .hg4-p31 h3 { margin: 0; font-weight: 800; letter-spacing: -.018em; line-height: 1.35; }
.hg4-p31 p { margin: 0 0 12px; }
.hg4-p31 strong, .hg4-p31 b { font-weight: 750; color: var(--p31-ink); }
.hg4-p31 a { color: var(--p31-accent); text-decoration: none; }
.hg4-p31 a:hover { text-decoration: underline; }
.hg4-p31 button { cursor: pointer; font-family: inherit; }
.hg4-p31 [hidden] { display: none !important; }
.hg4-p31 img { max-width: 100%; height: auto; }
.hg4-p31-sr, .p31-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.p31-wrap { max-width: 1220px; margin: 0 auto; padding: 0 24px; }

/* ---------- 首屏 ---------- */
.p31-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr);
    gap: 36px;
    align-items: center;
    padding: 38px 0 32px;
    border-bottom: 1px solid var(--p31-line);
}
.p31-kicker {
    display: inline-block;
    font: 700 11px/1.4 var(--p31-mono);
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--p31-accent);
    border-bottom: 2px solid var(--p31-accent2);
    padding-bottom: 6px;
}
.p31-hero h1 {
    font-size: clamp(30px, 3.5vw, 46px);
    line-height: 1.22;
    letter-spacing: -.03em;
    margin: 18px 0 14px;
    color: var(--p31-ink);
    background: none;
    -webkit-text-fill-color: currentColor;
}
.p31-lede { font-size: 16px; line-height: 1.92; color: var(--p31-sub); max-width: 56ch; margin: 0 0 18px; }
.p31-lede strong { color: var(--p31-ink); }
.p31-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; }
.p31-points li {
    font-size: 12.5px; color: var(--p31-sub); background: var(--p31-surface);
    border: 1px solid var(--p31-line); border-radius: 7px; padding: 4px 11px;
}
.p31-hero-note { font-size: 12.5px; color: var(--p31-muted); margin: 0; }

/* ---------- 首屏操作台 ---------- */
.p31-console {
    position: relative; overflow: hidden;
    background: var(--p31-surface);
    border: 1px solid var(--p31-line);
    border-radius: 20px;
    box-shadow: var(--p31-shadow);
    padding: 20px 22px 22px;
}
.p31-console::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: linear-gradient(90deg, var(--p31-accent) 0 62%, var(--p31-accent2) 62% 100%);
}
.p31-console-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.p31-console-label { font: 700 11px/1.4 var(--p31-mono); letter-spacing: .16em; color: var(--p31-muted); text-transform: uppercase; }
.p31-console-tag { font-size: 11px; color: var(--p31-accent); background: var(--p31-soft); border-radius: 999px; padding: 3px 10px; }
.p31-timer { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.p31-ring {
    width: 148px; height: 148px; flex: none; border-radius: 50%;
    background: conic-gradient(var(--p31-accent) var(--p31-progress, 0%), var(--p31-surface2) 0);
    display: grid; place-items: center;
    box-shadow: inset 0 0 0 1px var(--p31-line);
    transition: background .1s linear;
}
.p31-ring-in {
    width: 122px; height: 122px; border-radius: 50%;
    background: var(--p31-surface);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.p31-ring-num {
    font: 700 42px/1 var(--p31-mono); font-variant-numeric: tabular-nums;
    color: var(--p31-accent); letter-spacing: -.04em;
}
.p31-ring-unit { font: 700 10px/1.6 var(--p31-mono); letter-spacing: .24em; color: var(--p31-muted); }
.p31-timer-side { flex: 1; min-width: 0; }
.p31-timer-tip { font-size: 12.5px; color: var(--p31-sub); line-height: 1.72; margin: 0 0 10px; }
.p31-timer-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.p31-mini { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--p31-muted); margin-top: 10px; }
.p31-console-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.p31-field { display: block; font-size: 13px; font-weight: 700; color: var(--p31-ink); }
.p31-field > span { display: block; margin-bottom: 6px; }
.p31-field i { font-style: normal; font-weight: 400; font-size: 11.5px; color: var(--p31-muted); margin-left: 5px; }
.p31-input {
    width: 100%; font-family: inherit; font-size: 14px; color: var(--p31-ink);
    background: var(--p31-surface2); border: 1px solid var(--p31-line);
    border-radius: 9px; padding: 9px 12px; outline: none;
    transition: border-color .16s, box-shadow .16s;
}
.p31-input:focus { border-color: var(--p31-accent); box-shadow: 0 0 0 3px var(--p31-soft); }
.p31-input--mini { width: auto; padding: 4px 8px; font-size: 12px; }
.p31-textarea { resize: vertical; min-height: 108px; line-height: 1.7; }
.p31-console-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.p31-btn {
    appearance: none; border: 1px solid var(--p31-line); background: var(--p31-surface2);
    color: var(--p31-ink); font-size: 13.5px; font-weight: 700;
    border-radius: 9px; padding: 9px 16px;
    transition: transform .14s, filter .14s, background .14s;
}
.p31-btn:hover { transform: translateY(-1px); border-color: var(--p31-accent); }
.p31-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.p31-btn--main { background: var(--p31-accent); color: var(--p31-on); border-color: var(--p31-accent); }
.p31-btn--main:hover { filter: brightness(1.1); }
:root[data-theme="dark"] .p31-btn--main { color: #07130f; }
.hg4-err.p31-err { font-size: 12.5px; color: var(--p31-accent2); min-height: 0; margin: 8px 0 0; }
.hg4-err.p31-err:empty { display: none; }

/* ---------- 年龄刻度带 ---------- */
.p31-band { padding: 26px 0 28px; border-bottom: 1px solid var(--p31-line); }
.p31-band-head { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.p31-band-head h2 { font-size: 18px; }
.p31-band-head small { font-size: 12px; font-weight: 400; color: var(--p31-muted); margin-left: 8px; }
.p31-mode-switch {
    border: 1px solid var(--p31-line); background: var(--p31-surface); color: var(--p31-accent);
    font-size: 12px; font-weight: 700; border-radius: 999px; padding: 5px 13px;
}
.p31-scale { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.p31-scale-item {
    background: var(--p31-surface); border: 1px solid var(--p31-line);
    border-radius: 12px; padding: 12px 12px 14px;
    transition: border-color .18s, background .18s;
}
.p31-scale-item.is-current { border-color: var(--p31-accent); background: var(--p31-soft); }
.p31-scale-item b { display: block; font-size: 12.5px; color: var(--p31-sub); margin-bottom: 10px; }
.p31-scale-bar { display: block; height: 7px; border-radius: 99px; background: var(--p31-surface2); overflow: hidden; }
.p31-scale-bar i { display: block; height: 100%; width: var(--v); border-radius: 99px; background: linear-gradient(90deg, var(--p31-accent), var(--p31-accent2)); }
.p31-scale-item em { display: block; margin-top: 9px; font: 700 20px/1.2 var(--p31-mono); font-style: normal; color: var(--p31-ink); }
.p31-band-foot { font-size: 12.5px; color: var(--p31-muted); line-height: 1.78; margin: 14px 0 0; }

/* ---------- 结果 ---------- */
.p31-result, .p31-extra, .p31-content { padding: 30px 0; border-bottom: 1px solid var(--p31-line); }
.p31-sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.p31-sec-no { font: 700 11px/1 var(--p31-mono); letter-spacing: .16em; color: var(--p31-accent2); border: 1px solid var(--p31-accent2); border-radius: 5px; padding: 5px 7px; }
.p31-sec-head h2 { font-size: 21px; }
.p31-sec-head small { font-size: 12px; color: var(--p31-muted); font-weight: 400; }
.p31-empty {
    display: flex; align-items: center; gap: 16px;
    background: var(--p31-surface); border: 1px dashed var(--p31-line);
    border-radius: 14px; padding: 26px 22px; color: var(--p31-muted); font-size: 14px;
}
.p31-empty b { font-size: 34px; font-weight: 400; }
.p31-out-top { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 14px; margin-bottom: 18px; }
.p31-verdict {
    background: var(--p31-ink); color: var(--p31-surface); border-radius: 14px; padding: 18px 20px;
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
:root[data-theme="dark"] .p31-verdict { background: var(--p31-accent); color: #07130f; }
.p31-verdict span { font: 700 10.5px/1.4 var(--p31-mono); letter-spacing: .2em; text-transform: uppercase; opacity: .72; }
.p31-verdict strong { font-size: 19px; font-weight: 800; line-height: 1.45; color: inherit; }
.p31-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.p31-kpi { background: var(--p31-surface); border: 1px solid var(--p31-line); border-radius: 12px; padding: 14px 12px; text-align: center; }
.p31-kpi b { display: block; font: 700 26px/1.2 var(--p31-mono); color: var(--p31-accent); font-variant-numeric: tabular-nums; }
.p31-kpi span { font-size: 11.5px; color: var(--p31-sub); }
.p31-feet { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.p31-foot { background: var(--p31-surface); border: 1px solid var(--p31-line); border-radius: 12px; padding: 15px 16px; }
.p31-foot h3 { font-size: 13px; color: var(--p31-sub); margin-bottom: 10px; }
.p31-foot-bar { height: 9px; background: var(--p31-surface2); border-radius: 99px; overflow: hidden; }
.p31-foot-bar i { display: block; height: 100%; width: 0; background: var(--p31-accent); border-radius: 99px; transition: width .3s; }
.p31-foot p { margin: 10px 0 0; font-size: 13px; color: var(--p31-sub); }
.p31-foot p b { font: 700 22px/1.2 var(--p31-mono); color: var(--p31-ink); margin-right: 4px; }
.p31-tag { font-size: 11.5px; border-radius: 5px; padding: 2px 8px; margin-left: 6px; }
.p31-tag--ok { color: var(--p31-accent); background: var(--p31-okbg); }
.p31-tag--warn { color: var(--p31-accent2); background: var(--p31-warnbg); }
.p31-subh { font-size: 15.5px; margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.p31-subh small { font-size: 11.5px; font-weight: 400; color: var(--p31-muted); }
.p31-chip { font: 700 11px/1.5 var(--p31-mono); background: var(--p31-soft); color: var(--p31-accent); border-radius: 5px; padding: 3px 9px; }
.p31-list { list-style: none; margin: 0; padding: 0; }
.p31-list li {
    position: relative; padding: 8px 0 8px 22px; font-size: 14px; color: var(--p31-sub);
    border-bottom: 1px solid var(--p31-line); line-height: 1.8;
}
.p31-list li::before { content: "—"; position: absolute; left: 0; color: var(--p31-accent); font-family: var(--p31-mono); }
.p31-list li:last-child { border-bottom: 0; }
.p31-list strong { color: var(--p31-ink); }
.p31-train { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.p31-train div { background: var(--p31-surface2); border-radius: 10px; padding: 11px 14px; font-size: 13.5px; color: var(--p31-sub); line-height: 1.75; }
.p31-train b { display: block; color: var(--p31-ink); font-size: 13px; margin-bottom: 2px; }
.p31-table-scroll { overflow-x: auto; border: 1px solid var(--p31-line); border-radius: 10px; }
.p31-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
.p31-table th, .p31-table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--p31-line); }
.p31-table th { background: var(--p31-surface2); color: var(--p31-sub); font-weight: 700; font-size: 12px; white-space: nowrap; }
.p31-table tr:last-child td { border-bottom: 0; }
.p31-table td strong { color: var(--p31-ink); }
.p31-disclaimer {
    margin: 20px 0 0; padding: 13px 15px; border-left: 3px solid var(--p31-accent2);
    background: var(--p31-surface2); border-radius: 0 9px 9px 0;
    font-size: 13px; line-height: 1.85; color: var(--p31-sub);
}
.p31-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

/* ---------- 批量 / 留档 ---------- */
.p31-extra-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.p31-card { background: var(--p31-surface); border: 1px solid var(--p31-line); border-radius: 14px; padding: 18px 19px; }
.p31-card h3 { font-size: 15px; margin-bottom: 12px; }
.p31-hint { font-size: 12.5px; color: var(--p31-muted); line-height: 1.78; margin: 8px 0 12px; }
.p31-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; }
.p31-checks label { font-size: 13px; color: var(--p31-sub); display: flex; gap: 7px; align-items: center; cursor: pointer; }
.p31-checks input { accent-color: var(--p31-accent); }
.p31-history { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.p31-history-empty { font-size: 12.5px; color: var(--p31-muted); }
.p31-history-row { font: 12px/1.6 var(--p31-mono); color: var(--p31-sub); border-bottom: 1px dashed var(--p31-line); padding-bottom: 5px; }

/* ---------- 内容 / Tabs / FAQ ---------- */
.p31-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.p31-tab {
    border: 1px solid var(--p31-line); background: var(--p31-surface); color: var(--p31-sub);
    font-size: 13.5px; font-weight: 700; border-radius: 9px; padding: 8px 16px;
}
.p31-tab.is-on { background: var(--p31-accent); color: var(--p31-on); border-color: var(--p31-accent); }
:root[data-theme="dark"] .p31-tab.is-on { color: #07130f; }
.p31-prose { max-width: 82ch; }
.p31-prose h3 { font-size: 17px; margin: 22px 0 9px; }
.p31-prose h3:first-child { margin-top: 0; }
.p31-prose p { font-size: 14.5px; line-height: 2; color: var(--p31-sub); margin: 0 0 15px; }
.p31-prose strong { color: var(--p31-ink); }
.p31-figure { display: block; width: 100%; max-width: 720px; border: 1px solid var(--p31-line); border-radius: 12px; margin: 6px 0 18px; background: var(--p31-surface); }
.p31-faq details { border: 1px solid var(--p31-line); background: var(--p31-surface); border-radius: 10px; margin-bottom: 9px; }
.p31-faq summary { cursor: pointer; font-size: 14.5px; font-weight: 700; padding: 13px 16px; color: var(--p31-ink); }
.p31-faq details > div { padding: 0 16px 15px; font-size: 14px; line-height: 1.95; color: var(--p31-sub); }
.p31-faq details > div strong { color: var(--p31-ink); }
.p31-boundary {
    margin: 26px 0 18px; padding: 14px 17px; border: 1px solid var(--p31-line);
    border-radius: 11px; background: var(--p31-surface2);
    font-size: 13px; line-height: 1.9; color: var(--p31-sub);
}
.p31-related { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.p31-related a {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    background: var(--p31-surface); border: 1px solid var(--p31-line); border-radius: 10px;
    padding: 12px 14px; font-size: 13.5px; font-weight: 700; color: var(--p31-ink);
}
.p31-related a:hover { border-color: var(--p31-accent); text-decoration: none; }
.p31-related a span { color: var(--p31-accent); }

@media (max-width: 900px) {
    .p31-hero, .p31-out-top, .p31-extra-grid, .p31-feet { grid-template-columns: 1fr; }
    .p31-scale { grid-template-columns: repeat(3, 1fr); }
    .p31-related { grid-template-columns: repeat(2, 1fr); }
    .p31-train { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .p31-wrap { padding: 0 16px; }
    .p31-hero { padding-top: 26px; }
    .p31-timer { flex-direction: column; align-items: flex-start; }
    .p31-console-fields, .p31-kpis { grid-template-columns: 1fr 1fr; }
    .p31-scale { grid-template-columns: repeat(2, 1fr); }
    .p31-related { grid-template-columns: 1fr; }
}
