:root {
  --bg: #f6f5f1; --bg-raised: #ffffff; --fg: #17181a; --muted: #5d6066; --line: #dedbd3;
  --accent: #0b5d6b; --accent-2: #0e7a8c; --accent-soft: #e2eff1; --zero: #9a9890;
  --wrong-bg: #fbe9e7; --wrong-fg: #8a2316; --right-bg: #e6f2e3; --right-fg: #1f5a1a;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 72ch;
  --scroll-shadow: rgba(23, 24, 26, .28);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315; --bg-raised: #1a1c1f; --fg: #e9e7e1; --muted: #a3a6ad; --line: #2c2f34;
    --accent: #7fcad6; --accent-2: #a5dce5; --accent-soft: #15343a; --zero: #6c6e73;
    --wrong-bg: #3a1a16; --wrong-fg: #ffb4a8; --right-bg: #18311a; --right-fg: #a9dfa2;
    --scroll-shadow: rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html { font-family: var(--sans); font-size: 17px; line-height: 1.6; color: var(--fg); background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, pre, .mono, .brand { font-family: var(--mono); }
code { font-size: .9em; }
.inner, main { max-width: 980px; margin: 0 auto; padding: 0 16px; }
header.site { border-bottom: 1px solid var(--line); background: var(--bg-raised); }
header.site .inner { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: baseline; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
header.site .brand { font-weight: 700; color: var(--fg); text-decoration: none; font-size: 1rem; }
header.site nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9rem; }
header.site nav a { color: var(--muted); text-decoration: none; }
header.site nav a:hover { color: var(--accent); }
main { padding-top: 24px; padding-bottom: 48px; }
.crumbs { margin: 0 0 6px; font-size: .85rem; color: var(--muted); font-family: var(--mono); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -.01em; max-width: var(--measure); overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 32px 0 10px; }
section.summary { max-width: var(--measure); border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; margin: 0 0 20px; border-radius: 0; }
section.summary p { margin: 0; font-size: 1.08rem; }
section.summary code { background: var(--bg-raised); padding: 1px 4px; border-radius: 4px; overflow-wrap: anywhere; }
dl.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 24px; }
dl.stats div { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
dl.stats dt { font-size: .8rem; color: var(--muted); }
dl.stats dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 600; overflow-wrap: anywhere; }
section.tables { margin: 0 0 24px; }
/* Wide tables scroll inside the wrapper (never the page); a shadow at the hidden edge shows there is more
   (background-attachment: local covers it at the end of the scroll). tabindex=0 in the HTML lets a keyboard scroll it. */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 8px;
  background:
    linear-gradient(to right, var(--bg-raised) 40%, transparent) 0 0 / 48px 100% no-repeat local,
    linear-gradient(to left, var(--bg-raised) 40%, transparent) 100% 0 / 48px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--scroll-shadow), transparent) 0 0 / 18px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-shadow), transparent) 100% 0 / 18px 100% no-repeat scroll,
    var(--bg-raised); }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scroll-hint { display: none; margin: -12px 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
caption { text-align: left; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th, td { padding: 8px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { font-weight: 600; color: var(--muted); font-size: .8rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.zero, .zero { color: var(--zero); }
.empty { color: var(--muted); font-style: italic; }
.muted { color: var(--muted); font-size: .9rem; }
code.wrong, code.right { padding: 1px 4px; border-radius: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
code.wrong { background: var(--wrong-bg); color: var(--wrong-fg); }
td code.wrong, td code.right { white-space: pre; overflow-wrap: normal; }
code.right { background: var(--right-bg); color: var(--right-fg); }
section.diff, section.alternatives { margin: 0 0 24px; }
section.action { margin: 0 0 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
section.action h2 { margin-top: 0; }
section.action h3 { font-size: 1rem; margin: 16px 0 6px; }
section.action ul { padding-left: 1.3em; margin: 0; }
section.example pre { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; overflow-x: auto; font-size: .85rem; max-height: none; }
section.diff pre, section.alternatives pre { margin: 0 0 6px; padding: 10px 14px; border-radius: 8px; overflow-x: auto; display: flex; gap: 10px; font-size: .9rem; }
section.diff pre.wrong, section.alternatives pre.wrong { background: var(--wrong-bg); color: var(--wrong-fg); }
section.diff pre.right, section.alternatives pre.right { background: var(--right-bg); color: var(--right-fg); }
section.diff pre.error { background: var(--bg-raised); border: 1px solid var(--line); color: var(--fg); }
section.diff .sign, section.alternatives .sign { font-weight: 700; user-select: none; }
blockquote { margin: 0 0 8px; padding: 8px 16px; border-left: 3px solid var(--line); border-radius: 0; color: var(--fg); background: var(--bg-raised); max-width: var(--measure); }
blockquote p { margin: 0; }
section.steps ol, section.limits ul, section.for-agents ul { padding-left: 1.3em; max-width: var(--measure); }
section.steps li, section.limits li, section.for-agents li { margin: 0 0 6px; }
section.for-agents { margin-top: 32px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: 8px; background: var(--bg-raised); }
section.for-agents h2 { margin-top: 0; }
section.for-agents code { overflow-wrap: anywhere; }
section.api pre { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; overflow-x: auto; font-size: .85rem; }
form p { margin: 0 0 12px; max-width: 560px; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 0 0 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: .95rem; color: var(--fg); background: var(--bg-raised); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
textarea { font-family: var(--mono); font-size: .85rem; }
button { font: inherit; font-weight: 600; color: var(--bg-raised); background: var(--accent); border: 0; border-radius: 6px; padding: 9px 18px; cursor: pointer; }
button:hover { background: var(--accent-2); }
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
footer.site .inner { padding-top: 16px; padding-bottom: 24px; }
@media (max-width: 760px) {
  .scroll-hint { display: block; }
}
@media (max-width: 560px) {
  html { font-size: 16px; }
  h1 { font-size: 1.5rem; }
  th, td { padding: 7px 10px; }
}
/* D7: search form (plain GET, no JavaScript) */
section.search { margin: 0 0 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
section.search h2 { margin-top: 0; }
section.search form p { max-width: var(--measure); }
section.search input[type="search"] { font-family: var(--mono); font-size: .9rem; }
section.search button + a { margin-left: 12px; font-size: .9rem; }
/* D8: first screen — two actions side by side, the search inside the second card */
section.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin: 0 0 24px; }
.action-card { padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-raised); }
.action-card h2 { margin-top: 0; }
.action-card p { margin: 0 0 10px; }
.action-card form p { max-width: none; }
.action-card button + a { margin-left: 12px; font-size: .9rem; }
a.button { display: inline-block; font-weight: 600; color: var(--bg-raised); background: var(--accent); border-radius: 6px; padding: 9px 18px; text-decoration: none; }
a.button:hover { background: var(--accent-2); color: var(--bg-raised); }
section.example pre.wrong, section.example pre.right { margin: 0 0 6px; padding: 10px 14px; border-radius: 8px; overflow-x: auto; display: flex; gap: 10px; font-size: .9rem; border: 0; }
section.example pre.wrong { background: var(--wrong-bg); color: var(--wrong-fg); }
section.example pre.right { background: var(--right-bg); color: var(--right-fg); }
section.example pre.error { color: var(--fg); }
section.example .sign { font-weight: 700; user-select: none; }
section.method-brief p, section.coverage > p, section.next p { max-width: var(--measure); }
section.developers ul { padding-left: 1.3em; max-width: var(--measure); }
section.developers li { margin: 0 0 6px; }
