:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #1c1b1a;
  --muted: #6a6762;
  --line: #e7e3dc;
  --accent: #6d4aff;
  --accent-2: #ff6b3d;
  --accent-soft: #efeaff;
  --ok: #15803d; --ok-bg: #dcfce7;
  --meh: #b45309; --meh-bg: #fef3c7;
  --no: #b91c1c; --no-bg: #fee2e2;
  --c1: #6d4aff; --c2: #ff6b3d; --c3: #0d9488; --c4: #db2777;
  --c5: #d97706; --c6: #2563eb; --c7: #16a34a; --c8: #64748b;
  --shadow: 0 1px 2px rgba(28, 27, 26, .05), 0 6px 24px rgba(28, 27, 26, .06);
  --radius: 16px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114; --surface: #1a1a1f; --surface-2: #222229; --text: #ecebe8; --muted: #a09d97; --line: #2d2d35;
    --accent: #a48dff; --accent-2: #ff8c66; --accent-soft: #2a2447;
    --ok: #4ade80; --ok-bg: #12321f; --meh: #fbbf24; --meh-bg: #3a2c0c; --no: #f87171; --no-bg: #3b1515;
    --c1: #a48dff; --c2: #ff8c66; --c3: #2dd4bf; --c4: #f472b6; --c5: #fbbf24; --c6: #60a5fa; --c7: #4ade80; --c8: #94a3b8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111114; --surface: #1a1a1f; --surface-2: #222229; --text: #ecebe8; --muted: #a09d97; --line: #2d2d35;
  --accent: #a48dff; --accent-2: #ff8c66; --accent-soft: #2a2447;
  --ok: #4ade80; --ok-bg: #12321f; --meh: #fbbf24; --meh-bg: #3a2c0c; --no: #f87171; --no-bg: #3b1515;
  --c1: #a48dff; --c2: #ff8c66; --c3: #2dd4bf; --c4: #f472b6; --c5: #fbbf24; --c6: #60a5fa; --c7: #4ade80; --c8: #94a3b8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 var(--font); overflow-x: hidden;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; overflow-wrap: anywhere; }
img { max-width: 100%; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 8px; align-items: center; font-weight: 750; color: var(--text); text-decoration: none; white-space: nowrap; }
.top nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a {
  display: flex; gap: 5px; align-items: center; white-space: nowrap; padding: 5px 10px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: .9rem;
}
.top nav a:hover { color: var(--text); background: var(--surface-2); }
.top nav a.here { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
}
@media (max-width: 720px) {
  .brand { font-size: 0; gap: 0; }
  .brand span { font-size: 1.3rem; }
}

main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
article { max-width: 860px; margin: 0 auto; }
article > p, article > ul, article > ol { max-width: 72ch; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; }
article h2 { font-size: 1.6rem; margin: 2.4em 0 .6em; }
article h3 { font-size: 1.2rem; margin: 1.8em 0 .5em; }
article li { margin: .25em 0; }
strong { font-weight: 680; }

/* hero */
.hero {
  position: relative; display: flex; gap: 22px; align-items: flex-start; margin: 32px auto 28px; max-width: 860px;
  padding: 28px; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-icon { font-size: 3.2rem; line-height: 1; flex: none; }
.hero-text { position: relative; min-width: 0; }
.hero-kicker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin: 6px 0 10px; }
.lead { font-size: 1.12rem; color: var(--muted); margin: 0 0 14px; }
.pick { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); }
.pick span { font-weight: 700; color: var(--accent); margin-right: 6px; }
.dry { font-size: .92rem; }
@media (max-width: 600px) {
  .hero { flex-direction: column; gap: 10px; padding: 20px; margin-top: 20px; }
  .hero-icon { font-size: 2.6rem; }
}

.verdict { text-transform: none; letter-spacing: 0; padding: 2px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.v-ok { color: var(--ok); background: var(--ok-bg); }
.v-meh { color: var(--meh); background: var(--meh-bg); }
.v-no { color: var(--no); background: var(--no-bg); }

/* index cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; margin: 24px 0; }
.card {
  display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow); color: var(--text); text-decoration: none; border: 1px solid transparent;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-icon { font-size: 1.9rem; }
.card h3 { margin: 0; font-size: 1.12rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .stat { margin-top: auto; padding-top: 8px; font-weight: 700; color: var(--accent); font-size: .95rem; }

/* big numbers */
.bignums { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 14px; margin: 24px 0; }
.bignum { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.bignum b { display: block; font-size: 1.9rem; line-height: 1.1; color: var(--accent); letter-spacing: -.02em; }
.bignum span { color: var(--muted); font-size: .92rem; }

blockquote { margin: 20px 0; padding: 4px 18px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 12px 12px 0; }
blockquote p { margin: .6em 0; }

/* charts */
.chart { margin: 28px 0; padding: 18px 18px 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.chart-box { position: relative; height: 340px; }
.chart figcaption { color: var(--muted); font-size: .9rem; margin-top: 10px; }
.chart-title { font-weight: 700; margin: 0 0 8px; }

/* admonitions: !!! tip / warning / note / fun */
.admonition { margin: 22px 0; padding: 14px 18px; border-radius: 14px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.admonition > p { margin: .4em 0; }
.admonition-title { font-weight: 700; }
.admonition.tip { border-color: var(--ok); }
.admonition.warning { border-color: var(--meh); }
.admonition.danger { border-color: var(--no); }
.admonition.tip .admonition-title::before { content: "💡 "; }
.admonition.warning .admonition-title::before { content: "⚠️ "; }
.admonition.danger .admonition-title::before { content: "💥 "; }
.admonition.note .admonition-title::before { content: "📝 "; }

/* tables (reports and small inline tables) */
.table-wrap, article > table { display: block; overflow-x: auto; margin: 16px 0; }
table { border-collapse: collapse; font-size: .9rem; min-width: 100%; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
th[align="right"], td[align="right"] { text-align: right; font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable::after { content: " ↕"; color: var(--muted); font-size: .8em; }
th.sorted-asc::after { content: " ↑"; color: var(--accent); }
th.sorted-desc::after { content: " ↓"; color: var(--accent); }

/* side-by-side examples */
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 16px; margin: 24px 0; }
.example { border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.example img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; background: var(--surface-2); }
.example .body { padding: 12px 14px 14px; font-size: .93rem; }
.example .row { display: grid; grid-template-columns: 1.4em 1fr; gap: 4px; margin: 4px 0; }
.example .who { color: var(--muted); font-size: .8rem; grid-column: 2; margin-top: -2px; }
.example .txt { overflow-wrap: anywhere; }
.example .bad .txt { font-family: var(--mono); font-size: .88em; }

/* image galleries */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; margin: 20px 0; }
.gallery figure { margin: 0; border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.gallery img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; cursor: zoom-in; background: var(--surface-2); }
.gallery figcaption { padding: 8px 10px; font-size: .82rem; color: var(--muted); }

/* audio grid */
.audio-grid { margin: 20px 0; display: grid; gap: 14px; }
.phrase-card { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.phrase-card .phrase { font-size: 1.05rem; margin: 0 0 4px; }
.phrase-card .why { color: var(--muted); font-size: .88rem; margin: 0 0 10px; }
.voices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 8px; }
.voice { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.voice b { font-size: .85rem; }
.voice audio { width: 100%; height: 34px; display: block; margin-top: 4px; }
.voice small { color: var(--muted); font-size: .78rem; }
.voice .score { color: var(--c5); font-size: .8rem; letter-spacing: 1px; margin-left: 4px; }
.voice .err { margin-left: 6px; font-size: .72rem; font-weight: 700; color: var(--no); background: var(--no-bg); padding: 1px 6px; border-radius: 999px; }

.phrase-card > audio { width: 100%; height: 38px; margin: 4px 0 10px; display: block; }
.hyps { display: grid; gap: 6px; }
.hyp { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; font-size: .93rem; padding: 4px 0; border-top: 1px dashed var(--line); }
.hyp b { font-weight: 600; color: var(--muted); font-size: .86rem; }
mark { background: color-mix(in srgb, var(--accent-2) 26%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
@media (max-width: 600px) { .hyp { grid-template-columns: 1fr; gap: 0; } }

/* voice dialogs */
.dialogs { display: grid; gap: 16px; margin: 20px 0; }
.dialog { padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.said { display: grid; gap: 4px; margin-bottom: 12px; }
.said audio { width: 100%; height: 36px; }
.said small, .dialog small { color: var(--muted); font-size: .78rem; margin-right: 6px; text-transform: uppercase; letter-spacing: .04em; }
.turns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.turn { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: .92rem; }
.turn-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.turn-head span { color: var(--muted); font-variant-numeric: tabular-nums; }
.calls code { font-size: .78rem; background: transparent; padding: 0; }
.calls i { color: var(--muted); }
.reply { margin-top: 6px; }
.dialog .why { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }

/* json demo */
.json-demo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; margin: 20px 0 8px; }
.json-demo .doc { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.json-demo small { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.json-demo p { margin: 6px 0 0; }
pre { font-family: var(--mono); font-size: .8rem; line-height: 1.45; margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* OCR side by side */
.ocr-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin: 24px 0; align-items: start; }
.ocr-compare > img { width: 100%; border-radius: 12px; box-shadow: var(--shadow); cursor: zoom-in; }
.ocr-compare .tabs { margin: 0; }
.ocr-out { padding: 12px 14px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); font-size: .85rem; min-width: 0; overflow-x: auto; }
.ocr-out small { color: var(--muted); display: block; margin-bottom: 6px; }
.ocr-out table { font-size: .78rem; }
.ocr-out h1 { font-size: 1rem; margin: 0 0 6px; }
.ocr-out p { margin: 4px 0; }
@media (max-width: 760px) { .ocr-compare { grid-template-columns: 1fr; } }

/* VLM */
.opts { margin: 8px 0; padding-left: 1.4em; font-size: .9rem; color: var(--muted); }
.opts li.right { color: var(--ok); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: .74rem; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.chip.yes { color: var(--ok); background: var(--ok-bg); }
.chip.no { color: var(--no); background: var(--no-bg); }
.caption-cards { display: grid; gap: 16px; margin: 20px 0; }
.caption-card { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; padding: 14px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); align-items: start; }
.caption-card img { width: 100%; border-radius: 10px; cursor: zoom-in; }
.caption-card .hyp { grid-template-columns: 8.5em 1fr; }
.hyp .score { color: var(--c5); font-size: .78rem; letter-spacing: 1px; font-weight: 400; }
@media (max-width: 700px) { .caption-card { grid-template-columns: 1fr; } }

/* image generation */
.img-compare { display: grid; grid-template-columns: minmax(120px, 1.1fr) repeat(var(--cols), minmax(0, 1fr)); gap: 8px; margin: 20px 0; align-items: center; }
.img-compare .ih { font-weight: 700; font-size: .85rem; text-align: center; color: var(--muted); }
.img-compare img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; background: var(--surface-2); }
.ic-prompt { font-size: .86rem; line-height: 1.35; }
.ic-prompt small { display: block; color: var(--muted); font-size: .76rem; margin-top: 2px; }
.ic-empty { aspect-ratio: 1; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
@media (max-width: 640px) {
  .img-compare { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
  .img-compare .ic-prompt { grid-column: 1 / -1; margin-top: 8px; }
  .img-compare > .ic-prompt:first-child { display: none; }
}

/* tabs */
.tabs { margin: 24px 0; }
.tab-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab-buttons button {
  font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer;
}
.tab-buttons button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel[hidden] { display: none; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 16px; background: rgba(10, 10, 12, .88); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 10px; }
.lightbox p { color: #eee; max-width: 760px; text-align: center; margin: 0; font-size: .95rem; }

/* pager */
.pager { display: flex; justify-content: space-between; gap: 12px; max-width: 860px; margin: 56px auto 0; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { padding: 10px 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
.pager .next { margin-left: auto; }

/* rendered REPORT.md pages */
.report article { max-width: 1000px; padding-top: 24px; }
.report article > p, .report article > ul, .report article > ol { max-width: 90ch; }
.report-note { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); }
