:root {
  color-scheme: light;
  --ink: #14181f;
  --ink-soft: #3e4754;
  --muted: #667485;
  --line: #d9e0e8;
  --line-strong: #b8c4d1;
  --paper: #ffffff;
  --wash: #f4f7fb;
  --wash-2: #ebf2f7;
  --blue: #145ca8;
  --blue-dark: #0d3f75;
  --teal: #087c74;
  --green: #22805a;
  --rust: #b3532d;
  --red: #b82e3f;
  --amber: #a66a00;
  --teacher: #b3532d;
  --student: #145ca8;
  --pool: #087c74;
  --shadow: 0 24px 60px rgba(20, 24, 31, 0.11);
  --shadow-soft: 0 12px 36px rgba(20, 24, 31, 0.08);
  --max-width: clamp(1180px, 78vw, 1600px);
  --radius: 8px;
}

.text-teacher { color: var(--teacher); }
.text-student { color: var(--student); }

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

canvas {
  width: 100%;
}

a {
  color: inherit;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

code {
  padding: 0.08em 0.32em;
  color: var(--blue-dark);
  background: #edf4fb;
  border-radius: 5px;
}

section,
.subsection-head[id] {
  scroll-margin-top: 92px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px max(24px, calc((100vw - var(--max-width)) / 2));
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(217, 224, 232, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 650;
}

.site-header nav a,
.site-footer a {
  position: relative;
  text-decoration: none;
}

.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.site-header nav a:hover {
  color: var(--blue);
}

.site-header nav a.is-active {
  color: var(--blue);
}

.site-header nav a.is-active::after,
.site-header nav a:hover::after {
  transform: scaleX(1);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 48px max(24px, calc((100vw - var(--max-width)) / 2)) 78px;
  color: var(--ink);
  background: var(--paper);
}

.hero-heading,
.hero-details {
  max-width: var(--max-width);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3.6rem, 5.4vw, 5.2rem);
  line-height: 0.96;
  letter-spacing: 0;
  font-weight: 850;
}

h2 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1.06;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.22;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
}

.hero-copy {
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.hero-copy strong {
  color: var(--ink);
}

.hero-visual {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  margin: 0 auto;
}

.hero-visual img {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.hero-highlights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 20px 0 0;
}

.highlight-box {
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--wash);
}

.highlight-box--results {
  border-top: 3px solid var(--blue-dark);
}

.highlight-box--insights {
  border-top: 3px solid var(--rust);
}

.highlight-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.highlight-list {
  list-style: disc;
  margin: 0;
  padding: 0 0 0 20px;
}

.highlight-list li {
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.5;
}

.highlight-list li + li {
  margin-top: 10px;
}

.highlight-list strong {
  color: var(--ink);
  font-weight: 800;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 26px;
  color: var(--ink);
  font-weight: 700;
}

.authors sup,
.affiliations sup {
  color: var(--rust);
  font-weight: 800;
}

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

.hero-actions,
.cite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  color: #fff;
  background: var(--ink);
}

.button-primary:hover {
  background: var(--ink-soft);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--paper);
}

.button-secondary:hover {
  border-color: var(--ink-soft);
  background: var(--wash);
}

.button-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.button-icon--arxiv {
  width: 24px;
  height: 24px;
}

.section {
  width: min(var(--max-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 92px 0 0;
}

.section-accent {
  width: 100%;
  max-width: none;
  padding: 92px max(24px, calc((100vw - var(--max-width)) / 2)) 0;
  background: linear-gradient(180deg, transparent 0, transparent 30px, var(--wash-2) 30px, var(--wash-2) 100%);
}

.section-head {
  margin-bottom: 30px;
}

.section-head p {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 1.04rem;
}

.subsection-head {
  margin-top: 40px;
  margin-bottom: 12px;
}

.subsection-head h3 {
  font-size: 1.5rem;
  line-height: 1.15;
}

.subsection-head p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.reward-panel,
.chart-card,
.case-panel {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.reward-panel.teacher { --accent: var(--teacher); }
.reward-panel.student { --accent: var(--student); }

.role-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.reward-panel p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

.reward-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.reward-panel {
  container-type: inline-size;
  padding: 24px 22px 22px;
  border-top: 3px solid var(--accent, var(--blue));
}

.reward-panel h3 {
  margin-bottom: 8px;
  font-size: 1.28rem;
}

.reward-panel code {
  white-space: normal;
}

.equation {
  margin: 12px 0 0;
  padding: 12px 14px;
  overflow: hidden;
  color: var(--blue-dark);
  background: #edf4fb;
  border: 1px solid color-mix(in srgb, var(--blue) 16%, white);
  border-radius: 7px;
  font-size: 0.95rem;
}

.equation mjx-container[display="true"] {
  margin: 0 !important;
  max-width: 100%;
  text-align: left !important;
}

.equation mjx-container {
  max-width: 100%;
}

.equation-split {
  display: none;
}

@container (max-width: 860px) {
  .equation {
    font-size: 0.9rem;
  }
}

@container (max-width: 680px) {
  .equation-wide {
    display: none;
  }

  .equation-split {
    display: block;
  }
}

.reward-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.reward-list li {
  padding: 11px 0;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-size: 0.94rem;
  line-height: 1.5;
}

.reward-list strong {
  color: var(--ink);
}

.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.control {
  display: grid;
  min-width: 220px;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 800;
}

.segmented {
  display: inline-flex;
  width: fit-content;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: var(--wash-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.segmented button,
.case-tabs button {
  min-height: 36px;
  padding: 0 15px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 750;
  font-size: 0.9rem;
}

.segmented button:hover,
.case-tabs button:hover {
  color: var(--blue);
}

.segmented button.is-active,
.case-tabs button.is-active {
  color: var(--blue-dark);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 2px 6px rgba(20, 24, 31, 0.08);
}

.chart-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  min-width: 0;
  padding: 18px;
}

.chart-card.full {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  min-height: 50px;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
}

.card-head h3 {
  font-size: 1.18rem;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.chart-box {
  position: relative;
  height: 340px;
  min-height: 340px;
}

.chart-box.tall {
  height: 460px;
  min-height: 460px;
}

.chart-box.short {
  height: 300px;
  min-height: 300px;
}

.table-wrap {
  margin-top: 16px;
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

table.data,
.mini-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  white-space: nowrap;
}

table.data caption {
  caption-side: top;
  padding: 14px 18px 6px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: left;
}

table.data th,
table.data td,
.mini-table th,
.mini-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

table.data th:first-child,
table.data td:first-child,
.mini-table th:first-child,
.mini-table td:first-child {
  text-align: left;
}

table.data th:first-child,
table.data td:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
}

table.data thead th,
.mini-table thead th {
  color: var(--ink-soft);
  background: var(--wash-2);
  font-size: 0.82rem;
  font-weight: 750;
}

table.data thead th:first-child {
  z-index: 1;
  background: var(--wash-2);
}

table.data tbody tr:hover td,
.mini-table tbody tr:hover td {
  background: var(--wash);
}

table.data tbody tr:hover td:first-child {
  background: var(--wash);
}

table.data td.best,
.mini-table td.best {
  color: var(--blue-dark);
  font-weight: 800;
}

table.data tr.is-opensir td:first-child,
.mini-table tr.is-opensir td:first-child {
  color: var(--blue-dark);
  font-weight: 800;
}

table.data .delta-pos { color: var(--teal); font-weight: 750; }
table.data .delta-neg { color: var(--red); font-weight: 750; }

.mini-table {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.mini-table table {
  font-size: 0.84rem;
}

.case-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 5px;
  background: var(--wash-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.case-panel {
  display: none;
  padding: 24px;
}

.case-panel.is-active {
  display: block;
}

.case-panel p {
  margin: 14px 0 0;
  color: var(--ink-soft);
}

.case-panel p:first-of-type {
  color: var(--ink);
  font-size: 1.02rem;
}

.case-note {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.case-note strong {
  color: var(--ink);
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--wash-2);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.good {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 10%, white);
}

.badge.bad {
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, white);
}

.badge.step {
  color: var(--blue-dark);
  background: color-mix(in srgb, var(--blue) 10%, white);
}

.badge.rate {
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 10%, white);
}

.cite-section {
  padding-bottom: 88px;
}

pre {
  margin: 16px 0 0;
  padding: 20px;
  overflow-x: auto;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.55;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  margin-top: 92px;
  padding: 28px 24px 40px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.site-footer a {
  color: var(--ink-soft);
}

.site-footer a:hover {
  color: var(--blue);
}

.error-panel {
  padding: 18px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 8%, white);
  border: 1px solid color-mix(in srgb, var(--red) 35%, white);
  border-radius: var(--radius);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .reward-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1040px) {
  .chart-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .site-header nav {
    display: none;
  }

  .hero {
    gap: 24px;
    padding-top: 40px;
    padding-bottom: 58px;
  }

  .hero-visual {
    max-width: 640px;
  }

  h1 {
    font-size: 3.4rem;
  }

  h2 {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.16rem;
  }

}

@media (max-width: 560px) {
  .section {
    width: min(100% - 28px, var(--max-width));
  }

  .section-accent {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chart-card,
  .case-panel {
    padding: 16px;
  }

  .chart-box,
  .chart-box.short {
    height: 300px;
    min-height: 300px;
  }

  .chart-box.tall {
    height: 380px;
    min-height: 380px;
  }

  .equation {
    font-size: 0.88rem;
  }
}
