:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1c2430;
  --border: #26303d;
  --text: #e6edf3;
  --muted: #8b98a9;
  --primary: #5b8cff;
  --primary-hover: #4a7bee;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --radius: 10px;
  --wrap: 1860px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.main { padding: 40px 20px 72px; flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.xsmall { font-size: 0.84rem; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); background: rgba(13,17,23,0.85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 24px; height: 68px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.15rem; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; flex: 1; }
.nav a { color: var(--muted); font-size: 1rem; white-space: nowrap; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav-auth { display: flex; gap: 10px; flex-shrink: 0; }
.burger { display: none; background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 5px 10px; color: var(--text); font-size: 1.3rem; line-height: 1; flex-shrink: 0; margin-left: auto; }

/* Buttons */
.btn { display: inline-block; padding: 9px 18px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 30px 0 50px; }
.hero h1 { font-size: 2rem; line-height: 1.15; margin: 14px 0 16px; letter-spacing: -0.02em; }
.lead { font-size: 1.05rem; line-height: 1.55; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; margin: 22px 0 10px; }
.pill { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--surface-2); color: var(--primary); font-size: 0.86rem; font-weight: 600; border: 1px solid var(--border); }

/* Code */
.code-block { background: #0a0e14; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; max-width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.91rem; color: #b9c5d3; position: relative; }
.copy-btn { position: absolute; top: 10px; right: 10px; padding: 4px 12px; font-size: 0.78rem; font-family: inherit; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: background .15s; }
.copy-btn:hover { background: var(--border); color: var(--text); }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 20px 0 60px; }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.feature-card h3 { margin: 0 0 8px; }

/* Sections */
.section { margin: 50px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.page-head { margin-bottom: 26px; }
.page-head.center { text-align: center; }
.page-head h1 { margin: 0 0 6px; font-size: 1.85rem; line-height: 1.25; }

/* Grid / cards */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; color: var(--text); overflow: hidden; min-width: 0; }
.card:hover { border-color: var(--primary); text-decoration: none; }
.card-thumb { display: block; width: calc(100% + 36px); margin: -18px -18px 14px; height: 150px; object-fit: cover; }
.card-thumb-placeholder { display: block; width: calc(100% + 36px); margin: -18px -18px 14px; height: 150px; background: linear-gradient(135deg, var(--surface-2) 0%, var(--border) 100%); }
.card h3 { margin: 8px 0 4px; font-size: 1.05rem; line-height: 1.35; }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.card-meta { display: flex; gap: 12px; margin-top: 12px; }
.tag { background: var(--surface-2); color: var(--primary); padding: 3px 10px; border-radius: 6px; font-size: 0.84rem; font-weight: 600; }
.chip { background: var(--surface-2); color: var(--muted); padding: 3px 10px; border-radius: 6px; font-size: 0.84rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.badge { padding: 3px 10px; border-radius: 6px; font-size: 0.84rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.badge-ok { color: var(--ok); }
.author-chip { color: var(--primary); cursor: pointer; }
.author-chip:hover { text-decoration: underline; }
.badge-new { color: var(--warn); }
.badge-warn { color: var(--warn); }
.badge-err { color: var(--err); }

/* Filters */
.filters { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.filters > * { width: auto; flex-shrink: 0; }
.filters input[type=search] { flex: 1; min-width: 160px; width: auto; }

/* Forms */
input, select, textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); padding: 10px 12px; font-size: 1rem; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
label { display: block; margin-bottom: 14px; font-size: 1rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 6px; }
.row { display: flex; gap: 12px; }
.row label { flex: 1; }

/* Detail */
.detail { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.detail-side .panel { position: sticky; top: 80px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0; font-size: 1rem; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.hash { margin-top: 12px; }
.hash code { display: block; word-break: break-all; margin-top: 4px; color: var(--muted); }
.samples { display: flex; gap: 12px; flex-wrap: wrap; }
.samples img { width: 180px; height: 180px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.ticks { list-style: none; padding: 0; }
.ticks li { padding-left: 22px; position: relative; margin: 6px 0; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); }
.crumbs { margin-bottom: 8px; }

/* Prose */
.prose { max-width: 780px; font-size: 1rem; line-height: 1.65; }
.prose h1 { margin-bottom: 8px; font-size: 1.85rem; line-height: 1.25; }
.prose h2 { margin-top: 36px; margin-bottom: 12px; font-size: 1.4rem; line-height: 1.3; }
.prose h3 { margin-top: 24px; margin-bottom: 8px; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em 1.4em; }
.prose li { margin-bottom: 4px; }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.875em; }
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose pre { margin: 0 0 1.2em; }
.prose table { margin: 0 0 1.2em; }
.table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.table th, .table td { border: 1px solid var(--border); padding: 9px 14px; text-align: left; font-size: 1rem; }
.table th { background: var(--surface-2); }

/* Docs layout */
.docs-layout { display: grid; grid-template-columns: 220px 1fr; gap: 36px; }
.docs-nav { position: sticky; top: 80px; align-self: start; display: flex; flex-direction: column; }
.docs-nav h4 { margin: 16px 0 6px; color: var(--muted); font-size: 0.86rem; text-transform: uppercase; letter-spacing: 0.05em; }
.docs-nav a { color: var(--muted); font-size: 1rem; padding: 3px 0; }
.docs-nav a:hover { color: var(--text); }
/* desktop: hide <details> chrome, show nav links directly */
.docs-toc { display: contents; }
.docs-toc-toggle { display: none; }

/* Fine-tune how-it-works panel */
.ft-steps { display: flex; flex-direction: column; gap: 24px; padding: 8px 4px; }
.ft-step { display: flex; gap: 16px; align-items: flex-start; }
.ft-step-num { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.ft-step strong { display: block; margin-bottom: 4px; }
.ft-step p { margin: 0; }

/* Articles */
.article-list { display: flex; flex-direction: column; gap: 14px; }
.article-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--text); display: flex; gap: 16px; align-items: flex-start; }
.article-item:hover { border-color: var(--primary); text-decoration: none; }
.article-item h3 { margin: 0 0 6px; font-size: 1.05rem; line-height: 1.35; }
.article-item-body { flex: 1; min-width: 0; }
.article-item-thumb { width: 160px; height: 100px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.article-cover { display: block; width: 100%; max-height: 340px; object-fit: cover; border-radius: var(--radius); margin-bottom: 24px; }

/* Pricing */
.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.price-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; }
.price-card.featured { border-color: var(--primary); }
.price { font-size: 2.2rem; font-weight: 700; margin: 8px 0; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 400; }

/* Status */
.status-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.status-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--surface); }
.status-note { margin-top: 18px; }

/* Timeline */
.timeline { border-left: 2px solid var(--border); padding-left: 24px; margin-left: 6px; }
.tl-item { margin-bottom: 36px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: -31px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.tl-item h3 { margin: 4px 0 8px; font-size: 1.15rem; }
.tl-release h3 { color: var(--text); }
.tl-release h3::before { content: attr(data-version); display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; margin-right: 8px; vertical-align: middle; position: relative; top: -1px; }
.tl-spotlight::before { background: var(--warn) !important; }
.tl-date { display: block; margin-bottom: 4px; }

/* FAQ accordion */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.faq-item summary { cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 1rem; list-style: none; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--muted); flex-shrink: 0; margin-left: 12px; }
.faq-item[open] summary::after { content: '−'; }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-item .faq-body { padding: 14px 18px; }
.faq-item .faq-body > *:first-child { margin-top: 0; }
.faq-item .faq-body > *:last-child { margin-bottom: 0; }
.faq-section-head { margin: 28px 0 12px; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

/* Playground tabs */
.pg-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.pg-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; padding: 10px 20px; font-size: 1rem; font-family: inherit; color: var(--muted); cursor: pointer; font-weight: 500; transition: color .15s; }
.pg-tab:hover { color: var(--text); }
.pg-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.txt-result { min-height: 220px; padding: 4px 0; }
.txt-output { }
.txt-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 16px; font-size: 0.95rem; line-height: 1.7; white-space: pre-wrap; }
.txt-example-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; cursor: pointer; font-family: inherit; color: var(--text); text-align: left; transition: border-color .15s; }
.txt-example-btn:hover { border-color: var(--primary); }
.txt-example-name { font-size: 0.92rem; font-weight: 500; }

/* Playground / finetune */
.pg { display: grid; grid-template-columns: 380px 1fr; gap: 24px; align-items: start; }
.pg-controls { display: flex; flex-direction: column; gap: 14px; }
.pg-params { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pg-output { display: flex; flex-direction: column; gap: 18px; }
.pg-result-panel { min-height: 300px; }
.pg-progress { margin-bottom: 14px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.pg-result { min-height: 260px; display: flex; align-items: center; justify-content: center; text-align: center; }
.pg-result img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
.pg-examples {}
.pg-example-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pg-example-item { cursor: pointer; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); transition: border-color .15s; }
.pg-example-item:hover { border-color: var(--primary); }
.pg-example-item img { display: block; width: 100%; height: 80px; object-fit: cover; }
.pg-example-label { display: block; padding: 4px 8px 6px; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--surface); }
input[type="range"] { width: 100%; accent-color: var(--primary); }
/* Custom file input */
.file-pick { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.file-pick input[type="file"] { display: none; }
.file-pick-btn { display: inline-block; padding: 8px 16px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); white-space: nowrap; }
.file-pick-btn:hover { background: var(--border); }
.file-pick-name { font-size: 0.94rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-log { background: #0a0e14; border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-top: 12px; font-size: 0.91rem; max-height: 220px; overflow-y: auto; color: #9db0c4; white-space: pre; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Auth */
.auth { display: flex; justify-content: center; align-items: center; flex: 1; padding: 20px 0; min-height: 55vh; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 14px; }
.code-input { letter-spacing: 0.4em; text-align: center; font-size: 1.3rem; font-family: ui-monospace, monospace; }
.alert { background: rgba(248,81,73,0.12); border: 1px solid rgba(248,81,73,0.4); color: #ffb3ae; padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 0.95rem; }
.verify-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }

/* Stats bar */
.stats-bar { display: flex; gap: 0; margin: 0 0 48px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat { flex: 1; padding: 18px 24px; text-align: center; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat strong { display: block; font-size: 1.6rem; font-weight: 700; color: var(--text); }
.stat span { font-size: 0.9rem; color: var(--muted); }
@media (max-width: 860px) { .stats-bar { flex-wrap: wrap; } .stat { flex: 1 1 50%; } .stat:nth-child(2) { border-right: none; } .stat:nth-child(3) { border-top: 1px solid var(--border); } .stat:nth-child(4) { border-top: 1px solid var(--border); border-right: none; } }

/* Author profile */
.author-head-row { display: flex; align-items: center; gap: 18px; min-width: 0; }
.author-avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700; flex-shrink: 0; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 14px; margin-top: 28px; justify-content: center; }

/* 404 */
.notfound { text-align: center; padding: 80px 0; }
.code404 { font-size: 4rem; font-weight: 800; color: var(--primary); margin: 0; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-link { display: block; padding: 8px 12px; border-radius: 6px; color: var(--muted); font-size: 0.95rem; }
.settings-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.settings-link.active { background: var(--surface); color: var(--text); font-weight: 600; }
.settings-main {}
.token-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 18px; }
.token-result { margin-top: 16px; padding: 14px; background: var(--surface-2); border: 1px solid var(--ok); border-radius: var(--radius); }
.token-value-wrap { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.token-value { word-break: break-all; font-size: 0.85rem; flex: 1; }
@media (max-width: 860px) { .settings-layout { grid-template-columns: 1fr; } }

/* Leaderboard */
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--border); font-size: 0.9rem; color: var(--muted); }
.lb-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.lb-rank { width: 48px; text-align: center; font-weight: 700; font-size: 1.05rem; }
.lb-num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-since { text-align: right; }
.lb-row:hover { background: var(--surface); }
/* on narrow viewports hide secondary columns so the table fits without wrapping */
@media (max-width: 560px) {
  .lb-adapters, .lb-since { display: none; }
}
.lb-top1 td, .lb-top2 td, .lb-top3 td { background: rgba(91,140,255,.06); }

/* Base model icon card */
.model-card-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; color: var(--primary); letter-spacing: 0.02em; }

/* Sparkline */
.sparkline-wrap { margin: 14px 0 10px; }
.sparkline { display: block; width: 100%; height: 40px; }

/* Shelf (trending / recently added strips) */
.shelf-section { margin-bottom: 40px; }
.shelf-heading { font-size: 1.1rem; font-weight: 600; margin: 0 0 14px; color: var(--text); }
.shelf { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; width: 100%; }
.shelf-card { display: flex; flex-direction: column; flex-shrink: 0; width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); transition: border-color .15s; }
.shelf-card:hover { border-color: var(--primary); text-decoration: none; }
.shelf-thumb { display: block; width: 100%; height: 110px; object-fit: cover; }
.shelf-thumb-placeholder { background: linear-gradient(135deg, var(--surface-2) 0%, var(--border) 100%); }
.shelf-info { padding: 8px 10px 10px; }
.shelf-name { display: block; font-size: 0.88rem; font-weight: 600; line-height: 1.3; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-meta { display: block; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 40px; }
.footer-inner { display: grid; grid-template-columns: 1.2fr 2fr; gap: 30px; padding: 40px 20px 20px; }
.footer-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.footer-cols h4 { margin: 0 0 8px; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.footer-cols a { display: block; color: var(--muted); font-size: 0.98rem; padding: 2px 0; }
.footer-cols a:hover { color: var(--text); }
.footer-legal { padding: 14px 20px 30px; border-top: 1px solid var(--border); }

/* detail-main and prose need min-width:0 so grid children don't overflow their 1fr column */
.detail-main, .prose { min-width: 0; }
/* hidden on desktop, shown only inside open burger menu on mobile */
.nav-mobile-auth { display: none; }
/* shelf: scroll-snap and hidden scrollbar for a cleaner carousel feel */
.shelf { scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.shelf::-webkit-scrollbar { display: none; }
.shelf-card { scroll-snap-align: start; }
/* tables can overflow on narrow viewports — wrap them */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap .table { min-width: 560px; }
.table-wrap .lb-table { min-width: 480px; }
/* shelf is clipped at its section boundary so inner scroll doesn't expand scrollWidth */
.shelf-section { overflow-x: hidden; }

@media (max-width: 860px) {
  .hero, .features, .grid, .pricing, .detail, .docs-layout, .pg, .footer-inner { grid-template-columns: 1fr; }
  .hero-copy, .hero-panel { min-width: 0; }
  .pg-params { grid-template-columns: 1fr; }
  .pg-example-grid { grid-template-columns: repeat(2, 1fr); }
  .nav { display: none; }
  .nav.open { display: flex; flex-direction: column; gap: 4px; position: fixed; top: 76px; left: 0; right: 0; background: var(--surface); border-bottom: 2px solid var(--border); padding: 14px 20px; z-index: 19; }
  .nav.open a { font-size: 1rem; padding: 6px 0; }
  .nav.open .nav-mobile-auth { display: flex; gap: 10px; padding: 10px 0 4px; border-top: 1px solid var(--border); margin-top: 6px; }
  .nav-auth { display: none; }
  .burger { display: block; }
  .code-block, .prose pre { overflow-x: auto; max-width: 100%; }
  .samples img { width: 140px; height: 140px; }
  .detail-side .panel { position: static; }
  /* blog cards: stack thumbnail on top */
  .article-item { flex-direction: column; }
  .article-item-thumb { width: 100%; height: 160px; order: -1; }
  /* docs: show TOC after article as collapsible */
  .docs-nav { order: 2; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 8px; position: static; }
  .docs-toc { display: block; }
  .docs-toc-toggle { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 600; color: var(--text); padding: 4px 0 12px; list-style: none; user-select: none; }
  .docs-toc-toggle::after { content: '▾'; }
  .docs-toc[open] .docs-toc-toggle::after { content: '▴'; }
  .docs-toc:not([open]) h4,
  .docs-toc:not([open]) a { display: none; }
  /* hero actions stack on very small screens */
  .hero-actions { flex-wrap: wrap; }
  /* footer columns collapse to 2 on mobile */
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  /* filters: full-width stack on mobile */
  .filters { flex-direction: column; }
  .filters > * { width: 100%; box-sizing: border-box; flex-shrink: 1; }
  .filters input[type=search] { min-width: 0; }
  /* author header text doesn't push flex row wider */
  .author-header-text { min-width: 0; overflow: hidden; }
  /* form controls must not exceed viewport */
  .pg-controls select, .pg-controls input[type="number"],
  .pg-controls input[type="text"] { width: 100%; box-sizing: border-box; }
  /* scroll fade indicator on code blocks and scrollable tables */
  .code-block { background: linear-gradient(to right, #0a0e14 85%, #1a2232) no-repeat right center / 32px 100%, #0a0e14; }
  .table-wrap { background: linear-gradient(to right, transparent 90%, var(--surface)) no-repeat right center / 32px 100%; }
  /* tighter headings and lead on mobile */
  .page-head h1, .prose h1, h1 { font-size: 1.8rem; line-height: 1.25; word-break: break-word; }
  .hero h1 { font-size: 1.7rem; }
  .lead, .page-head .muted { font-size: 0.98rem; line-height: 1.55; }
  /* filter button must not overflow or clip */
  .filters .btn { width: 100%; box-sizing: border-box; overflow: visible; }
  /* prevent prose content (tables, code) from expanding page width */
  .prose { max-width: 100%; overflow-x: hidden; }
  .prose pre, .prose table { overflow-x: auto; max-width: 100%; }
  /* leaderboard table always in scroll container on mobile */
  .table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
}
