:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #152033;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #138466;
  --green-soft: #ecfdf5;
  --amber: #9a5a0a;
  --amber-soft: #fff8e8;
  --red: #a63844;
  --red-soft: #fff1f2;
  --shadow: 0 12px 34px rgba(15, 23, 42, .06);
  --body: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.75 var(--body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: 4px; }
:focus-visible { outline: 3px solid #f2a93b; outline-offset: 3px; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 50; padding: 10px 15px; border-radius: 8px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }

.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.header-inner { width: min(1060px, calc(100% - 40px)); min-height: 68px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--blue); color: white; font: 700 17px var(--mono); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; line-height: 1.25; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.header-actions { display: flex; align-items: center; gap: 18px; }
.local-note { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.local-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.text-button { min-height: 40px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 12px; }
.text-button:hover { background: var(--surface-soft); border-color: var(--line-strong); }

.page { width: min(1060px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 28px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 36px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(32px, 5vw, 48px); line-height: 1.22; letter-spacing: -1.8px; }
h1 span { display: inline-block; margin-left: 10px; color: var(--blue); }
.page-heading > div > p:last-child { margin: 12px 0 0; color: var(--muted); }
.download-button { flex: 0 0 auto; min-height: 48px; padding: 11px 16px; display: inline-flex; align-items: center; gap: 18px; border-radius: 9px; background: var(--blue); color: white; text-decoration: none; font-size: 14px; font-weight: 700; box-shadow: 0 8px 20px rgba(37, 99, 235, .18); }
.download-button:hover { background: var(--blue-dark); }
.download-button b { font-size: 18px; font-weight: 400; }

.progress-shell { margin-bottom: 20px; padding: 18px 20px 9px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.progress-meta { margin-bottom: 9px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.progress-meta strong { color: var(--blue); font: 700 12px var(--mono); }
.progress-track { height: 4px; overflow: hidden; border-radius: 4px; background: #eaf0f6; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .2s ease; }
.step-tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 11px; }
.step-tab { min-width: 0; padding: 10px 7px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; }
.step-tab:hover { background: var(--surface-soft); color: var(--ink); }
.step-tab[aria-current="step"] { background: var(--blue-soft); color: var(--blue-dark); font-weight: 700; }
.step-tab.done::before { content: "✓"; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: 9px; }
.step-tab:not(.done)::before { content: attr(data-number); color: #94a3b8; font: 600 10px var(--mono); }

.intro-section { margin-bottom: 20px; padding: 28px 30px 30px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.intro-heading { display: flex; align-items: end; justify-content: space-between; gap: 26px; margin-bottom: 19px; }
.intro-heading h2 { margin: 0; font-size: 25px; line-height: 1.35; letter-spacing: -.5px; }
.intro-heading > p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; }
.concept-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.concept-card { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.concept-index { display: block; margin-bottom: 9px; color: var(--blue); font: 700 11px var(--mono); }
.concept-card h3 { margin: 0 0 6px; font-size: 15px; }
.concept-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.flow-note { margin-top: 12px; padding: 16px 17px; border: 1px solid #cfe1fa; border-radius: 9px; background: var(--blue-soft); }
.flow-note > span { display: block; margin-bottom: 8px; color: var(--blue-dark); font-size: 11px; font-weight: 700; letter-spacing: .7px; }
.flow-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.flow-line code { padding: 4px 7px; border: 1px solid #cfe1fa; border-radius: 5px; background: white; color: #234e81; font: 12px var(--mono); overflow-wrap: anywhere; }
.flow-line b { color: #6a91c4; font-weight: 500; }
.flow-note p { margin: 10px 0 0; color: #436487; font-size: 12px; line-height: 1.7; }

.lesson { min-height: 620px; padding: clamp(26px, 5vw, 52px); border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); scroll-margin-top: 88px; }
.lesson:focus { outline: none; }
.lesson-header { position: relative; padding-right: 70px; }
.step-badge { display: inline-flex; padding: 5px 9px; border-radius: 6px; background: var(--blue-soft); color: var(--blue-dark); font-size: 11px; font-weight: 700; }
.step-count { position: absolute; top: 3px; right: 0; color: #94a3b8; font: 600 12px var(--mono); }
.lesson h2 { margin: 16px 0 6px; font-size: clamp(27px, 4vw, 38px); line-height: 1.35; letter-spacing: -1px; }
.lesson-header > p { max-width: 760px; margin: 0 0 27px; color: var(--muted); }
.section-title { margin: 27px 0 12px; font-size: 14px; }
.action-list { counter-reset: actions; margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.action-list li { counter-increment: actions; position: relative; min-height: 50px; padding: 12px 15px 12px 48px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.action-list li::before { content: counter(actions); position: absolute; left: 14px; top: 13px; width: 23px; height: 23px; display: grid; place-items: center; border-radius: 6px; background: #e7eef8; color: var(--blue-dark); font: 700 11px var(--mono); }
.action-list code, .inline-code { padding: 2px 6px; border: 1px solid #d9e3ee; border-radius: 5px; background: white; color: #1e4d82; font: 14px/1.5 var(--mono); overflow-wrap: anywhere; }
.notice { margin: 15px 0; padding: 12px 14px; display: flex; gap: 10px; border-radius: 8px; font-size: 13px; }
.notice::before { content: "i"; flex: 0 0 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; font: 700 11px var(--mono); }
.notice p { margin: 0; }
.notice strong { display: block; margin-bottom: 1px; }
.notice.info { border: 1px solid #cfe1fa; background: var(--blue-soft); color: #325a88; }
.notice.info::before { background: #dceafd; color: var(--blue-dark); }
.notice.warn { border: 1px solid #eed9ad; background: var(--amber-soft); color: #785424; }
.notice.warn::before { content: "!"; background: #f7e7bf; color: var(--amber); }
.notice.danger { border: 1px solid #f1cdd1; background: var(--red-soft); color: #7c3b42; }
.notice.danger::before { content: "!"; background: #f5dade; color: var(--red); }

.reference-figure { margin: 23px 0 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #f1f5f9; }
.image-button { position: relative; width: 100%; padding: 0; display: block; border: 0; background: #f1f5f9; }
.image-button img { display: block; width: 100%; height: auto; object-fit: contain; }
.image-button::after { content: "查看大图"; position: absolute; right: 12px; bottom: 12px; padding: 6px 9px; border-radius: 6px; background: rgba(15, 23, 42, .82); color: white; font-size: 11px; }
.reference-figure figcaption { padding: 10px 13px; border-top: 1px solid var(--line); background: white; color: var(--muted); font-size: 12px; }
.image-error { display: none; min-height: 150px; padding: 28px; place-items: center; text-align: center; color: var(--red); background: var(--red-soft); }
.image-error strong, .image-error small { display: block; }
.image-error small { margin-top: 3px; color: #8f6267; font-family: var(--mono); }
.reference-figure.failed .image-button { display: none; }
.reference-figure.failed .image-error { display: grid; }

.endpoint-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.endpoint-card { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.endpoint-card span, .endpoint-card code, .endpoint-card small { display: block; }
.endpoint-card span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.endpoint-card code { margin: 6px 0 3px; overflow: hidden; text-overflow: ellipsis; color: var(--ink); font: 600 12px var(--mono); white-space: nowrap; }
.endpoint-card small { color: #8491a3; font-size: 11px; }
.code-card { margin-top: 19px; overflow: hidden; border: 1px solid #26364d; border-radius: 10px; background: #101b2c; }
.code-head { min-height: 44px; padding: 8px 10px 8px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ffffff15; color: #b2c0d0; font: 11px var(--mono); }
.copy-button { min-height: 30px; padding: 5px 9px; border: 1px solid #ffffff25; border-radius: 6px; background: #ffffff10; color: white; font-size: 11px; }
.copy-button:hover { background: #ffffff1d; }
pre { max-height: 440px; margin: 0; padding: 17px; overflow: auto; color: #dbe7f4; font: 13px/1.75 var(--mono); }
.success-box { margin-top: 13px; padding: 13px 15px; border: 1px solid #bde6d8; border-radius: 8px; background: var(--green-soft); color: #276957; font: 13px/1.75 var(--mono); }
.success-box strong { color: var(--green); }

.done-check { margin-top: 30px; padding: 14px; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 11px; align-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); cursor: pointer; }
.done-check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; background: white; color: transparent; }
.done-check strong, .done-check small { display: block; }
.done-check strong { font-size: 13px; }
.done-check small { color: var(--muted); font-size: 11px; }
.done-check input:checked + .check-box { border-color: var(--green); background: var(--green); color: white; }
.done-check:has(input:checked) { border-color: #bde6d8; background: var(--green-soft); }
.done-check:has(input:focus-visible) { outline: 3px solid #f2a93b; outline-offset: 3px; }
.lesson-footer { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.secondary-button, .primary-button { min-height: 44px; padding: 9px 15px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary-button:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--line-strong); }
.secondary-button:disabled { opacity: .4; cursor: not-allowed; }
.primary-button { border: 1px solid var(--blue); background: var(--blue); color: white; }
.primary-button:hover { background: var(--blue-dark); }

.help-section { margin-top: 28px; padding: 30px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.help-heading { display: flex; align-items: end; justify-content: space-between; gap: 26px; margin-bottom: 17px; }
.help-heading h2 { margin: 0; font-size: 25px; }
.help-heading > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; }
.troubleshooting { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.trouble { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.trouble summary { min-height: 50px; padding: 11px 13px; display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 650; }
.trouble summary::-webkit-details-marker { display: none; }
.trouble summary::after { content: "+"; color: var(--blue); font: 18px var(--mono); }
.trouble[open] summary::after { content: "−"; }
.trouble p { margin: 0; padding: 0 13px 13px; color: var(--muted); font-size: 12px; }
.trouble-source { display: inline-block; margin: 0 13px 13px; color: var(--blue); font-size: 11px; }
.page-footer { padding: 27px 2px 5px; color: var(--muted); font-size: 11px; }
.page-footer p { margin: 3px 0; }

.lightbox { width: min(1180px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 13px; border: 0; border-radius: 12px; background: #0d1726; color: white; box-shadow: 0 30px 100px #0008; }
.lightbox::backdrop { background: #08111ed9; backdrop-filter: blur(4px); }
.lightbox img { display: block; max-width: 100%; max-height: calc(100dvh - 95px); margin: auto; object-fit: contain; }
.lightbox p { margin: 8px 42px 0 3px; color: #bfccda; font-size: 12px; }
.lightbox button { position: absolute; top: 9px; right: 9px; width: 38px; height: 38px; border: 1px solid #ffffff2a; border-radius: 50%; background: #16263cdd; color: white; font-size: 23px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; padding: 9px 14px; transform: translate(-50%, 18px); border-radius: 8px; background: var(--ink); color: white; box-shadow: 0 10px 30px #0f172a38; opacity: 0; pointer-events: none; font-size: 12px; transition: opacity .17s, transform .17s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .header-inner, .page { width: min(100% - 28px, 640px); }
  .page { padding-top: 34px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 20px; }
  h1 span { display: block; margin-left: 0; }
  .download-button { width: 100%; justify-content: space-between; }
  .progress-shell { padding: 14px 12px 7px; }
  .step-tabs { display: flex; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .step-tab { flex: 0 0 auto; min-width: 92px; }
  .lesson { min-height: 0; padding: 27px 20px; }
  .endpoint-grid { grid-template-columns: 1fr; }
  .concept-grid { grid-template-columns: 1fr; }
  .intro-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .troubleshooting { grid-template-columns: 1fr; }
  .help-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (max-width: 430px) {
  .header-inner, .page { width: calc(100% - 22px); }
  .site-header .header-inner { min-height: 62px; }
  .local-note { display: none; }
  .brand small { display: none; }
  .page { padding-top: 27px; }
  h1 { font-size: 33px; }
  .page-heading > div > p:last-child { font-size: 14px; }
  .lesson { padding: 23px 16px; border-radius: 12px; }
  .intro-section { padding: 23px 16px; }
  .lesson-header { padding-right: 48px; }
  .lesson h2 { font-size: 27px; }
  .action-list li { padding-left: 44px; font-size: 14px; }
  .lesson-footer { display: grid; grid-template-columns: 1fr 1.2fr; }
  .secondary-button, .primary-button { width: 100%; }
  .help-section { padding: 23px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
