:root {
  color-scheme: light;
  --text: #4a4a4a;
  --heading: #363636;
  --muted: #555;
  --link: #209cee;
  --line: #ddd;
  --surface: #fafafa;
  --ours-bg: #f4f2fa;
  --subrow-bg: #fdf5ee;
  --gain-pos: #1e7e45;
  --gain-neg: #c0392b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f3f4f6;
  padding: 1px 5px;
  border-radius: 4px;
}

.content {
  width: min(980px, calc(100% - 48px));
  margin-inline: auto;
}

/* Header */
.paper-header {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 36px;
  text-align: center;
}

h1 {
  font-family: "Google Sans", "Noto Sans", Arial, sans-serif;
  font-size: 48px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--heading);
  margin: 0;
}

.project-name {
  display: block;
  margin-bottom: 14px;
}

.project-title {
  display: block;
  font-size: 36px;
  font-weight: 500;
  max-width: 1020px;
  margin-inline: auto;
  line-height: 1.24;
}

.publication-authors {
  font-family: "Google Sans", "Noto Sans", Arial, sans-serif;
  font-size: 19px;
  line-height: 1.7;
  max-width: 980px;
  margin: 26px auto 0;
  color: #3a3a3a;
}

.publication-authors span {
  display: inline-block;
  white-space: nowrap;
}

.publication-authors a {
  color: var(--link);
}

.publication-authors sup,
.publication-affiliations sup {
  font-size: 68%;
  margin-left: 1px;
}

.publication-affiliations {
  font-family: "Google Sans", "Noto Sans", Arial, sans-serif;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  max-width: 1020px;
  margin: 14px auto 0;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--muted);
}

.paper-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
  font-size: 15.5px;
}

.paper-links a,
.paper-links button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 17px;
  border-radius: 999px;
  color: #fff;
  background: #363636;
  line-height: 1.4;
  border: 0;
  appearance: none;
  font: inherit;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.paper-links a:hover {
  background: #222;
  text-decoration: none;
}

.paper-links button:disabled {
  background: #7c8288;
  cursor: default;
  opacity: 0.92;
}

.paper-links img {
  display: block;
  width: 17px;
  height: 17px;
  filter: brightness(0) invert(1);
}

/* Sections */
section {
  margin: 48px 0;
}

h2 {
  font-family: "Google Sans", "Noto Sans", Arial, sans-serif;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 22px;
  text-align: center;
  color: var(--heading);
}

h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  color: var(--heading);
}

p {
  margin: 0 0 12px;
}

.abstract {
  text-align: justify;
  max-width: 840px;
  margin-inline: auto;
}

.section-intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 18px;
  color: var(--muted);
}

/* Main Overview Figure */
figure {
  margin: 0;
}

.overview {
  margin: 28px 0 0;
}

.overview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

figcaption {
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.5;
}

.overview figcaption {
  text-align: left;
  max-width: 920px;
  margin-inline: auto;
}

/* Leaderboard */
.leaderboard-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-top: 22px;
  overflow-x: auto;
}

.leaderboard-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 2px;
  font-size: 14.5px;
  white-space: nowrap;
  color: var(--muted);
}

.leaderboard-tabs button:hover {
  color: var(--heading);
}

.leaderboard-tabs button[aria-selected="true"] {
  color: var(--link);
  border-bottom-color: var(--link);
  font-weight: 600;
}

.leaderboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
}

.leaderboard-toolbar > div {
  display: flex;
  gap: 10px;
  align-items: center;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

input {
  width: 215px;
}

.table-actions {
  display: flex;
  gap: 16px;
}

.action-link,
#reset-order,
#export-csv {
  background: transparent;
  border: 0;
  padding: 5px 0;
  color: var(--link);
  font-size: 13px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-link:hover,
#reset-order:hover,
#export-csv:hover {
  text-decoration: underline;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  border-top: 1.5px solid #111;
  border-bottom: 1.5px solid #111;
}

caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 10px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
}

thead {
  background: #fff;
}

th {
  background: #fff;
  white-space: nowrap;
  text-align: right;
  font-weight: 500;
  color: var(--heading);
}

.metric-group {
  position: relative;
  text-align: center;
  padding: 8px 8px 7px;
  font-weight: 600;
}

.metric-group::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 0;
  border-bottom: 0.75px solid #666;
}

.metric-group-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.harness-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: middle;
}

thead tr.metric-row th,
th.model-column {
  border-bottom: 1px solid #111;
}

th.model-column {
  vertical-align: bottom;
  min-width: 195px;
  text-align: left;
}

th button {
  background: transparent;
  border: 0;
  padding: 7px 8px;
  width: 100%;
  white-space: nowrap;
  font-size: 13.5px;
  text-align: right;
  font-weight: 500;
}

thead tr.metric-row th:not(:has(button)) {
  padding: 7px 8px;
  font-size: 13.5px;
}

thead tr.metric-row th.model-column:not(:has(button)) {
  font-weight: 600;
}

th.model-column button {
  text-align: left;
  font-weight: 600;
}

th[aria-sort="ascending"] button,
th[aria-sort="descending"] button {
  color: var(--link);
  font-weight: 600;
}

tr.subrow th,
tr.subrow td {
  background: var(--subrow-bg);
  font-size: 12.5px;
  color: var(--muted);
  padding: 5px 8px;
  border-bottom: 1px solid #ccc;
}

tr.subrow th {
  text-align: left;
  font-weight: 500;
}

.group-heading th {
  padding: 9px 8px 4px;
  text-align: left;
  font-style: italic;
  font-weight: 500;
  color: #555;
  border-top: 0.75px solid #aaa;
  background: #fff;
}

tbody tr:first-child.group-heading th {
  border-top: 0;
}

td {
  padding: 6.5px 8px;
  text-align: right;
  white-space: nowrap;
}

td.model-cell {
  text-align: left;
}

tr.model-ours td {
  background: var(--ours-bg);
}

tr.model-ours .table-model {
  font-weight: 700;
  color: var(--heading);
}

tr.summary-row td {
  border-top: 0.75px solid #bbb;
  font-style: italic;
  color: #333;
  padding-block: 7px;
}

tr.summary-row.model-ours td {
  font-style: normal;
}

.metric-strong {
  font-weight: 700;
  color: #111;
}

.delta {
  font-size: 10.5px;
  font-weight: 600;
  margin-left: 2px;
  vertical-align: super;
  line-height: 0;
}

.delta-pos {
  color: var(--gain-pos);
}

.delta-neg {
  color: var(--gain-neg);
}

.empty-results {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.table-status,
.metric-note {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.table-status {
  margin: 8px 0 10px;
}

.metric-note {
  margin-bottom: 8px;
}

/* Case Trajectory Section */
.case-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 18px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  background: #f3f4f6;
  color: #444;
  border: 1px solid #e5e7eb;
}

.meta-pill.meta-ok {
  background: #e6f4eb;
  color: #1f6b41;
  border-color: #bfe0cb;
  font-weight: 600;
}

.trajectory-shell {
  width: min(1260px, calc(100vw - 48px));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.trajectory-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 10px;
}

.trajectory-heading-left {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.trajectory-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.trajectory-hint kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  border: 1px solid #d0d7de;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  background: #fff;
  color: #444;
}

.trajectory-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.trajectory-frame {
  display: block;
  width: 100%;
  height: 760px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f9;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

/* Citation */
#citation {
  width: min(1060px, calc(100vw - 48px));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

.citation-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 18px;
}

.citation-header h2 {
  margin: 0;
}

#copy-bibtex {
  position: absolute;
  right: 0;
}

.citation {
  margin: 0;
  padding: 22px 24px;
  border-block: 1px solid var(--line);
  background: var(--surface);
  font-family: "Courier New", Courier, monospace;
  font-size: 15.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.citation code {
  font: inherit;
  background: transparent;
  padding: 0;
}

/* Footer */
footer.content {
  border-top: 1px solid #eee;
  padding-top: 16px;
  margin-top: 44px;
  margin-bottom: 32px;
  color: #888;
  font-size: 12px;
  text-align: center;
}

/* Expanded Trajectory Dialog */
dialog {
  width: min(1440px, calc(100% - 28px));
  height: calc(100dvh - 28px);
  max-width: none;
  max-height: none;
  padding: 14px 16px 16px;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.78);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  flex: none;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 17px;
  text-align: left;
}

.dialog-heading > div {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dialog-heading button {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--heading);
  font-size: 13px;
}

.dialog-heading button:hover {
  background: #f3f4f6;
}

.expanded-trajectory-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f9;
}

body:has(dialog[open]) {
  overflow: hidden;
}

/* Accessibility utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  top: -100px;
  left: 12px;
  background: #fff;
  padding: 8px;
  z-index: 5;
}

.skip:focus {
  top: 12px;
}

/* Responsive */
@media (max-width: 760px) {
  .content,
  .paper-header {
    width: calc(100% - 32px);
  }

  .paper-header {
    padding: 32px 0 24px;
  }

  h1 {
    font-size: 34px;
  }

  .project-name {
    margin-bottom: 10px;
  }

  .project-title {
    font-size: 24px;
  }

  .publication-authors {
    font-size: 16.5px;
    margin-top: 20px;
  }

  .publication-affiliations {
    font-size: 14.5px;
    gap: 4px 12px;
  }

  .paper-links {
    gap: 6px;
    font-size: 14px;
    margin-top: 22px;
  }

  .paper-links a,
  .paper-links button {
    padding: 7px 14px;
    min-height: 36px;
  }

  h2 {
    font-size: 25px;
  }

  section {
    margin: 34px 0;
  }

  .abstract {
    text-align: left;
  }

  .leaderboard-tabs {
    gap: 16px;
  }

  .leaderboard-tabs button {
    font-size: 13px;
  }

  .leaderboard-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .leaderboard-toolbar > div {
    flex: 1 1 100%;
    gap: 8px;
  }

  input {
    width: 0;
    flex: 1;
    min-width: 0;
  }

  select {
    max-width: 165px;
  }

  th.model-column {
    min-width: 175px;
  }

  .trajectory-shell,
  #citation {
    width: 100%;
    left: auto;
    transform: none;
  }

  .trajectory-frame {
    height: 600px;
  }

  .trajectory-hint {
    display: none;
  }

  .citation {
    font-size: 13.5px;
    padding: 16px;
  }

  #copy-bibtex {
    position: static;
  }

  .citation-header {
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
