/* sections */
section { padding-top: 56px; scroll-margin-top: 16px; }
h2 { font-family: var(--f-display); font-weight: 500; font-size: 24px; margin: 0 0 6px; display: flex; align-items: baseline; gap: 12px; text-wrap: balance; }
h2 .n { font-family: var(--f-mono); font-size: 14px; color: var(--accent); font-weight: 500; }
.lede { color: var(--muted); margin: 0 0 20px; max-width: 66ch; }
h3 { font-size: 17px; margin: 26px 0 8px; }
p { margin: 0 0 12px; max-width: 70ch; }
ul, ol { padding-left: 20px; margin: 0 0 12px; }
li { margin-bottom: 6px; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 2px 7px; border-radius: 999px; vertical-align: 2px; margin-left: 6px; white-space: nowrap; }
.t-dm { background: var(--dm-soft); color: var(--dm); }
.t-cp { background: var(--cp-soft); color: var(--cp); }

.note { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 14px 16px; margin: 16px 0; }
.note.key { background: var(--warn-soft); border-color: transparent; border-left-color: var(--accent); }
.note p:last-child { margin: 0; }

/* access cards */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: minmax(0,1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-width: 0; }
.panel h3 { margin-top: 0; }
.panel .sub { font-size: 14px; color: var(--muted); margin-bottom: 10px; }

.tpl { position: relative; background: var(--code-bg); border-radius: 10px; padding: 14px 16px; padding-right: 96px; font-family: var(--f-mono); font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0 12px; }
.copy { position: absolute; top: 10px; right: 10px; font: 600 12px var(--f-body); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.copy:hover { border-color: var(--accent); }
.copy.done { color: var(--cp); border-color: var(--cp); }
.addr { display: inline-flex; align-items: center; gap: 6px; }
.addr button { font: 600 11px var(--f-body); background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; cursor: pointer; }

/* table */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 12px 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.mark { text-align: center; width: 110px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dot.dm { background: var(--dm); } .dot.cp { background: var(--cp); }
.dash { color: var(--line); font-weight: 700; }
td.stepref { font-family: var(--f-mono); font-size: 13px; color: var(--muted); width: 56px; }
.fields { color: var(--muted); font-size: 13px; display: block; margin-top: 2px; }


/* checklist */
.check { list-style: none; padding: 0; display: grid; gap: 8px; }
.check li { margin: 0; }
.check label { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }

/* steps */
.steps { position: relative; margin-top: 8px; }
.step { position: relative; padding-left: 64px; padding-bottom: 36px; }
.step::before { content: ""; position: absolute; left: 21px; top: 46px; bottom: 0; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step .num { position: absolute; left: 0; top: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: var(--bg); font-family: var(--f-display); font-weight: 700; font-size: 18px; display: grid; place-items: center; }
.step h3 { margin: 8px 0 6px; font-size: 20px; }
.step h4 { font-size: 15px; margin: 20px 0 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
@media (max-width: 560px) { .step { padding-left: 0; } .step .num { position: static; margin-bottom: 4px; width: 38px; height: 38px; font-size: 16px; } .step::before { display: none; } }

dl.fl { margin: 0 0 12px; display: grid; gap: 10px; }
dl.fl > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
dl.fl dt { font-weight: 600; }
dl.fl dd { margin: 2px 0 0; color: var(--ink); font-size: 15px; }
dl.fl dd .ex { color: var(--muted); }

figure { margin: 14px 0 18px; }
figure button.zoom { display: block; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); cursor: zoom-in; max-width: 100%; }
figure img { display: block; max-width: 100%; height: auto; }
figure.narrow button.zoom { max-width: 460px; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.badges span { font-size: 12px; background: var(--code-bg); color: var(--ink); border-radius: 6px; padding: 1px 7px; }
.badges b { font-family: var(--f-mono); color: var(--accent); margin-right: 4px; }

.compare { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
@media (max-width: 700px) { .compare { grid-template-columns: minmax(0,1fr); } }
.compare .lab { font-size: 13px; font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.compare .bad { color: #c2410c; } .compare .good { color: var(--cp); }

/* rules */
.rules { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; counter-reset: q; }
@media (max-width: 700px) { .rules { grid-template-columns: minmax(0,1fr); } }
.rules li { counter-increment: q; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 14px 50px; position: relative; font-size: 15px; }
.rules li::before { content: counter(q); position: absolute; left: 16px; top: 13px; font-family: var(--f-mono); font-weight: 500; color: var(--accent); }

.ops { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ops > div { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ops > div:last-child { border-bottom: 0; }
.ops b { font-weight: 600; }
@media (max-width: 560px) { .ops > div { grid-template-columns: minmax(0,1fr); gap: 2px; } }

footer { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(10,12,30,.86); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); z-index: 50; cursor: zoom-out; }
.lb[hidden] { display: none; }
.lb img { max-width: 100%; max-height: 90vh; border-radius: 8px; background: #fff; }
.lb p { color: #e9ebf7; font-size: 14px; margin: 10px 0 0; text-align: center; }

/* Routes and compact navigation */
.mobile-toc { display: none; }
.route-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 24px 0 4px; }
.route-link { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--surface); min-width: 0; }
.route-link .route-kicker { font: 500 11px var(--f-mono); text-transform: uppercase; letter-spacing: .04em; }
.route-link strong { font-size: 18px; font-weight: 600; line-height: 1.35; }
.route-link.cp { border-top: 3px solid var(--cp); }
.route-link.dm { border-top: 3px solid var(--dm); }
.route-link.cp .route-kicker { color: var(--cp); }
.route-link.dm .route-kicker { color: var(--dm); }
.route-link:active { transform: scale(.99); }
.route { margin-top: 48px; border-top: 1px solid var(--line); padding-top: 32px; }
.route > .route-kicker { font: 500 12px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.route.cp > .route-kicker { color: var(--cp); }
.route.dm > .route-kicker { color: var(--dm); }
.route > h2 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 12px; }
.route > .subsection { padding-top: 32px; scroll-margin-top: 20px; }
.subsection > h3 { font-family: var(--f-display); font-size: 19px; font-weight: 500; line-height: 1.4; margin: 0 0 12px; }
.step h4.step-title { font-size: 19px; margin: 8px 0 12px; line-height: 1.4; }
.step h5 { font-size: 16px; margin: 24px 0 10px; }
.route .note.cp { border-left-color: var(--cp); }
.route .note.dm { border-left-color: var(--dm); }
.screens { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 14px 0 20px; }
.screens summary { cursor: pointer; padding: 13px 0; font-size: 14px; font-weight: 600; }
.screens[open] summary { margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.screens .grid2 { align-items: start; }
.screens .grid2 figure { margin-top: 0; }
.source-note { color: var(--muted); font-size: 13px; }
.route-check { padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.route-check li:last-child { margin-bottom: 0; }
.route-check ul { margin-bottom: 0; }
.tablewrap th { white-space: normal; }
.tablewrap td, .fl dd, footer { overflow-wrap: anywhere; }
.ops { margin: 16px 0; }
.ops dt, .ops dd { margin: 0; }
.lb-close { position: fixed; top: max(16px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); padding: 8px 12px; font: 600 14px var(--f-body); color: #e9ebf7; background: #232849; border: 1px solid #5d6488; border-radius: 8px; cursor: pointer; }
.lb .lb-content { max-width: 100%; }
.lb img { max-height: 80dvh; object-fit: contain; }
@media (max-width: 900px) {
  .mobile-toc { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 22px 0; background: var(--surface); }
  .mobile-toc summary { cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 15px; }
  .mobile-toc .toc-groups { padding-top: 8px; }
  .mobile-toc .toc-group { margin-bottom: 16px; }
  .mobile-toc a { min-height: 40px; display: flex; align-items: center; }
}
@media (max-width: 560px) {
  .route-links { grid-template-columns: minmax(0, 1fr); }
  .route { margin-top: 36px; }
  .screens { padding-inline: 12px; }
  .step h4.step-title { font-size: 18px; }
  .addr { flex-wrap: wrap; max-width: 100%; }
  .tpl { padding-right: 14px; padding-top: 52px; }
}

