/* =====================================================================
 * 40 · 斜视弱视儿童自查 —— 独立皮肤「视标卡」
 * 配色：亮青绿 / 白 / 柠檬黄；布局：视标图形卡 + 年龄横轴 + 双栏自查；
 * 字体层级：圆润 800 标题 + 超大视标字母 96px + 12px 疏排说明。
 * ===================================================================== */

.hg4-p40 {
    --p40-bg: #f3faf9;
    --p40-surface: #ffffff;
    --p40-surface2: #eaf5f3;
    --p40-ink: #173b3a;
    --p40-sub: #4d6b69;
    --p40-muted: #8aa5a2;
    --p40-line: #d4e9e5;
    --p40-accent: #0f8f8a;
    --p40-accent2: #e9c732;
    --p40-bad: #c4533c;
    --p40-soft: rgba(15, 143, 138, .11);
    --p40-badbg: rgba(196, 83, 60, .12);
    --p40-on: #ffffff;
    --p40-shadow: 0 14px 38px rgba(15, 90, 88, .09);
    --p40-round: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    --p40-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    background: var(--p40-bg); color: var(--p40-ink);
    font-family: var(--p40-round); font-size: 15px; line-height: 1.86;
    min-height: 60vh; padding: 0 0 72px; -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] .hg4-p40 {
    --p40-bg: #0c1a19; --p40-surface: #122522; --p40-surface2: #19312e;
    --p40-ink: #e6f5f2; --p40-sub: #aecbc7; --p40-muted: #779b97;
    --p40-line: #23433f; --p40-accent: #56d0c6; --p40-accent2: #f0d35c;
    --p40-bad: #f0927a; --p40-soft: rgba(86, 208, 198, .14); --p40-badbg: rgba(240, 146, 122, .14);
    --p40-on: #0a1817; --p40-shadow: 0 14px 38px rgba(0, 0, 0, .38);
}
.hg4-p40 *, .hg4-p40 *::before, .hg4-p40 *::after { box-sizing: border-box; }
.hg4-p40 h1, .hg4-p40 h2, .hg4-p40 h3 { margin: 0; font-weight: 800; letter-spacing: -.01em; line-height: 1.38; }
.hg4-p40 p { margin: 0 0 12px; }
.hg4-p40 strong, .hg4-p40 b { font-weight: 800; color: var(--p40-ink); }
.hg4-p40 a { color: var(--p40-accent); text-decoration: none; }
.hg4-p40 a:hover { text-decoration: underline; }
.hg4-p40 button { cursor: pointer; font-family: inherit; }
.hg4-p40 [hidden] { display: none !important; }
.hg4-p40 img { max-width: 100%; height: auto; }
.p40-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.p40-wrap { max-width: 1220px; margin: 0 auto; padding: 0 24px; }

/* ---------- 首屏 ---------- */
.p40-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .98fr); gap: 34px; align-items: center; padding: 38px 0 30px; border-bottom: 1px solid var(--p40-line); }
.p40-kicker { display: inline-block; font: 800 10.5px/1.4 var(--p40-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--p40-accent); background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 99px; padding: 6px 14px; }
.p40-hero h1 { font-size: clamp(29px, 3.4vw, 44px); line-height: 1.26; letter-spacing: -.024em; margin: 17px 0 13px; color: var(--p40-ink); background: none; -webkit-text-fill-color: currentColor; }
.p40-lede { font-size: 15.5px; line-height: 1.96; color: var(--p40-sub); max-width: 58ch; margin: 0 0 16px; }
.p40-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; }
.p40-points li { font-size: 12.5px; color: var(--p40-sub); background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 99px; padding: 4px 12px; }
.p40-hero-note { font-size: 12.5px; color: var(--p40-muted); margin: 0; }
.p40-console { position: relative; background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 22px; box-shadow: var(--p40-shadow); padding: 20px 22px 22px; }
.p40-optotype { position: absolute; right: 20px; top: -22px; width: 74px; height: 74px; border-radius: 18px; background: var(--p40-accent2); display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(6deg); box-shadow: 0 6px 14px rgba(15, 90, 88, .16); }
.p40-optotype span { font: 900 40px/1 var(--p40-mono); color: #173b3a; }
.p40-optotype small { font: 700 7px/1.4 var(--p40-mono); letter-spacing: .08em; color: #173b3a; margin-top: 3px; }
.p40-console-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 15px; padding-right: 76px; border-bottom: 1px dashed var(--p40-line); padding-bottom: 12px; }
.p40-console-head b { font: 800 11px/1.4 var(--p40-mono); letter-spacing: .15em; text-transform: uppercase; color: var(--p40-accent); }
.p40-console-head span { font-size: 11px; color: var(--p40-muted); }
.p40-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.p40-field { display: block; font-size: 12.5px; font-weight: 800; color: var(--p40-ink); }
.p40-field > span { display: block; margin-bottom: 5px; }
.p40-field i { font-style: normal; font-weight: 400; font-size: 11px; color: var(--p40-muted); margin-left: 4px; }
.p40-input { width: 100%; font-family: inherit; font-size: 14px; color: var(--p40-ink); background: var(--p40-surface2); border: 1px solid var(--p40-line); border-radius: 11px; padding: 9px 11px; outline: none; }
.p40-input:focus { border-color: var(--p40-accent); box-shadow: 0 0 0 3px var(--p40-soft); }
.p40-textarea { resize: vertical; min-height: 106px; line-height: 1.7; }
.p40-lab { display: block; font-size: 12.5px; font-weight: 800; margin: 14px 0 8px; }
.p40-lab i { font-style: normal; font-weight: 400; font-size: 11px; color: var(--p40-muted); margin-left: 5px; }
.p40-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.p40-checks label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--p40-sub); background: var(--p40-surface2); border: 1px solid var(--p40-line); border-radius: 9px; padding: 7px 9px; cursor: pointer; }
.p40-checks input { accent-color: var(--p40-accent); }
.p40-console-btns, .p40-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.p40-btn { appearance: none; border: 1px solid var(--p40-line); background: var(--p40-surface2); color: var(--p40-ink); font-size: 13.5px; font-weight: 800; border-radius: 99px; padding: 9px 18px; transition: transform .14s, filter .14s; }
.p40-btn:hover { transform: translateY(-1px); border-color: var(--p40-accent); }
.p40-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.p40-btn--main { background: var(--p40-accent); color: var(--p40-on); border-color: var(--p40-accent); }
:root[data-theme="dark"] .p40-btn--main { color: #0a1817; }
.hg4-err.p40-err { font-size: 12.5px; color: var(--p40-bad); min-height: 0; margin: 8px 0 0; }
.hg4-err.p40-err:empty { display: none; }
.p40-scope { margin: 20px 0 0; padding: 14px 17px; border-radius: 14px; background: var(--p40-surface); border-left: 4px solid var(--p40-accent2); font-size: 13px; line-height: 1.92; color: var(--p40-sub); }

/* ---------- 年龄横轴 ---------- */
.p40-ageaxis { padding: 26px 0 28px; border-bottom: 1px solid var(--p40-line); }
.p40-ageaxis h2 { font-size: 18px; }
.p40-ageaxis h2 small { display: block; font-size: 11.5px; font-weight: 400; color: var(--p40-muted); margin-top: 4px; }
.p40-axis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin-top: 18px; position: relative; }
.p40-axis::before { content: ""; position: absolute; left: 8%; right: 8%; top: 12px; height: 3px; background: var(--p40-line); border-radius: 99px; }
.p40-axis-item { position: relative; text-align: center; padding: 34px 8px 0; }
.p40-axis-item::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 15px; height: 15px; border-radius: 50%; background: var(--p40-surface); border: 3px solid var(--p40-line); }
.p40-axis-item.is-on::before { border-color: var(--p40-accent); background: var(--p40-accent2); }
.p40-axis-item b { display: block; font: 800 13px/1.4 var(--p40-mono); color: var(--p40-ink); }
.p40-axis-item.is-on b { color: var(--p40-accent); }
.p40-axis-item span { display: block; font-size: 11px; line-height: 1.7; color: var(--p40-muted); margin-top: 5px; }
.p40-axis-foot { font-size: 12.5px; color: var(--p40-muted); margin: 14px 0 0; }

/* ---------- 结果 ---------- */
.p40-result, .p40-ai, .p40-extra, .p40-content { padding: 28px 0; border-bottom: 1px solid var(--p40-line); }
.p40-sec-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.p40-sec-no { font: 800 10px/1 var(--p40-mono); letter-spacing: .14em; color: var(--p40-on); background: var(--p40-accent); border-radius: 99px; padding: 6px 10px; }
:root[data-theme="dark"] .p40-sec-no { color: #0a1817; }
.p40-sec-head h2 { font-size: 21px; }
.p40-sec-head small { font-size: 12px; color: var(--p40-muted); font-weight: 400; }
.p40-empty { display: flex; align-items: center; gap: 16px; background: var(--p40-surface); border: 2px dashed var(--p40-line); border-radius: 18px; padding: 26px 22px; color: var(--p40-muted); font-size: 14px; }
.p40-empty b { font-size: 34px; font-weight: 400; }
.p40-alert { background: var(--p40-badbg); border: 1px solid var(--p40-bad); border-left: 5px solid var(--p40-bad); border-radius: 0 12px 12px 0; padding: 14px 17px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.92; color: var(--p40-sub); }
.p40-alert strong { color: var(--p40-bad); }
.p40-verdict { background: var(--p40-accent); color: #fff; border-radius: 18px; padding: 18px 22px; margin-bottom: 14px; }
:root[data-theme="dark"] .p40-verdict { background: #155a56; }
.p40-verdict > span { display: block; font: 800 10px/1.5 var(--p40-mono); letter-spacing: .18em; text-transform: uppercase; opacity: .78; }
.p40-verdict strong { display: block; font-size: 21px; font-weight: 800; margin: 6px 0; color: inherit; }
.p40-verdict p { font-size: 13.5px; line-height: 1.88; margin: 0; opacity: .92; }
.p40-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.p40-kpi { background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 14px; padding: 13px 15px; }
.p40-kpi span { display: block; font: 800 10px/1.5 var(--p40-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--p40-muted); }
.p40-kpi b { display: block; font: 800 21px/1.45 var(--p40-mono); color: var(--p40-ink); margin-top: 4px; }
.p40-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.p40-panel { background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 16px; padding: 16px 19px; }
.p40-panel h3 { font-size: 15.5px; margin-bottom: 10px; }
.p40-panel h3 small { display: block; font-size: 11.5px; font-weight: 400; color: var(--p40-muted); margin-top: 3px; }
.p40-list { list-style: none; margin: 0; padding: 0; }
.p40-list li { position: relative; padding: 8px 0 8px 22px; font-size: 13.5px; line-height: 1.9; color: var(--p40-sub); border-bottom: 1px solid var(--p40-line); }
.p40-list li:last-child { border-bottom: 0; }
.p40-list li::before { content: "◎"; position: absolute; left: 0; color: var(--p40-accent); }
.p40-list strong { color: var(--p40-ink); }
.p40-subh { font-size: 16.5px; margin: 24px 0 11px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.p40-chip { font: 800 11px/1.5 var(--p40-mono); background: var(--p40-soft); color: var(--p40-accent); border-radius: 99px; padding: 3px 10px; }
.p40-window { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.p40-window-item { background: var(--p40-surface2); border-radius: 14px; padding: 13px 16px; }
.p40-window-item b { display: block; font: 800 10px/1.5 var(--p40-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--p40-accent); margin-bottom: 5px; }
.p40-window-item h4 { font-size: 14px; margin: 0 0 5px; }
.p40-window-item p { font-size: 12.5px; line-height: 1.85; color: var(--p40-sub); margin: 0; }
.p40-table-scroll { overflow-x: auto; border: 1px solid var(--p40-line); border-radius: 14px; }
.p40-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 780px; }
.p40-table th, .p40-table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--p40-line); }
.p40-table th { background: var(--p40-surface2); font-size: 12px; color: var(--p40-sub); font-weight: 800; white-space: nowrap; }
.p40-table tr:last-child td { border-bottom: 0; }
.p40-disclaimer { margin: 20px 0 0; padding: 14px 17px; border-radius: 14px; background: var(--p40-surface2); font-size: 13px; line-height: 1.92; color: var(--p40-sub); }

/* ---------- AI ---------- */
.p40-ai-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.p40-ai-head h2 { font-size: 18px; }
.p40-ai-head h2 small { font-size: 11.5px; font-weight: 700; color: var(--p40-accent); background: var(--p40-soft); border-radius: 99px; padding: 3px 9px; margin-left: 7px; }
.p40-ai-head > span { font-size: 12px; color: var(--p40-muted); }
.p40-ai { border: 1px solid var(--p40-line); border-left: 4px solid var(--p40-accent2); border-radius: 0 14px 14px 0; padding-left: 20px; padding-right: 20px; }
.p40-ai-box { background: var(--p40-surface2); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; line-height: 1.9; color: var(--p40-sub); max-height: 260px; overflow: auto; white-space: pre-wrap; }
.p40-ai-box b { color: var(--p40-ink); }
.p40-ai-btns { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.p40-ai-status { font: 12px/1.7 var(--p40-mono); color: var(--p40-muted); margin: 10px 0 0; }

/* ---------- 批量 / 内容 ---------- */
.p40-extra-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.p40-card { background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 16px; padding: 17px 19px; }
.p40-card h3 { font-size: 16px; margin-bottom: 10px; }
.p40-hint { font-size: 12.5px; color: var(--p40-muted); line-height: 1.8; margin: 8px 0 12px; }
.p40-card-text { font-size: 13.5px; line-height: 1.96; color: var(--p40-sub); }
.p40-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 17px; }
.p40-tab { border: 1px solid var(--p40-line); background: var(--p40-surface); color: var(--p40-sub); font-size: 13.5px; font-weight: 800; border-radius: 99px; padding: 8px 17px; }
.p40-tab.is-on { background: var(--p40-accent); color: var(--p40-on); border-color: var(--p40-accent); }
:root[data-theme="dark"] .p40-tab.is-on { color: #0a1817; }
.p40-prose { max-width: 84ch; }
.p40-prose h3 { font-size: 17.5px; margin: 22px 0 9px; }
.p40-prose h3:first-child { margin-top: 0; }
.p40-prose p { font-size: 14.5px; line-height: 2.02; color: var(--p40-sub); margin: 0 0 15px; }
.p40-figure { display: block; width: 100%; max-width: 720px; border: 1px solid var(--p40-line); border-radius: 16px; margin: 6px 0 18px; }
.p40-faq details { border: 1px solid var(--p40-line); background: var(--p40-surface); border-radius: 12px; margin-bottom: 8px; }
.p40-faq summary { cursor: pointer; font-size: 14.5px; font-weight: 800; padding: 13px 16px; }
.p40-faq details > div { padding: 0 16px 15px; font-size: 14px; line-height: 1.98; color: var(--p40-sub); }
.p40-faq details > div strong { color: var(--p40-ink); }
.p40-boundary { margin: 24px 0 18px; padding: 14px 17px; border: 1px solid var(--p40-line); border-radius: 14px; background: var(--p40-surface2); font-size: 13px; line-height: 1.92; color: var(--p40-sub); }
.p40-related { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.p40-related a { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--p40-surface); border: 1px solid var(--p40-line); border-radius: 14px; padding: 12px 15px; font-size: 13.5px; font-weight: 800; color: var(--p40-ink); }
.p40-related a:hover { border-color: var(--p40-accent); text-decoration: none; }
.p40-related a span { color: var(--p40-accent); }

@media (max-width: 980px) { .p40-axis { grid-template-columns: repeat(3, 1fr); row-gap: 16px; } .p40-axis::before { display: none; } }
@media (max-width: 760px) {
    .p40-hero, .p40-two, .p40-extra-grid, .p40-window { grid-template-columns: 1fr; }
    .p40-related { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .p40-wrap { padding: 0 16px; }
    .p40-fields, .p40-checks, .p40-kpis, .p40-related { grid-template-columns: 1fr; }
    .p40-axis { grid-template-columns: repeat(2, 1fr); }
    .p40-optotype { width: 58px; height: 58px; border-radius: 14px; }
    .p40-optotype span { font-size: 30px; }
}
