:root {
  --primary-color: #3a5f9e;
  --primary-hover: #254b8b;
  --success-color: #0f9f6e;
  --danger-color: #d94841;
  --text-primary: #252d38;
  --text-secondary: #626b76;
  --background-primary: #ffffff;
  --background-secondary: #f7f8fa;
  --surface-elevated: #ffffff;
  --button-background: #252d38;
  --button-text: #ffffff;
  --border-color: #e2e8f0;
  --track-color: #edf1f5;
  --grid-color: #dbe2ea;
  --accent-soft: #eff6ff;
  --success-soft: #ecfdf5;
  --danger-soft: #fee2e2;
  --danger-text: #b42318;
  --success-text: #067647;
  --control-color: #cbd5e1;
  --neutral-bar: #94a3b8;
  --media-background: #0f172a;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow-md: 0 10px 25px rgb(15 23 42 / 8%);
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.2s ease;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --primary-color: #7da2ff;
  --primary-hover: #9ab7ff;
  --success-color: #45d39b;
  --danger-color: #ff7b74;
  --text-primary: #e8edf5;
  --text-secondary: #a7b2c2;
  --background-primary: #0f141c;
  --background-secondary: #141b25;
  --surface-elevated: #18212d;
  --button-background: #e8edf5;
  --button-text: #111820;
  --border-color: #2b3748;
  --track-color: #222d3a;
  --grid-color: #344255;
  --accent-soft: #182641;
  --success-soft: #12372d;
  --danger-soft: #3b2024;
  --danger-text: #ffaaa5;
  --success-text: #7be0b9;
  --control-color: #56657a;
  --neutral-bar: #718198;
  --media-background: #080c12;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%);
  --shadow-md: 0 10px 28px rgb(0 0 0 / 28%);
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text-primary);
  background: var(--background-primary);
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.title {
  color: var(--text-primary) !important;
}

strong {
  color: var(--text-primary);
}

a {
  color: var(--primary-color);
}

.publication-header .hero-body {
  padding: 3.8rem 1.5rem 2.1rem;
}

.publication-title {
  max-width: 960px;
  margin: 0 auto 1.35rem !important;
  color: var(--text-primary) !important;
  font-size: clamp(2.7rem, 5vw, 4rem) !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em;
  line-height: 1.08 !important;
}

.publication-authors {
  margin-bottom: 0.35rem;
  color: var(--primary-color);
  font-weight: 500;
}

.publication-affiliation {
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.publication-meta {
  color: var(--text-secondary);
  font-weight: 500;
}

.publication-links {
  margin: 1.25rem 0 0;
}

.link-block a {
  margin: 0.3rem 0.2rem;
}

.github-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  border: 1px solid #d5dae2;
  border-radius: 999px;
  background: #fff;
  color: #24292f;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.github-button img {
  display: block;
  width: 22px;
  height: 22px;
}

.github-button:hover,
.github-button:focus-visible {
  border-color: #8da3c5;
  background: #f5f8ff;
  color: #24292f;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.button {
  border-radius: var(--border-radius) !important;
  font-weight: 600 !important;
  transition: var(--transition) !important;
}

.button.is-dark {
  border: 0 !important;
  background: var(--button-background) !important;
  color: var(--button-text) !important;
  box-shadow: var(--shadow-sm);
}

.button.is-light {
  border-color: var(--border-color) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
}

.theme-toggle {
  position: fixed;
  z-index: 30;
  top: 1rem;
  right: 1rem;
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.button.is-dark:hover,
.button.is-dark:focus-visible {
  background: var(--primary-color) !important;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.button-icon {
  min-width: 1.35rem;
  margin-right: 0.4rem;
  font-size: 0.9rem;
  font-weight: 800;
}

.hero.is-light {
  border-block: 1px solid var(--border-color);
  background: var(--background-secondary);
}

.hero-body {
  padding: 3.5rem 1.5rem;
}

.overview-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-color);
}

.diagram-teaser {
  padding-top: 0.5rem;
  padding-bottom: 3.5rem;
}

.teaser {
  padding-top: 4rem;
  padding-bottom: 3.6rem;
  border-top: 1px solid var(--border-color);
}

.teaser-body {
  max-width: 980px;
  margin: 0 auto;
}

.teaser-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
}

.teaser-header .title {
  margin: 0 !important;
}

.rollout-intro {
  max-width: 760px;
  margin: 0.45rem 0 0;
  text-align: left;
}

.rollout-section-heading {
  max-width: 820px;
  margin-bottom: 2.25rem;
}

.rollout-section-heading .title {
  margin-bottom: 0 !important;
}

.rollout-example + .rollout-example {
  margin-top: 3.25rem;
  padding-top: 3.25rem;
  border-top: 1px solid var(--border-color);
}

.rollout-example .title.is-4 {
  margin: 0 !important;
  color: var(--text-primary);
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.rollout-example .rollout-intro {
  margin-top: 0.75rem;
}

.rollout-setup {
  margin-top: 1.5rem;
  overflow: hidden;
  border-top: 1px solid var(--border-color);
}

.rollout-setup summary {
  padding: 0.85rem 0.15rem;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.setup-grid > div {
  min-width: 0;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--background-secondary);
}

.setup-grid > div:nth-child(odd) {
  border-right: 1px solid var(--border-color);
}

.setup-grid dt {
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.setup-grid dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.setup-grid code {
  padding: 0;
  color: var(--text-primary);
  background: transparent;
  font-size: 0.86rem;
  white-space: normal;
}

.setup-note {
  margin: 0;
  padding: 0.8rem 1rem;
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.55;
}

.rollout-columns {
  margin-top: 0 !important;
}

.rollout-card {
  height: 100%;
  padding: 0;
  background: transparent;
}

.rollout-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.rollout-label strong {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
}

.rollout-failure .rollout-label strong {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.rollout-success .rollout-label strong {
  background: var(--success-soft);
  color: var(--success-text);
}

.rollout-card video {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--media-background);
  object-fit: cover;
}

.rollout-card figcaption {
  padding: 0.65rem 0.1rem 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.55;
}

.teaser-caption {
  max-width: 820px;
  margin: 1.3rem auto 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.teaser-caption a,
.footer a {
  color: var(--primary-color);
  font-weight: 600;
}

.title.is-3 {
  margin-bottom: 1.5rem !important;
  color: var(--text-primary);
  font-size: 2rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
}

.abstract-copy {
  color: var(--text-secondary);
  font-size: 1.06rem;
  line-height: 1.75;
}

.abstract-copy p + p {
  margin-top: 1.15rem;
}

.section-intro {
  max-width: 650px;
  margin: -1rem auto 2.2rem;
  color: var(--text-secondary);
  font-size: 1.04rem;
}

.method-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-color);
}

.method-explanation {
  max-width: 780px;
  margin: 1.6rem auto 0;
}

.method-diagram {
  max-width: 980px;
  margin: 0 auto;
}

.method-diagram img {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}

:root[data-theme="dark"] .method-diagram img {
  filter: invert(1) hue-rotate(180deg);
}

.method-diagram figcaption {
  max-width: 850px;
  margin: 0.85rem auto 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.method-diagram figcaption a {
  display: inline-block;
  margin-left: 0.25rem;
  font-weight: 600;
}

.results-section {
  padding-block: 4rem;
  border-top: 1px solid var(--border-color);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: 920px;
  margin: 0 auto 2.1rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.result-summary > div {
  min-width: 0;
  padding: 1.05rem 1.2rem 1.1rem;
  text-align: center;
}

.result-summary > div + div {
  border-left: 1px solid var(--border-color);
}

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

.result-summary strong {
  color: var(--primary-color);
  font-size: 1.35rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.result-summary span {
  margin-top: 0.3rem;
  color: var(--text-secondary);
  font-size: 0.77rem;
  line-height: 1.35;
}

.aggregate-results {
  max-width: 920px;
  margin: 0 auto;
}

.aggregate-table {
  table-layout: fixed;
}

.aggregate-table th:first-child {
  width: 29%;
}

.aggregate-table th:last-child {
  width: 20%;
}

.aggregate-table td,
.aggregate-table th {
  padding: 0.78rem 0.9rem !important;
}

.aggregate-table tbody th {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  vertical-align: top;
}

.aggregate-table .group-start:not(:first-child) > * {
  border-top: 2px solid var(--border-color);
}

.aggregate-table tbody td:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.aggregate-table .primary-result td {
  color: var(--primary-color);
  font-weight: 700 !important;
  background: var(--accent-soft);
}

.aggregate-table .prompt-result td {
  color: var(--success-text);
  font-weight: 700 !important;
  background: var(--success-soft);
}

.aggregate-table td small {
  margin-left: 0.2rem;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
}

.aggregate-results figcaption {
  margin-top: 0.7rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

.task-results {
  max-width: 920px;
  margin: 3.2rem auto 0;
}

.task-results-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.task-results-heading .title {
  margin: 0 !important;
}

.task-results-heading p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.results-table {
  overflow-x: auto;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.results-table .table {
  margin: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.results-table th {
  color: var(--text-secondary);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.results-table .table thead th {
  color: var(--text-secondary);
}

.results-table td,
.results-table th {
  border-color: var(--border-color);
}

.results-table tbody tr:hover {
  background: var(--background-secondary);
}

.results-table td strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.results-table td small {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.results-table td.has-text-right small,
.results-table th.has-text-right small {
  display: inline;
  margin: 0 0 0 0.2rem;
  white-space: nowrap;
}

.results-table .task-key {
  color: var(--primary-color);
  font-weight: 700;
}

.results-table tfoot {
  background: var(--accent-soft);
}

.results-table .table tfoot th {
  color: var(--text-primary);
}

.artifact-links {
  margin-top: 0.85rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-align: right;
}

.artifact-links a {
  font-weight: 600;
}

.artifact-links span {
  margin-inline: 0.35rem;
  color: var(--border-color);
}

.footer {
  padding: 3rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--background-secondary);
}

.footer .content {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.template-credit {
  font-size: 0.78rem;
}

:focus-visible {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .publication-header .hero-body {
    padding-top: 2.6rem;
    padding-bottom: 1rem;
  }

  .publication-title {
    font-size: 2.2rem !important;
  }

  .teaser {
    padding-top: 0.7rem;
  }

  .teaser-header .title {
    font-size: 1.7rem !important;
  }

  .teaser-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-grid {
    grid-template-columns: 1fr;
  }

  .setup-grid > div:nth-child(odd) {
    border-right: 0;
  }

  .aggregate-table {
    min-width: 560px;
  }

  .result-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-summary > div:nth-child(3) {
    border-left: 0;
  }

  .result-summary > div:nth-child(n + 3) {
    border-top: 1px solid var(--border-color);
  }

  .task-results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .results-table .table {
    min-width: 560px;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
