:root {
  color-scheme: light;
  --ink: #1f2328;
  --text: #3a4048;
  --muted: #5d6670;
  --faint: #8c959f;
  --line: #e3e6ea;
  --soft: #f6f7f9;
  --accent: #4b44ce;
  --accent-soft: #efeefc;
  --emp: #3b6db3;
  --recon: #d1453b;
  --spec: #3f9a55;
  --sig: #e0873a;
  --pow: #7fb0e6;
  --spow: #8fcf9b;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Noto Serif", Georgia, "Songti SC", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  color: var(--ink);
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-wide {
  max-width: 1160px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* Hero */

.hero {
  padding: 72px 0 28px;
  text-align: center;
  background: linear-gradient(180deg, #f7f6ff 0%, #fff 100%);
}

.hero .container {
  max-width: 1040px;
}

.hero h1,
.hero p {
  text-wrap: balance;
}

.venue {
  display: inline-block;
  margin: 0 0 18px;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.8vw, 3.15rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.authors {
  margin: 0 0 6px;
  font-size: 1.16rem;
  color: var(--ink);
}

.authors span,
.affiliations span,
.notes span {
  display: inline-block;
  margin: 0 0.55em;
}

.affiliations {
  margin: 0 0 4px;
  color: var(--muted);
}

.notes {
  margin: 0 0 26px;
  color: var(--faint);
  font-size: 0.84rem;
}

sup {
  line-height: 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 1.15em;
  border: 1px solid #1f2328;
  border-radius: 999px;
  background: #1f2328;
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  background: #000;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn svg {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sections */

section {
  padding: 40px 0;
}

h2 {
  margin: 0 0 26px;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  text-align: center;
}

h2::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin: 12px auto 0;
  border-radius: 2px;
  background: var(--accent);
}

figure {
  margin: 0;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.intro {
  padding-top: 20px;
  padding-bottom: 12px;
}

.tldr {
  padding: 18px 24px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 1.05rem;
}

.tldr p {
  margin: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 0;
  text-align: center;
}

.stats > div {
  padding: 14px 8px;
  border-radius: 12px;
  background: var(--soft);
}

.stats dt {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
}

.stats dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.parts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.parts a {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.35;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.parts a:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.parts span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
}

.parts small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Parts and subsections */

.part {
  padding-top: 44px;
  border-top: 1px solid var(--line);
}

.kicker {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.part h2 {
  margin-bottom: 10px;
}

.lead {
  max-width: 760px;
  margin: 0 auto 8px;
  color: var(--muted);
  font-size: 0.98rem;
  text-align: center;
  text-wrap: balance;
}

h3.sub {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 34px 0 12px;
  font-size: 1.15rem;
  font-weight: 700;
}

h3.sub span {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* Live figures */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.4;
}

.toolbar .spacer {
  flex: 1 1 auto;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--soft);
}

.seg button {
  padding: 0.35em 1em;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.15);
}

.seg.mini {
  position: absolute;
  top: -2px;
  right: 0;
  padding: 2px;
  font-size: 11px;
  line-height: 1.3;
}

.seg.mini button {
  padding: 0.2em 0.65em;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.35em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tool:hover {
  color: var(--ink);
  border-color: var(--faint);
}

.tool svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart {
  position: relative;
  min-width: 0;
}

.chart svg {
  display: block;
  max-width: 100%;
  overflow: visible;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.legend span {
  white-space: nowrap;
}

.legend i {
  display: inline-block;
  width: 18px;
  height: 0;
  margin-right: 6px;
  border-top: 2px solid;
  vertical-align: middle;
}

.legend i.dash {
  border-top-style: dashed;
}

.legend i.thick {
  border-top-width: 3.5px;
}

.legend i.pt {
  width: 7px;
  height: 7px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
}

.legend span:not([class]) i.pt {
  background: #7d858e;
}

.legend i.ramp {
  width: 40px;
  height: 7px;
  border: 0;
  border-radius: 2px;
}

.legend i.band {
  width: 14px;
  height: 10px;
  border: 0;
  border-radius: 2px;
  background: rgba(33, 145, 140, 0.18);
}

.legend .emp {
  color: var(--emp);
}

.legend .recon {
  color: var(--recon);
}

.legend .spec {
  color: var(--spec);
}

.legend .sig {
  color: var(--sig);
}

.legend .pow {
  color: #5d93cf;
}

.legend .spow {
  color: #5fae6d;
}

.legend .ink {
  color: var(--ink);
}

.hint {
  color: var(--faint);
  font-size: 0.8rem;
}

/* 1.1 tiles */

.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.tile svg {
  display: block;
  width: 100%;
  height: auto;
}

/* 1.2 panels */

.panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 26px;
}

.panel {
  min-width: 0;
}

.panel .legend {
  padding-left: 4px;
}

/* 2.1 synthetic problems */

.mano {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.mtiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mtile {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.mtile svg {
  display: block;
  width: 100%;
  height: auto;
  margin-top: auto;
}

.mq {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-height: 2.9em;
  margin: 0 0 6px;
  line-height: 1.4;
}

.mq code {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.lvl {
  flex: none;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.6;
}

.mmeta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

/* 2.2 mechanism */

.demo {
  padding: 18px 20px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfbff 0%, var(--soft) 100%);
}

.toy-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px 22px;
  align-items: end;
  margin-bottom: 14px;
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5em 1.1em 0.5em 0.9em;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(75, 68, 206, 0.28);
  transition: transform 0.15s ease;
}

.play:hover {
  transform: translateY(-1px);
}

.play svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.play .i-pause,
.play[aria-pressed="true"] .i-play {
  display: none;
}

.play[aria-pressed="true"] .i-pause {
  display: inline;
}

.control {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  align-items: center;
  min-width: 0;
}

.control label {
  grid-column: 1 / -1;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.control input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.control output {
  min-width: 5.6em;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: right;
}

.toy-panels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.toy-panels figure {
  min-width: 0;
  padding: 10px 10px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.toy-panels .chart svg {
  touch-action: none;
}

.toy-panels .legend {
  justify-content: center;
  margin-top: 2px;
}

.readout {
  min-height: 1.6em;
  margin: 14px 0 4px;
  color: var(--ink);
  font-size: 0.93rem;
  text-align: center;
  text-wrap: balance;
}

.toy-note {
  margin: 0;
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}

/* BibTeX */

.code {
  position: relative;
  margin-top: 10px;
}

.code pre {
  overflow-x: auto;
  margin: 0;
  padding: 16px 74px 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.6;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

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

.btn:focus-visible,
.copy:focus-visible,
.seg button:focus-visible,
.tool:focus-visible,
.play:focus-visible,
.parts a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Footer */

.footer {
  margin-top: 24px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.86rem;
  text-align: center;
}

.footer p {
  margin: 4px 0;
}

@media (max-width: 1000px) {
  .panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toy-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .toy-bar .control:not(.control-time) {
    grid-column: span 3;
  }

  .mano {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toy-panels {
    grid-template-columns: minmax(0, 1fr);
    max-width: 520px;
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding-top: 48px;
  }

  .wide-only {
    display: none;
  }

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

  .parts {
    grid-template-columns: minmax(0, 1fr);
  }

  .toolbar .hint {
    display: none;
  }

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

@media (max-width: 640px) {
  .panels {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .toy-bar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .toy-bar .control:not(.control-time) {
    grid-column: span 2;
  }

  .toy-bar #toy-resample {
    grid-column: span 2;
    justify-self: center;
  }
}

@media (max-width: 480px) {
  .mtiles {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

  .btn,
  .play,
  .parts a {
    transition: none;
  }
}
