html {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── themes (night = default) ───────────────────────────── */
html[data-theme="night"] {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #1e2a3d;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --border: #2d3a4d;
  --card: #131c28;
  --green: #34d399;
  --amber: #fbbf24;
  --accent-soft: rgba(61, 139, 253, 0.06);
  --accent-soft-hover: rgba(61, 139, 253, 0.1);
  --sticky-shadow: rgba(0, 0, 0, 0.35);
  --sticky-edge: rgba(0, 0, 0, 0.4);
  --row-hover: rgba(255, 255, 255, 0.025);
  --thead-shadow: rgba(0, 0, 0, 0.35);
  --err-bg: rgba(248, 113, 113, 0.08);
  --err-border: rgba(248, 113, 113, 0.25);
  --err-text: #f87171;
  --footer-rule: rgba(45, 58, 77, 0.65);
  --focus-ring: rgba(61, 139, 253, 0.45);
}

html[data-theme="day"] {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #e8e8ed;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --border: #d2d2d7;
  --card: #fafafa;
  --green: #008547;
  --amber: #b8860b;
  --accent-soft: rgba(0, 113, 227, 0.08);
  --accent-soft-hover: rgba(0, 113, 227, 0.12);
  --sticky-shadow: rgba(0, 0, 0, 0.08);
  --sticky-edge: rgba(0, 0, 0, 0.06);
  --row-hover: rgba(0, 0, 0, 0.03);
  --thead-shadow: rgba(0, 0, 0, 0.06);
  --err-bg: rgba(255, 59, 48, 0.08);
  --err-border: rgba(255, 59, 48, 0.22);
  --err-text: #d70015;
  --footer-rule: rgba(0, 0, 0, 0.08);
  --focus-ring: rgba(0, 113, 227, 0.35);
}

html[data-theme="paper"] {
  --bg: #e8e4dc;
  --surface: #faf8f3;
  --surface-hover: #f0ebe3;
  --text: #2c2416;
  --muted: #6b5d4d;
  --accent: #8b4513;
  --border: #c9c0b0;
  --card: #f7f4ec;
  --green: #2d6a4f;
  --amber: #a67c00;
  --accent-soft: rgba(139, 69, 19, 0.08);
  --accent-soft-hover: rgba(139, 69, 19, 0.14);
  --sticky-shadow: rgba(44, 36, 22, 0.1);
  --sticky-edge: rgba(44, 36, 22, 0.12);
  --row-hover: rgba(44, 36, 22, 0.04);
  --thead-shadow: rgba(44, 36, 22, 0.08);
  --err-bg: rgba(180, 60, 40, 0.1);
  --err-border: rgba(140, 45, 30, 0.25);
  --err-text: #8b2e1a;
  --footer-rule: rgba(90, 75, 55, 0.2);
  --focus-ring: rgba(139, 69, 19, 0.35);
}

* { box-sizing: border-box; }

@keyframes cn-bg-drift {
  0% {
    background-position: 0% 45%;
  }
  50% {
    background-position: 100% 55%;
  }
  100% {
    background-position: 0% 45%;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: color 0.2s ease;
}

/* Gradient drift ~30s cycle (no image assets); colors stay within each theme */
html[data-theme="night"] body {
  background-image: linear-gradient(
    125deg,
    #080c11,
    #0f1419,
    #152a42,
    #101a28,
    #0f1419,
    #121f2e
  );
  background-size: 420% 420%;
  animation: cn-bg-drift 30s ease-in-out infinite alternate;
}

html[data-theme="day"] body {
  background-image: linear-gradient(
    125deg,
    #eceef2,
    #f5f5f7,
    #e8eef8,
    #f6f6f8,
    #f0f3f7,
    #f5f5f7
  );
  background-size: 420% 420%;
  animation: cn-bg-drift 30s ease-in-out infinite alternate;
}

html[data-theme="paper"] body {
  background-image: linear-gradient(
    125deg,
    #ddd6cb,
    #e8e4dc,
    #f2ebe0,
    #e4dfd4,
    #ebe4d8,
    #e8e4dc
  );
  background-size: 420% 420%;
  animation: cn-bg-drift 30s ease-in-out infinite alternate;
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="night"] body,
  html[data-theme="day"] body,
  html[data-theme="paper"] body {
    animation: none;
    background-size: 100% 100%;
    background-position: 50% 50%;
  }
}

html[data-theme="paper"] body {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

html[data-theme="paper"] .rtbl,
html[data-theme="paper"] .search-row input,
html[data-theme="paper"] .search-row button,
html[data-theme="paper"] .theme-switch {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
}
.skip-link:focus {
  left: 0.5rem;
}

/* ── Apple-style theme switch (top right) ───────────────── */
.theme-switch {
  position: fixed;
  top: 1rem;
  /* Align with .wrap inner content right edge (same % margin + horizontal padding as .wrap) */
  right: calc((100% - 80%) / 2 + 1.5rem);
  z-index: 60;
  display: flex;
  align-items: stretch;
  padding: 2px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.18);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

html[data-theme="night"] .theme-switch {
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.theme-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-width: 2.2rem;
  padding: 0.32rem 0.52rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.theme-seg:hover {
  color: var(--text);
}

html[data-theme="night"] .theme-seg[data-theme="night"],
html[data-theme="day"] .theme-seg[data-theme="day"],
html[data-theme="paper"] .theme-seg[data-theme="paper"] {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

html[data-theme="night"] .theme-seg[data-theme="night"] {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.theme-seg__icon {
  display: flex;
  opacity: 0.92;
}

.theme-seg__icon svg {
  display: block;
  width: 14px;
  height: 14px;
}

.theme-seg__label {
  display: none;
}

@media (min-width: 520px) {
  .theme-seg {
    min-width: 3.6rem;
    padding: 0.36rem 0.68rem;
  }
  .theme-seg__label {
    display: inline;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── layout ────────────────────────────────────────────── */

.wrap {
  width: 80%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Corner nav (top-left); brand + tagline centered */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 1.5rem;
  padding: 0;
  text-align: center;
}

/* Same band as .theme-switch (top-left vs top-right) */
.site-header-nav--corner {
  position: fixed;
  top: 1rem;
  left: calc((100% - 80%) / 2 + 1.5rem);
  z-index: 58;
  margin: 0;
}

header .brand-line.brand-line-centered {
  text-align: center;
  width: 100%;
  margin: 0 0 0.35rem;
}

.site-header .tagline {
  margin: 0;
  max-width: 36rem;
  text-align: center;
}

.site-subhead-sep {
  color: var(--muted);
  opacity: 0.55;
  user-select: none;
  flex-shrink: 0;
  font-style: normal;
  font-weight: 400;
}

.site-header-nav {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
}

.site-header-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-header-link:hover {
  color: var(--accent);
}

.site-header-link[aria-current="page"] {
  color: var(--accent);
}

/* About page — centered video */
.about-page {
  max-width: 42rem;
  margin: 0 auto;
}

.about-video-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 1.75rem;
}

.about-video-frame {
  width: min(92vw, 720px);
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
}

.about-video-frame__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.about-copy h2 {
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.about-copy p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  .about-video-frame__media {
    display: none;
  }

  .about-video-frame {
    min-height: 12rem;
    background: color-mix(in srgb, var(--surface) 92%, var(--muted));
  }
}

/* About: no brand line / tagline — reserve vertical rhythm under fixed nav */
.site-header--about-only {
  margin-bottom: 1rem;
  min-height: 4.5rem;
}

header .brand-line {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.brand-name-link {
  color: inherit;
  text-decoration: none;
}

.brand-name-link:hover {
  color: var(--accent);
}

header .tagline {
  color: var(--muted);
  margin: 0;
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.01em;
}

/* try examples */
.try-line {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.try-line .try-label {
  margin-right: 0.35rem;
  color: var(--text);
  font-weight: 600;
}

.try-line a {
  color: var(--accent);
  text-decoration: none;
}
.try-line a:hover {
  text-decoration: underline;
}

.try-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

/* ── search bar ────────────────────────────────────────── */

.search-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.search-row input[type="text"],
.search-row input[type="search"] {
  flex: 1 1 560px;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.search-row input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

.search-row input:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--accent);
}

.search-row button {
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  white-space: nowrap;
}

.search-row button:hover { filter: brightness(1.08); }

/* ── data freshness badge ──────────────────────────────── */

.data-meta { margin-bottom: 0.85rem; min-height: 1.4rem; }

.data-badge {
  display: inline;
  font-size: 0.78rem;
  color: var(--muted);
}

.data-badge strong { color: var(--text); }

/* ── intent banner ─────────────────────────────────────── */

.route-banner {
  display: none;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.route-banner.visible { display: block; }

/* ── results table ─────────────────────────────────────── */

.tbl-wrap {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}

/*
 * Sticky thead needs a real vertical scrollport. overflow-x:auto alone makes this box the
 * sticky containing block and breaks “freeze on page scroll” in Chromium/Safari.
 * Bounded height + overflow:auto: header stays pinned while you scroll the table body here.
 */
.tbl-x-scroll {
  max-height: min(72vh, calc(100vh - 9rem));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 11px 11px;
}

.rtbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  /* # column width — must match sticky `left` on Model column or a hairline gap shows through */
  --sticky-rank-w: 4rem;
}

.rtbl th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.6rem 0.65rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: normal;
  line-height: 1.25;
  vertical-align: bottom;
  hyphens: auto;
  overflow-wrap: break-word;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  background-clip: padding-box;
  box-shadow: 0 2px 6px var(--thead-shadow);
}

.rtbl th.rtbl-th-sort {
  cursor: pointer;
  user-select: none;
  transition: color 0.12s ease, background 0.12s ease;
}

.rtbl th.rtbl-th-sort:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.rtbl th.rtbl-th-sort.is-sorted {
  color: var(--accent);
}

/* Freeze # + Model while scrolling horizontally (Model stays readable with row rank) */
.rtbl thead th:nth-child(1),
.rtbl tbody td:nth-child(1) {
  position: sticky;
  left: 0;
  width: var(--sticky-rank-w);
  min-width: var(--sticky-rank-w);
  max-width: var(--sticky-rank-w);
  box-sizing: border-box;
}

.rtbl thead th:nth-child(2),
.rtbl tbody td:nth-child(2) {
  position: sticky;
  left: var(--sticky-rank-w);
  min-width: max-content;
  box-sizing: border-box;
}

.rtbl thead th:nth-child(1) {
  z-index: 7;
  border-right: 1px solid var(--border);
  box-shadow: 0 2px 6px var(--thead-shadow);
}

.rtbl thead th:nth-child(2) {
  z-index: 6;
  border-right: 1px solid var(--border);
  box-shadow: 0 2px 6px var(--thead-shadow);
}

.rtbl tbody td:nth-child(1) {
  z-index: 3;
  background-color: var(--card);
  background-clip: padding-box;
  border-right: 1px solid var(--border);
}

.rtbl tbody td:nth-child(2) {
  z-index: 2;
  background-color: var(--card);
  background-clip: padding-box;
  border-right: 1px solid var(--border);
}

.rtbl td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.rtbl tbody tr:last-child td { border-bottom: none; }

.rtbl tbody tr:hover td { background: var(--row-hover); }

/* Sticky # + Model: opaque hover (avoid rgba “see-through” over scrolling cells) */
.rtbl tbody tr:hover td:nth-child(1),
.rtbl tbody tr:hover td:nth-child(2) {
  background: color-mix(in srgb, var(--text) 4.5%, var(--card));
}

/* top row highlight — use opaque mix so sticky # + Model cells don’t look “see-through” */
.rtbl tbody tr.top-row td {
  background: color-mix(in srgb, var(--accent) 14%, var(--card));
}
.rtbl tbody tr.top-row:hover td {
  background: color-mix(in srgb, var(--accent) 20%, var(--card));
}

/* rank number — width comes from sticky column 1 (see --sticky-rank-w) */
.rtbl td.rank {
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
  text-align: center;
}
.rtbl tbody tr.top-row td.rank { font-size: 1.15rem; }

/* model name + developer */
.model-name {
  display: block;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.model-dev {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

/* provider */
.provider-cell { white-space: nowrap; }

/* price */
.price-cell { white-space: nowrap; }

.price-main {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.price-out {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.05rem;
}

/* tags */
.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-top: 0.25rem;
  margin-right: 0.2rem;
}

.tag-open {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
}
.tag-closed {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
  border: 1px solid color-mix(in srgb, var(--muted) 28%, transparent);
}

.tag-type {
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 0.68rem;
}
.tag-type-chat {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
}
.tag-type-vision {
  background: color-mix(in srgb, #5b8cff 14%, transparent);
  color: #5b8cff;
  border: 1px solid color-mix(in srgb, #5b8cff 35%, transparent);
}
.tag-type-reasoning {
  background: color-mix(in srgb, #a855f7 14%, transparent);
  color: #c4a5f5;
  border: 1px solid color-mix(in srgb, #a855f7 35%, transparent);
}
.tag-type-image {
  background: color-mix(in srgb, #f59e0b 14%, transparent);
  color: #fbbf24;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
}
.tag-type-video {
  background: color-mix(in srgb, #ec4899 14%, transparent);
  color: #f9a8d4;
  border: 1px solid color-mix(in srgb, #ec4899 35%, transparent);
}
.tag-type-audio {
  background: color-mix(in srgb, #14b8a6 14%, transparent);
  color: #5eead4;
  border: 1px solid color-mix(in srgb, #14b8a6 38%, transparent);
}

/* endpoint link */
.ep-link {
  display: block;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.ep-link:hover { text-decoration: underline; }

.rtbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.td-date,
.td-params {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.84rem;
}

/* Type tags on one line — column width follows tag content */
.td-type {
  white-space: nowrap;
  width: 1%;
  min-width: max-content;
}
.td-type .tag {
  margin-top: 0;
  margin-bottom: 0;
  vertical-align: middle;
}
.td-region { white-space: nowrap; font-variant-numeric: tabular-nums; }
.td-region-code {
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.td-src { white-space: nowrap; }
.td-cp { white-space: nowrap; }

.td-source {
  white-space: nowrap;
  font-size: 0.82rem;
}

.td-source .td-source-link {
  font-weight: 600;
}

.td-source .td-source-missing {
  color: var(--muted);
  opacity: 0.65;
}

.cell-link {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.cell-link:hover { text-decoration: underline; }

.td-entity {
  font-weight: 500;
}

.link-hint {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* Model column: full label on one line — width follows content */
.td-model {
  width: 1%;
  min-width: max-content;
}

/* Developer — single line; column width follows longest cell */
.td-dev {
  white-space: nowrap;
}

/* ── API doc page ───────────────────────────────────────── */
.api-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10.5rem, 12.5rem);
  gap: 2rem 2.25rem;
  align-items: start;
  width: 100%;
}

.api-toc {
  position: sticky;
  top: 2.5rem;
  margin-top: 2rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.api-toc__title {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.api-toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.api-toc__list li {
  margin: 0 0 0.4rem;
}

.api-toc__list li:last-child {
  margin-bottom: 0;
}

.api-toc__list a {
  display: block;
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  padding: 0.15rem 0;
  transition: color 0.12s ease;
}

.api-toc__list a:hover {
  color: var(--accent);
  text-decoration: none;
}

.api-toc__list a code {
  font-size: 0.88em;
}

@media (max-width: 900px) {
  .api-page {
    display: block;
  }

  .api-toc {
    position: static;
    margin-top: 0;
    margin-bottom: 1.75rem;
  }
}

.api-doc {
  max-width: 46rem;
}

.api-doc h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 0.65rem;
  letter-spacing: -0.02em;
  color: var(--text);
  scroll-margin-top: 1rem;
}

.api-doc h2:first-of-type {
  margin-top: 0.5rem;
}

.api-doc p,
.api-doc li {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
}

.api-doc p {
  margin: 0 0 0.85rem;
}

.api-doc ul {
  margin: 0 0 1rem 1.1rem;
  padding: 0;
}

.api-doc ol {
  margin: 0 0 1rem 1.25rem;
  padding: 0;
}

.api-doc li {
  margin-bottom: 0.35rem;
}

.api-doc a {
  color: var(--accent);
  text-decoration: none;
}

.api-doc a:hover {
  text-decoration: underline;
}

.api-doc pre {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.api-doc code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.api-doc pre code {
  font-size: inherit;
}

.api-doc .api-kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin: 0 0 1.25rem;
}

.api-doc .api-kv th,
.api-doc .api-kv td {
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.api-doc .api-kv th {
  color: var(--muted);
  font-weight: 600;
  width: 11rem;
  white-space: nowrap;
}

.api-doc .api-note {
  font-size: 0.84rem;
  color: var(--muted);
  margin: -0.35rem 0 1rem;
}

.api-doc .api-lead {
  font-size: 1.02rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

/* ── misc ──────────────────────────────────────────────── */

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.err {
  color: var(--err-text);
  padding: 1rem;
  border-radius: 10px;
  background: var(--err-bg);
  border: 1px solid var(--err-border);
  font-size: 0.9rem;
}

.err-detail {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.55;
}

.err-detail code {
  font-size: 0.78rem;
  background: var(--surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text);
}

/* ── footer ──────────────────────────────────────────────── */

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding-bottom: 1.15rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--footer-rule);
  font-size: 0.8125rem;
}

.footer-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-home {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text) !important;
}

.footer-home:hover {
  color: var(--accent) !important;
}

.footer-nav-divider {
  display: inline-block;
  width: 1px;
  height: 0.85rem;
  margin: 0 0.15rem;
  background: var(--border);
  align-self: center;
}

/* Shared footer copy block (home + API + any future pages) */
.footer-text {
  max-width: 46rem;
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--muted);
}

.footer-text p {
  margin: 0.55rem 0 0;
}

.footer-text p:first-child {
  margin-top: 0;
}

.footer-lede {
  margin: 0;
}

.footer-meta-line {
  display: block;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.footer-meta-line:empty {
  display: none;
}

.footer-disclaimer {
  opacity: 0.92;
}

.footer-text a {
  color: var(--accent);
  text-decoration: none;
}

.footer-text a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .wrap {
    width: 92%;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 2.75rem;
  }

  header .tagline {
    font-size: 0.98rem;
  }

  .theme-switch {
    top: 0.65rem;
    right: calc((100% - 92%) / 2 + 1rem);
  }

  .site-header-nav--corner {
    top: 0.65rem;
    left: calc((100% - 92%) / 2 + 1rem);
  }
}
