:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --border: #e4e0d8;
  --text: #1d1c1a;
  --muted: #6b6760;
  --accent: #0d7a6f;
  --accent-soft: #e3f2ef;
  --accent-text: #ffffff;
  --warn: #9a6200;
  --warn-soft: #fbf0dc;
  --ok: #2f7a3a;
  --ok-soft: #e5f3e6;
  --track-1: #0d7a6f; --track-2: #3d6fb6; --track-3: #a35a9a; --track-4: #c27a2c;
  --track-5: #5c8a3a; --track-6: #8a6d5b; --track-7: #4b8fa3; --track-8: #9b9488;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(30, 25, 15, .05), 0 2px 8px rgba(30, 25, 15, .04);
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141513; --surface: #1c1d1b; --surface-2: #242522; --border: #33352f;
    --text: #ecebe6; --muted: #a29f96; --accent: #3fb5a5; --accent-soft: #1c3431;
    --accent-text: #0d1513; --warn: #e0a84a; --warn-soft: #3a2f1c; --ok: #7cc68a; --ok-soft: #1f3324;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141513; --surface: #1c1d1b; --surface-2: #242522; --border: #33352f;
  --text: #ecebe6; --muted: #a29f96; --accent: #3fb5a5; --accent-soft: #1c3431;
  --accent-text: #0d1513; --warn: #e0a84a; --warn-soft: #3a2f1c; --ok: #7cc68a; --ok-soft: #1f3324;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(28px, 5vw, 40px); letter-spacing: -.01em; }
h2 { font-size: 22px; }
h3 { font-size: 17px; font-family: var(--sans); font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.top { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; }
.brand { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-b { color: var(--accent); }
nav { display: flex; gap: 4px; overflow-x: auto; }
nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-weight: 500; font-size: 14px; }
nav a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
nav a.active { color: var(--text); background: var(--surface-2); }

main { padding: 32px 16px 48px; min-height: 60vh; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 20px; padding-bottom: 32px; border-top: 1px solid var(--border); font-size: 13px; }

.hero { display: grid; gap: 14px; margin-bottom: 28px; max-width: 680px; }
.hero p, .lede { font-size: 17px; color: var(--muted); max-width: 680px; }
.hero .actions, .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.search { flex: 1 1 240px; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.search:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; max-width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); min-width: 0; transition: border-color .15s; }
.card:hover { border-color: var(--accent); }
.card h3 a { color: var(--text); }
.card h3 a:hover { text-decoration: none; }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card .summary { color: var(--muted); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card .meta { margin-top: auto; padding-top: 4px; font-size: 13px; color: var(--muted); }
.card .meta b { color: var(--accent); font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.metric { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.metric .v { font-family: var(--mono); font-size: 18px; font-weight: 500; }
.metric .n { color: var(--muted); font-size: 13px; }

.trackbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.trackbar span { display: block; height: 100%; }
.trackbar span + span { border-left: 2px solid var(--surface); }
.legend { display: grid; gap: 6px; }
.legend-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.legend-row .sw { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; }
.legend-row .w { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 13px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }

.page-head { display: grid; gap: 10px; margin-bottom: 24px; }
.crumbs { font-size: 14px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-areas: "main side"; gap: 24px; align-items: start; }
.layout > .main { grid-area: main; min-width: 0; }
.layout > .side { grid-area: side; min-width: 0; }
@media (max-width: 880px) { .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main"; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); min-width: 0; }
.panel + .panel { margin-top: 16px; }
.cols > .panel + .panel { margin-top: 0; }
.panel-body { display: grid; gap: 14px; }
details.panel > summary { list-style-position: outside; }
details.panel[open] { gap: 12px; }
.panel h2 { font-size: 19px; }
.sticky { position: sticky; top: 76px; }
@media (max-width: 880px) { .sticky { position: static; } }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
ul.clean { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
ul.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
ul.clean li { overflow-wrap: anywhere; }
details > summary { cursor: pointer; font-weight: 500; }
details[open] > summary { margin-bottom: 8px; }
.qlist { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.qlist code { color: var(--text); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 600; }
.codebox { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.promptbox { display: grid; gap: 8px; }
.promptbox .codebox { max-height: 180px; overflow-y: auto; }
.promptbox .copy { justify-self: stretch; padding: 9px 13px; }
.copy-row { display: flex; justify-content: flex-end; gap: 8px; }
.field .chips { margin-top: 8px; }
.panel h2 .badge { vertical-align: middle; margin-left: 6px; font-family: var(--sans); }
.hint { font-size: 13px; color: var(--muted); }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: 14px; }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; align-items: start; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }

/* Add page: progressive decision tree */
.tree { display: grid; gap: 16px; max-width: 820px; }
.tree .step-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.choice { text-align: left; display: grid; gap: 4px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 14px 16px; font: inherit; cursor: pointer; }
.choice:hover { background: var(--surface-2); }
.choice b { font-size: 15px; }
.choice span { font-size: 13px; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.choice.recommended { border-width: 2px; border-color: var(--accent); }
.choice .tag { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.choices.secondary { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.choices.secondary .choice { padding: 10px 12px; }
.repo-input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--surface); color: var(--text); }
.grades { width: 100%; border-collapse: collapse; font-size: 14px; }
.grades th, .grades td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border); }
.grades th { font-weight: 600; color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
