/* Top LLMs – Gestaltung. Leitbild: ein Messprotokoll mit Textmarker.
   Tinte auf neutralem Papier, eine einzige Farbe (Marker) für die Unsicherheitsspanne.
   Begründungen stehen in docs/DESIGN.md. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f4f2;
  --surface: #ffffff;
  --ink: #111411;
  --ink-2: #454b46;
  --ink-3: #626963;
  --line: #dcdfda;
  --grid: #e3e6e1;
  --mark: #ffd43a;
  --focus: #1f3fbf;
  --warn: #a3321c;
  --tile: #ffffff;
  --tile-dark: #1b1e1b;
  --hover: #eceeea;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121412; --surface: #1b1e1b; --ink: #eef1ec; --ink-2: #c3c9c2; --ink-3: #969d96;
    --line: #2c302c; --grid: #262a26; --mark: #8f6f0a; --focus: #a9baff; --warn: #ff9b85;
    --tile: #f1f3ef; --tile-dark: #0b0c0b; --hover: #1b1e1b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121412; --surface: #1b1e1b; --ink: #eef1ec; --ink-2: #c3c9c2; --ink-3: #969d96;
  --line: #2c302c; --grid: #262a26; --mark: #8f6f0a; --focus: #a9baff; --warn: #ff9b85;
  --tile: #f1f3ef; --tile-dark: #0b0c0b; --hover: #1b1e1b;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 48px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3, p, ul, ol, dl, dd, fieldset, legend, table { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
small { font-size: 12px; color: var(--ink-3); font-weight: 400; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.skip { position: absolute; left: 8px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 6px; z-index: 20; }
.skip:focus { top: 8px; }
.na { color: var(--ink-3); }

/* ---------- Kopf ---------- */
.top { padding-top: 22px; padding-bottom: 18px; }
.top-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
h1 { font-size: clamp(34px, 6.2vw, 60px); line-height: 1; font-weight: 800; letter-spacing: -0.04em; }
h1 a { text-decoration: none; }
.lede { margin-top: 12px; max-width: 54ch; font-size: clamp(16px, 1.5vw, 19px); line-height: 1.4; color: var(--ink-2); }
.stamp { margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.alert { color: var(--warn); margin-left: 6px; white-space: nowrap; }
.alert::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }

.ghost {
  background: transparent; border: 1px solid var(--line); border-radius: 7px; padding: 0 12px; min-height: 36px;
  cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap;
}
.ghost:hover { border-color: var(--ink-3); }
.link { background: none; border: 0; padding: 0; margin-left: 8px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; color: var(--ink-2); }

/* ---------- Bedienung ---------- */
.controls { padding-bottom: 14px; }
.c-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { flex: 1 1 200px; min-width: 0; }
.search input {
  width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); font-size: 16px;
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input:hover, .sel select:hover { border-color: var(--ink-3); }
#filters-toggle { min-height: 40px; }

.seg { display: flex; align-items: center; }
.seg legend { float: left; font-size: 13px; color: var(--ink-3); margin-right: 8px; white-space: nowrap; }
.seg label { position: relative; margin-left: -1px; cursor: pointer; }
.seg label:first-of-type { margin-left: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; padding: 0 11px; line-height: 34px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.seg label:first-of-type span { border-radius: 7px 0 0 7px; }
.seg label:last-of-type span { border-radius: 0 7px 7px 0; }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); position: relative; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }
#sort { flex: 1 0 100%; order: 2; }

.filters { display: none; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.filters.show { display: flex; }
.sel { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); min-width: 0; }
.sel select {
  min-height: 36px; max-width: 100%; padding: 0 30px 0 10px; border: 1px solid var(--line); border-radius: 7px;
  background-color: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 36px; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--ink); }

.state { padding: 40px 0; color: var(--ink-2); }
.state p { margin-bottom: 12px; }

/* ---------- Legende ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; padding: 6px 0 10px; font-size: 13px; color: var(--ink-3); }
.count { color: var(--ink); font-weight: 600; font-size: 14px; }
.key { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.k { display: inline-flex; align-items: center; gap: 7px; }
.sortnote { flex: 1 0 100%; color: var(--ink-2); max-width: 78ch; }

/* ---------- Spanne auf gemeinsamer Achse (das Kernstück) ---------- */
.track { position: relative; display: block; height: 18px; min-width: 60px; }
.band, .whisk, .dot, .ref { position: absolute; top: 50%; }
.band { left: var(--lo); width: var(--w); height: 12px; margin-top: -6px; background: var(--mark); border-radius: 2px; }
.whisk {
  left: var(--lo); width: var(--w); height: 7px; margin-top: -3.5px;
  border-inline: 1px solid var(--ink-2);
  background: linear-gradient(var(--ink-2), var(--ink-2)) center / 100% 1px no-repeat;
}
.dot { left: var(--x); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--ink); }
.dot.ring { background: var(--surface); border: 2px solid var(--ink); }
.ref { left: var(--ref); top: 1px; bottom: 1px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.track.demo { width: 44px; min-width: 44px; --lo: 8%; --w: 84%; --x: 50%; }
.track.mini { min-width: 70px; background: linear-gradient(var(--line), var(--line)) center / 100% 1px no-repeat; }
.track.mini .band { height: 10px; margin-top: -5px; }

.pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pips i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--ink-3); }
.pips i.on { background: var(--ink-2); border-color: var(--ink-2); }

.tag { display: inline-block; font-size: 11px; line-height: 16px; padding: 0 5px; border: 1px solid var(--ink-3); border-radius: 4px; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
.tag.quiet { border-color: var(--line); color: var(--ink-3); }
.tag.warn { border-color: var(--warn); color: var(--warn); margin-left: 8px; }

/* ---------- Rangliste: Handy zuerst ---------- */
.board { --ticks: 7; }
.head, .row {
  display: grid; column-gap: 10px;
  grid-template-columns: 24px 28px minmax(0, 1fr) auto 10px;
  grid-template-areas: "rank logo name score chev" "strip strip strip strip strip";
}
.head {
  position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1.5px solid var(--ink);
  font-size: 12px; color: var(--ink-3); padding: 6px 0 3px;
  grid-template-areas: "strip strip strip strip strip";
}
.head > span { display: none; }
.head > .c-strip { display: block; grid-area: strip; }
.axis { position: relative; display: block; height: 15px; }
.tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 11px; line-height: 15px; }
.tick:first-child { transform: none; }
.tick:last-child { transform: translateX(-100%); }

.item { border-bottom: 1px solid var(--line); content-visibility: auto; contain-intrinsic-size: auto 84px; }
.item.open { content-visibility: visible; }
.row {
  width: 100%; text-align: left; background: none; border: 0; padding: 10px 0 8px; cursor: pointer;
  align-items: start; row-gap: 6px;
}
.row:hover { background: var(--hover); }
.row:focus-visible { outline-offset: -2px; }
.c-rank { grid-area: rank; font-size: 13px; color: var(--ink-3); padding-top: 5px; text-align: right; }
.c-logo { grid-area: logo; }
.c-name { grid-area: name; min-width: 0; }
.c-strip { grid-area: strip; min-width: 0; }
.c-score { grid-area: score; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; text-align: right; line-height: 28px; }
.c-chev { grid-area: chev; align-self: start; margin-top: 9px; width: 8px; height: 8px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
.item.open .c-chev { transform: rotate(-135deg); margin-top: 13px; }
.c-src, .c-price, .c-speed, .c-ctx, .c-val { display: none; }

.name { display: block; font-size: 16px; font-weight: 650; line-height: 1.25; letter-spacing: -0.012em; overflow-wrap: anywhere; }
.vl { font-weight: 450; color: var(--ink-3); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 3px; font-size: 13px; color: var(--ink-3); line-height: 18px; }
.flag { display: inline-block; width: 16px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); object-fit: cover; vertical-align: -1px; }
.maker { color: var(--ink-2); }
.nvar { white-space: nowrap; }
.sortline { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); line-height: 14px; letter-spacing: 0; white-space: nowrap; }

.row .track { background: linear-gradient(to right, var(--grid) 1px, transparent 1px) 0 0 / calc(100% / var(--ticks)) 100%; box-shadow: inset -1px 0 var(--grid); }

.logo { display: block; width: 28px; height: 28px; border-radius: 7px; background: var(--tile); box-shadow: 0 0 0 1px var(--line); padding: 4px; overflow: hidden; }
.logo img { width: 100%; height: 100%; object-fit: contain; }
.logo.on-dark { background: var(--tile-dark); }
.logo.bleed { padding: 0; }
.logo.bleed img { object-fit: cover; }
.logo.mono { padding: 0; background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 700; line-height: 28px; text-align: center; letter-spacing: 0.02em; }

/* ---------- Detail ---------- */
.item.open { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: 10px; border-bottom-color: transparent; margin: 6px -8px; padding: 0 8px; position: relative; }
.item.open .row:hover { background: none; }
.panel { padding: 4px 0 18px; }
.finding { font-size: 15px; line-height: 1.5; max-width: 68ch; color: var(--ink-2); }
.finding strong { color: var(--ink); font-weight: 650; }
.panel h3 { font-size: 14px; font-weight: 650; margin: 20px 0 6px; }
.note { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.pgrid { display: grid; gap: 0 40px; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 7px 10px 7px 0; text-align: left; vertical-align: middle; border-top: 1px solid var(--line); font-weight: 400; }
thead th { border-top: 0; font-size: 12px; color: var(--ink-3); padding-bottom: 4px; white-space: nowrap; }
th:last-child, td:last-child { padding-right: 0; }
.r { text-align: right; white-space: nowrap; }
.b { font-weight: 650; }
.t { width: 38%; }
.range { display: block; font-size: 12px; color: var(--ink-3); }
.absent th, .absent td { color: var(--ink-3); }
.absent a { text-decoration-color: var(--line); }
.variants tr.cur th { font-weight: 650; }
.variants tr.cur th::after { content: " shown"; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.variants th:nth-child(5), .variants td:nth-child(5), .variants th:nth-child(7), .variants td:nth-child(7) { display: none; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.facts > div { padding: 7px 0; border-top: 1px solid var(--line); }
.facts dt { font-size: 12px; color: var(--ink-3); }
.facts dd { font-size: 14px; font-weight: 500; }
.facts .flag { margin-right: 3px; }

.scalenote { font-size: 13px; color: var(--ink-3); max-width: 78ch; padding: 16px 0 0; }

/* ---------- Fuß ---------- */
.foot { margin-top: 48px; padding-top: 22px; padding-bottom: 40px; border-top: 1.5px solid var(--ink); font-size: 14px; }
.foot h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 10px; }
.notices { margin-bottom: 14px; max-width: 78ch; }
.notices li { position: relative; padding: 3px 0 3px 16px; color: var(--ink-2); }
.notices li::before { content: ""; position: absolute; left: 0; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.notices strong { color: var(--ink); font-weight: 650; }
.sources li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.sources a { font-weight: 600; }
.sources .by, .sources .when { color: var(--ink-3); font-size: 13px; }
.footlinks { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.footlinks a { font-weight: 600; }
.footlinks span, .foot .small { color: var(--ink-3); font-size: 13px; }
.foot .small { margin-top: 6px; }

/* ---------- Methodikseite ---------- */
.prose { max-width: 68ch; font-size: 17px; line-height: 1.6; padding-bottom: 20px; }
.prose h2 { font-size: 24px; line-height: 1.2; font-weight: 750; letter-spacing: -0.02em; margin: 44px 0 10px; }
.prose p { margin: 0 0 14px; color: var(--ink-2); }
.prose p strong { color: var(--ink); font-weight: 650; }
.prose ul.plain { margin: 0 0 14px; color: var(--ink-2); }
.prose ul.plain li { position: relative; padding: 2px 0 2px 18px; }
.prose ul.plain li::before { content: ""; position: absolute; left: 2px; top: 14px; width: 6px; height: 2px; background: var(--ink-3); }
.prose ol.steps { margin: 0 0 14px; counter-reset: s; color: var(--ink-2); }
.prose ol.steps li { counter-increment: s; position: relative; padding: 4px 0 4px 30px; }
.prose ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 4px; font-weight: 700; color: var(--ink); }
.prose .figure { margin: 18px 0 20px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 1.45; }
.prose .figure .track { margin: 6px 0; }
.prose .figure .track.w1 { --lo: 18%; --w: 60%; --x: 48%; }
.prose .figure .track.w2 { --lo: 39%; --w: 22%; --x: 50%; }
.prose .figure p { margin: 0; font-size: 13px; color: var(--ink-3); }
.prose .figure b { font-weight: 600; color: var(--ink); }
.prose .live { color: var(--ink); }
/* position: relative, damit unsichtbare Hilfstexte (.vh, absolut) mit der Tabelle scrollen statt die Seite zu verbreitern */
.tablewrap { overflow-x: auto; margin: 0 0 14px; position: relative; }
.tablewrap table { min-width: 520px; }
.back { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--ink-2); }

/* ---------- ab 560 px: mehr Luft ---------- */
@media (min-width: 560px) {
  #sort { flex: 0 0 auto; order: 0; }
  .variants th:nth-child(5), .variants td:nth-child(5), .variants th:nth-child(7), .variants td:nth-child(7) { display: table-cell; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- ab Tablet: Tabellenzeile mit Preis, Tempo, Kontext ---------- */
@media (min-width: 760px) {
  .top { padding-top: 36px; padding-bottom: 26px; }
  #filters-toggle { display: none; }
  .filters { display: flex; border-top: 0; padding-top: 0; }
  .head, .row {
    column-gap: 12px; align-items: center;
    grid-template-columns: 34px 28px minmax(170px, 1fr) minmax(130px, 1fr) 74px 60px 48px 52px 12px;
    grid-template-areas: "rank logo name strip score price speed ctx chev";
  }
  .head { padding: 8px 8px 6px; margin-inline: -8px; align-items: end; }
  .head > span { display: block; white-space: nowrap; }
  .head > .c-src, .head > .c-val { display: none; }
  .item { contain-intrinsic-size: auto 57px; }
  .head .c-name { padding: 0; }
  .head small { display: block; font-size: 11px; line-height: 1.1; }
  .head .c-rank, .head .c-src, .head .c-score, .head .c-price, .head .c-speed, .head .c-ctx, .head .c-val { text-align: right; padding-top: 0; font-size: 12px; font-weight: 400; line-height: 1.3; letter-spacing: 0; }
  .head .c-chev { border: 0; }
  .head .c-src { text-align: center; }
  .row { padding: 0 8px; margin-inline: -8px; width: calc(100% + 16px); min-height: 56px; row-gap: 0; border-radius: 6px; }
  .c-rank { padding-top: 0; font-size: 14px; }
  .c-name { padding: 9px 0; }
  .c-strip { align-self: stretch; }
  .row .track { height: 100%; min-height: 56px; }
  .c-score { line-height: 1.2; }
  .c-price, .c-speed, .c-ctx { display: block; font-size: 14px; text-align: right; color: var(--ink-2); }
  .c-chev { margin-top: -4px; align-self: center; }
  .item.open .c-chev { margin-top: 4px; }
  .sortline { display: none; }
  .sortline.s-value { display: block; }
  .item.open { margin: 8px -16px; padding: 0 16px; }
  .panel { padding: 2px 0 24px 86px; }
  .pgrid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-variants { max-width: 760px; }
  :root[data-sort="price"] .row .c-price, :root[data-sort="speed"] .row .c-speed { color: var(--ink); font-weight: 650; }
}

/* ---------- breiter Schirm: eigene Spalte für Preis-Leistung ---------- */
@media (min-width: 1120px) {
  .head, .row {
    column-gap: 16px;
    grid-template-columns: 34px 28px minmax(300px, 1fr) minmax(240px, 1.15fr) 46px 52px 64px 52px 56px 52px 12px;
    grid-template-areas: "rank logo name strip score src price speed ctx val chev";
  }
  .c-val, .head > .c-val { display: block; font-size: 14px; text-align: right; color: var(--ink-2); }
  .c-src, .head > .c-src { display: block; text-align: center; }
  .head > .c-val, .head > .c-src { font-size: 12px; color: var(--ink-3); }
  .m-pips { display: none; }
  .sortline.s-value { display: none; }
  :root[data-sort="value"] .row .c-val { color: var(--ink); font-weight: 650; }
  .panel { padding-left: 94px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .band { background: Highlight; }
  .dot { background: CanvasText; }
  .seg input:checked + span { background: Highlight; color: HighlightText; }
}
@media print {
  .controls, #theme-toggle, .skip { display: none; }
  .head { position: static; }
}
