/* ═══════════════════════════════════════════
   ProgramBench — Design Tokens + Theming
   ═══════════════════════════════════════════ */

[data-theme="dark"] {
  --bg:         #0b0f15;
  --bg-s:       #111820;
  --bg-r:       #181f2a;
  --border:     #1f2937;
  --text:       #b0b8c4;
  --text-m:     #8d96a3;
  --text-b:     #e4e8ee;
  --accent:     #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.10);
  --gold:       #eab308;
  --silver:     #94a3b8;
  --bronze:     #d97706;
  --nav-bg:     rgba(11, 15, 21, 0.88);
  --logo-invert: brightness(0) invert(1);
}

[data-theme="light"] {
  --bg:         #f8f9fb;
  --bg-s:       #ffffff;
  --bg-r:       #f0f1f4;
  --border:     #dfe2e8;
  --text:       #4a5568;
  --text-m:     #8492a6;
  --text-b:     #1a202c;
  --accent:     #1a5cff;
  --accent-soft: rgba(26, 92, 255, 0.14);
  --gold:       #b8960c;
  --silver:     #64748b;
  --bronze:     #b45309;
  --nav-bg:     rgba(248, 249, 251, 0.88);
  --logo-invert: none;
}

:root {
  --mono:       'JetBrains Mono', monospace;
  --sans:       'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-w:      960px;
  --radius:     8px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s, color 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

a { color: inherit; text-decoration: none; }

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

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 56px;
}

/* ═══════════════════════════════════════════
   Navigation
   ═══════════════════════════════════════════ */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, border-color 0.2s;
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 54px;
}

.nav-brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-b);
  letter-spacing: 0.4px;
}

.nav-links {
  display: flex;
  gap: 2px;
  margin-left: auto;
  align-items: center;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-m);
  padding: 7px 14px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-r);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 4px;
  min-width: 150px;
  z-index: 100;
}

@media (hover: hover) {
  .nav-dropdown:hover .nav-dropdown-menu {
    display: block;
  }
}
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu-inner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-dropdown-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-m);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-dropdown-item:hover {
  color: var(--text);
  background: var(--bg-r);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-m);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-r);
}

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

/* ═══════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════ */

.hero {
  text-align: center;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 51px 24px 48px;
}

.hero-logo {
  display: block;
  margin: 0 auto;
  height: 107px;
  width: auto;
}

.hero-title {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  color: var(--text-b);
  letter-spacing: 0.8px;
  margin-top: 0;
  margin-bottom: 12px;
  white-space: pre;
}

.hero-subtitle {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-b);
  max-width: 580px;
  margin: 0 auto 10px;
  line-height: 1.5;
}

.hero-description {
  font-size: 15px;
  color: var(--text-m);
  max-width: 580px;
  margin: 0 auto 24px;
  line-height: 1.7;
}

.hero-authors {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0 auto 28px;
  max-width: 640px;
}
.hero-authors-line {
  display: block;
  font-size: 15px;
  color: var(--text-m);
  letter-spacing: 0.01em;
  line-height: 1.6;
  white-space: nowrap;
}
.hero-authors a {
  color: var(--text-b);
  text-decoration: none;
  transition: color 0.15s;
  white-space: nowrap;
}
.hero-authors a:hover {
  color: var(--accent);
}
.author-sep {
  color: var(--text-m);
  opacity: 0.5;
}
.hero-authors-affiliation {
  display: block;
  font-size: 14px;
  color: var(--text-m);
  margin-top: 4px;
}

.hero-badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-install {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.hero-gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-m);
  background: var(--bg-r);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.hero-gh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-install-cmd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-b);
  background: var(--bg-r);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.hero-install-cmd:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-install-hover { display: none; }
.hero-install-cmd:hover .hero-install-default { display: none; }
.hero-install-cmd:hover .hero-install-hover { display: inline; }

.badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--mono);
  padding: 8px 16px;
}

.badge strong {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.badge span {
  font-size: 11px;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   Section headers
   ═══════════════════════════════════════════ */

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-m);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.section-label-link {
  color: inherit;
  text-decoration: none;
}
.section-label-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.section-note {
  font-size: 12px;
  color: var(--text-m);
}

/* ═══════════════════════════════════════════
   Leaderboard table
   ═══════════════════════════════════════════ */

.lb-block {
  display: table;
  margin: 0 auto;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  transition: border-color 0.2s;
  -webkit-overflow-scrolling: touch;
}

.lb-table {
  border-collapse: collapse;
  background: var(--bg-s);
  transition: background 0.2s;
}

.lb-table thead { background: var(--bg-r); }

.lb-table th {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 26px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.lb-table td {
  padding: 13px 26px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.lb-table tbody tr { transition: background 0.12s; }
.lb-table tbody tr:hover { background: var(--bg-r); }

.col-rank {
  width: 48px;
  text-align: center !important;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-m);
}

.col-logo {
  width: 36px;
  padding-right: 0 !important;
}

.org-logo {
  height: 20px;
  width: auto;
  display: block;
  color: black;
  filter: var(--logo-invert);
}

.org-logo-google {
  filter: none !important;
}

[data-theme="light"] .org-logo {
  color: black;
}

.col-num {
  text-align: right !important;
  font-family: var(--mono);
  font-size: 13px;
}

.col-agent {
  font-family: var(--mono);
  font-size: 12px;
}

.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

.model-name {
  font-weight: 600;
  color: var(--text-b);
}

.model-provider {
  color: var(--text-m);
  font-size: 12px;
  margin-left: 8px;
}

td.resolved-highlight {
  font-weight: 700;
  color: var(--accent);
}

.resolved-zero {
  font-weight: 700;
  color: var(--accent);
}

.muted { color: var(--text-m); }

.col-almost {
  color: var(--text-m);
  font-size: 12px !important;
}

.th-mobile { display: none; }

.pct {
  font-size: 0.75em;
}

.col-cost,
.col-calls {
  color: var(--text-m);
  font-size: 12px !important;
}

.th-info {
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.info-icon {
  font-size: 14px;
  opacity: 0.5;
  transition: opacity 0.15s;
  vertical-align: middle;
}

.th-info:hover .info-icon {
  opacity: 1;
}

.info-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  max-width: 280px;
  padding: 10px 14px;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
  z-index: 50;
}

.info-popover a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-popover.active {
  display: block;
}

.extended-link {
  font-size: 13px;
  margin: 8px 0;
}

.extended-link a {
  color: var(--accent);
  text-decoration: none;
  transition: text-decoration 0.15s;
}

.extended-link a:hover {
  text-decoration: underline;
}

.extended-inline {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   Steps / How it works
   ═══════════════════════════════════════════ */

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.step-card {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: background 0.2s, border-color 0.2s;
}

.step-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
}

.step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-b);
  margin-bottom: 6px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-m);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   FAQ
   ═══════════════════════════════════════════ */

.faq-list {
  display: flex;
  flex-direction: column;
  margin-top: 28px;
}

.faq-question {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-b);
  padding: 8px 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
}

.faq-link-btn {
  margin-left: auto;
  padding: 2px 6px;
  font-size: 12px;
  color: var(--text-m);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  flex-shrink: 0;
}

.faq-item[id] {
  scroll-margin-top: 70px;
}

.faq-item[open] .faq-link-btn {
  opacity: 0.5;
}

.faq-link-btn:hover {
  opacity: 1;
  color: var(--accent);
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::before {
  content: "+";
  display: inline-block;
  width: 20px;
  color: var(--accent);
  font-weight: 700;
}

.faq-item[open] .faq-question::before {
  content: "\2212";
}

.faq-answer {
  font-size: 13px;
  color: var(--text-m);
  line-height: 1.7;
  padding: 0 0 14px 20px;
  margin: 0;
}

.faq-answer p {
  margin: 0 0 10px;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-b);
  margin-bottom: 16px;
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.about-text {
  max-width: 680px;
  margin: 0 auto;
}
.about-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.about-text p {
  font-size: 14px;
  color: var(--text-m);
  line-height: 1.75;
  margin: 0 0 16px;
}
.about-question {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-b);
  margin: 28px 0 8px;
}

/* ═══════════════════════════════════════════
   Stats bar
   ═══════════════════════════════════════════ */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.stat {
  text-align: center;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 14px;
  transition: background 0.2s, border-color 0.2s;
}

.stat-num {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-b);
  margin-bottom: 2px;
}

.stat-label {
  font-size: 11px;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ═══════════════════════════════════════════
   Page-level headings (Team, News, Assets)
   ═══════════════════════════════════════════ */

.page-top { padding-top: 48px; }

.page-title {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-b);
  margin-bottom: 12px;
}

.page-intro {
  font-size: 15px;
  color: var(--text-m);
  margin-bottom: 32px;
}

/* ═══════════════════════════════════════════
   Team
   ═══════════════════════════════════════════ */

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.team-card {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: background 0.2s, border-color 0.15s;
}

.team-card-link {
  display: block;
}

.team-card-link:hover {
  border-color: var(--accent);
  background: var(--bg-r);
}

.team-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.team-info { flex: 1; min-width: 0; }


.team-name {
  font-weight: 600;
  color: var(--text-b);
  font-size: 14px;
  margin-bottom: 2px;
}

.team-affiliation {
  font-size: 12px;
  color: var(--text-m);
}

.footnote {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-m);
}

.team-section-heading {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-b);
  margin-top: 40px;
  margin-bottom: 10px;
}

.team-section-text {
  font-size: 14px;
  color: var(--text-m);
  line-height: 1.7;
}

.team-section-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.citation-block {
  margin-top: 12px;
  margin-bottom: 48px;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ═══════════════════════════════════════════
   Blog
   ═══════════════════════════════════════════ */

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blog-item {
  display: block;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s;
}

.blog-item:hover { border-color: var(--accent); }

.blog-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 4px;
}

.blog-item-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-b);
  margin-bottom: 4px;
}

.blog-item-desc {
  font-size: 13px;
  color: var(--text-m);
}

.empty-state {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  color: var(--text-m);
}

/* ═══════════════════════════════════════════
   Post (individual blog article)
   ═══════════════════════════════════════════ */

.post { max-width: 680px; }

.post-meta { margin-bottom: 8px; }

.post-body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
}

.post-body h2,
.post-body h3 {
  color: var(--text-b);
  margin-top: 32px;
  margin-bottom: 8px;
}

.post-body p { margin-bottom: 16px; }
.post-body img { max-width: 100%; height: auto; }

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-r);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════
   Assets
   ═══════════════════════════════════════════ */

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.asset-card {
  display: block;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color 0.15s, background 0.15s;
}

.asset-card:hover {
  border-color: var(--accent);
  background: var(--bg-r);
}

.asset-inline-icon {
  font-size: 18px;
  vertical-align: -3px;
  margin-right: 4px;
  color: var(--accent);
}

.asset-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-b);
  margin-bottom: 4px;
}

.asset-desc {
  font-size: 13px;
  color: var(--text-m);
  line-height: 1.5;
}

.asset-tag {
  display: inline-block;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 12px;
}

/* ═══════════════════════════════════════════
   Instance carousel
   ═══════════════════════════════════════════ */

.carousel-nav {
  display: flex;
  gap: 4px;
}

.carousel-btn {
  background: var(--bg-r);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-m);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.carousel-btn:hover {
  color: var(--text);
  background: var(--bg-s);
}

.carousel-track {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(4, auto);
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  padding-bottom: 4px;
}

.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track.dragging { cursor: grabbing; scroll-behavior: auto; }

.instance-card {
  width: 240px;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.instance-card:hover {
  border-color: var(--accent);
  background: var(--bg-r);
}

.instance-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.instance-gh {
  flex-shrink: 0;
  color: var(--text-m);
}

.instance-repo {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instance-desc {
  font-size: 12px;
  color: var(--text-m);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.instance-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instance-stars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-m);
}

.instance-stars svg {
  color: var(--gold);
}

.instance-lang {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════
   Clickable rows
   ═══════════════════════════════════════════ */

.clickable-row { cursor: pointer; }

/* ═══════════════════════════════════════════
   Sortable columns
   ═══════════════════════════════════════════ */

th[data-sort] {
  cursor: pointer;
  user-select: none;
}

th[data-sort]::after {
  content: '⇅';
  margin-left: 5px;
  opacity: 0.35;
  font-size: 13px;
}

th[data-sort]:hover::after {
  opacity: 0.7;
}

th[data-sort].sort-asc::after {
  content: '↑';
  opacity: 1;
  color: var(--accent);
}

th[data-sort].sort-desc::after {
  content: '↓';
  opacity: 1;
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   Instance best-model line
   ═══════════════════════════════════════════ */

.instance-best {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-m);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.instance-best-label {
  color: var(--accent);
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   Truncated description in tables
   ═══════════════════════════════════════════ */

.col-repo-cell {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.repo-name-truncate,
.repo-desc-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════
   Instance card hero (task detail page)
   ═══════════════════════════════════════════ */

.instance-card-hero {
  width: 100%;
  max-width: 480px;
}

/* ═══════════════════════════════════════════
   Instance difficulty tag
   ═══════════════════════════════════════════ */

.instance-difficulty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-m);
  background: var(--bg-r);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
}

/* ═══════════════════════════════════════════
   Model detail hero
   ═══════════════════════════════════════════ */

.model-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.org-logo-lg {
  height: 36px;
}

.model-hero-name {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-b);
  margin-bottom: 2px;
}

.model-hero-meta {
  font-size: 13px;
  color: var(--text-m);
}

.model-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   Model link inside tables
   ═══════════════════════════════════════════ */

.model-link {
  color: inherit;
  text-decoration: none;
}

.model-link:hover .model-name {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   Container wide (for wide tables)
   ═══════════════════════════════════════════ */

.container-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 56px;
}

/* ═══════════════════════════════════════════
   Misc
   ═══════════════════════════════════════════ */

.back-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-size: 14px;
}

.back-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════
   Heatmap
   ═══════════════════════════════════════════ */

.heatmap-wrap {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.heatmap-wrap canvas {
  display: block;
}

.heatmap-tooltip {
  display: none;
  position: fixed;
  padding: 8px 12px;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
  z-index: 200;
  pointer-events: none;
  white-space: nowrap;
}

.heatmap-tooltip strong {
  color: var(--text-b);
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.heatmap-legend-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-m);
}

.heatmap-legend-bar {
  width: 200px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

[data-theme="light"] .heatmap-legend-bar {
  background: linear-gradient(to right, #f7f7f7, #d1e5f0, #6BAED6, #2E5EAA, #08519c);
}

[data-theme="dark"] .heatmap-legend-bar {
  background: linear-gradient(to right, #1a2233, #1e3a5f, #2d6a9f, #3b8fd4, #5bb5ff);
}

/* ═══════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
  .hero-title { font-size: 28px; }
  .steps-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .model-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .nav-inner {
    flex-wrap: nowrap;
    height: auto;
    padding: 10px 16px;
    gap: 4px;
  }
  .nav-links {
    flex-wrap: nowrap;
    gap: 0;
  }
  .nav-brand { display: none; }
  .nav-link { padding: 7px 8px; font-size: 12px; }
  .theme-toggle { margin-left: 4px; }
  .container-wide { padding: 0 16px 40px; }
  .hero-authors-line {
    display: inline;
    white-space: normal;
    font-size: 11px;
  }
  .hero-authors-affiliation { font-size: 12px; }
  .hero-authors {
    display: block;
    text-align: center;
    line-height: 1.8;
  }
  .section-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .footer-inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 0 16px;
  }
  .footer-links a:first-child { margin-left: 0; }
  .lb-block { display: block; }
  .lb-table { width: 100%; }
}

@media (max-width: 520px) {
  .stats-bar { grid-template-columns: 1fr; }
  .col-secondary .th-full { display: none; }
  .col-secondary .th-mobile { display: inline; }
  .col-resolved-header .th-full { display: none; }
  .col-resolved-header .th-mobile { display: inline; }
  .col-almost-header .th-full { display: none; }
  .col-almost-header .th-mobile { display: inline; }
  .hero { padding: 40px 16px 32px; }
  .hero-title { font-size: 24px; }
  .hero-subtitle { font-size: 17px; }
  .hero-description { font-size: 14px; }
  .container { padding: 0 16px 40px; }
  .model-provider { display: none; }
  .col-agent { display: none; }
  .col-logo { display: none; }
  .lb-table th { padding: 10px 8px; }
  .lb-table td { padding: 10px 8px; }
  .col-rank { width: 28px; font-size: 12px; }
  .col-num { font-size: 12px; }
  .model-name { font-size: 13px; }
  .model-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .model-hero-name { font-size: 18px; }
  .chart-toggle-btn { font-size: 12px; padding: 5px 10px; }
}

/* ── Charts ── */
.chart-block {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px 16px;
  height: 420px;
  position: relative;
}
@media (max-width: 640px) {
  .chart-block { height: 320px; padding: 16px 8px 8px; }
}

.chart-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-r);
  border-radius: 6px;
  padding: 3px;
}
.chart-toggle-btn {
  background: none;
  border: none;
  color: var(--text-m);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chart-toggle-btn:hover { color: var(--text-b); }
.chart-toggle-btn.active {
  background: var(--bg-s);
  color: var(--text-b);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.table-hint {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-m);
  opacity: 0.55;
  margin: 6px 0 0;
}
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 6px 0 0;
}
.table-footer .table-hint { margin: 0; }
.chart-legend-hint {
  text-align: center;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--text-m);
  opacity: 0.55;
  margin: 6px 0 0;
}

footer {
  margin-top: 60px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer-links a {
  color: var(--text);
  text-decoration: none;
  margin-left: 16px;
}
.footer-links a:hover {
  color: var(--accent);
}
