:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #000;
  --panel-raised: #111;
  --ink: #f4f4f2;
  --muted: #a8a8a2;
  --soft: #d7d7d2;
  --line: #2b2b2b;
  --line-strong: #5c5c5c;
  --accent: #f4f4f2;
  --accent-2: #d7d7d2;
  --accent-weak: #141414;
  --green-weak: #141414;
  --green: #d7d7d2;
  --rank-1: rgba(185, 134, 46, 0.28);
  --rank-2: rgba(122, 132, 142, 0.22);
  --rank-3: rgba(143, 88, 46, 0.2);
  --danger: #ff6b6b;
  --shadow: none;
  --font-sans: "IBM Plex Sans", Arial, "Helvetica Neue", sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  letter-spacing: 0;
}

.shell-glow {
  display: none;
}

a {
  color: var(--accent);
}

.page-header {
  padding: 54px 0 28px;
  border-bottom: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.title-block {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-family: var(--font-serif);
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 500;
  line-height: 1.05;
  text-transform: none;
}

h2 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 620;
}

.subtitle {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 8px;
}

.status-strip span {
  position: relative;
  color: var(--muted);
  padding: 0 0 0 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-strip span::before {
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  content: "";
}

.data-link,
button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-raised);
  color: var(--ink);
  padding: 7px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.data-link:hover,
button:hover {
  border-color: var(--line-strong);
  background: #181818;
}

main {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto 56px;
}

.toolbar,
.summary {
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.toolbar {
  display: grid;
  grid-template-columns: 160px minmax(220px, 1fr) 170px 220px;
  gap: 0;
  padding: 0;
  overflow: visible;
}

label,
.filter-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  padding: 11px 12px;
  font-size: 11px;
  font-weight: 680;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border-right: 1px solid var(--line);
}

.toolbar > label:last-child,
.toolbar > .filter-field:last-child {
  border-right: 0;
}

select,
input:not([type="checkbox"]) {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #050505;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

.provider-filter-label {
  position: relative;
}

.provider-filter {
  position: relative;
}

.provider-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #050505;
  color: var(--ink);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  list-style: none;
}

.provider-filter summary::-webkit-details-marker {
  display: none;
}

.provider-filter summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 14px;
}

.provider-filter[open] summary {
  border-color: var(--accent);
}

.provider-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080808;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.provider-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.provider-option:last-child {
  border-bottom: 0;
}

.provider-option:hover {
  background: var(--hover);
}

.rate-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.rate-control button {
  min-height: 38px;
  border-radius: 6px;
}

.rate-status {
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

select:focus,
input:not([type="checkbox"]):focus,
summary:focus-visible,
button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 18px;
  overflow: hidden;
}

.metric {
  min-height: 60px;
  padding: 12px 0;
  background: transparent;
  border-right: 1px solid var(--line);
  padding-left: 16px;
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 5px;
  color: var(--accent);
  font-size: 20px;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  margin-top: 34px;
  overflow-x: auto;
  overflow-y: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.table-titlebar {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 100%;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.table-titlebar h2 {
  color: var(--ink);
  font-size: 28px;
  font-weight: 620;
  letter-spacing: 0;
  text-transform: none;
}

.table-titlebar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.table-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

th,
td {
  padding: 18px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  font-weight: 560;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 1px 0 var(--line);
}

th span {
  display: block;
}

.column-condition {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  text-transform: none;
}

tbody tr:hover td {
  background: #080808;
  transition: background 140ms ease, color 140ms ease;
}

tbody tr[data-model-id] {
  cursor: pointer;
}

tbody tr.is-selected td {
  background: #0d0d0d;
}

tbody tr.is-selected:hover td {
  background: #101010;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.model-name {
  line-height: 1.2;
  color: var(--ink);
  font-weight: 430;
}

.model-id,
.price-note,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.provider-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #080808;
}

.provider-icon img {
  width: 15px;
  height: 15px;
  display: block;
  opacity: 0.96;
}

.provider-openai img {
  filter: invert(1);
}

.provider-name {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.price-cell {
  min-width: 110px;
  color: #f4f7f5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 400;
}

.price-converted {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

td:last-child,
th:last-child {
  min-width: 116px;
  white-space: nowrap;
}

td:last-child .model-id {
  white-space: nowrap;
}

td:nth-child(3),
th:nth-child(3) {
  min-width: 220px;
}

th:nth-child(1),
td:nth-child(1),
th:nth-child(2),
td:nth-child(2),
th:nth-child(3),
td:nth-child(3) {
  position: sticky;
  background: var(--bg);
}

th:nth-child(1),
td:nth-child(1) {
  left: 0;
  width: 66px;
  min-width: 66px;
  z-index: 4;
}

th:nth-child(2),
td:nth-child(2) {
  left: 66px;
  width: 116px;
  min-width: 116px;
  z-index: 4;
}

th:nth-child(3),
td:nth-child(3) {
  left: 182px;
  z-index: 4;
  box-shadow: 1px 0 0 var(--line);
}

th:nth-child(1),
th:nth-child(2),
th:nth-child(3) {
  background: var(--bg);
  z-index: 5;
}

tbody tr:hover td:nth-child(1),
tbody tr:hover td:nth-child(2),
tbody tr:hover td:nth-child(3) {
  background: #080808;
}

tbody tr.is-selected td:nth-child(1),
tbody tr.is-selected td:nth-child(2),
tbody tr.is-selected td:nth-child(3) {
  background: #0d0d0d;
}

.price-line {
  display: grid;
  gap: 2px;
  margin-bottom: 6px;
}

.price-line:last-child {
  margin-bottom: 0;
}

.source-link {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--green);
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.source-link:hover {
  background: transparent;
  color: var(--ink);
}

.compare,
.notes {
  margin-top: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.compare:has(.empty) {
  padding: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compare-list {
  display: block;
  margin-top: 18px;
}

.compare-list .empty {
  margin: 0;
}

.compare-table-wrap {
  overflow-x: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.compare-grid {
  display: grid;
  grid-template-columns: 220px repeat(var(--compare-columns), minmax(190px, 1fr));
  min-width: max(100%, calc(220px + var(--compare-columns) * 190px));
  align-items: stretch;
}

.compare-cell {
  min-width: 0;
  padding: 18px 12px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.compare-grid > .compare-header:first-child,
.compare-row-head {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg);
  box-shadow: 1px 0 0 var(--line);
}

.compare-header {
  border-top: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 560;
}

.compare-row-head {
  color: var(--ink);
  font-weight: 520;
  z-index: 3;
}

.compare-cell.rank-1 {
  background: var(--rank-1);
}

.compare-cell.rank-2 {
  background: var(--rank-2);
}

.compare-cell.rank-3 {
  background: var(--rank-3);
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 500;
}

.rank-badge-1 {
  border-color: rgba(214, 162, 67, 0.68);
  color: #f4d28d;
}

.rank-badge-2 {
  border-color: rgba(168, 178, 188, 0.62);
  color: #d5dce3;
}

.rank-badge-3 {
  border-color: rgba(184, 111, 62, 0.6);
  color: #e7b08a;
}

#versionNotes {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

.sort-button {
  display: grid;
  justify-items: start;
  align-items: start;
  gap: 3px;
  min-height: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
}

.sort-main {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.sort-button:hover {
  background: transparent;
  color: var(--ink);
}

.sort-button:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 4px;
}

.sort-indicator {
  display: inline-block;
  min-height: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
}

.sort-indicator.is-active {
  margin-top: 0;
}

@media (max-width: 760px) {
  .page-header {
    align-items: start;
    flex-direction: column;
  }
  .toolbar,
  .summary {
    grid-template-columns: 1fr;
  }
}
