:root {
  --ink: #111827;
  --muted: #4b5563;
  --subtle: #6b7280;
  --line: #e5e7eb;
  --paper: #ffffff;
  --soft: #f8fafc;
  --callout: #fff4e8;
  --callout-line: #c26d2d;
  --takeaway-bg: #eef6ff;
  --takeaway-line: #3b82f6;
  --cambridge: #003e72;
  --teal: #0f766e;
  --link: #1d4ed8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
}

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

a:hover {
  text-decoration: underline;
}

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

.project-page {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.project-hero {
  text-align: center;
  padding: 12px 0 34px;
}

.project-hero h1 {
  max-width: 960px;
  margin: 0 auto 22px;
  font-size: clamp(1.6rem, 2.8vw, 2.25rem);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: 0;
}

.authors {
  margin: 0 auto 6px;
  color: #1f2937;
  font-size: clamp(0.98rem, 1.35vw, 1.12rem);
  line-height: 1.4;
}

.affiliation {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.3vw, 1.16rem);
}

.venue-line {
  margin: 16px auto 6px;
  color: var(--cambridge);
  font-size: 1.06rem;
}

.project-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.project-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.45rem;
  min-width: 6.6rem;
  padding: 0 1rem;
  border: 1px solid #cfd8e3;
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper);
  font-weight: 650;
}

.project-links a:hover {
  border-color: var(--link);
  color: var(--link);
  text-decoration: none;
}

.link-icon {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.tldr {
  max-width: 880px;
  margin: 24px auto 0;
  color: #1f2937;
  font-size: 1.08rem;
  text-align: left;
}

section {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 0 4px;
}

h2 {
  margin: 2.2em 0 0.75em;
  padding-bottom: 0.22em;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.5rem, 3vw, 1.95rem);
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin: 1.5em 0 0.55em;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: 0;
}

p,
ul,
ol {
  margin-top: 0;
  margin-bottom: 1rem;
}

li {
  margin: 0.45rem 0;
}

code {
  padding: 0.12em 0.28em;
  border-radius: 4px;
  background: #f3f4f6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.central-question,
.takeaway {
  max-width: 900px;
  margin: 1.45rem auto;
  padding: 1.1rem 1.25rem;
  border: 1px solid #f0d7bd;
  border-left: 4px solid var(--callout-line);
  border-radius: 8px;
  background: var(--callout);
}

.takeaway {
  border-color: #cfe2ff;
  border-left-color: var(--takeaway-line);
  background: var(--takeaway-bg);
}

.central-question p,
.takeaway {
  color: #2f2f2f;
}

.central-question p {
  margin: 0;
  font-size: 1.08rem;
}

.hero-figure,
.paper-figure {
  margin: 30px auto 32px;
}

.hero-figure {
  max-width: 600px;
}

.paper-figure {
  max-width: 920px;
}

.hero-figure img,
.paper-figure img {
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.hero-figure img,
.key-figure img,
.paper-figure img {
  border-radius: 4px;
}

.hero-figure figcaption,
.paper-figure figcaption {
  max-width: 860px;
  margin: 12px auto 0;
  color: var(--subtle);
  font-size: 0.93rem;
  line-height: 1.45;
  text-align: center;
}

.key-figure {
  max-width: 980px;
}

.independent-composition-figure {
  max-width: 784px;
}

.table-wrap {
  width: 100%;
  margin: 22px auto 10px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.folded-box {
  margin: 1.1rem 0 1.35rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: var(--soft);
}

.folded-box summary {
  cursor: pointer;
  padding: 0.85rem 1rem;
  color: #1f2937;
  font-weight: 700;
}

.folded-box .table-wrap {
  margin: 0 1rem 1rem;
  background: var(--paper);
}

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

.compact-table table {
  min-width: 620px;
}

th,
td {
  padding: 0.72rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: #111827;
  font-weight: 700;
}

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

.ours-row {
  background: #f2fbf8;
}

.table-note {
  margin-top: 0.55rem;
  color: var(--subtle);
  font-size: 0.9rem;
}

.math-block {
  max-width: 900px;
  margin: 1rem auto 1.2rem;
  overflow-x: auto;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0;
}

.prompt-grid div {
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.prompt-grid span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: uppercase;
}

.prompt-grid code {
  display: block;
  overflow-x: auto;
  background: #ffffff;
  white-space: nowrap;
}

.ablation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.45rem 0 1.6rem;
}

.ablation-grid article {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.ablation-grid h3 {
  margin-top: 0;
  color: var(--teal);
}

.ablation-grid p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

.bibtex-section {
  padding-top: 32px;
}

pre {
  max-width: 900px;
  margin: 20px auto;
  padding: 16px 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fa;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

pre code {
  padding: 0;
  background: transparent;
  white-space: pre-wrap;
}

mjx-container[jax="SVG"][display="true"] {
  margin: 1em auto !important;
  overflow-x: auto;
  overflow-y: hidden;
}

@media (max-width: 760px) {
  .project-page {
    width: min(100% - 28px, 980px);
    padding-top: 34px;
  }

  .project-hero h1 {
    font-size: 2rem;
  }

  .tldr {
    font-size: 1rem;
  }

  .prompt-grid,
  .ablation-grid {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }

  .compact-table table {
    min-width: 0;
  }

  .compact-table thead {
    display: none;
  }

  .compact-table tr {
    display: block;
    border-bottom: 1px solid var(--line);
  }

  .compact-table tr:last-child {
    border-bottom: 0;
  }

  .compact-table td {
    display: block;
    border-bottom: 0;
  }

  .compact-table td:first-child {
    background: var(--soft);
    font-weight: 700;
  }

}

@media (max-width: 420px) {
  .project-page {
    width: min(100% - 24px, 980px);
  }

  .project-links a {
    min-width: 0;
    flex: 1 1 8rem;
  }
}
