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

:root {
  color-scheme: light;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b626d;
  --primary: #2a5bd7;
  --primary-ink: #0f1f4d;
  --border: #e2e6ee;
  --shadow: 0 12px 28px rgba(18, 28, 45, 0.08);
  --matsat-vars: 0;
  --matsat-chip-size: 50px;
  --matsat-chip-height: 40px;
  --matsat-gap: 6px;
  --matsat-right-col: 140px;
}

body {
  margin: 0;
  font-family: "Inter", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: #ffffff;
  color: var(--text);
  line-height: 1.6;
}

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

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

.hero {
  background: linear-gradient(120deg, #dfe7ff 0%, #f5f7ff 60%, #ffffff 100%);
  padding: 64px 24px 48px;
  border-bottom: 1px solid var(--border);
}

.hero__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
  align-items: center;
}

.hero__eyebrow {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--primary);
  margin: 0 0 12px;
}

.hero h1 {
  font-size: clamp(2.2rem, 3vw, 3.2rem);
  margin: 0 0 16px;
  line-height: 1.2;
}

.hero__subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 24px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero__visual {
  background: #ffffff;
  padding: 0 5px;
  border-radius: 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  overflow: hidden;
}

.section {
  padding: 20px 24px;
}

.section--tight {
  padding-top: 8px;
  padding-bottom: 8px;
}

#tasks {
  padding-bottom: 8px;
}

#highlights {
  padding-top: 8px;
}

.section__header {
  max-width: 820px;
  margin: 0 auto 24px;
}

.section__header h2 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
}

.section__header p {
  margin: 0;
  color: var(--muted);
}

.card-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.abstract-details {
  margin: 0 0 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #f7f9ff;
  padding: 12px 16px;
}

.abstract-details summary {
  list-style: none;
  cursor: pointer;
}

.abstract-details summary::-webkit-details-marker {
  display: none;
}

.abstract-details__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--primary-ink);
}

.abstract-details__summary::after {
  content: "▾";
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.abstract-details[open] .abstract-details__summary::after {
  transform: rotate(180deg);
}

.abstract-details__meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: auto;
}

.abstract-details[open] .abstract-details__meta::before {
  content: "Collapse";
}

.abstract-details:not([open]) .abstract-details__meta::before {
  content: "Expand";
}

.abstract-details .abstract {
  margin-top: 12px;
  margin-bottom: 8px;
}

.summary-text {
  max-width: 880px;
  margin: 0 auto 24px;
  color: var(--muted);
}

.task-card,
.highlight-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(25, 35, 55, 0.06);
  display: grid;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.highlight-card--interactive {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: var(--surface);
}

.highlight-card--interactive:focus-visible {
  outline: 2px solid #9bb4ff;
  outline-offset: 2px;
}

.task-card:hover,
.task-card:focus,
.highlight-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 30px rgba(25, 35, 55, 0.12);
}

.task-card h3,
.highlight-card h3 {
  margin: 0 0 8px;
}

.task-card p,
.highlight-card p {
  margin: 0;
  color: var(--muted);
}

.task-card__cta {
  margin-top: 10px;
  display: inline-flex;
  font-weight: 600;
  color: var(--primary);
}

.button {
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button--primary {
  background: var(--primary);
  color: #ffffff;
  border-color: transparent;
}

.button--ghost {
  background: transparent;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(25, 35, 55, 0.12);
}

.abstract {
  max-width: 880px;
  margin: 0 auto;
  font-size: 1.03rem;
  color: var(--text);
}

.bibtex {
  max-width: 880px;
  margin: 0 auto;
  background: var(--surface);
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.bibtex pre {
  margin: 16px 0 0;
  background: #f4f6fa;
  border-radius: 12px;
  padding: 16px;
  overflow-x: auto;
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, SFMono-Regular,
    Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

.footer {
  padding: 32px 24px 48px;
  text-align: center;
  color: var(--muted);
}

.page-header {
  padding: 32px 24px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-header__inner {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.page-header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.page-content {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--surface);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-top: 0;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #eef3ff;
  color: var(--primary-ink);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.canvas-wrap {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #ffffff;
}

.task-grid {
  display: grid;
  gap: 16px;
}

.tree-grid {
  display: grid;
  gap: 10px;
}

.tree-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tree-node {
  min-width: 88px;
  padding: 10px 12px;
  background: #f3f4f8;
  border: 1px dashed #c7cfdd;
  border-radius: 12px;
  text-align: center;
  font-size: 0.9rem;
  cursor: not-allowed;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tree-node--active {
  background: #ffffff;
  border-style: solid;
  cursor: pointer;
}

.tree-node--known {
  border-color: #3a7d44;
  background: #f0fff5;
  cursor: default;
}

.tree-node--active:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(30, 45, 75, 0.12);
}

.vars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.vars-grid--row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: visible;
  padding-bottom: 4px;
}

.vars-grid--row .var-toggle {
  flex: 0 0 auto;
}

.vars-grid--submit {
  animation: matsat-drop 160ms ease-out;
}

.var-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8f9fd;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease,
    background 0.15s ease, color 0.15s ease;
}

.var-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(30, 45, 75, 0.12);
}

.var-toggle:focus-visible {
  outline: 2px solid #9bb4ff;
  outline-offset: 2px;
}

.var-toggle.is-active {
  background: var(--primary);
  border-color: transparent;
  color: #ffffff;
}

.matsat-history-panel {
  margin-top: 16px;
}

.matsat-assignment-row {
  display: grid;
  grid-template-columns: repeat(var(--matsat-vars), var(--matsat-chip-size))
    var(--matsat-right-col);
  align-items: center;
  column-gap: var(--matsat-gap);
}

.matsat-assignment-row .vars-grid--row {
  display: contents;
}

.matsat-assignment-row .button {
  width: 100%;
  justify-self: end;
}

.matsat-history-item {
  display: grid;
  grid-template-columns: repeat(var(--matsat-vars), var(--matsat-chip-size))
    var(--matsat-right-col);
  align-items: center;
  column-gap: var(--matsat-gap);
  color: var(--text);
}

.matsat-history-item--new {
  animation: matsat-history-in 180ms ease-out;
}

.matsat-score {
  background: #eef3ff;
  color: var(--primary-ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  justify-self: end;
  width: 100%;
  text-align: center;
}

.matsat-history-assignment {
  display: contents;
}

.matsat-xi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--primary-ink);
  font-weight: 600;
  font-size: 0.85rem;
}

.matsat-assignment-row .var-toggle,
.matsat-history-item .matsat-xi {
  width: var(--matsat-chip-size);
  height: var(--matsat-chip-height);
  padding: 0;
}

.matsat-xi.is-true {
  background: var(--primary);
  border-color: transparent;
  color: #ffffff;
}

.matsat-xi.is-false {
  background: #ffffff;
  border-color: #d4dae6;
  color: var(--muted);
}

.result-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

@keyframes matsat-drop {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(14px);
    opacity: 0.7;
  }
}

@keyframes matsat-history-in {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.muted-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.tree-svg {
  width: 100%;
  height: 520px;
  display: block;
  background: #ffffff;
}

.tree-node-circle {
  transition: transform 0.15s ease, filter 0.15s ease;
}

.tree-node-circle.is-active {
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(42, 91, 215, 0.2));
}

.tree-node-circle.is-revealed {
  stroke-dasharray: 5 4;
  stroke-width: 2.5;
}

.tree-node-circle.is-known {
  stroke-width: 3.5;
}

.tree-node-text {
  font-family: "Inter", "SF Pro Text", system-ui, sans-serif;
  font-size: 12px;
  fill: #1f2328;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.figure-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.figure-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(25, 35, 55, 0.06);
  display: grid;
  gap: 12px;
}

.figure-embed {
  width: 100%;
  min-height: 260px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  object-fit: contain;
}

.hero__visual .figure-embed {
  border: none;
  background: transparent;
  border-radius: 0;
}

.figure-card figcaption {
  color: var(--muted);
  font-size: 0.95rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1200px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f4f6fa;
  font-size: 1.25rem;
  cursor: pointer;
}

.modal__image {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  object-fit: contain;
}

.modal__caption {
  margin: 0;
  color: var(--muted);
}

.modal__figure h4 {
  margin: 0;
  font-size: 1.1rem;
}

.modal__figure-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.modal__figure-grid--compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.modal__figure-grid figure {
  margin: 0;
  display: grid;
  gap: 8px;
  text-align: center;
}

.modal__figure-grid img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  object-fit: contain;
}

.modal__figure-grid--compact img {
  max-height: 220px;
}

.modal__figure-grid figcaption {
  font-size: 0.9rem;
  color: var(--muted);
}

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

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  min-width: 520px;
}

.result-table--summary {
  font-size: 0.88rem;
}

.result-table--wide {
  min-width: 0;
  table-layout: fixed;
}

.result-table th,
.result-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: normal;
  line-height: 1.25;
}

.result-table--summary th,
.result-table--summary td {
  padding: 10px 12px;
}

.result-table thead th {
  background: #f4f6fa;
}

.result-table .task-divider {
  border-left: 2px solid #d4dae6;
}

.result-table thead .task-divider {
  background: #f4f6fa;
}

.result-table th:first-child,
.result-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #ffffff;
  white-space: normal;
}

.table-delta {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
}

.result-table thead th {
  background: #f4f6fa;
  font-weight: 600;
}

.result-table__baseline {
  background: #f9fafc;
  font-weight: 600;
}

.stat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.select-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  color: var(--text);
}

.select-field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.select-field select {
  border: none;
  background: transparent;
  font: inherit;
  color: inherit;
  outline: none;
  cursor: pointer;
}

@media (max-width: 720px) {
  .hero__inner,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }
}
