:root {
  color-scheme: light;
  --ink: #213147;
  --muted: #596b7e;
  --line: #dce4ed;
  --accent: #116c72;
  --surface: #f4f7fa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
body { margin: 0; color: var(--ink); background: white; line-height: 1.85; }
a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a:hover { text-decoration: underline; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #51a6ac; outline-offset: 3px;
}
.topbar {
  position: fixed; inset: 0 0 auto; height: 64px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; border-bottom: 1px solid var(--line); background: #fff;
}
.brand { font-weight: 750; font-size: 20px; letter-spacing: .03em; }
.brand span { color: var(--muted); font-size: 13px; margin-left: 12px; font-weight: 400; }
button { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 5px 13px; color: var(--ink); }
kbd { color: var(--muted); padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; margin-left: 10px; }
#nav-toggle { display: none; }
#sidebar {
  position: fixed; top: 64px; bottom: 0; width: 274px; overflow-y: auto;
  padding: 23px 18px; border-right: 1px solid var(--line); background: var(--surface);
}
nav a { display: block; padding: 7px 11px; color: #44566b; font-size: 13px; line-height: 1.6; border-radius: 6px; }
nav > a { font-weight: 650; font-size: 14px; }
nav a[aria-current] { color: #07575e; background: #dcefed; font-weight: 650; }
nav details { margin: 9px 0; }
nav summary { font-size: 14px; font-weight: 650; cursor: pointer; padding: 5px 8px; }
nav details a { margin-left: 12px; border-left: 1px solid #ccd9e4; border-radius: 0; }
main { margin: 64px 232px 0 274px; padding: 34px 46px 60px; max-width: 1120px; }
.breadcrumbs { color: var(--muted); font-size: 13px; margin-bottom: 19px; }
article h1 { font-size: clamp(25px, 2.6vw, 35px); line-height: 1.45; letter-spacing: -.02em; margin: 0 0 24px; }
article h2 { font-size: 24px; margin: 48px 0 19px; padding-bottom: 9px; border-bottom: 1px solid var(--line); line-height: 1.5; }
article h3 { font-size: 19px; margin: 30px 0 12px; line-height: 1.6; }
article p, article ul, article ol { margin: 16px 0; }
article li { margin: 6px 0; }
article blockquote { margin: 22px 0; padding: 7px 22px; border-left: 4px solid #78b6b8; background: #f0f7f7; }
article img, .mermaid-target svg { max-width: 100%; height: auto; }
article img { display: block; margin: 24px auto; border: 1px solid #edf1f5; border-radius: 10px; padding: 10px; background: white; }
.table-scroll { overflow-x: auto; margin: 22px 0; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.75; }
th, td { text-align: left; vertical-align: top; padding: 12px 15px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; min-width: 120px; }
th { background: #edf4f7; color: #26445b; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
tr:nth-child(even) td { background: #fafcfd; }
code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .87em; background: #edf2f6; border-radius: 4px; padding: 2px 5px; overflow-wrap: anywhere; }
pre { overflow-x: auto; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: #f6f8fa; line-height: 1.7; }
pre code { padding: 0; background: none; overflow-wrap: normal; }
math { font-size: 1.08em; }
math[display="block"] { display: block math; margin: 0; }
article div:has(> math[display="block"]) { overflow-x: auto; margin: 20px 0; padding: 14px 18px; background: #f7fafc; border: 1px solid var(--line); border-radius: 8px; }
var { font-family: "Times New Roman", "STIX Two Math", serif; font-style: italic; font-size: 1.05em; }
.math-source { white-space: pre-wrap; }
.toc { position: fixed; right: 0; top: 64px; bottom: 0; width: 232px; padding: 32px 20px; overflow-y: auto; }
.toc strong { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.toc a { display: block; font-size: 12px; color: #637388; padding: 5px 0; line-height: 1.6; }
.toc .level-3 { padding-left: 13px; }
footer { color: var(--muted); border-top: 1px solid var(--line); margin-top: 50px; padding-top: 22px; font-size: 13px; }
.diagram { margin: 24px 0; }
.diagram summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.diagram-error { color: #a7473c; font-size: 13px; }
.skip { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px; background: white; }
.skip:focus { top: 8px; }
dialog { width: min(780px, 94vw); max-height: 85vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; padding: 24px; color: var(--ink); }
dialog::backdrop { background: rgb(20 38 58 / .45); }
.search-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-weight: 650; margin-bottom: 18px; }
#search-input { width: 100%; border: 1px solid #a3bacd; border-radius: 8px; padding: 11px 14px; }
#search-status { color: var(--muted); font-size: 13px; }
#search-results { list-style: none; padding: 0; }
#search-results li { padding: 16px 0; border-top: 1px solid var(--line); }
#search-results a { display: block; font-weight: 650; }
#search-results p { font-size: 13px; color: var(--muted); margin: 7px 0 0; }
@media (max-width: 1220px) {
  .toc { display: none; }
  main { margin-right: 0; max-width: 1100px; }
}
@media (max-width: 800px) {
  .topbar { padding: 0 14px; gap: 12px; }
  .brand { font-size: 17px; }
  .brand span, kbd { display: none; }
  #nav-toggle { display: block; }
  #sidebar { display: none; z-index: 19; width: min(320px, 88vw); box-shadow: 5px 0 16px #0002; }
  body.nav-open #sidebar { display: block; }
  main { margin-left: 0; padding: 24px 20px 40px; }
  article h2 { font-size: 21px; }
}
@media print {
  .topbar, #sidebar, .toc, footer, dialog { display: none; }
  main { margin: 0; padding: 0; max-width: none; }
  .table-scroll, pre { overflow: visible; }
  article img { max-height: 85vh; }
}
.lab { margin: 22px 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfe; }
.lab-inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 18px; align-items: end; }
.lab-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.lab-inputs input[type="number"], .lab-inputs select { border: 1px solid #b9cad8; border-radius: 6px; padding: 6px 9px; font-size: 14px; color: var(--ink); background: white; }
.lab-inputs input[type="range"] { width: 100%; }
.lab-inputs span[data-show] { color: var(--ink); font-weight: 650; }
.lab-output { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.lab-row { display: grid; grid-template-columns: minmax(9em, 14em) minmax(7em, 10em) 1fr; gap: 10px; padding: 5px 0; font-size: 14px; align-items: baseline; }
.lab-row span { color: var(--muted); }
.lab-row em { color: var(--muted); font-style: normal; font-size: 12px; }
.lab-verdict { margin: 12px 0 0; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.lab-verdict.ok { background: #e6f4ea; color: #1e5e3a; }
.lab-verdict.warn { background: #fff3d6; color: #6b4d00; }
.lab-verdict.bad { background: #fde9e7; color: #8a2f25; }
.fold-grid { display: grid; gap: 6px; margin-top: 16px; overflow-x: auto; }
.fold-head { font-size: 12px; color: var(--muted); align-self: center; text-align: center; }
.fold-cell { padding: 6px 0; font-size: 13px; border-radius: 6px; }
.fold-cell.hit { background: #eaf2ff; border-color: #9bb7d4; }
.fold-cell.miss { background: #fde9e7; border-color: #d99a92; color: #8a2f25; }
.fold-cell.usable { background: #d3efdc; border-color: #6db389; color: #1e5e3a; font-weight: 650; }
.timeline { position: relative; height: 58px; margin-top: 18px; border-bottom: 2px solid var(--line); }
.tl-bar { position: absolute; top: 26px; height: 16px; border-radius: 4px; }
.tl-queue { background: #f2c66d; }
.tl-transfer { background: #6aa9d6; }
.tl-mark { position: absolute; top: 0; bottom: 0; border-left: 2px dashed; }
.tl-mark span { position: absolute; top: 0; left: 4px; font-size: 11px; white-space: nowrap; }
.tl-lease { border-color: #c0392b; color: #c0392b; }
.tl-timeout { border-color: #6c5ce7; color: #6c5ce7; }
.tl-timeout span { top: 13px; }
@media (max-width: 800px) {
  .lab-row { grid-template-columns: 1fr 1fr; }
  .lab-row em { grid-column: 1 / -1; }
}
@media print { .lab-inputs { display: none; } }
.note { margin: 18px 0 22px; padding: 14px 18px; border-left: 4px solid #3f8f95; background: #eef7f7; border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.8; }
.note p { margin: 6px 0; }
.note strong:first-child { color: #0d5f65; }
.stepper { margin: 24px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdfe; }
.stepper-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.stepper-count { color: var(--muted); font-size: 13px; margin-left: 6px; }
.stepper-stage { display: grid; gap: 14px; }
.st-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.st-label { width: 9.5em; flex: none; font-size: 13px; color: var(--muted); }
.st-box { min-width: 3.4em; padding: 6px 9px; border: 1px solid #b9cad8; border-radius: 6px; background: white; font-size: 13px; text-align: center; transition: all .35s; }
.st-box small { display: block; font-size: 11px; color: var(--muted); }
.st-box.free { background: #f1f4f7; color: #6b7c8d; }
.st-box.used { background: #eaf2ff; border-color: #7aa3cf; }
.st-box.cached { background: #e6f4ea; border-color: #6db389; }
.st-box.warn { background: #fde9e7; border-color: #d99a92; }
.st-arrow { color: var(--muted); font-size: 13px; }
.st-hidden { display: none !important; }
.st-hl { outline: 3px solid #f2b84b; outline-offset: 2px; box-shadow: 0 0 0 4px #fff3d6; }
.stepper-captions { margin: 16px 0 0; padding-left: 1.4em; font-size: 14px; color: var(--muted); }
.stepper-captions li { cursor: pointer; padding: 3px 0; }
.stepper-captions li.st-current { color: var(--ink); font-weight: 600; }
@media print { .stepper-controls { display: none; } .st-hidden { display: initial !important; } }
