:root {
  color-scheme: light;
  --paper: #f8f5f0;
  --surface: #fcfaf6;
  --ink: #292725;
  --muted: #79736e;
  --rule: #d8d0c7;
  --accent: #873840;
  --tint: #eee4e2;
  --serif: "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  background: var(--paper);
}
body {
  margin: 0;
  color: var(--ink);
  font:
    14px/1.6 "Segoe UI",
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
}
button,
input {
  font: inherit;
}
button,
.upload {
  cursor: pointer;
}
button:focus-visible,
.upload:focus-within,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
header {
  max-width: 1600px;
  margin: auto;
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  border-bottom: 1px solid var(--rule);
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}
.brand strong {
  font:
    400 31px/1 Georgia,
    serif;
  letter-spacing: -1.8px;
}
.brand i {
  width: 1px;
  height: 21px;
  background: var(--rule);
}
.brand small {
  color: var(--muted);
  font-size: 12px;
}
.top-links {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}
.top-links a:hover {
  color: var(--accent);
}
.layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  max-width: 1600px;
  margin: auto;
  min-height: calc(100vh - 76px);
}
aside {
  padding: 38px 19px 32px 39px;
  border-right: 1px solid var(--rule);
}
.nav-caption {
  font: 11px var(--mono);
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 24px;
}
.nav-caption span {
  display: block;
  font: 500 18px/1.6 var(--serif);
  letter-spacing: 0;
  color: var(--ink);
  margin-top: 7px;
}
nav h4 {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin: 27px 0 8px;
  padding-left: 10px;
}
nav button {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  padding: 8px 10px;
  line-height: 1.45;
  border-left: 2px solid transparent;
  border-radius: 0;
  margin: 1px 0;
}
nav button:hover {
  background: #eee9e2;
}
nav button.active {
  background: var(--tint);
  border-left-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.nav-end {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-top: 28px;
  font-size: 11px;
  color: var(--muted);
}
main {
  min-width: 0;
  padding: 35px 40px 22px;
  align-self: start;
}
.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--ink);
}
#group {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.08em;
}
h1 {
  font: 400 clamp(32px, 3.5vw, 49px) / 1.18 var(--serif);
  letter-spacing: -0.035em;
  margin: 10px 0 5px;
}
#desc {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}
.experiment-number {
  font:
    400 52px/0.95 Georgia,
    serif;
  color: #b5a6a0;
  letter-spacing: -0.055em;
  text-align: right;
  min-width: 92px;
}
.experiment-number small {
  display: block;
  font: 10px/1.5 var(--mono);
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-top: 10px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 17px 0;
}
.toolbar .spacer {
  flex: 1;
}
button,
.upload {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 3px;
  white-space: nowrap;
}
.toolbar button:hover,
.upload:hover {
  background: #efeae2;
  border-color: #b6a8a0;
}
button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding-inline: 18px;
}
button.primary:hover {
  background: #6e2b32;
  border-color: #6e2b32;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}
.upload {
  position: relative;
}
.upload svg,
button svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 6px;
}
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.pane {
  min-width: 0;
  margin: 0;
}
.pane-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border-top: 1px solid var(--rule);
  padding: 10px 0 9px;
}
.pane-heading h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 0;
}
.pane-heading small {
  font: 11px var(--mono);
  color: var(--muted);
  text-align: right;
}
.stage {
  height: clamp(260px, 31vw, 460px);
  display: grid;
  place-items: center;
  background: #eae6df;
  border: 1px solid var(--rule);
  overflow: hidden;
  position: relative;
  padding: 16px;
  isolation: isolate;
}
.stage canvas,
.stage video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 1px 3px #30251d13;
}
.stage video {
  width: 100%;
  height: 100%;
}
.pane figcaption {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--muted);
}
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 30px;
}
.panel {
  min-width: 0;
  border-top: 1px solid var(--ink);
  padding-top: 15px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 11px;
  margin: 0 0 14px;
}
.panel-head span {
  font: 11px var(--mono);
  color: var(--accent);
}
.panel h3 {
  font: 400 20px/1.4 var(--serif);
  margin: 0;
}
.field {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  margin-top: 8px;
}
.field span:last-child {
  font: 12px var(--mono);
  color: var(--accent);
}
input[type="range"] {
  display: block;
  width: 100%;
  margin: 10px 0 16px;
  accent-color: var(--accent);
  height: 4px;
  cursor: pointer;
}
#params {
  color: var(--muted);
  font-size: 12px;
}
#status {
  font-size: 12px;
  color: var(--muted);
  margin: 14px 0 5px;
  white-space: pre-wrap;
}
#status::before {
  content: "•";
  color: var(--accent);
  margin-right: 7px;
}
#result {
  font: 12px/1.8 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 210px;
  overflow: auto;
  color: var(--ink);
}
#theory {
  font-size: 14px;
  line-height: 1.9;
  margin: 0 0 9px;
}
#note {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}
footer {
  border-top: 1px solid var(--rule);
  padding-top: 13px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
}
footer span:last-child {
  white-space: nowrap;
}
@media (max-width: 1100px) {
  header {
    padding-inline: 24px;
  }
  .layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }
  aside {
    padding-left: 24px;
  }
  main {
    padding-inline: 24px;
  }
  .stage {
    padding: 10px;
  }
}
@media (max-width: 760px) {
  header {
    min-height: 64px;
    padding-inline: 16px;
  }
  .brand {
    gap: 10px;
  }
  .brand strong {
    font-size: 25px;
  }
  .top-links {
    gap: 12px;
  }
  .brand small {
    font-size: 10px;
  }
  .top-links span {
    display: none;
  }
  .layout {
    display: block;
  }
  aside {
    padding: 12px 16px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .nav-caption,
  .nav-end,
  nav h4 {
    display: none;
  }
  nav {
    display: flex;
    overflow-x: auto;
    gap: 3px;
    scrollbar-width: thin;
  }
  nav button {
    width: auto;
    white-space: nowrap;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }
  nav button.active {
    border-bottom-color: var(--accent);
  }
  main {
    padding: 24px 16px;
  }
  .experiment-number {
    font-size: 38px;
    min-width: auto;
  }
  .work {
    gap: 10px;
  }
  .stage {
    height: clamp(150px, 36vw, 270px);
    padding: 6px;
  }
  .pane-heading small {
    font-size: 9px;
  }
  .pane-heading h3 {
    font-size: 12px;
  }
  .controls {
    gap: 20px;
  }
  .toolbar .spacer {
    display: none;
  }
  footer {
    flex-wrap: wrap;
  }
}
@media (max-width: 420px) {
  .brand small,
  .brand i {
    display: none;
  }
  .controls {
    grid-template-columns: 1fr;
  }
  .intro {
    gap: 6px;
  }
  .experiment-number small {
    font-size: 8px;
  }
  .pane figcaption {
    font-size: 10px;
  }
  .toolbar {
    gap: 5px;
  }
  .toolbar button,
  .upload {
    padding: 7px 9px;
  }
}

/* Extended workbench controls */
.extra-field {
  display: block;
  font-size: 12px;
  margin: 12px 0;
  color: var(--muted);
}
.extra-field input[type="text"],
.extra-field input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 2px;
  color: var(--ink);
}
.extra-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin: 9px 0;
}
.extra-consent {
  display: flex;
  gap: 5px;
  align-items: center;
  font-size: 12px;
  margin: 8px 0;
}
.extra-consent input {
  accent-color: var(--accent);
}
#detail-extra {
  font-size: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--rule);
}
#detail-extra:empty {
  display: none;
}
#sample {
  font: 12px inherit;
  font-family: inherit;
  font-size: 12px;
  border: 1px solid var(--rule);
  padding: 8px 10px;
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
  max-width: 100%;
}
.toolbar select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#params p {
  margin: 0 0 10px;
  line-height: 1.7;
}
#result {
  font-family: var(--mono);
  max-height: 360px;
}
.study-row {
  border-top: 1px solid var(--rule);
  padding-top: 10px;
  margin-top: 12px;
}
.study-row h4,
.hist-title {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 5px;
}
.study-row p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 0;
}
.histogram {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: none;
}
.hist-title {
  margin: 12px 0 8px;
}
.research-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--ink);
  padding-top: 19px;
  margin: 29px 0 17px;
}
.research-heading h2 {
  font: 400 25px/1.4 var(--serif);
  margin: 0;
  white-space: nowrap;
}
.research-heading p {
  font-size: 12px;
  color: var(--muted);
  max-width: 560px;
  margin: 0;
}
.research-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.research-figure {
  margin: 0;
  min-width: 0;
}
.research-figure h4 {
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 7px;
}
.research-figure canvas {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: #eae6df;
}
.research-figure figcaption {
  font: 11px/1.6 var(--mono);
  color: var(--muted);
  margin-top: 7px;
}
.pipeline-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.research-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.research-table th,
.research-table td {
  text-align: left;
  border-bottom: 1px solid var(--rule);
  padding: 9px 10px;
  vertical-align: top;
}
.research-table th {
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--ink);
}
.research-bars {
  display: grid;
  gap: 9px;
  margin: 20px 0;
}
.research-bar {
  display: grid;
  grid-template-columns: 110px 1fr 76px;
  gap: 12px;
  align-items: center;
  font-size: 11px;
}
.research-track {
  background: #e6e0d8;
  height: 8px;
}
.research-fill {
  background: var(--accent);
  height: 100%;
}
.research-bar:first-child .research-fill {
  background: #a59b91;
}
.research-bar span:last-child {
  text-align: right;
  font-family: var(--mono);
}
.extra-field select {
  display: block;
  margin-top: 6px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
}
.featured {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  padding: 11px 0 13px;
}
.featured > span {
  font: 11px var(--mono);
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-right: 8px;
}
.featured button {
  border: 0;
  padding: 6px 10px;
  background: #eee8df;
  color: var(--ink);
}
.featured button:hover {
  background: var(--tint);
  color: var(--accent);
}
.featured button:focus-visible {
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .research-grid,
  .pipeline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .research-heading {
    display: block;
  }
  .research-heading h2 {
    margin-bottom: 8px;
  }
  .research-table td,
  .research-table th {
    padding: 8px 4px;
  }
  .research-bar {
    grid-template-columns: 86px 1fr 60px;
    gap: 5px;
  }
}

.featured button.current {
  background: var(--tint);
  color: var(--accent);
  box-shadow: inset 0 -2px var(--accent);
}
.research-mode .stage {
  height: clamp(205px, 21vw, 300px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.research-mode .stage canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  object-fit: contain;
  box-shadow: none;
}
.research-mode .controls {
  margin-top: 18px;
}
.research-mode .research-heading {
  margin-top: 23px;
}
.research-figure canvas[role="button"] {
  cursor: zoom-in;
}
.research-figure canvas[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.sweep-plot {
  display: block;
  width: 100%;
  height: auto;
  max-width: 900px;
  margin: 12px 0;
  background: var(--paper);
}
#sweep-output:not(:empty) {
  border-top: 1px solid var(--rule);
  margin-top: 24px;
  padding-top: 14px;
}
#sweep-output h3 {
  font: 400 22px/1.3 var(--serif);
  margin: 8px 0;
}
#sweep-output p {
  font-size: 12px;
  color: var(--muted);
}
#figure-dialog {
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  max-width: 94vw;
  padding: 18px;
  margin: auto;
}
#figure-dialog::backdrop {
  background: #25201bc0;
}
#figure-dialog canvas {
  display: block;
  max-width: 85vw;
  max-height: 77vh;
  width: min(720px, 80vw);
  height: auto;
  object-fit: contain;
  margin: auto;
}
#figure-dialog header {
  border: 0;
  padding: 0 0 12px;
  min-height: 0;
  gap: 15px;
}
#figure-caption {
  font-size: 13px;
  max-width: 68vw;
}
#figure-close {
  padding: 4px 10px;
}
