:root {
  --bg: #fbfaf7; --surface: #ffffff; --ink: #1d2327; --muted: #5b6670; --line: #e3e0d8;
  --accent: #0f6b5c; --accent-ink: #ffffff; --soft: #e7f2ef;
  --close: #1f8a5b; --mid: #a3a9ad; --far: #c2483b;
  --radius: 10px;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121517; --surface: #1a1f22; --ink: #e8ecee; --muted: #9aa5ad; --line: #2c3337;
    --accent: #4cc3a8; --accent-ink: #0b1513; --soft: #183029;
    --close: #4cc38a; --mid: #6b7378; --far: #ef7a6c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.tag { font-size: .8rem; color: var(--muted); }
.home { margin-left: auto; font-size: .9rem; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 32px 0 8px; }
.lede { color: var(--muted); max-width: 60ch; margin: 0 0 20px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
.search { position: relative; max-width: 520px; }
#q { width: 100%; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
#q:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#sugg { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / .12); max-height: 320px; overflow: auto; }
#sugg li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
#sugg li[aria-selected="true"], #sugg li:hover { background: var(--soft); }
#sugg .st { color: var(--muted); }

#setup { margin-top: 24px; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.presets .lbl { color: var(--muted); font-size: .9rem; }
#presets { display: contents; }
.chip, .scope button { font: inherit; font-size: .9rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"], .scope button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.link { font: inherit; font-size: .9rem; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 6px 4px; }
.note { color: var(--muted); font-size: .9rem; margin: 8px 0 0; max-width: 75ch; }

#criteria { margin-top: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.group h3 { margin: 0 0 8px; font-size: .95rem; display: flex; justify-content: space-between; }
.group h3 span { color: var(--muted); font-weight: 500; }
.crit { display: grid; grid-template-columns: 1fr 90px 44px; align-items: center; gap: 8px; font-size: .85rem; padding: 3px 0; }
.crit input[type=range] { width: 100%; accent-color: var(--accent); }
.crit output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.crit.off label { color: var(--muted); }
.crit label { font-weight: 400; margin: 0; }

#results { margin-top: 28px; }
.subject { background: var(--soft); border-radius: var(--radius); padding: 14px 16px; }
.subject h2 { margin: 0 0 6px; font-size: 1.3rem; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }
.scope { display: flex; gap: 8px; margin: 18px 0 8px; }
.list h3 { margin: 22px 0 8px; font-size: 1.05rem; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; position: sticky; top: 0; background: var(--surface); }
tr:last-child td { border-bottom: 0; }
tr.you td { background: var(--soft); font-weight: 600; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-variant-numeric: tabular-nums; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 6px; vertical-align: middle; }
.more { margin-top: 8px; }
.about { margin: 48px 0 64px; color: var(--muted); max-width: 75ch; font-size: .92rem; }
.about h2 { color: var(--ink); font-size: 1.05rem; }
.info { cursor: help; color: var(--muted); font-size: .8em; margin-left: 2px; }
@media (max-width: 600px) {
  .tag { display: none; }
  .crit { grid-template-columns: 1fr 70px 40px; }
}
