/* The /docs pages (generated by tools/docs.mjs). Loads after styles.css, which has the color
   tokens, the consent banner and the footer. */

:root {
  --accent: #6d28d9;
  --accent-tint: color-mix(in srgb, #7c3aed 9%, var(--bg));
  --green-tint: color-mix(in srgb, #1a7f37 9%, var(--bg));
  --red-tint: color-mix(in srgb, #c4262e 8%, var(--bg));
  --amber-tint: color-mix(in srgb, #a15c00 10%, var(--bg));
  --blue-tint: color-mix(in srgb, #0b57d0 8%, var(--bg));
  --side-w: 256px;
  --toc-w: 232px;
  --top-h: 60px;
  --panel-dark: #1c2128;
  --panel-dark-line: #2d333b;
  --panel-dark-fg: #adbac7;
  --panel-dark-muted: #768390;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #a78bfa;
    --accent-tint: color-mix(in srgb, #a78bfa 13%, var(--bg));
    --green-tint: color-mix(in srgb, #5cc97a 12%, var(--bg));
    --red-tint: color-mix(in srgb, #ff6b6b 11%, var(--bg));
    --amber-tint: color-mix(in srgb, #f0b45a 12%, var(--bg));
    --blue-tint: color-mix(in srgb, #7aa7ff 12%, var(--bg));
    --panel-dark: #161b22;
    --panel-dark-line: #2a2f37;
  }
}
:root[data-theme="dark"] {
  --accent: #a78bfa;
  --accent-tint: color-mix(in srgb, #a78bfa 13%, var(--bg));
  --green-tint: color-mix(in srgb, #5cc97a 12%, var(--bg));
  --red-tint: color-mix(in srgb, #ff6b6b 11%, var(--bg));
  --amber-tint: color-mix(in srgb, #f0b45a 12%, var(--bg));
  --blue-tint: color-mix(in srgb, #7aa7ff 12%, var(--bg));
  --panel-dark: #161b22;
  --panel-dark-line: #2a2f37;
}

body.dx { font-size: 16px; line-height: 1.7; }
.dx svg { flex: none; }

/* Top bar */
.dx-top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.dx-top-in { display: flex; align-items: center; gap: 12px; height: 100%; padding: 0 20px; }
.dx-tag {
  font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none;
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px;
}
.dx-search {
  display: flex; align-items: center; gap: 8px; margin-inline: auto;
  width: min(380px, 40vw); height: 36px; padding: 0 8px 0 12px;
  font: inherit; font-size: 14px; color: var(--muted); text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.dx-search:hover { border-color: color-mix(in srgb, var(--muted) 50%, var(--line)); }
.dx-search svg { width: 16px; height: 16px; }
.dx-search span { flex: 1; }
kbd {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; background: var(--bg);
}
.dx-links { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.dx-links a { color: var(--muted); text-decoration: none; }
.dx-links a:hover { color: var(--fg); }
.dx-links .nav-gh { color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; }
.dx-menu { display: none; background: none; border: 0; color: var(--fg); padding: 6px; margin-left: -6px; cursor: pointer; }
.dx-menu svg { width: 20px; height: 20px; display: block; }

/* Shell */
.dx-shell {
  display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--toc-w);
  max-width: 1480px; margin-inline: auto;
}
.dx-ref .dx-shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }

.dx-side {
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h)); overflow-y: auto;
  padding: 28px 16px 48px 20px; border-right: 1px solid var(--line);
}
.side-group { margin-bottom: 22px; }
.side-group p {
  margin: 0 0 6px 10px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.side-group a {
  display: block; padding: 5px 10px; border-radius: 7px; font-size: 14.5px; line-height: 1.45;
  color: var(--muted); text-decoration: none;
}
.side-group a:hover { color: var(--fg); background: var(--panel); }
.side-group a[aria-current="page"] { color: var(--accent); background: var(--accent-tint); font-weight: 600; }

.dx-main { min-width: 0; padding: 40px 56px 64px; }
.doc { max-width: 760px; margin-inline: auto; }
.dx-ref .doc { max-width: 1180px; }

.dx-toc { position: sticky; top: var(--top-h); align-self: start; max-height: calc(100vh - var(--top-h)); overflow-y: auto; }
.toc-in { padding: 40px 20px 40px 8px; font-size: 13.5px; line-height: 1.45; }
.toc-h { margin: 0 0 10px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.dx-toc nav { display: flex; flex-direction: column; border-left: 1px solid var(--line); margin-bottom: 28px; }
.dx-toc nav a { color: var(--muted); text-decoration: none; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 1px solid transparent; }
.dx-toc nav a.d3 { padding-left: 24px; }
.dx-toc nav a:hover { color: var(--fg); }
.dx-toc nav a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
.ai-box { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.ai-box .toc-h { margin-bottom: 4px; }
.ai-box a { color: var(--fg); text-decoration: none; font-family: var(--mono); font-size: 12.5px; }
.ai-box a:hover { color: var(--accent); }

/* Article */
.crumb { display: flex; gap: 8px; margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.doc h1 { font-size: clamp(30px, 3.6vw, 40px); line-height: 1.12; letter-spacing: -0.03em; margin: 0 0 12px; }
.lead { font-size: 19px; line-height: 1.55; color: var(--muted); margin: 0 0 18px; max-width: 42em; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-actions a, .page-actions button {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  font: inherit; font-size: 13px; color: var(--muted); text-decoration: none;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
}
.page-actions a:hover, .page-actions button:hover { color: var(--fg); border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.page-actions svg { width: 15px; height: 15px; }

.doc h2 { font-size: 25px; line-height: 1.25; letter-spacing: -0.02em; margin: 56px 0 14px; scroll-margin-top: calc(var(--top-h) + 20px); }
.doc h3 { font-size: 18.5px; line-height: 1.35; letter-spacing: -0.01em; margin: 36px 0 10px; scroll-margin-top: calc(var(--top-h) + 20px); }
.doc h2, .doc h3 { position: relative; display: flex; align-items: center; gap: 10px; }
.hash { color: var(--muted); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity 0.15s; }
.doc h2:hover .hash, .doc h3:hover .hash, .hash:focus-visible { opacity: 1; }
.step {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none;
  font-size: 14px; font-weight: 600; color: var(--accent); background: var(--accent-tint);
  border-radius: 999px; letter-spacing: 0;
}
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 1.35em; margin: 0 0 16px; }
.doc li { margin-bottom: 6px; }
.doc li > p { margin-bottom: 8px; }
.doc li::marker { color: var(--muted); }
.doc a { color: var(--accent); text-decoration: none; }
.doc a:hover { text-decoration: underline; text-underline-offset: 3px; }
.doc strong { font-weight: 600; }
.doc :not(pre) > code {
  font-size: 0.86em; padding: 0.1em 0.35em; border-radius: 5px;
  background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere;
}

/* Code blocks */
.code { margin: 14px 0 22px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; font-size: 12px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
.copy { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.copy:hover { color: var(--fg); border-color: var(--line); }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; background: transparent !important; }
.code pre code { font-size: inherit; }
.shiki, .shiki span { color: var(--shiki-light); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shiki, :root:not([data-theme="light"]) .shiki span { color: var(--shiki-dark); }
}
:root[data-theme="dark"] .shiki, :root[data-theme="dark"] .shiki span { color: var(--shiki-dark); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--line); border-radius: 10px; }
.doc table { width: 100%; margin: 0; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 14px; border-top: 1px solid var(--line); }
.doc thead th { border-top: 0; background: var(--panel); font-size: 12.5px; font-weight: 500; color: var(--muted); padding-block: 8px; }
.doc td code { white-space: nowrap; }
.doc tbody tr:last-child td { border-bottom: 0; }

/* Callouts */
.callout { margin: 20px 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--accent-tint); }
.callout.warn { border-left-color: var(--amber); background: var(--amber-tint); }
.callout.info { border-left-color: var(--blue); background: var(--blue-tint); }
.callout p:last-child { margin-bottom: 0; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0 28px; }
.card {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  text-decoration: none !important; transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card b { color: var(--fg); font-size: 15.5px; font-weight: 600; }
.card span { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* Pager and meta */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 64px 0 20px; }
.pg { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none !important; }
.pg:hover { border-color: var(--accent); }
.pg small { font-size: 12.5px; color: var(--muted); }
.pg b { color: var(--fg); font-weight: 600; }
.pg.next { text-align: right; grid-column: 2; }
.doc-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); padding-top: 18px; border-top: 1px solid var(--line); }
.doc-meta span { font-family: var(--mono); font-size: 12px; }

/* API reference */
.ref { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 32px; }
.ref-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; }
.ref-code { position: sticky; top: calc(var(--top-h) + 20px); align-self: start; padding-top: 4px; }
.endpoint { font-family: var(--mono); font-size: 16.5px !important; gap: 10px !important; margin-top: 24px !important; }
.method { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; letter-spacing: 0.02em; }
.method.get { color: var(--green); background: var(--green-tint); }
.method.post { color: var(--blue); background: var(--blue-tint); }
.method.delete { color: var(--red); background: var(--red-tint); }
.path { font-weight: 600; }
.panel { margin-bottom: 14px; border-radius: 12px; overflow: hidden; background: var(--panel-dark); border: 1px solid var(--panel-dark-line); }
.panel-head { padding: 8px 14px; font-size: 11.5px; font-family: var(--mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--panel-dark-muted); border-bottom: 1px solid var(--panel-dark-line); }
.dark-code { margin: 0; padding: 14px 16px; font-size: 13px; line-height: 1.65; color: var(--panel-dark-fg); overflow-x: auto; }

/* Figures */
.fig { margin: 28px 0 32px; }
.fig-stage {
  padding: 24px; border: 1px solid var(--line); border-radius: 14px; overflow-x: auto;
  background-color: var(--bg);
  background-image: radial-gradient(color-mix(in srgb, var(--muted) 22%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.fig figcaption { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 10px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }
.fig figcaption b { color: var(--fg); font-weight: 600; }
.fig-btn { flex: none; font: inherit; font-size: 12px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.fig-btn:hover { color: var(--fg); }
html:not(.js) .fig-btn, .no-motion .fig-btn { display: none; }

.dia { display: block; width: 100%; min-width: 560px; height: auto; margin-inline: auto; overflow: visible; }
.dia text { font-family: var(--sans); font-size: 13.5px; fill: var(--fg); }
.dia .t { font-weight: 600; }
.dia .s { font-size: 12px; fill: var(--muted); font-weight: 400; }
.dia .mono, .dia .mono-t .t { font-family: var(--mono); font-size: 12.5px; }
.dia .n rect, .dia .n polygon { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.dia .n.accent rect { stroke: var(--accent); }
.dia .n.dashed rect { stroke-dasharray: 5 4; }
.dia .n.dashed text { fill: var(--muted); }
.dia .n.ok rect { stroke: var(--green); fill: var(--green-tint); }
.dia .n.ok .t { fill: var(--green); font-family: var(--mono); font-size: 12.5px; }
.dia .n.exit .t { font-family: var(--mono); font-size: 13px; }
.dia .n.exit.bad rect { stroke: color-mix(in srgb, var(--red) 55%, var(--line)); fill: var(--red-tint); }
.dia .n.exit.bad .t { fill: var(--red); }
.dia .n.exit.neutral .t { fill: var(--muted); }
.dia .n.final-w rect { stroke-dasharray: 5 4; }
.dia .n.start rect { fill: var(--fg); stroke: var(--fg); }
.dia .n.start text { fill: var(--bg); }
.dia .edge { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.dia .edge.ok { stroke: var(--green); }
.dia .edge.dash { stroke-dasharray: 5 4; }
.dia .ah { fill: var(--muted); }
.dia .ah.ok { fill: var(--green); }
.dia .lbl { font-family: var(--mono); font-size: 12px; fill: var(--muted); }
.dia .lbl.ok { fill: var(--green); }
.dia .lbl.sub { font-family: var(--sans); font-size: 11.5px; }
.dia .lbl.head { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.dia .lbl.warn { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--amber); }
.dia .dot { fill: var(--accent); opacity: 0; filter: drop-shadow(0 0 4px var(--accent)); }
.dia .dot.ok { fill: var(--green); filter: drop-shadow(0 0 4px var(--green)); }
.dia .life { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 5; }
.dia .frame { fill: none; stroke: var(--muted); stroke-opacity: 0.5; stroke-dasharray: 6 5; }
.dia .item rect { fill: var(--panel); stroke: var(--line); }
.dia .item.kept rect { fill: var(--accent-tint); stroke: var(--accent); }
.dia .item.drop { opacity: 0.4; }
.dia .strike { stroke: var(--muted); stroke-width: 1.2; }
.dia .window { fill: var(--amber-tint); stroke: color-mix(in srgb, var(--amber) 50%, transparent); }
.dia .axis { stroke: var(--muted); stroke-width: 1.5; }
.dia .mark circle { fill: var(--bg); stroke-width: 1.5; }
.dia .mark.ok circle { stroke: var(--green); }
.dia .mark.bad circle { stroke: var(--red); }
.dia .mark text { font-size: 12px; font-weight: 700; }
.dia .mark.ok text { fill: var(--green); }
.dia .mark.bad text { fill: var(--red); }
.dia .playhead { stroke: var(--accent); stroke-width: 1.5; opacity: 0; }
.dia .track { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 2 5; }

/* DSN anatomy */
.dsn { display: flex; flex-wrap: wrap; justify-content: center; row-gap: 10px; font-family: var(--mono); font-size: 14px; }
.dsn .part { display: inline-flex; flex-direction: column; align-items: center; }
.dsn .part code { padding: 4px 2px; border-radius: 5px; font-size: inherit; background: transparent; border: 0; }
.dsn .p1 code, .dsn .p2 code, .dsn .p3 code { background: var(--accent-tint); color: var(--fg); padding-inline: 5px; }
.dsn small { margin-top: 6px; font-family: var(--sans); font-size: 12px; color: var(--muted); }

/* Terminal */
.term { border-radius: 12px; overflow: hidden; background: var(--panel-dark); border: 1px solid var(--panel-dark-line); }
.term-bar { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-bottom: 1px solid var(--panel-dark-line); }
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: var(--panel-dark-line); }
.term-bar b { flex: 1; text-align: center; margin-right: 40px; font-weight: 400; font-size: 12px; color: var(--panel-dark-muted); }
.term-body { margin: 0; padding: 14px 18px 16px; max-height: 440px; overflow: auto; font-size: 12.5px; line-height: 1.65; color: var(--panel-dark-fg); }
.term-body .ln { display: block; white-space: pre; min-height: 1.65em; }
.term-body .ps { color: #a78bfa; }
.term-body .dim { color: var(--panel-dark-muted); }
.term-body .hl { color: #8ddb8c; }
.is-playing .term-body .ty {
  display: inline-block; vertical-align: bottom; overflow: hidden; white-space: pre;
  animation: dx-type min(calc(var(--n) * 25ms), 1.6s) steps(var(--n)) var(--d) both;
}
.is-playing .term-body .out { animation: dx-in 0.25s ease-out var(--d) both; }
@keyframes dx-type { from { width: 0; } to { width: calc(var(--n) * 1ch); } }
@keyframes dx-in { from { opacity: 0; transform: translateY(3px); } }

/* Scrub demo */
.scrub { margin: 0; padding: 18px 20px; border-radius: 12px; background: var(--panel-dark); border: 1px solid var(--panel-dark-line); color: var(--panel-dark-fg); font-size: 13px; line-height: 1.75; overflow-x: auto; }
.scrub .k { color: #6cb6ff; }
.scrub .v { color: #96d0ff; }
.scrub .sx { white-space: nowrap; }
.scrub .sx > span { display: inline-block; vertical-align: bottom; overflow: hidden; white-space: pre; }
.scrub .old { max-width: 0; opacity: 0; color: #f47067; text-decoration: line-through; }
.scrub .new { max-width: 11ch; color: #8ddb8c; }

/* Counters (caps, budget) */
@property --ts { syntax: "<integer>"; inherits: false; initial-value: 0; }
@property --se { syntax: "<integer>"; inherits: false; initial-value: 0; }
@property --p { syntax: "<integer>"; inherits: false; initial-value: 0; }

.caps, .budget { max-width: 560px; margin-inline: auto; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); box-shadow: 0 6px 24px rgb(0 0 0 / 0.06); }
.caps-title { font-size: 14.5px; font-weight: 600; margin-bottom: 14px; line-height: 1.4; }
.lvl { display: inline-block; margin-right: 6px; font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--red); background: var(--red-tint); border-radius: 5px; padding: 1px 6px; vertical-align: 1px; }
.caps-row { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; padding: 4px 0; }
.caps-row .mono { font-family: var(--mono); color: var(--muted); flex: 1; }
.ctr { font-family: var(--mono); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.ctr-ts { --ts: 250; counter-reset: c var(--ts); }
.ctr-se { --se: 100; counter-reset: c var(--se); }
.ctr::after { content: counter(c); }
.caps-row .of { font-family: var(--mono); color: var(--muted); font-size: 13px; }
.caps .bar { height: 8px; margin: 10px 0 12px; border-radius: 4px; background: var(--line); overflow: hidden; }
.caps .bar span { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: 4px; }
.caps-note { font-size: 13px; color: var(--amber); font-weight: 500; }

.budget-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 30px; }
.pct { --p: 92; counter-reset: p var(--p); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pct::after { content: counter(p) "%"; }
.mode { display: inline-grid; font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.mode > span { grid-area: 1 / 1; text-align: center; padding: 2px 10px; border-radius: 999px; }
.m-full { color: var(--green); background: var(--green-tint); opacity: 0; }
.m-co { color: var(--amber); background: var(--amber-tint); }
.gauge { position: relative; height: 14px; border-radius: 7px; background: var(--line); }
.gauge .fill { position: absolute; inset: 0 auto 0 0; width: 92%; border-radius: 7px; background: linear-gradient(90deg, var(--green), var(--amber) 85%); }
.gauge .mark { position: absolute; top: -8px; bottom: -8px; width: 2px; background: var(--amber); }
.gauge .mark i { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 12px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.scale { display: flex; justify-content: space-between; margin-top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.scale span:nth-child(2) { opacity: 0.35; }

/* Animation controls */
.is-paused, .is-paused * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .is-playing, .is-playing * { animation: none !important; }
}

/* Search */
.dx-dialog { width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); margin-top: 12vh; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 60px rgb(0 0 0 / 0.25); }
.dx-dialog::backdrop { background: rgb(0 0 0 / 0.35); backdrop-filter: blur(2px); }
.sd-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.sd-input svg { width: 18px; height: 18px; color: var(--muted); }
.sd-input input { flex: 1; height: 52px; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; }
.sd-results { list-style: none; margin: 0; padding: 8px; max-height: 440px; overflow-y: auto; }
.sd-results li a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.sd-results li a small { display: block; font-size: 12px; color: var(--muted); }
.sd-results li a b { display: block; font-size: 14.5px; font-weight: 600; }
.sd-results li a span { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-results li[aria-selected="true"] a, .sd-results li a:hover { background: var(--accent-tint); }
.sd-empty { padding: 18px 12px; color: var(--muted); font-size: 14px; }

/* Footer */
.dx-foot { padding-inline: 24px; max-width: 1480px; margin-inline: auto; }

/* Narrow screens */
@media (max-width: 1240px) {
  .dx-shell { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .dx-toc { display: none; }
  .ref-cols { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ref-code { position: static; }
}
@media (max-width: 900px) {
  .dx-shell, .dx-ref .dx-shell { grid-template-columns: minmax(0, 1fr); }
  .dx-menu { display: block; }
  .dx-side {
    position: fixed; z-index: 15; top: var(--top-h); left: 0; bottom: 0; width: 280px; height: auto;
    background: var(--bg); transform: translateX(-100%); transition: transform 0.2s ease; visibility: hidden;
  }
  .dx-side.open { transform: none; visibility: visible; box-shadow: 0 0 40px rgb(0 0 0 / 0.2); }
  .dx-main { padding: 28px 20px 48px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .dx-top-in { padding: 0 16px; gap: 10px; }
  .dx-search { width: 38px; padding: 0; justify-content: center; margin-left: auto; margin-right: 0; }
  .dx-search span, .dx-search kbd, .dx-links a:not(.nav-gh), .dx-tag { display: none; }
  .dx-main { padding: 24px 16px 40px; }
  .fig-stage { padding: 14px; }
  .fig figcaption { flex-direction: column; gap: 8px; }
  .page-actions a span, .page-actions button span { display: inline; }
  .pager { grid-template-columns: 1fr; }
  .pg.next { grid-column: 1; }
  .dx-foot { padding-inline: 16px; }
}

/* Untrusted fence */
.uf { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 14px; }
.uf-h { margin: 0 0 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.uf-arrow { font-size: 22px; color: var(--muted); }
.uf .scrub { min-height: 230px; }
.uf-bad { color: #f47067; }
.uf-label { color: #6cb6ff; font-weight: 600; }
.uf-run, .uf-fence { border-radius: 3px; }
.uf-fence { color: #8ddb8c; }
@media (max-width: 640px) {
  .uf { grid-template-columns: minmax(0, 1fr); }
  .uf-arrow { transform: rotate(90deg); justify-self: center; }
}
.dia .edge.warn { stroke: var(--amber); stroke-dasharray: 5 4; }
.dia .ah.warn { fill: var(--amber); }
.dia .dot.warn { fill: var(--amber); filter: drop-shadow(0 0 4px var(--amber)); }
.dia .lbl.warn-l { fill: var(--amber); }
.dia .edge.bad { stroke: var(--red); }
.dia .lbl.bad { fill: var(--red); }
.dia .dot.bad { fill: var(--red); filter: drop-shadow(0 0 4px var(--red)); }
.dia .lease { fill: var(--accent-tint); stroke: var(--accent); stroke-width: 1.2; }
.dia .ah.bad { fill: var(--red); }
.dia .qbar { fill: var(--line); }
.dia .qfill { fill: var(--green); opacity: 0.75; }
.dia .deploy-mark { stroke: var(--muted); stroke-width: 2; }
.method.patch { color: var(--amber); background: var(--amber-tint); }
.dia .wait { fill: var(--amber-tint); stroke: color-mix(in srgb, var(--amber) 50%, transparent); }

/* Source map frame */
.smf { display: flex; flex-direction: column; gap: 8px; max-width: 620px; margin-inline: auto; }
.smf .uf-arrow { align-self: center; }
.smf-label { color: var(--panel-dark-muted); font-size: 11.5px; }
.smf-min { color: #f0b45a; border-radius: 3px; }
.smf-orig { color: #8ddb8c; }
.smf-hit { display: inline-block; border-radius: 3px; }

/* Alert message mock-up */
.am { max-width: 560px; margin-inline: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 14px; line-height: 1.5; }
.am-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.am-app { font-weight: 700; }
.am-bot { font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.am-facts { margin: 0 0 10px; color: var(--fg); }
.am-label { margin: 0 0 4px; font-size: 13px; color: var(--amber); font-weight: 600; }
.am-code { margin: 0 0 8px; padding: 10px 12px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.am-mention { border-radius: 3px; }
.am-note { margin: 0; font-size: 12.5px; color: var(--muted); }
