:root {
  color-scheme: dark;
  --ink: #e9f4f6;
  --muted: #91aeb5;
  --dim: #5f7d85;
  --bg: #001015;
  --panel: #031a21;
  --panel-2: #06232b;
  --line: #123a44;
  --line-soft: rgba(147, 196, 207, .13);
  --red: #ed254e;
  --red-soft: rgba(237, 37, 78, .12);
  --green: #9ee858;
  --green-soft: rgba(158, 232, 88, .1);
  --blue: #38bdf8;
  --yellow: #facc15;
  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0;
  min-width: 300px;
  background:
    radial-gradient(900px 520px at 13% -8%, rgba(56, 189, 248, .09), transparent 62%),
    radial-gradient(680px 460px at 90% 4%, rgba(237, 37, 78, .08), transparent 64%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: #8bdcff; }
button, input { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
}
.skip-link:focus { transform: translateY(0); }

.reading-progress {
  position: fixed;
  z-index: 1001;
  inset: 0 0 auto;
  height: 3px;
  background: rgba(255, 255, 255, .04);
}
.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), #ff6b6b 55%, var(--green));
  box-shadow: 0 0 18px rgba(237, 37, 78, .5);
}

.guide-bar {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(0, 16, 21, .9);
  backdrop-filter: blur(18px);
}
.guide-bar__inner {
  max-width: var(--max);
  min-height: 68px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand em { color: var(--red); font-style: normal; }
.guide-bar__label {
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.guide-bar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}
.bar-link, .bar-button, .toc-toggle {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}
.bar-link:hover, .bar-button:hover, .toc-toggle:hover {
  border-color: #276172;
  color: var(--ink);
}
.bar-link--primary {
  border-color: rgba(237, 37, 78, .55);
  background: var(--red);
  color: #fff;
}
.bar-link--primary:hover { border-color: #ff5b78; background: #f1375e; color: #fff; }
.toc-toggle { display: none; }

.guide-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 84px 24px 58px;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 28px;
  color: var(--dim);
  font-size: 12px;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: end;
  gap: 56px;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.guide-hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(40px, 6.4vw, 78px);
  line-height: .98;
  letter-spacing: -.065em;
  text-wrap: balance;
}
.guide-hero h1 span { color: var(--red); }
.hero-lede {
  max-width: 820px;
  margin: 25px 0 0;
  color: #bad0d5;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
}
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, rgba(56, 189, 248, .08), rgba(237, 37, 78, .035) 52%, rgba(158, 232, 88, .035));
  box-shadow: 0 20px 70px rgba(0, 0, 0, .22);
}
.hero-card::before {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -45px;
  top: -60px;
  border-radius: 50%;
  background: rgba(237, 37, 78, .18);
  filter: blur(26px);
}
.hero-card h2 { margin: 0 0 12px; font-size: 17px; }
.hero-card p { margin: 0 0 17px; color: var(--muted); font-size: 13px; }
.hero-card dl { margin: 0; }
.hero-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.hero-card dt { color: var(--dim); font-size: 12px; }
.hero-card dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 800; text-align: right; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.hero-cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 11px 19px;
  border: 1px solid rgba(237, 37, 78, .65);
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
}
.hero-cta:hover { background: #f3385f; color: #fff; }
.hero-cta--quiet { background: transparent; border-color: var(--line); color: var(--muted); }
.hero-cta--quiet:hover { background: var(--panel-2); color: var(--ink); }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 32px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line-soft);
  color: var(--dim);
  font-size: 12px;
}
.hero-meta strong { color: var(--muted); }

.guide-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 96px;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 42px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(3, 26, 33, .78);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.toc__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.toc__head strong { font-size: 13px; }
.toc__head span { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.toc-search {
  width: 100%;
  margin-bottom: 13px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #001319;
  color: var(--ink);
  font-size: 12px;
}
.toc-search:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(56, 189, 248, .1); }
.toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 7px;
  padding: 6px 4px;
  border-radius: 5px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11.5px;
  line-height: 1.35;
}
.toc a::before { content: counter(toc, decimal-leading-zero); color: var(--dim); font-variant-numeric: tabular-nums; }
.toc a:hover, .toc a[aria-current="true"] { color: var(--ink); background: rgba(255, 255, 255, .035); }
.toc a[aria-current="true"]::before { color: var(--red); }
.toc li[hidden] { display: none; }

.guide-main { min-width: 0; }
.chapter {
  position: relative;
  margin: 0 0 28px;
  padding: clamp(27px, 5vw, 54px);
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(6, 35, 43, .74), rgba(3, 26, 33, .76));
  box-shadow: 0 16px 55px rgba(0, 0, 0, .12);
  scroll-margin-top: 88px;
}
.chapter__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 11px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.chapter__kicker::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.chapter h2 {
  margin: 0 0 18px;
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.chapter h3 {
  margin: 34px 0 10px;
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.25;
  letter-spacing: -.025em;
}
.chapter h4 { margin: 24px 0 7px; font-size: 16px; }
.chapter p { margin: 0 0 17px; color: #b5cbd0; }
.chapter p:last-child { margin-bottom: 0; }
.chapter strong { color: #f5fbfc; }
.chapter ul, .chapter ol { margin: 0 0 20px; padding-left: 24px; color: #b5cbd0; }
.chapter li { margin: 8px 0; padding-left: 4px; }
.chapter li::marker { color: var(--red); font-weight: 800; }
.chapter code {
  padding: 2px 5px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  background: rgba(0, 0, 0, .24);
  color: #d8f1f5;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-wrap: anywhere;
}
kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid #2d5964;
  border-bottom-width: 3px;
  border-radius: 5px;
  background: #08252d;
  color: var(--ink);
  font: 11px/1.4 ui-monospace, monospace;
  text-align: center;
}

.chapter-lede {
  max-width: 760px;
  color: #d5e5e8 !important;
  font-size: 18px;
  line-height: 1.62;
}
.rule {
  margin: 28px 0;
  height: 1px;
  border: 0;
  background: var(--line-soft);
}
.callout {
  margin: 24px 0;
  padding: 18px 20px;
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
  background: rgba(56, 189, 248, .065);
}
.callout p { margin: 0; font-size: 14px; }
.callout strong:first-child { color: var(--blue); }
.callout--warn { border-left-color: var(--yellow); background: rgba(250, 204, 21, .055); }
.callout--warn strong:first-child { color: var(--yellow); }
.callout--danger { border-left-color: var(--red); background: var(--red-soft); }
.callout--danger strong:first-child { color: #ff7b95; }
.callout--good { border-left-color: var(--green); background: var(--green-soft); }
.callout--good strong:first-child { color: var(--green); }

.example {
  margin: 25px 0;
  border: 1px solid rgba(158, 232, 88, .25);
  border-radius: 13px;
  overflow: hidden;
  background: rgba(158, 232, 88, .035);
}
.example__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 17px;
  border-bottom: 1px solid rgba(158, 232, 88, .17);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.example__body { padding: 18px 20px; }
.example__body > :last-child { margin-bottom: 0; }
.example ol, .example ul { margin-bottom: 0; }

.formula {
  margin: 22px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #001319;
  color: #d7eef2;
  font: 14px/1.8 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow-x: auto;
}
.formula span { color: var(--green); }

.steps-grid, .feature-grid, .stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin: 22px 0;
}
.step-card, .feature-card, .stat-card {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: rgba(0, 0, 0, .16);
}
.step-card span, .feature-card > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}
.step-card h3, .feature-card h3, .stat-card h3 { margin: 0 0 7px; font-size: 16px; }
.step-card p, .feature-card p, .stat-card p { margin: 0; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; margin-bottom: 4px; color: var(--green); font-size: 22px; line-height: 1.2; }

.table-wrap { width: 100%; margin: 24px 0; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
caption { padding: 12px 15px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; text-align: left; font-size: 13px; }
th { background: rgba(255, 255, 255, .035); color: var(--ink); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
td { color: #acc4c9; }
tr:last-child td { border-bottom: 0; }
td:first-child { color: #e2eff1; font-weight: 720; }

.workflow {
  margin: 25px 0;
  padding: 0;
  list-style: none;
  counter-reset: workflow;
}
.workflow li {
  position: relative;
  margin: 0;
  padding: 0 0 24px 47px;
  counter-increment: workflow;
}
.workflow li::before {
  content: counter(workflow);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(237, 37, 78, .4);
  border-radius: 50%;
  background: var(--red-soft);
  color: #ff6f8c;
  font-size: 11px;
  font-weight: 900;
}
.workflow li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}
.workflow li:last-child { padding-bottom: 0; }
.workflow li:last-child::after { display: none; }
.workflow strong { display: block; margin-bottom: 3px; }

.diagram {
  margin: 26px 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #001319;
}
.diagram__row { display: flex; align-items: stretch; gap: 9px; }
.diagram__node {
  flex: 1;
  min-width: 0;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: center;
}
.diagram__node strong { display: block; font-size: 12px; }
.diagram__node span { display: block; margin-top: 4px; color: var(--dim); font-size: 10px; line-height: 1.35; }
.diagram__arrow { align-self: center; color: var(--red); font-weight: 900; }
.diagram figcaption { margin-top: 12px; color: var(--dim); font-size: 11px; text-align: center; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
}
.chapter-nav a { color: var(--muted); text-decoration: none; }
.chapter-nav a:hover { color: var(--ink); }

.faq-item { padding: 18px 0; border-top: 1px solid var(--line-soft); }
.faq-item:first-of-type { border-top: 0; }
.faq-item h3 { margin: 0 0 7px; font-size: 18px; }
.faq-item p { margin: 0; }

.guide-footer {
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, .16);
}
.guide-footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 34px 24px 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}
.guide-footer p { max-width: 660px; margin: 0; color: var(--dim); font-size: 12px; }
.guide-footer nav { display: flex; flex-wrap: wrap; gap: 13px; }
.guide-footer a { color: var(--muted); font-size: 12px; text-decoration: none; }
.guide-footer a:hover { color: var(--ink); }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-card { max-width: 620px; }
  .guide-shell { grid-template-columns: 1fr; }
  .toc-toggle { display: inline-flex; }
  .toc {
    position: fixed;
    z-index: 200;
    inset: 79px 18px 18px;
    max-height: none;
    transform: translateX(calc(-100% - 30px));
    transition: transform .2s ease;
    box-shadow: 0 22px 80px rgba(0, 0, 0, .5);
    background: #031a21;
  }
  .toc.is-open { transform: translateX(0); }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .guide-bar__inner { padding-inline: 14px; }
  .guide-bar__label, .bar-button { display: none; }
  .bar-link:not(.bar-link--primary) { display: none; }
  .bar-link--primary { padding-inline: 11px; }
  .guide-hero { padding: 56px 18px 40px; }
  .guide-hero h1 { font-size: clamp(38px, 14vw, 58px); }
  .hero-lede { font-size: 18px; }
  .guide-shell { padding: 0 12px 64px; }
  .chapter { padding: 26px 20px; border-radius: 13px; }
  .steps-grid, .feature-grid, .stat-grid { grid-template-columns: 1fr; }
  .diagram__row { flex-direction: column; }
  .diagram__arrow { transform: rotate(90deg); align-self: center; }
  .guide-footer__inner { flex-direction: column; padding-inline: 18px; }
}

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

@media print {
  :root { color-scheme: light; }
  @page { size: A4; margin: 17mm 16mm 18mm; }
  body { background: #fff !important; color: #111; font: 10.6pt/1.48 Georgia, "Times New Roman", serif; }
  .reading-progress, .guide-bar, .toc, .hero-actions, .chapter-nav, .guide-footer { display: none !important; }
  .guide-hero { max-width: none; padding: 12mm 0 0; break-after: page; }
  .breadcrumbs { display: none; }
  .hero-grid { display: block; }
  .guide-hero h1 { max-width: none; color: #111; font: 700 31pt/1.02 Georgia, serif; letter-spacing: -.035em; }
  .guide-hero h1 span { color: #a40022; }
  .hero-lede { color: #333; font-size: 14pt; }
  .hero-card { margin-top: 20mm; border: 1px solid #bbb; background: #f7f7f7; box-shadow: none; }
  .hero-card::before { display: none; }
  .hero-card p, .hero-card dt { color: #444; }
  .hero-card dd, .hero-card h2 { color: #111; }
  .hero-meta { color: #555; border-color: #bbb; }
  .guide-shell { display: block; max-width: none; padding: 0; }
  .chapter {
    min-height: 250mm;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    break-before: page;
  }
  .chapter__kicker { color: #a40022; }
  .chapter h2 { color: #111; font: 700 23pt/1.08 Georgia, serif; letter-spacing: -.025em; }
  .chapter h3 { color: #111; font-size: 15pt; break-after: avoid; }
  .chapter h4 { color: #111; break-after: avoid; }
  .chapter p, .chapter li { color: #222; orphans: 3; widows: 3; }
  .chapter a { color: #111; text-decoration: underline; }
  .chapter a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; overflow-wrap: anywhere; }
  .chapter code, kbd { border-color: #aaa; background: #f2f2f2; color: #111; }
  .callout, .example, .formula, .step-card, .feature-card, .stat-card, .diagram { border-color: #aaa; background: #f7f7f7; color: #111; break-inside: avoid; }
  .callout p, .example p, .step-card p, .feature-card p, .stat-card p { color: #222; }
  .callout strong:first-child, .example__head, .chapter strong, .stat-card strong { color: #111; }
  .table-wrap { border-color: #aaa; break-inside: avoid; }
  table { min-width: 0; }
  th { background: #eee; color: #111; }
  td { color: #222; }
  th, td { border-color: #ccc; padding: 7px; font-size: 8.3pt; }
  .diagram__node { border-color: #aaa; background: #f5f5f5; }
  .diagram__node strong { color: #111; }
  .diagram__node span, .diagram figcaption { color: #444; }
}
