/* UrhoX Agent Benchmark — public site. Hand-rolled, zero dependencies.
 * Light theme is the default (publication feel); dark via [data-theme="dark"]. */

:root {
  --bg: #f6f7f9;
  --bg-raised: #ffffff;
  --bg-inset: #eceff3;
  --header-bg: rgba(255, 255, 255, .88);
  --border: #d5dbe4;
  --border-soft: #e4e8ee;
  --text: #1c2330;
  --prose: #39414f;
  --text-dim: #49525f;
  --text-faint: #6b7482;
  --accent: #4f46e5;
  --accent-2: #0d9488;
  --accent-soft: rgba(79, 70, 229, .09);
  --accent-border: rgba(79, 70, 229, .35);
  --good: #16a34a;
  --warn: #b45309;
  --bad: #dc2626;
  --bar-soft: rgba(79, 70, 229, .5);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --maxw: 1200px;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --bg-inset: #0a0e13;
  --header-bg: rgba(13, 17, 23, .92);
  --border: #2a313c;
  --border-soft: #21262e;
  --text: #e6edf3;
  --prose: #c9d4df;
  --text-dim: #9da7b3;
  --text-faint: #6e7781;
  --accent: #818cf8;
  --accent-2: #2dd4bf;
  --accent-soft: rgba(129, 140, 248, .14);
  --accent-border: rgba(129, 140, 248, .45);
  --good: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --bar-soft: rgba(129, 140, 248, .5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.brand .brand-sub { color: var(--text-faint); font-weight: 400; font-size: 13px; }

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}
.site-nav a {
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.site-nav a:hover { color: var(--text); background: var(--bg-raised); text-decoration: none; }
.site-nav a.active { color: var(--text); background: var(--accent-soft); }

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.lang-switch button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 9px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.lang-switch button.active { background: var(--accent-soft); color: var(--text); }

.theme-switch {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}
.theme-switch:hover { color: var(--text); background: var(--bg-raised); }

/* ---------- layout ---------- */

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ---------- meta bar ---------- */

.meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  font-size: 13px;
}
.meta-bar .meta-item { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.meta-bar .meta-label { color: var(--text-faint); }
.meta-bar .meta-value { color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.meta-position {
  flex-basis: 100%;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  border-top: 1px dashed var(--border-soft);
  padding-top: 8px;
}
.meta-tagline {
  flex-basis: 100%;
  color: var(--text-dim);
  font-style: italic;
}

.archive-banner {
  background: rgba(210, 153, 34, .12);
  border: 1px solid rgba(210, 153, 34, .4);
  color: var(--warn);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 14px;
}
.archive-banner a { color: var(--warn); text-decoration: underline; }

/* ---------- single-page boards layout + side nav ---------- */

.boards-layout {
  display: grid;
  grid-template-columns: 185px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 18px;
}

.side-nav {
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--border-soft);
}
.side-nav a {
  color: var(--text-dim);
  padding: 7px 12px;
  font-size: 13.5px;
  border-left: 2px solid transparent;
  margin-left: -1.5px;
  white-space: nowrap;
}
.side-nav a:hover { color: var(--text); text-decoration: none; }
.side-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
}

.boards-main section {
  scroll-margin-top: 76px;
  margin-bottom: 42px;
}
.boards-main section > h2 {
  font-size: 17px;
  font-weight: 650;
  margin: 0 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border-soft);
}

/* ---------- vertical column chart (held-out) ---------- */

.vc-chart { overflow-x: auto; }
.vc-plot {
  position: relative;
  display: flex;
  gap: 5px;
  height: 280px;
  /* Right pad matches .vc-names: -45° labels hang past the last bar and must
   * stay inside the scrollable width (otherwise the final name is clipped). */
  padding: 0 80px 0 44px;
  min-width: 900px;
  box-sizing: border-box;
}
.vc-grid {
  position: absolute;
  /* Inset matches plot horizontal padding so grid stops with the bars. */
  left: 44px; right: 80px;
  border-top: 1px solid var(--border-soft);
  height: 0;
}
.vc-grid span {
  position: absolute;
  left: -40px;
  top: -7px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  width: 34px;
  text-align: right;
}
.vc-col {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-width: 40px;
}
.vc-val {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.vc-bar {
  position: relative;
  width: 100%;
  max-width: 46px;
  margin: 0 auto;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}
.vc-inbar {
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-family: var(--mono);
  font-size: 9.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.vc-names {
  display: flex;
  gap: 5px;
  /* Same horizontal pad as .vc-plot so columns line up; right pad leaves room
   * for the last diagonal label. Do NOT use overflow:hidden — it clipped the
   * final name where the rotated span paints outside its cell. */
  padding: 8px 80px 0 44px;
  min-width: 900px;
  box-sizing: border-box;
  overflow: visible;
}
.vc-name {
  flex: 1;
  min-width: 40px;
  position: relative;
  /* Optional second line (`(effort)` via <br>) needs a little more drop. */
  height: 160px;
  display: flex;
  justify-content: center;
}
.vc-name .provider-icon { width: 16px; height: 16px; }
/* Direct-child name only. Nested spans must NOT match — each would get its
 *  own absolute + rotate and the diagonal collapses into upright stacks. */
.vc-name > span {
  position: absolute;
  top: 24px;
  right: 50%;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap; /* <br> still forces the effort onto line 2 */
  text-align: center;   /* centre `(effort)` under the model name */
  transform: rotate(-45deg);
  transform-origin: top right;
}

/* ---------- board table ---------- */

.board-wrap { overflow-x: auto; }

table.board {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.board th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.board th .info {
  display: inline-block;
  width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 10px;
  margin-left: 5px;
  vertical-align: 1px;
}
.board th .info:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.board td {
  padding: 10px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.board tbody tr:hover { background: rgba(255, 255, 255, .02); }

/* rank with plausible-range (Arena-style) */
.rank {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  min-width: 44px;
}
.rank-range {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 1px;
}

.model-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.model-cell .model-name { font-weight: 600; font-size: 15px; }
.model-cell .provider-name { color: var(--text-faint); font-size: 12px; }
.provider-icon { width: 22px; height: 22px; border-radius: 5px; background: #fff; padding: 1px; flex: none; }
.provider-chip {
  width: 22px; height: 22px; border-radius: 5px; flex: none;
  background: var(--bg-inset); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 9px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}
.chip.reasoning { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.chip.reasoning.none { color: var(--text-faint); border-color: var(--border-soft); background: transparent; }
/* Reasoning-effort tag trailing a model name on the main board: same type size
   as the name, parenthesized — e.g. "claude-opus-5 (xhigh)". Slightly dimmer
   color keeps it readable as an annotation without shrinking it into a footnote. */
.model-name .effort-tag {
  margin-left: 0.35em;
  font: inherit;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}

.rate-num { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.rate-ci { color: var(--text-dim); font-family: var(--mono); font-size: 12px; }
.cost { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.na { color: var(--text-faint); }

/* ---------- notes / footnotes ---------- */

.note { color: var(--text-dim); font-size: 12.5px; margin: 10px 0 0; }

.section-title { font-size: 18px; font-weight: 650; margin: 4px 0 14px; }

/* ---------- dataset strip ---------- */

.dataset-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}
.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 130px;
}
.stat-card .stat-num { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.stat-card .stat-label { color: var(--text-faint); font-size: 12px; }

/* ---------- heatmap ---------- */

.heatmap-wrap { overflow-x: auto; }
table.heatmap {
  border-collapse: collapse;
  font-size: 12.5px;
}
.heatmap th, .heatmap td {
  padding: 5px 7px;
  text-align: center;
  border: 1px solid var(--bg);
  font-family: var(--mono);
  min-width: 58px;
}
.heatmap th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11.5px;
  background: var(--bg-raised);
  white-space: nowrap;
}
.heatmap th.row-head {
  text-align: left;
  font-family: var(--sans);
  font-size: 12.5px;
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 170px;
}
.heatmap td.row-head {
  text-align: left;
  font-family: var(--sans);
  background: var(--bg-raised);
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: nowrap;
}
.heatmap td.cell { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.heatmap td.cell.null { background: var(--bg-inset) !important; color: var(--text-faint); text-shadow: none; }

/* ---------- bars ---------- */

.bar-cell { min-width: 150px; }
.bar-track.score {
  height: 10px;
  margin-top: 5px;
  min-width: 150px;
}
.bar-track.score .bar-fill {
  background: var(--accent);
}
.bar-track {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  height: 16px;
  position: relative;
  overflow: hidden;
  min-width: 110px;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--bar-soft);
}
.bar-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* ---------- methodology page ---------- */

.prose-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.toc {
  position: sticky;
  top: 76px;
  font-size: 13.5px;
  border-left: 1px solid var(--border-soft);
  padding-left: 14px;
}
.toc a { display: block; color: var(--text-dim); padding: 4px 0; }
.toc a:hover { color: var(--text); text-decoration: none; }

.prose { max-width: 780px; }
.prose h1 { font-size: 26px; margin: 0 0 6px; }
.prose h2 {
  font-size: 20px;
  margin: 42px 0 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: 76px;
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 24px; }
.prose h3 { font-size: 16px; margin: 24px 0 8px; scroll-margin-top: 76px; }
.prose p { margin: 10px 0; color: var(--prose); }
.prose ul, .prose ol { color: var(--prose); padding-left: 22px; }
.prose li { margin: 5px 0; }
.prose .lede { color: var(--text-dim); font-size: 15.5px; }
.prose code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.prose pre {
  background: var(--bg-inset);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose .callout {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
}
.prose .callout p { margin: 4px 0; }
.anchor-link {
  color: var(--text-faint);
  font-weight: 400;
  font-size: .8em;
  margin-left: 8px;
  visibility: hidden;
}
.prose h2:hover .anchor-link, .prose h3:hover .anchor-link { visibility: visible; }

/* language blocks: exactly one visible */
body.lang-en .lang-zh { display: none; }
body.lang-zh .lang-en { display: none; }

/* ---------- editions page ---------- */

.editions-note {
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text-dim);
  margin: 14px 0 20px;
  max-width: 720px;
}

/* ---------- fatal error ---------- */

.fatal {
  max-width: 640px;
  margin: 80px auto;
  background: var(--bg-raised);
  border: 1px solid rgba(248, 81, 73, .5);
  border-radius: 12px;
  padding: 28px;
}
.fatal h1 { font-size: 20px; margin: 0 0 12px; color: var(--bad); }
.fatal pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-inset);
  border-radius: 8px;
  padding: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-soft); filter: brightness(1.15); }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
}
.site-footer .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px;
  color: var(--text-faint);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
}

.compliance {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  border-top: 1px dashed var(--border-soft);
  padding-top: 12px;
  margin-top: 6px;
  font-size: 11.5px;
}
.compliance a { color: var(--text-faint); }
.compliance a:hover { color: var(--text-dim); }

/* ---------- loading ---------- */

.loading { color: var(--text-faint); padding: 60px 0; text-align: center; font-size: 14px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .prose-layout { grid-template-columns: 1fr; }
  .toc { position: static; border-left: 0; padding-left: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .brand .brand-sub { display: none; }
  .boards-layout { grid-template-columns: 1fr; }
  .side-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-left: 0;
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .side-nav a { border-left: 0; border-bottom: 2px solid transparent; margin: 0 0 -1px; }
  .side-nav a.active { border-radius: 0; background: transparent; border-bottom-color: var(--accent); }
}

@media (max-width: 640px) {
  .site-header .inner {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 6px 12px;
    gap: 4px 10px;
  }
  .site-header .brand { flex-basis: 100%; }
  .site-nav { margin-left: 0; }
  .site-nav a { padding: 6px 7px; font-size: 13px; }
  .page { padding: 16px 12px 48px; }
  .meta-bar { gap: 6px 14px; }
  .board th, .board td { padding: 7px 6px; }
  .model-cell { min-width: 130px; }
  .bar-cell, .bar-track.score { min-width: 110px; }
  .hide-sm { display: none; }
}

@media print {
  .site-header, .side-nav, .lang-switch { display: none; }
  body { background: #fff; color: #000; }
}
