:root {
  --primary: #5b8def;
  --primary-dark: #0f3f6f;
  --primary-soft: #eef4fd;
  --red: #ef4b36;
  --red-soft: #fff0ed;
  --text: #18181b;
  --muted: #71717a;
  --light: #9a9ea6;
  --border: #e4e4e7;
  --bg-alt: #f7f7f6;
  --container-width: 68rem;
  --figure-width: 62rem;
  --font-sans: "Carlito", "Calibri", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --nav-h: 60px;
}

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

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

body {
  padding-left: 10.5rem;
  background:
    radial-gradient(circle at 16px 16px, rgba(24, 24, 27, 0.035) 1px, transparent 1.5px) 0 0 / 32px 32px,
    #fafaf9;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

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

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.2;
}

p {
  margin: 0.8rem 0 1.5rem;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.7;
  text-align: left;
}

strong {
  font-weight: 700;
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  width: 100%;
  padding: 4.5rem 0;
  border-top: 1px solid var(--border);
}

.section.alt-bg {
  background: var(--bg-alt);
}

.section-title {
  width: fit-content;
  margin: 0 0 2rem;
  padding-bottom: 0.72rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subsection-title {
  margin: 3rem 0 1rem;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}

.sidebar {
  position: fixed;
  z-index: 100;
  top: 50%;
  left: 2.2rem;
  transform: translateY(-50%);
}

.sidebar-nav {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.sidebar-nav::before {
  position: absolute;
  z-index: 0;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 1px;
  background: var(--border);
  content: "";
}

.sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s;
}

.sidebar-dot {
  position: relative;
  z-index: 2;
  width: 11px;
  height: 11px;
  border: 2px solid #fafaf9;
  border-radius: 50%;
  background: var(--light);
  box-sizing: content-box;
  transition: background 0.2s, transform 0.2s;
}

.sidebar-item:hover .sidebar-dot,
.sidebar-item.active .sidebar-dot {
  background: var(--text);
  box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.1);
  transform: scale(1.15);
}

.sidebar-item:hover .sidebar-label,
.sidebar-item.active .sidebar-label {
  color: var(--text);
  font-weight: 700;
}

.sidebar-item:hover,
.sidebar-item.active {
  color: var(--text);
}

.hero-section {
  margin-bottom: 3rem;
  text-align: center;
}

.hero-cover {
  display: flex;
  min-height: calc(100vh - var(--nav-h, 60px));
  padding: 1.4rem 0;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
}

.hero-container {
  max-width: 62rem;
  margin: 0 auto 1.8rem;
  padding: 0 1rem;
}

.hero-title {
  margin: 0 0 0.9rem;
  color: var(--text);
  font-size: clamp(1.45rem, 2.3vw, 2rem);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
}

.hero-authors {
  display: flex;
  margin: 0 auto 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 1rem;
  row-gap: 0.2rem;
}

.author-break {
  flex-basis: 100%;
  height: 0;
}

.hero-authors span,
.hero-authors a {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
}

.hero-authors a:hover {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.hero-authors sup,
.hero-affiliations sup {
  position: relative;
  top: -0.25em;
  margin-left: 0.08em;
  font-size: 0.67em;
}

.hero-affiliations {
  display: flex;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.3;
}

.hero-notes {
  margin-bottom: 0.5rem;
  color: var(--light);
  font-size: 0.8rem;
  font-style: italic;
}

.venue-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  line-height: 1.3;
}

.hero-venue {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-venue-secondary {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.hero-venue-sep {
  color: var(--light);
}

.hero-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 1.02rem;
  line-height: 1.3;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text);
  font-weight: 700;
  transition: color 0.15s;
}

.hero-links a:hover {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.hero-links a svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.hero-links-disabled {
  color: var(--light);
  font-weight: 700;
}

.hero-links-sep {
  color: var(--light);
}

.teaser-container {
  max-width: var(--figure-width);
  margin: 0 auto 2rem;
  padding: 0 1rem;
}

.concept-animation {
  position: relative;
}

.animation-canvas-shell {
  position: relative;
  width: 100%;
  background: #fff;
}

#civet-concept-animation {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #fff;
}

.figure-container {
  max-width: 48rem;
  margin: 2rem auto 0;
  padding: 1.15rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.figure-container img {
  width: 100%;
}

.hero-figure {
  margin-top: 0;
  padding: 0.65rem;
}

.figure-caption,
.table-caption {
  display: block;
  margin: 0.7rem auto 0;
  color: var(--light);
  font-size: 0.89rem;
  line-height: 1.5;
  text-align: center;
}

.tldr-box {
  padding: 1.5rem 1.65rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text);
  border-radius: 0 12px 12px 0;
  background: var(--bg-alt);
  text-align: left;
}

.tldr-content {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
}

.tldr-label {
  flex: 0 0 auto;
  padding: 0.3rem 0.62rem;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.tldr-text {
  margin: -0.08rem 0 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
}

.tldr-highlight {
  color: var(--text);
  font-weight: 700;
}

.question-box {
  margin-top: 2rem;
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  border-radius: 0 12px 12px 0;
  background: var(--red-soft);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 650;
  line-height: 1.55;
}

.principle-grid,
.stage-grid,
.finding-grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.principle-grid article,
.stage-card,
.finding-grid article {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
}

.principle-grid article > span,
.finding-grid article > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.principle-grid h3,
.stage-card h3 {
  margin-top: 0.5rem;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 650;
}

.principle-grid p,
.stage-card p,
.finding-grid p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.stage-card {
  position: relative;
  overflow: hidden;
  padding-top: 1.65rem;
}

.stage-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--primary);
  content: "";
}

.stage-online::before {
  background: var(--red);
}

.stage-index {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
}

.stage-card > strong {
  display: block;
  margin-top: 1rem;
  color: var(--text);
  font-size: 0.86rem;
}

.metric-row {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.dataset-metrics {
  grid-template-columns: repeat(4, 1fr);
}

.metric {
  padding: 1.3rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
  text-align: center;
}

.metric strong {
  display: block;
  color: var(--primary);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metric span {
  display: block;
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-primary {
  border-color: var(--border);
  background: var(--bg-alt);
}

.dataset-splits {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: #fff;
}

.dataset-splits div {
  padding: 1rem 1.2rem;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
}

.dataset-splits div:last-child {
  border-right: 0;
}

.dataset-splits strong {
  color: var(--text);
  font-size: 1.12rem;
}

.dataset-splits span {
  color: var(--muted);
  font-size: 0.78rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 0.85rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
th:nth-child(2),
td:first-child,
td:nth-child(2) {
  text-align: left;
}

th {
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

td {
  color: var(--muted);
  font-family: var(--font-mono);
}

td:first-child,
td:nth-child(2) {
  color: var(--text);
  font-family: var(--font-sans);
}

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

.row-ours td {
  background: var(--bg-alt);
}

.row-ours td:nth-child(2),
.row-best td:nth-child(2) {
  color: var(--primary-dark);
  font-weight: 700;
}

.row-best td {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.pp-score-figure {
  max-width: 24rem;
}

.cross-eval-figure {
  max-width: 34rem;
}

.finding-grid article strong {
  display: block;
  margin-top: 0.7rem;
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.citation-section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--border);
  background: #fff;
}

.citation-title {
  margin-bottom: 1rem;
  border-color: var(--border);
  font-size: 1.5rem;
}

.citation-block {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
}

.citation-code {
  margin: 0;
  padding: 1.5rem 5.5rem 1.5rem 1.5rem;
  overflow-x: auto;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.65;
  white-space: pre;
}

.citation-copy-btn {
  position: absolute;
  z-index: 2;
  top: 0.85rem;
  right: 0.85rem;
  padding: 0.43rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  transition: border-color 0.2s, color 0.2s;
}

.citation-copy-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: #fff;
  text-align: center;
}

.footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.js .fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.js .fade-in-section.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1280px) {
  body {
    padding-left: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0.8rem 1rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    background: rgba(250, 250, 249, 0.92);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transform: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    scrollbar-width: none;
  }

  .sidebar::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.3rem;
  }

  .sidebar-nav::before,
  .sidebar-dot {
    display: none;
  }

  .sidebar-item {
    gap: 0;
    padding: 0.4rem 0.2rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 768px) {
  p {
    font-size: 1rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  .sidebar {
    gap: 0.8rem;
    padding: 0.7rem 1rem;
  }

  .sidebar-nav {
    justify-content: flex-start;
    gap: 0.8rem;
  }

  .sidebar-item {
    font-size: 0.78rem;
  }

  .hero-authors span,
  .hero-authors a {
    font-size: 0.85rem;
  }

  .hero-affiliations {
    flex-direction: column;
    gap: 0.25rem;
  }

  .tldr-content {
    flex-direction: column;
  }

  .principle-grid,
  .stage-grid,
  .finding-grid,
  .metric-row,
  .dataset-metrics,
  .dataset-splits {
    grid-template-columns: 1fr;
  }

  .dataset-splits div {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .dataset-splits div:last-child {
    border-bottom: 0;
  }

  .citation-code {
    padding: 3.5rem 1.2rem 1.2rem;
    font-size: 0.74rem;
  }
}

@media (max-width: 480px) {
  .hero-container {
    padding: 0 0.85rem;
  }

  .figure-container {
    padding: 0.4rem;
    border-radius: 9px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .js .fade-in-section {
    opacity: 1;
    transform: none;
  }
}
