:root {
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --surface-subtle: #f8faff;
  --ink: #12233f;
  --muted: #5d6b80;
  --muted-strong: #40516b;
  --line: #dbe4f0;
  --navy: #122a52;
  --blue: #1769e0;
  --blue-dark: #1053bb;
  --blue-soft: #eaf2ff;
  --teal: #087f86;
  --teal-soft: #e8f8f7;
  --warn: #8a4d11;
  --warn-bg: #fff5e8;
  --warn-line: #f0d7b2;
  --ok: #126b4e;
  --ok-bg: #e9f8f0;
  --branch: #4c3a87;
  --branch-bg: #f4f1ff;
  --branch-line: #d8cff5;
  --max: 70rem;
  --reading: 47rem;
  --rail: 17rem;
  --nav-h: 4.25rem;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 38, 72, .04), 0 12px 32px rgba(16, 38, 72, .07);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.68;
  font-size: 1rem;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-dark); text-decoration-thickness: 2px; }
#first, section.step, .symptom-map, .faq, .sources { scroll-margin-top: 6.5rem; }

a:focus-visible, summary:focus-visible { outline: 3px solid rgba(23, 105, 224, .35); outline-offset: 3px; border-radius: 4px; }
strong { overflow-wrap: anywhere; word-break: break-word; }

code {
  padding: .12em .35em;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #173b73;
  background: #f1f5fa;
  font-size: .92em;
}

.skip { position: absolute; left: -999px; top: auto; }
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: .6rem .85rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  overflow-x: hidden;
}
.site-header-inner {
  max-width: var(--max);
  min-height: var(--nav-h);
  margin: 0 auto;
  padding: .7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 2rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--navy);
  font-weight: 750;
  font-size: .96rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  text-decoration: none;
}
.brand::before {
  content: "";
  width: .62rem;
  height: .62rem;
  margin-right: .55rem;
  border-radius: 3px;
  background: linear-gradient(135deg, #2d8bff, #11a7a0);
  box-shadow: 0 0 0 4px #eaf3ff;
}
.brand:hover { color: var(--blue-dark); }
.nav {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: .83rem;
  white-space: nowrap;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: .42rem .62rem;
  border-radius: 7px;
  color: var(--muted-strong);
  text-decoration: none;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--blue-dark); background: var(--blue-soft); }

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.45rem 1.25rem 4.5rem;
  display: grid;
  grid-template-columns: minmax(0, var(--reading)) minmax(14rem, var(--rail));
  gap: 1rem 2rem;
  align-items: start;
  counter-reset: guide-step;
}
main > .breadcrumb { grid-column: 1 / -1; }
main > .hero { grid-column: 1; grid-row: 2; }
main > .toc { grid-column: 2; grid-row: 2 / span 2; }
main > .callout,
main > .step,
main > .symptom-map,
main > .faq,
main > .sources { grid-column: 1; }

.breadcrumb { margin: 0; color: var(--muted); font-size: .78rem; font-weight: 650; letter-spacing: .035em; text-transform: uppercase; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue-dark); }

.hero {
  position: relative;
  overflow: hidden;
  min-height: 14rem;
  padding: clamp(1.45rem, 4vw, 2.5rem);
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #11264b 0%, #1c4a80 66%, #126e78 100%);
  box-shadow: 0 14px 30px rgba(18, 42, 82, .18);
  isolation: isolate;
}
.hero::before, .hero::after { position: absolute; z-index: -1; content: ""; border-radius: 999px; pointer-events: none; }
.hero::before {
  width: 20rem;
  height: 20rem;
  top: -13rem;
  right: -5rem;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 0 0 2.6rem rgba(255,255,255,.035), 0 0 0 5.2rem rgba(255,255,255,.025);
}
.hero::after { width: 8rem; height: 8rem; right: 14%; bottom: -5rem; background: rgba(38, 202, 191, .16); }
.hero h1 {
  max-width: 100%;
  margin: 0 0 .85rem;
  color: #fff;
  font-size: clamp(1.8rem, 3.3vw, 2rem);
  line-height: 1.12;
  letter-spacing: -.045em;
  text-wrap: balance;
  overflow-wrap: break-word;
  word-break: normal;
}
.lede { max-width: 70ch; margin: 0; color: rgba(255,255,255,.86); font-size: clamp(1rem, 1.5vw, 1.1rem); overflow-wrap: anywhere; }
.hero .lede strong { color: #fff; overflow-wrap: anywhere; }

.toc {
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  padding: 1.1rem 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.82);
  box-shadow: 0 8px 24px rgba(16, 38, 72, .05);
}
.toc h2 { margin: 0 0 .75rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc-item; }
.toc li { counter-increment: toc-item; margin: .16rem 0; }
.toc li::before { display: inline-block; width: 1.65rem; color: #8a9ab0; content: counter(toc-item, decimal-leading-zero); font-size: .72rem; font-weight: 750; letter-spacing: .03em; }
.toc a { color: var(--muted-strong); font-size: .88rem; text-decoration: none; overflow-wrap: anywhere; }
.toc a:hover { color: var(--blue-dark); }

.callout {
  margin: 0 0 .1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--muted-strong);
}
.callout strong { display: block; margin-bottom: .25rem; color: var(--ink); }
.callout.warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.callout.warn strong { color: #693a0a; }
.callout.branch { border-color: var(--branch-line); background: var(--branch-bg); color: var(--branch); }
.callout.branch strong { color: #3c2c76; }
.callout.ok { border-color: #b8e4d2; background: var(--ok-bg); color: var(--ok); }

section.step, .symptom-map, .faq, .sources {
  margin: 0;
  padding: 1.35rem 1.45rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
section.step { border-top: 3px solid #d8e8ff; }
section.step h2, .symptom-map h2, .faq h2, .sources h2 {
  margin: 0 0 .75rem;
  color: var(--navy);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.3;
  letter-spacing: -.025em;
}
section.step[id^="step-"] h2::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  margin-right: .55rem;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  content: counter(guide-step);
  counter-increment: guide-step;
  font-size: .78rem;
  letter-spacing: 0;
  vertical-align: -.12rem;
}
section.step h3 { margin: 1.15rem 0 .45rem; color: var(--navy); font-size: 1.02rem; }
section.step p { margin: .5rem 0; }
section.step ul, section.step ol { margin: .5rem 0 .75rem; padding-left: 1.35rem; }
section.step li { margin: .3rem 0; padding-left: .12rem; }
section.step li::marker { color: #7490b2; }

.figure { margin: 1.05rem 0 .3rem; padding: .7rem; border: 1px solid var(--line); border-radius: 10px; background: #f4f7fb; }
.figure img { width: 100%; border: 1px solid #e2e8f0; border-radius: 7px; background: #fff; }
.figure figcaption { margin-top: .55rem; color: var(--muted); font-size: .86rem; }

.branch-box { display: grid; gap: .65rem; margin: .8rem 0 .25rem; }
@media (min-width: 640px) { .branch-box.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.branch-card {
  min-width: 0;
  position: relative;
  padding: .85rem .95rem;
  border: 1px solid var(--branch-line);
  border-radius: 10px;
  background: var(--branch-bg);
  color: var(--branch);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.branch-card:hover { border-color: #b5a7e9; box-shadow: 0 7px 18px rgba(76, 58, 135, .1); transform: translateY(-1px); }
.branch-card strong { color: #3d2f74; }
.branch-card a { font-weight: 700; overflow-wrap: anywhere; word-break: break-word; }

.symptom-map h2, .faq h2, .sources h2 { padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.symptom-map ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.symptom-map li { position: relative; min-width: 0; padding-left: 1rem; }
.symptom-map a { overflow-wrap: anywhere; word-break: break-word; }
.symptom-map li::before { position: absolute; left: 0; top: .72em; width: .34rem; height: .34rem; border-radius: 50%; background: #4a90e8; content: ""; }
.faq details { border-top: 1px solid var(--line); padding: .82rem 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; color: var(--navy); font-weight: 700; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { display: inline-block; width: 1.25rem; color: var(--blue); content: "+"; font-size: 1.15rem; font-weight: 500; }
.faq details[open] summary::before { content: "−"; }
.faq details p { margin: .45rem 0 0 1.25rem; color: var(--muted); }
.sources ol { margin: 0; padding-left: 1.25rem; }
.sources a { overflow-wrap: anywhere; word-break: break-word; }
.sources li { min-width: 0; margin: .4rem 0; color: var(--muted-strong); font-size: .92rem; }

.step-note { margin: .85rem 0; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 8px; background: var(--teal-soft); color: var(--muted-strong); font-size: .91rem; }
.site-footer { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem 3rem; color: var(--muted); font-size: .84rem; }
.site-footer p { max-width: 75ch; margin: .35rem 0; }

@media (max-width: 900px) {
  :root { --nav-h: auto; }
  .site-header-inner { align-items: flex-start; flex-direction: column; gap: .55rem; padding-top: .8rem; padding-bottom: .65rem; }
  .nav { width: 100%; }
  main { display: block; padding-top: 1.15rem; }
  main > * { margin-bottom: 1rem; }
  .toc { position: static; }
  .hero { min-height: auto; }
  .site-footer { padding-bottom: 2.2rem; }
}

@media (max-width: 600px) {
  body { font-size: .97rem; line-height: 1.62; }
  .site-header-inner { padding-left: 1rem; padding-right: 1rem; }
  .brand { font-size: .92rem; }
  main { padding: .95rem 1rem 3rem; }
  .hero { padding: 1.35rem 1.2rem 1.45rem; border-radius: 12px; }
  .hero h1 { font-size: clamp(1.7rem, 9vw, 2.2rem); }
  .lede { font-size: .98rem; }
  .toc, section.step, .symptom-map, .faq, .sources { padding: 1.05rem 1.05rem 1.15rem; border-radius: 11px; }
  .symptom-map ul { display: block; }
  .symptom-map li { margin: .32rem 0; }
  .branch-box.two { grid-template-columns: 1fr; }
  .figure { padding: .5rem; }
  .site-footer { padding-left: 1rem; padding-right: 1rem; }
}

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