:root {
  --ink: #17202a;
  --muted: #607080;
  --line: #dbe2e8;
  --soft: #f4f7f8;
  --paper: #ffffff;
  --accent: #e6552d;
  --accent-dark: #b93b1b;
  --green: #18794e;
  --blue: #2563a7;
  --amber: #a65f00;
  --red: #b42318;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.08);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-family: var(--font); line-height: 1.65; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }

.topbar { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); }
.topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand > span:last-child { min-width: 0; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; line-height: 1.25; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.brand-mark { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); }
.brand-mark::before { content: ""; width: 21px; height: 10px; border: 3px solid var(--accent); border-bottom: 0; border-radius: 20px 20px 0 0; }
.brand-mark i { position: absolute; left: 18px; top: 11px; width: 2px; height: 11px; background: var(--ink); transform: rotate(28deg); transform-origin: bottom; }
.topbar nav, footer nav { display: flex; align-items: center; gap: 22px; font-size: 13px; font-weight: 700; }
.topbar nav a:hover, footer nav a:hover { color: var(--accent-dark); }

.breadcrumbs { min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.breadcrumbs a:hover { color: var(--accent-dark); }
.hero { padding: 34px 0 38px; border-bottom: 1px solid var(--line); background: var(--soft); }
.hero .shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr); align-items: center; gap: 44px; }
.hero-copy { min-width: 0; }
.eyebrow { display: block; color: var(--accent-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 780px; margin-bottom: 12px; font-size: clamp(30px, 4vw, 46px); line-height: 1.18; letter-spacing: 0; overflow-wrap: anywhere; }
.hero-copy p { max-width: 720px; margin-bottom: 0; color: var(--muted); font-size: 16px; }
.fact-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.fact { min-width: 0; padding: 18px 14px; border-right: 1px solid var(--line); }
.fact:last-child { border-right: 0; }
.fact dt { color: var(--muted); font-size: 11px; line-height: 1.35; }
.fact dd { margin: 5px 0 0; font-size: 17px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }

.main-grid { padding: 32px 0 64px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.main-column { min-width: 0; }
.calculator-panel { scroll-margin-top: 84px; padding: 26px; border: 1px solid #cbd5dc; border-top: 4px solid var(--accent); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.section-heading h2 { margin: 2px 0 0; font-size: 24px; line-height: 1.25; }
.calculator-note { margin: 7px 0 20px; color: var(--muted); font-size: 13px; }
.unit-switch { display: inline-grid; grid-template-columns: 1fr 1fr; flex: 0 0 132px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.unit-button { min-height: 34px; padding: 4px 12px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.unit-button.is-active { color: var(--ink); background: var(--paper); box-shadow: 0 1px 4px rgba(23, 32, 42, 0.12); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { min-width: 0; display: grid; gap: 7px; color: #344454; font-size: 13px; font-weight: 800; }
.input-shell { min-width: 0; min-height: 54px; display: flex; align-items: stretch; border: 2px solid #aebbc5; border-radius: 8px; background: var(--paper); overflow: hidden; transition: border-color 160ms ease, box-shadow 160ms ease; }
.input-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230, 85, 45, 0.15); }
.input-shell input { width: 100%; min-width: 0; padding: 0 14px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 19px; font-weight: 800; }
.input-shell input::placeholder { color: #93a0aa; font-size: 14px; font-weight: 500; opacity: 1; }
.input-shell b { min-width: 66px; display: grid; place-items: center; padding: 0 12px; border-left: 1px solid var(--line); color: #445463; background: var(--soft); font-size: 12px; white-space: nowrap; }
.form-error { margin: 10px 0 0; color: var(--red); font-size: 13px; font-weight: 700; }
.calculate-button { width: 100%; min-height: 50px; margin-top: 16px; border: 0; border-radius: 8px; color: #fff; background: var(--accent); cursor: pointer; font-weight: 800; box-shadow: 0 8px 18px rgba(230, 85, 45, 0.24); }
.calculate-button:hover { background: var(--accent-dark); }
.calculate-button:focus-visible, .unit-button:focus-visible, .modal-close:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(37, 99, 167, 0.35); outline-offset: 2px; }
.inline-result { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.result-gauge { position: relative; height: 9px; margin-bottom: 14px; border-radius: 6px; background: linear-gradient(90deg, #3b82c4 0 18%, #2d8a5f 18% 45%, #d18417 45% 65%, #c43b31 65% 100%); }
.result-gauge span { position: absolute; top: 50%; left: 0; width: 17px; height: 17px; border: 3px solid var(--ink); border-radius: 50%; background: var(--paper); transform: translate(-50%, -50%); transition: left 280ms ease; }
.result-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.result-row > span { color: var(--muted); font-size: 13px; }
.result-row strong { font-size: 34px; line-height: 1; }
.result-row em { padding: 3px 9px; border-radius: 5px; color: var(--green); background: #e4f3eb; font-size: 12px; font-style: normal; font-weight: 800; }
.result-row em[data-grade="thin"], .report-score span[data-grade="thin"] { color: #1d5f93; background: #e6f2fb; }
.result-row em[data-grade="overweight"], .report-score span[data-grade="overweight"] { color: #845000; background: #fff0d5; }
.result-row em[data-grade="obese"], .report-score span[data-grade="obese"] { color: #96251d; background: #fde9e7; }
.result-row em[data-grade="special"], .report-score span[data-grade="special"] { color: #5c4a86; background: #f0ecf8; }
.inline-result p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }

.article-content { margin-top: 34px; }
.content-section { padding: 28px 0; border-top: 1px solid var(--line); }
.content-section:first-child { border-top: 0; }
.content-section h2, .related h2, .references h2 { margin-bottom: 10px; font-size: 21px; line-height: 1.35; }
.content-section p { color: #465665; }
.content-section p:last-child { margin-bottom: 0; }
.table-wrap { max-width: 100%; margin-top: 17px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #415160; background: var(--soft); font-weight: 800; }
tr:last-child td { border-bottom: 0; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { padding: 15px 2px; cursor: pointer; font-weight: 800; }
.faq details p { padding: 0 2px 15px; margin: 0; }
.related { padding: 28px 0; border-top: 1px solid var(--line); }
.related-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.related-grid a { min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; color: #314354; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.related-grid a:hover { border-color: var(--accent); color: var(--accent-dark); }
.related-grid span { flex: 0 0 auto; color: var(--accent); }
.references { padding: 26px; border-radius: 8px; background: var(--soft); }
.references ol { margin: 0; padding-left: 20px; }
.references li { margin: 9px 0; color: #415160; font-size: 13px; }
.references li strong, .references li span { display: block; }
.references li span, .references > p { color: var(--muted); }
.references > p { margin: 16px 0 0; font-size: 12px; }

.sidebar { position: sticky; top: 88px; border-left: 1px solid var(--line); }
.side-section { padding: 0 0 24px 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.side-section h2 { margin-bottom: 11px; font-size: 15px; }
.side-section p { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.side-section .side-note:empty { display: none; }
.side-section code { display: block; padding: 11px; border-radius: 6px; color: #194b78; background: #edf5fa; font-size: 12px; white-space: normal; }
.scale-list { margin: 0; padding: 0; list-style: none; }
.scale-list li { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 8px 0; color: var(--muted); font-size: 12px; }
.scale-list b { color: #344454; }
.scale-dot { width: 8px; height: 8px; border-radius: 50%; }
.scale-dot.thin { background: var(--blue); }.scale-dot.normal { background: var(--green); }.scale-dot.overweight { background: var(--amber); }.scale-dot.obese { background: var(--red); }
.side-section.caution { padding: 18px; margin-left: 24px; border: 1px solid #edc9bd; border-radius: 8px; background: #fff7f4; }
.side-section.caution p { color: #75412f; }

footer { border-top: 1px solid var(--line); background: var(--soft); }
footer .shell { min-height: 120px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
footer strong { font-size: 15px; }
footer p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.result-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.result-modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23, 32, 42, 0.62); }
.modal-dialog { position: relative; width: min(460px, 100%); max-height: min(90vh, 720px); overflow: auto; padding: 26px; border-radius: 8px; background: var(--paper); box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28); }
.modal-dialog > h2 { margin: 3px 38px 14px 0; font-size: 23px; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; color: #4b5b69; background: var(--soft); cursor: pointer; font-size: 24px; line-height: 1; }
.report-score { min-height: 86px; display: flex; align-items: center; gap: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.report-score strong { font-size: 42px; line-height: 1; }
.report-score span { padding: 4px 9px; border-radius: 5px; color: var(--green); background: #e4f3eb; font-size: 12px; font-weight: 800; }
.modal-dialog > p { margin: 14px 0; color: var(--muted); font-size: 13px; }
.report-range { padding: 12px 14px; border-left: 4px solid var(--green); background: #eef8f3; font-size: 13px; }
.resource-offer { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.resource-offer > span { color: var(--accent-dark); font-size: 11px; font-weight: 800; }
.resource-offer h3 { margin: 3px 0 6px; font-size: 18px; }
.resource-offer p { margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.resource-offer a { min-height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: #fff; background: var(--accent); font-weight: 800; }
.resource-offer a:hover { background: var(--accent-dark); }
.resource-offer small { display: block; margin-top: 9px; color: var(--muted); text-align: center; }

.directory { padding-bottom: 64px; }
.directory header { padding: 36px 0 28px; border-bottom: 1px solid var(--line); }
.directory header h1 { margin: 4px 0 8px; }
.directory header p { margin: 0; color: var(--muted); }
.directory-section { padding: 30px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 80px; }
.directory-section h2 { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.directory-section h2 span { padding: 2px 8px; border-radius: 5px; color: var(--muted); background: var(--soft); font-size: 11px; }
.directory-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 18px; }
.directory-links a { min-width: 0; padding: 5px 0; color: #3b4c5c; font-size: 12px; overflow-wrap: anywhere; }
.directory-links a:hover { color: var(--accent-dark); text-decoration: underline; }

@media (max-width: 900px) {
  .hero .shell { grid-template-columns: 1fr; gap: 24px; }
  .main-grid { grid-template-columns: 1fr; gap: 30px; }
  .sidebar { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; border-top: 1px solid var(--line); }
  .side-section { margin: 0; padding: 22px 20px 22px 0; border-bottom: 0; }
  .side-section:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--line); }
  .side-section.caution { margin: 0; }
  .directory-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 28px, 1120px); }
  .topbar-inner { min-height: 58px; }
  .brand small { display: none; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .topbar nav { gap: 14px; }
  .topbar nav a:nth-child(2) { display: none; }
  .hero { padding: 26px 0 30px; }
  .hero .shell { gap: 20px; }
  h1 { font-size: 30px; }
  .hero-copy p { font-size: 14px; }
  .fact-grid { grid-template-columns: 1fr; }
  .fact { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .fact:last-child { border-bottom: 0; }
  .fact dd { margin: 0; text-align: right; font-size: 16px; }
  .main-grid { padding-top: 20px; }
  .calculator-panel { padding: 19px 16px; }
  .section-heading { display: grid; gap: 14px; }
  .section-heading h2 { font-size: 21px; }
  .unit-switch { width: 100%; }
  .fields { grid-template-columns: 1fr; }
  .related-grid, .sidebar, .directory-links { grid-template-columns: 1fr; }
  .side-section, .side-section:nth-child(even) { padding: 20px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .side-section.caution { padding: 16px; margin-top: 20px; border: 1px solid #edc9bd; }
  .references { padding: 20px 16px; }
  footer .shell { min-height: 140px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 14px; }
  footer nav { gap: 16px; }
  .modal-dialog { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
