:root {
  color-scheme: light;
  --ink: #17201d;
  --ink-soft: #414b47;
  --muted: #66716d;
  --muted-strong: #59625f;
  --faint: #929b97;
  --paper: #f4f3ed;
  --surface: #fffefa;
  --surface-translucent: rgba(255, 254, 250, 0.72);
  --surface-strong: rgba(255, 254, 250, 0.94);
  --surface-subtle: #f8f9f5;
  --surface-muted: #f1f2ef;
  --surface-row: rgba(247, 248, 244, 0.72);
  --surface-hover: rgba(220, 236, 229, 0.42);
  --surface-selected: #e3f0e9;
  --control-bg: #fff;
  --control-border: #cbd1ca;
  --control-border-strong: #bdc7c0;
  --line: #d9ddd6;
  --accent: #0d6b4d;
  --accent-dark: #07523a;
  --accent-hover: #07523a;
  --accent-soft: #dcece5;
  --danger: #9b2c2c;
  --danger-soft: #fbe7e5;
  --on-accent: #fff;
  --page-glow: rgba(13, 107, 77, 0.11);
  --focus-ring: rgba(13, 107, 77, 0.2);
  --focus-shadow: rgba(13, 107, 77, 0.13);
  --accent-shadow: rgba(13, 107, 77, 0.28);
  --panel-shadow: rgba(34, 48, 42, 0.06);
  --popover-shadow: rgba(34, 48, 42, 0.16);
  --warning: #775512;
  --warning-soft: #fff1ca;
  --code-bg: #17201d;
  --code-ink: #e9f2ed;
  --tooltip-border: #4f5b56;
  --accuracy-high: #e6f5e9;
  --accuracy-mid: #fff9db;
  --accuracy-low: #fbe7e5;
  --chart-axis: #aab4ae;
  --chart-bar: #b9dfd1;
  --chart-bar-border: #5d9f87;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4f0;
  --ink-soft: #c8d3cd;
  --muted: #9daaa3;
  --muted-strong: #b4c0ba;
  --faint: #78867f;
  --paper: #0d1210;
  --surface: #151c18;
  --surface-translucent: rgba(21, 28, 24, 0.82);
  --surface-strong: rgba(21, 28, 24, 0.96);
  --surface-subtle: #1b241f;
  --surface-muted: #202923;
  --surface-row: rgba(255, 255, 255, 0.025);
  --surface-hover: rgba(45, 159, 116, 0.13);
  --surface-selected: #203e32;
  --control-bg: #111814;
  --control-border: #3b4942;
  --control-border-strong: #4a5a52;
  --line: #34423b;
  --accent: #238d68;
  --accent-dark: #6bd3aa;
  --accent-hover: #176b51;
  --accent-soft: #193b2e;
  --danger: #ff9c9c;
  --danger-soft: #452526;
  --on-accent: #fff;
  --page-glow: rgba(35, 141, 104, 0.18);
  --focus-ring: rgba(107, 211, 170, 0.3);
  --focus-shadow: rgba(107, 211, 170, 0.16);
  --accent-shadow: rgba(0, 0, 0, 0.3);
  --panel-shadow: rgba(0, 0, 0, 0.3);
  --popover-shadow: rgba(0, 0, 0, 0.42);
  --warning: #f1cf72;
  --warning-soft: #453a1e;
  --code-bg: #090d0b;
  --code-ink: #dce9e2;
  --tooltip-border: #526159;
  --accuracy-high: #183b2a;
  --accuracy-mid: #40381d;
  --accuracy-low: #452526;
  --chart-axis: #65746c;
  --chart-bar: #2f7058;
  --chart-bar-border: #62bc98;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 88% 2%, var(--page-glow), transparent 27rem),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: 90%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 42px 0 72px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.hero-heading {
  min-width: 0;
}

.hero-tagline {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
}

.hero .hero-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.app-version {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.github-badge-link {
  display: inline-flex;
  border-radius: 6px;
  line-height: 0;
}

.github-badge-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.github-badge {
  display: block;
  width: 134px;
  height: 28px;
}

.author-credit {
  white-space: nowrap;
}

.author-credit a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.author-credit a:hover {
  color: var(--accent);
}

.theme-toggle {
  display: inline-grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-translucent);
  color: var(--accent-dark);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.theme-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
  display: block;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-translucent);
  width: fit-content;
}

.tab-button {
  min-height: 42px;
  padding: 9px 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.tab-button:hover {
  color: var(--accent-dark);
}

.tab-button[aria-selected="true"] {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 5px 14px var(--accent-shadow);
  transform: translateY(-1px);
}

.tab-button[aria-selected="true"]:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}

.tab-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.tab-panel[hidden] {
  display: none;
}

.connection-card,
.results,
.benchmark {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: 0 20px 55px var(--panel-shadow);
}

.connection-card {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.connection-card .section-heading {
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: -0.025em;
}

.privacy-note,
.count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

form {
  display: grid;
  grid-template-columns: minmax(175px, 0.55fr) minmax(260px, 1.2fr) minmax(230px, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 750;
}

input,
select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  outline: none;
  background: var(--control-bg);
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%),
    linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 21px,
    calc(100% - 13px) 21px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

textarea {
  width: 100%;
  min-height: 82px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  outline: none;
  background: var(--control-bg);
  color: var(--ink);
  line-height: 1.45;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95em;
}

.key-input-wrap {
  position: relative;
}

.key-input-wrap input {
  padding-right: 64px;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 750;
}

.reveal-button:hover {
  background: var(--accent-soft);
}

.reveal-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 164px;
  height: 48px;
  margin-top: 27px;
  padding: 0 17px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  font-weight: 750;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.primary-button[aria-busy="true"] {
  cursor: wait;
}

.status:not(:empty) {
  margin-top: 14px;
  padding: 9px 11px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.84rem;
  line-height: 1.45;
}

.global-status:not(:empty) {
  margin: -6px 0 20px;
}

.status.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.results {
  margin-top: 24px;
}

.benchmark {
  margin-top: 0;
}

.results,
.benchmark {
  padding: 30px 0 20px;
}

.benchmark-form,
.benchmark .status {
  margin-left: 30px;
  margin-right: 30px;
}

.benchmark-form {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-top: 18px;
}

.prompt-field {
  grid-column: 1 / -1;
}

.benchmark-options {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.benchmark-options legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 750;
}

.benchmark-toggle-control {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.benchmark-toggle-control label {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 750;
}

.benchmark-toggle-control input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.benchmark-toggle-control .hint {
  margin-left: 26px;
}

.model-selection-actions,
.result-toolbar,
.export-actions,
.results-actions,
.run-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* Wrap instead of overflowing when a toolbar has a long note plus many controls. */
.result-toolbar,
.export-actions {
  flex-wrap: wrap;
}

.model-selection-actions {
  flex-wrap: nowrap;
  margin: -6px 30px 18px;
}

.selection-label {
  margin-right: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.model-search {
  width: 20%;
  min-width: 140px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  background: var(--control-bg);
  color: var(--ink);
  font-size: 0.8rem;
}

.model-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-shadow);
  outline: none;
}

.results-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.results-actions .count {
  margin-right: 3px;
}

.run-actions {
  grid-column: 1 / -1;
}

.run-actions .primary-button {
  margin-top: 0;
}

.secondary-button {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--control-border-strong);
  border-radius: 9px;
  background: var(--control-bg);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
}

.secondary-button:hover:not(:disabled) {
  background: var(--accent-soft);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.column-picker {
  position: relative;
}

.column-picker-cue {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

#thinking-results:not([hidden]) .column-picker-cue span {
  display: inline-block;
  animation: column-cue-nudge 1.8s ease-in-out 3;
}

@keyframes column-cue-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  #thinking-results:not([hidden]) .column-picker-cue span {
    animation: none;
  }
}

.column-picker > summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
  user-select: none;
}

.column-picker > summary::-webkit-details-marker {
  display: none;
}

.column-picker > summary::after {
  margin-left: 7px;
  content: "▾";
  font-size: 0.68rem;
}

.column-picker[open] > summary {
  background: var(--accent-soft);
}

.column-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--control-bg);
  box-shadow: 0 16px 38px var(--popover-shadow);
}

.column-menu > p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.column-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
}

.column-option {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 2px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.74rem;
  line-height: 1.25;
}

.column-option input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.column-reset {
  margin-top: 10px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 750;
}

.column-reset:hover {
  text-decoration: underline;
}

.result-toolbar {
  justify-content: space-between;
  gap: 18px;
  padding: 20px 30px 14px;
}

.run-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 1px;
  margin: 20px 30px 4px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.run-summary > div {
  min-width: 0;
  padding: 14px 15px;
  background: var(--surface-subtle);
}

.run-summary span,
.run-summary strong {
  display: block;
}

.run-summary span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.run-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.methodology-overview {
  margin: 0 30px 4px;
}

.methodology-overview h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.methodology-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.methodology-metrics > div {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.methodology-metrics strong,
.methodology-metrics span {
  display: block;
}

.methodology-metrics strong {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 0.78rem;
}

.methodology-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.methodology-details {
  margin: 30px 30px 4px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.methodology-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  padding: 2px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.methodology-details > summary::-webkit-details-marker {
  display: none;
}

.methodology-details > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 0.85rem;
  transition: transform 150ms ease;
}

.methodology-details[open] > summary::before {
  transform: rotate(90deg);
}

.methodology-details > summary::after {
  margin-left: auto;
  content: "Show details";
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0;
}

.methodology-details[open] > summary::after {
  content: "Hide details";
}

.methodology-details > .methodology {
  margin-top: 16px;
}

.methodology-request,
.methodology {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.methodology-request summary,
.methodology summary {
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 750;
}

.methodology ul {
  margin-bottom: 0;
  padding-left: 20px;
}

.methodology-request-item,
.methodology-sample-item {
  margin-top: 12px;
  list-style: none;
}

.methodology-request-item .methodology-request,
.methodology-sample-item .sample-exchange {
  margin-top: 6px;
}

.sample-exchanges {
  display: grid;
  gap: 9px;
  margin: 18px 0 0 20px;
}

.sample-exchange,
.methodology-request {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-translucent);
}

.sample-exchange > summary,
.methodology-request > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.sample-exchange > summary::-webkit-details-marker,
.methodology-request > summary::-webkit-details-marker {
  display: none;
}

.sample-exchange > summary::before,
.methodology-request > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 0.85rem;
  transition: transform 150ms ease;
}

.sample-exchange[open] > summary::before,
.methodology-request[open] > summary::before {
  transform: rotate(90deg);
}

.sample-exchange[open] > summary,
.methodology-request[open] > summary {
  border-bottom: 1px solid var(--line);
}

.sample-request-note {
  margin: 11px 13px 9px;
  font-size: 0.72rem;
}

.sample-request {
  margin: 0 13px 13px;
  padding: 14px;
  max-height: 420px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
}

.thinking-table th {
  padding: 0;
  color: var(--muted-strong);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thinking-table {
  min-width: 1080px;
  table-layout: fixed;
  font-size: 0.78rem;
}

.thinking-table th,
.thinking-table td {
  padding: 12px 14px;
  white-space: nowrap;
}

.thinking-table .sort-icon {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.thinking-table th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

.thinking-table th[aria-sort="none"]:hover .sort-icon,
.thinking-table th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.thinking-table th[data-thinking-column="modelId"] {
  width: 16%;
}

.thinking-table th[data-thinking-column="status"] {
  width: 15%;
}

.thinking-table th[data-thinking-column="accuracy"] {
  width: 10%;
}

.thinking-table th[data-thinking-column="ttftMedian"],
.thinking-table th[data-thinking-column="e2eMedian"] {
  width: 9%;
}

.thinking-table th[data-thinking-column="tpsMedian"] {
  width: 10%;
}

.thinking-table th[data-thinking-column="totalTokens"] {
  width: 15%;
}

.thinking-table th[data-thinking-column="totalTestTimeMs"] {
  width: 8%;
}

.thinking-table th[data-thinking-column="cost"] {
  width: 8%;
}

.thinking-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
}

.thinking-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.thinking-table th:not([data-thinking-column="modelId"]) .sort-button {
  text-align: left;
}

.thinking-table tbody tr:nth-child(even) td {
  background: var(--surface-row);
}

.thinking-table tbody tr:hover td {
  background: var(--surface-hover);
}

.model-select {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.model-select:disabled {
  cursor: not-allowed;
}

.status-pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.running { background: var(--warning-soft); color: var(--warning); }
.status-pill.complete { background: var(--accent-soft); color: var(--accent-dark); }
.status-pill.partial { background: var(--warning-soft); color: var(--warning); }
.status-pill.error { background: var(--danger-soft); color: var(--danger); }

.status-has-error {
  cursor: help;
}

.status-error-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.status-error-indicator:focus-visible {
  border-radius: 50%;
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.benchmark-error-tooltip {
  position: fixed;
  z-index: 200;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--tooltip-border);
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.4;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
}

.benchmark-error-tooltip[hidden] {
  display: none;
}

.accuracy-high { background: var(--accuracy-high) !important; }
.accuracy-mid { background: var(--accuracy-mid) !important; }
.accuracy-low { background: var(--accuracy-low) !important; }

.results-heading {
  padding: 0 30px;
}

#results .table-frame {
  overflow-x: visible;
}

#results table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
}

#results th,
#results td {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Column widths keyed by column identity (not nth-child position) so adding or
   removing catalog columns never shifts the rest of the table's layout. */
#results th[data-model-column="selected"] { width: 6%; }
#results th[data-model-column="modelId"] { width: 19%; }
#results th[data-model-column="releaseDate"] { width: 9%; }
#results th[data-model-column="aaIndex"] { width: 6%; }
#results th[data-model-column="contextWindow"] { width: 10%; }
#results th[data-model-column="parameterCount"] { width: 9%; }
#results th[data-model-column="inputPrice"],
#results th[data-model-column="cachedInputPrice"],
#results th[data-model-column="cacheWritePrice"],
#results th[data-model-column="outputPrice"] { width: 8%; }
#results th[data-model-column="blendedPrice"] { width: 9%; }

#results .sort-icon {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

#results th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

#results th[aria-sort="none"]:hover .sort-icon,
#results th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.table-frame {
  width: 100%;
  overflow-x: visible;
}

.table-frame > table {
  border: 1px solid var(--control-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  max-width: 420px;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th:last-child,
td:last-child {
  border-right: 0;
}

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

tbody tr:hover {
  background: var(--surface-hover);
}

th {
  padding: 0;
  background: var(--surface-subtle);
}

th.sorted-column {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 0 var(--focus-ring), inset -2px 0 0 var(--focus-ring);
}

th.sorted-column .sort-button {
  color: var(--accent-dark);
}

.thinking-table td.sorted-column {
  background: transparent;
  box-shadow: none;
}

.thinking-table tbody tr:hover td.sorted-column {
  background: var(--surface-hover);
}

.sort-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 52px;
  width: 100%;
  padding: 10px 24px 10px 12px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: left;
  text-transform: uppercase;
  white-space: normal;
  text-wrap: balance;
}

/* Universal header-label wrapping: every benchmark table's column names wrap
   onto multiple lines instead of stretching the column or overflowing. */
.sort-button > span:first-child {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sort-button:hover,
.sort-button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.sort-icon {
  color: var(--faint);
  font-size: 0.82rem;
}

th[aria-sort="ascending"] .sort-icon,
th[aria-sort="descending"] .sort-icon {
  color: var(--accent);
}

td {
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

td:first-child {
  color: var(--ink);
  font-weight: 750;
}

.empty-value {
  color: var(--faint);
}

.table-hint {
  margin: 16px 30px 0;
  color: var(--muted);
  font-size: 0.73rem;
}

.next-step-hint {
  margin: 0 30px 12px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 750;
}

@media (max-width: 840px) {
  .shell {
    padding-top: 32px;
  }

  form {
    grid-template-columns: 1fr;
  }

  .benchmark-form {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .run-summary {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .methodology-metrics {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
    margin-top: 2px;
  }
}

@media (max-width: 880px) {
  .hero {
    display: block;
  }

  .hero-actions {
    justify-content: space-between;
    margin-top: 8px;
  }

  .hero .hero-meta {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: calc(100% - 24px);
    padding: 24px 0 48px;
  }

  .hero {
    margin-bottom: 22px;
  }

  .tabs {
    width: 100%;
  }

  .tab-button {
    flex: 1;
    padding-right: 10px;
    padding-left: 10px;
  }

  .connection-card {
    padding: 16px;
  }

  .section-heading {
    display: block;
  }

  .privacy-note,
  .count {
    margin-top: 14px;
  }

  .results-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .results-actions .count {
    margin-top: 0;
  }

  .results {
    padding-top: 22px;
  }

  .benchmark-form {
    grid-template-columns: 1fr;
  }

  .prompt-field,
  .benchmark-options,
  .benchmark-toggle-control,
  .run-actions {
    grid-column: 1;
  }

  .benchmark-options {
    grid-template-columns: 1fr;
  }

  .benchmark-form,
  .benchmark .status {
    margin-left: 18px;
    margin-right: 18px;
  }

  .result-toolbar {
    display: block;
    padding-left: 18px;
    padding-right: 18px;
  }

  .run-summary {
    margin-left: 18px;
    margin-right: 18px;
  }

  .export-actions {
    flex-wrap: wrap;
    margin-top: 12px;
  }

  .results-heading {
    padding: 0 18px;
  }

  .model-selection-actions {
    flex-wrap: wrap;
    margin-right: 18px;
    margin-left: 18px;
  }

  .model-search {
    width: 100%;
  }

  .table-hint {
    margin-left: 18px;
  }

  .methodology-overview {
    margin-left: 18px;
    margin-right: 18px;
  }

  .methodology-details {
    margin-left: 18px;
    margin-right: 18px;
  }
}

/* --- Speed Test 1 (token throughput over time) --- */

.speed-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.78rem;
}

.speed-table th,
.speed-table td {
  padding: 11px 9px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.speed-table tbody tr:nth-child(even) td {
  background: var(--surface-row);
}

.speed-graphs-section {
  margin: 30px 30px 4px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.speed-graphs-section > h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

#speed-graphs {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.speed-graph-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.speed-graph-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
}

.speed-graph-head h4 {
  margin: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speed-graph-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
}

.speed-chart {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
}

.speed-graph-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin: 12px;
  padding: 16px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.sp-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.sp-axis {
  stroke: var(--chart-axis);
  stroke-width: 1.5;
}

.sp-tick {
  fill: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.sp-label {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.sp-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0.55;
}

.sp-bar {
  stroke-width: 1.2;
}

.sp-bar-throughput {
  fill: var(--chart-bar);
  stroke: var(--chart-bar-border);
}

.sp-bar-reasoning {
  fill: var(--warning);
  stroke: var(--warning);
}

.sp-ref {
  stroke-width: 1.5;
}

.sp-ref-p50 {
  stroke: #d97706;
  stroke-dasharray: 6 3;
}

.speed-throughput-chart {
  position: relative;
  padding: 16px;
}

.speed-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 8px 30px;
}

.speed-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 750;
}

.speed-chart-legend-item::before {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  content: "";
}

.speed-chart-legend-item.throughput::before {
  border: 1px solid var(--chart-bar-border);
  background: var(--chart-bar);
}

.speed-chart-legend-item.reasoning::before {
  border: 1px solid var(--warning);
  background: var(--warning);
}

.speed-chart-legend-item.p50::before {
  height: 0;
  border-radius: 0;
  background: transparent;
}

.speed-chart-legend-item.p50::before {
  border-top: 2px dashed #d97706;
}

.speed-tooltip {
  position: fixed;
  z-index: 50;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

/* --- Decode Test (client-observed output generation speed) --- */

.decode-table td.decode-empty-cell {
  padding: 26px 16px;
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  text-align: center;
}

.decode-table {
  width: 100%;
  min-width: 1260px;
  table-layout: fixed;
  border: 1px solid var(--control-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  font-size: 0.78rem;
}

/* Headers are rendered as sort buttons, so the <th> keeps zero padding and the
   button provides its own spacing. Header labels wrap; data cells stay on one line. */
.decode-table th {
  padding: 0;
  white-space: normal;
}

.decode-table td {
  padding: 11px 10px;
  white-space: nowrap;
}

.decode-table td[data-decode-column="modelId"] {
  overflow-wrap: anywhere;
  white-space: normal;
}

.decode-table td[data-decode-column="reasoningStatus"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

.decode-table .sort-icon {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.decode-table th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

.decode-table th[aria-sort="none"]:hover .sort-icon,
.decode-table th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.decode-table th[data-decode-column="modelId"] { width: 15%; }
.decode-table th[data-decode-column="length"] { width: 7%; }
.decode-table th[data-decode-column="status"] { width: 11%; }
.decode-table th[data-decode-column="decodeTpsP50"] { width: 10%; }
.decode-table th[data-decode-column="ttftP50"] { width: 7%; }
.decode-table th[data-decode-column="ttftP90"] { width: 7%; }
.decode-table th[data-decode-column="decodeTimeP50"] { width: 8%; }
.decode-table th[data-decode-column="totalLatencyP50"] { width: 8%; }
.decode-table th[data-decode-column="totalLatencyP90"] { width: 8%; }
.decode-table th[data-decode-column="visibleTokensP50"] { width: 7%; }
.decode-table th[data-decode-column="reasoningTokensP50"] { width: 8%; }
.decode-table th[data-decode-column="reasoningStatus"] { width: 10%; }

.decode-table td[data-decode-column="modelId"],
.decode-table td[data-decode-column="status"],
.decode-table td[data-decode-column="reasoningStatus"] {
  text-align: left;
}

.decode-table td[data-decode-column="decodeTpsP50"],
.decode-table td[data-decode-column="ttftP50"],
.decode-table td[data-decode-column="ttftP90"],
.decode-table td[data-decode-column="decodeTimeP50"],
.decode-table td[data-decode-column="totalLatencyP50"],
.decode-table td[data-decode-column="totalLatencyP90"],
.decode-table td[data-decode-column="length"],
.decode-table td[data-decode-column="visibleTokensP50"],
.decode-table td[data-decode-column="reasoningTokensP50"] {
  text-align: right;
}

.decode-table tbody tr.decode-model-start td {
  border-top: 2px solid var(--control-border-strong);
}

.decode-table tbody tr.decode-run-reasoning td {
  background: var(--warning-soft);
}

.decode-table td.decode-speed-cell {
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

/* --- Long Context 1 (needle retrieval by document position) --- */

.context-table td.context-empty-cell {
  padding: 26px 16px;
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  text-align: center;
}

/* Cache Test: little "!" marker on the cost-savings cell when the model has
   no cached pricing in the catalog and the number comes from the input-price
   fallback. */
.cache-table .cache-price-fallback-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
}

.cache-table .cache-price-fallback-indicator:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 3px;
}

/* Cache Test chart: one per model, cold vs warm TTFT bars per variant. */
#cache-chart {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
  gap: 20px;
  align-items: start;
}

/* Cap each chart so a lone one never stretches to full width. */
#cache-chart .decode-line-chart {
  max-width: 640px;
}

.cache-chart-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 2px 0 8px;
}

.cache-chart-model {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.cache-legend {
  display: inline-flex;
  gap: 12px;
  margin-left: auto;
}

.cache-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.cache-legend-chip {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.cache-legend-chip.cold { background: var(--muted); }
.cache-legend-chip.warm { background: var(--accent); }

.cache-bar-cold { fill: var(--muted); }
.cache-bar-warm { fill: var(--accent); }

.cache-bar-value {
  font-size: 10px;
  font-weight: 650;
  fill: var(--muted);
}

.context-table {
  width: 100%;
  min-width: 1000px;
  table-layout: fixed;
  border: 1px solid var(--control-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  font-size: 0.78rem;
}

/* Headers are rendered as sort buttons, so the <th> keeps zero padding and the
   button provides its own spacing. Header labels wrap; data cells stay on one line. */
.context-table th {
  padding: 0;
  white-space: normal;
}

.context-table td {
  padding: 11px 10px;
  white-space: nowrap;
}

.context-table td[data-context-column="modelId"] {
  overflow-wrap: anywhere;
  white-space: normal;
}

.context-table .sort-icon {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.context-table th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

.context-table th[aria-sort="none"]:hover .sort-icon,
.context-table th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.context-table th[data-context-column="modelId"] { width: 14%; }
.context-table th[data-context-column="status"] { width: 10%; }
.context-table th[data-context-column="inputTokens"] { width: 9%; }
.context-table th[data-context-column="positionPercent"] { width: 15%; }
.context-table th[data-context-column="accuracy"] { width: 10%; }
.context-table th[data-context-column="inputTpsP50"] { width: 13%; }
.context-table th[data-context-column="ttftP50"] { width: 9%; }
.context-table th[data-context-column="ttftP90"] { width: 9%; }
.context-table th[data-context-column="testTimeMs"] { width: 8%; }
.context-table th[data-context-column="promptTokensP50"] { width: 10%; }

.context-table td[data-context-column="modelId"],
.context-table td[data-context-column="status"] {
  text-align: left;
}

.context-table td[data-context-column="inputTokens"],
.context-table td[data-context-column="positionPercent"],
.context-table td[data-context-column="accuracy"],
.context-table td[data-context-column="inputTpsP50"],
.context-table td[data-context-column="ttftP50"],
.context-table td[data-context-column="ttftP90"],
.context-table td[data-context-column="testTimeMs"],
.context-table td[data-context-column="promptTokensP50"] {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.context-table tbody tr.context-model-start td {
  border-top: 2px solid var(--control-border-strong);
}

.context-table td.context-tps-cell {
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 800;
}

/* Accuracy matrix: one row per model x input size, one column per position. */
.context-matrix-section {
  margin: 22px 30px 4px;
}

.context-matrix {
  width: 100%;
  table-layout: fixed;
  border: 1px solid var(--control-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  font-size: 0.82rem;
}

.context-matrix th {
  padding: 0;
  background: var(--surface-subtle);
  color: var(--muted-strong);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: normal;
}

.context-matrix th:first-child {
  width: 30%;
}

/* The matrix uses the same sortable-header pattern as the run table. */
.context-matrix .sort-icon {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.context-matrix th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

.context-matrix th[aria-sort="none"]:hover .sort-icon,
.context-matrix th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.context-matrix th.sorted-column {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 0 var(--focus-ring), inset -2px 0 0 var(--focus-ring);
}

.context-matrix th.sorted-column .sort-button {
  color: var(--accent-dark);
}

.context-matrix td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.context-matrix tbody tr:nth-child(even) td {
  background: var(--surface-row);
}

.context-matrix td.context-matrix-model {
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.context-matrix td.context-matrix-size {
  color: var(--ink);
  font-weight: 750;
}

.context-matrix td.context-accuracy-cell {
  font-variant-numeric: tabular-nums;
}

.context-matrix td.context-accuracy-skipped {
  color: var(--muted);
  font-weight: 500;
}


.decode-matrix-section,
.decode-chart-section {
  margin: 22px 30px 4px;
}

.decode-run-section {
  margin-top: 22px;
}

.decode-run-head {
  margin: 0 30px 2px;
}

.decode-run-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.decode-matrix-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.decode-matrix-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.decode-matrix-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.decode-matrix {
  width: 100%;
  table-layout: fixed;
  border: 1px solid var(--control-border);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  font-size: 0.82rem;
}

.decode-matrix th {
  padding: 0;
  background: var(--surface-subtle);
  color: var(--muted-strong);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: normal;
}

.decode-matrix th:first-child {
  width: 40%;
}

/* The leaderboard header uses the universal .sort-button rules above; only
   the icon placement is matrix-specific. */
.decode-matrix .sort-icon {
  position: absolute;
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
  transition: color 150ms ease, opacity 150ms ease;
}

.decode-matrix th[aria-sort="none"] .sort-icon {
  opacity: 0;
}

.decode-matrix th[aria-sort="none"]:hover .sort-icon,
.decode-matrix th[aria-sort="none"] .sort-button:focus-visible .sort-icon {
  opacity: 1;
}

.decode-matrix th.sorted-column {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 0 var(--focus-ring), inset -2px 0 0 var(--focus-ring);
}

.decode-matrix th.sorted-column .sort-button {
  color: var(--accent-dark);
}

.decode-matrix td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.decode-matrix tbody tr:nth-child(even) td {
  background: var(--surface-row);
}

.decode-matrix td.decode-matrix-model {
  color: var(--ink);
  font-weight: 750;
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.decode-matrix td.decode-speed-cell {
  color: var(--accent-dark);
  font-size: 1.02rem;
  font-weight: 800;
}

.decode-chart-section {
  margin-bottom: 8px;
}

.decode-line-chart {
  position: relative;
  padding: 14px 16px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.decode-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 6px 10px;
}

.decode-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 750;
}

.decode-chart-legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.decode-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 340px;
}

.decode-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.decode-axis {
  stroke: var(--chart-axis);
  stroke-width: 1.5;
}

.decode-tick {
  fill: var(--faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.decode-axis-label {
  fill: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.decode-series {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Invisible, thicker companion line that makes the whole series easy to hover. */
.decode-series-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
}

.decode-series-label {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.decode-point {
  cursor: pointer;
  stroke: var(--surface);
  stroke-width: 1.5;
}

.decode-tooltip {
  position: fixed;
  z-index: 50;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.decode-chart-empty {
  margin: 0;
  padding: 34px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

@media (max-width: 760px) {
  .decode-table {
    min-width: 720px;
    font-size: 0.72rem;
  }

  .decode-matrix-section,
  .decode-chart-section {
    margin-left: 18px;
    margin-right: 18px;
  }

  .decode-run-head {
    margin-left: 18px;
    margin-right: 18px;
  }
}

/* --- Pre-run confirmation dialog (styled window.confirm replacement) --- */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 14, 12, 0.46);
  animation: confirm-overlay-enter 140ms ease-out;
}

.confirm-dialog {
  width: min(760px, 100%);
  max-height: min(640px, calc(100vh - 48px));
  overflow-y: auto;
  padding: 22px 24px 20px;
  border: 1px solid var(--control-border-strong);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: 0 24px 56px rgba(23, 32, 29, 0.3);
  animation: confirm-dialog-enter 170ms cubic-bezier(0.2, 0.9, 0.3, 1.05);
}

.confirm-title {
  margin: 0 0 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.confirm-headline {
  margin: 0 0 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.confirm-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  table-layout: fixed;
}

/* Fixed layout with bounded side columns: the middle (notes) column takes
   the rest and every cell wraps instead of bleeding into its neighbor. */
.confirm-table th:first-child,
.confirm-table td:first-child {
  width: 22%;
}

.confirm-table th:last-child,
.confirm-table td:last-child {
  width: 26%;
}

.confirm-table th {
  padding: 6px 12px;
  border-bottom: 1px solid var(--control-border-strong);
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.confirm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  /* Every column wraps, unconditionally: nothing can bleed into a
     neighbor, whatever the content (long ids, long notes, cost strings). */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.confirm-table tbody tr:last-child td {
  border-bottom: none;
}

.confirm-row-muted td {
  opacity: 0.6;
}

.confirm-row-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.confirm-row-detail {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.confirm-row-meta {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.confirm-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}

.confirm-totals-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.confirm-totals-detail {
  font-size: 0.85rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.confirm-totals-meta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-dark);
  font-variant-numeric: tabular-nums;
}

.confirm-note {
  margin: 0 0 16px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.confirm-actions button {
  min-width: 110px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.confirm-cancel {
  border: 1px solid var(--control-border-strong);
  background: var(--control-bg);
  color: var(--ink);
}

.confirm-cancel:hover {
  background: var(--surface-hover);
}

.confirm-go {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: var(--on-accent);
}

.confirm-go:hover {
  background: var(--accent-hover);
}

.confirm-actions button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes confirm-overlay-enter {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes confirm-dialog-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-overlay,
  .confirm-dialog {
    animation: none;
  }
}

@media (max-width: 760px) {
  .confirm-overlay {
    padding: 12px;
  }

  .confirm-table th,
  .confirm-table td {
    padding: 6px 8px;
  }
}

/* Input upload progress bar inside a running row's Status cell. */
.context-upload {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.context-upload-label {
  font-size: 0.7rem;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.context-upload-track {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  overflow: hidden;
}

.context-upload-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 120ms linear;
}

@media (prefers-reduced-motion: reduce) {
  .context-upload-fill {
    transition: none;
  }
}
