:root {
  --paper: #f8f8f8;
  --ink: var(--black-80);
  --muted: var(--black-55);
  --line: var(--grid);
  --mono: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  --serif: 'Iowan Old Style', Georgia, serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 13px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; }
button:hover { filter: brightness(.88); }
button:disabled { cursor: default; opacity: .35; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--region-blue); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h2, h3 { font-size: 12px; font-weight: 500; }
.site-header { max-width: 1400px; margin: auto; padding: 0 32px; height: 76px; display: flex; align-items: center; gap: 27px; }
h1 { font-size: 20px; letter-spacing: -.5px; font-weight: 500; }
.model-label { color: var(--muted); font-family: var(--serif); font-size: 13px; }
.model-separator { margin: 0 9px; color: var(--black-35); }
.paper-link { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
main { max-width: 1400px; margin: auto; padding: 0 32px 28px; }
.experiment-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 28px; margin-bottom: 17px; color: var(--muted); font-size: 11px; }
.experiment-bar select { padding: 7px 9px; border: 1px solid var(--line); background: white; border-radius: 4px; color: var(--ink); }
.algorithm-link { margin-left: auto; font-size: 11px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 20px; align-items: start; }
.plot-card { background: white; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.plot-toolbar { height: 49px; padding: 0 21px; display: flex; align-items: center; justify-content: space-between; }
.plot-toolbar h2 { display: flex; align-items: baseline; gap: 12px; }
.dimension { font-family: var(--serif); color: var(--muted); font-weight: 400; }
.segmented { display: flex; padding: 3px; border-radius: 5px; background: var(--black-4); font-size: 11px; }
.segmented button { padding: 5px 9px; border-radius: 3px; color: var(--muted); }
.segmented button.selected { background: white; color: var(--region-blue); box-shadow: 0 1px 3px #0000000a; }
.transport { border-top: 1px solid var(--line); display: flex; align-items: center; height: 65px; gap: 23px; padding: 0 21px; }
.playback-buttons { display: flex; align-items: center; gap: 7px; }
.icon-button { width: 27px; height: 33px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; }
.icon-button svg { width: 17px; }
.play-button { display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--region-blue); color: white; height: 33px; min-width: 77px; border-radius: 4px; font-size: 11px; }
.play-button svg { width: 13px; }
.scrubber { flex: 1; min-width: 70px; }
.scrubber label { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 10px; margin-bottom: 9px; }
.scrubber strong { color: var(--ink); font: 11px var(--mono); margin-left: 4px; }
.round-total { color: var(--black-35); font: 9px var(--mono); margin-left: 4px; }
#timeline-phase { font-size: 10px; }
input[type=range] { appearance: none; -webkit-appearance: none; width: 100%; height: 3px; border-radius: 2px; background: var(--grid); display: block; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 11px; height: 11px; border: 2px solid white; background: var(--region-blue); border-radius: 50%; box-shadow: 0 0 0 1px var(--region-blue); }
input[type=range]::-moz-range-thumb { width: 8px; height: 8px; background: var(--region-blue); border: 2px solid white; border-radius: 50%; }
#speed { font-size: 10px; background: white; border: 1px solid var(--line); border-radius: 4px; padding: 6px; color: var(--muted); }
.plot-container { position: relative; border-top: 1px solid var(--line); background: white; }
#geometry { width: 100%; display: block; height: clamp(355px, 54vh, 540px); touch-action: pan-y; }
.plot-stamp { position: absolute; top: 17px; left: 22px; color: var(--muted); font: 10px var(--mono); pointer-events: none; }
.target-tool { position: absolute; top: 10px; right: 15px; font-size: 10px; color: var(--muted); border: 1px solid transparent; border-radius: 4px; padding: 5px 8px; }
.target-tool span { font-size: 16px; vertical-align: -1px; margin-right: 3px; }
.target-tool.active { color: var(--region-blue); border-color: var(--region-blue-65); background: var(--region-blue-15); }
.legend { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 24px; min-height: 45px; padding: 10px 12px; border-top: 1px solid var(--line); }
.legend label { position: relative; display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); cursor: pointer; user-select: none; }
.legend input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.legend input:focus-visible + span { outline: 2px solid var(--region-blue); outline-offset: 4px; }
.legend label:has(input:not(:checked)) { opacity: .4; }
.legend-key { display: inline-block; width: 10px; height: 10px; }
.region-key { border: 1px solid var(--feasible-contour); background: var(--region-blue-15); border-radius: 2px; }
.ellipse-key { width: 13px; height: 8px; border: 1.5px solid var(--region-blue); border-radius: 50%; transform: rotate(-25deg); background: linear-gradient(90deg,transparent 45%,var(--cut-orange) 45%,var(--cut-orange) 55%,transparent 55%); }
.target-key { font-size: 14px; line-height: 10px; color: var(--ink); }
.history-key { width: 13px; height: 0; border-top: 1px dashed var(--black-35); }
.experiment-settings { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 12px 1px 0; font-size: 10px; color: var(--muted); }
.setting-group { display: flex; align-items: center; gap: 8px; }
.experiment-settings select { font-size: 10px; padding: 5px 6px; border: 1px solid var(--line); background: white; border-radius: 4px; }
.experiment-settings input { width: 107px; font: 10px var(--mono); padding: 5px 6px; border: 1px solid var(--line); background: white; border-radius: 4px; }
.experiment-settings button { font-size: 10px; padding: 5px 8px; }
#apply-seed { border: 1px solid var(--line); border-radius: 4px; background: white; }
#new-run { margin-left: auto; color: var(--region-blue); }
.inspector { border: 1px solid var(--line); border-radius: 9px; background: white; padding: 20px; }
.main-equation { display: flex; align-items: center; justify-content: center; gap: 7px; font: 20px var(--serif); color: var(--region-blue); padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.main-equation .katex { font-size: .88em; }
.main-equation sub { font-size: 12px; transform: translate(-7px,8px); margin-right: -7px; }
.fraction { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; font-size: 23px; margin: 0 3px; }
.fraction>span:first-child { border-bottom: 1px solid var(--region-blue-65); padding: 0 4px 3px; }
.fraction>span:last-child { font-size: 20px; padding-top: 3px; }
.fraction sub { transform: none; margin: 0; font-size: 10px; vertical-align: -2px; }
.round-data { padding: 9px 0 14px; }
.data-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-top: 14px; font-size: 11px; color: var(--muted); }
.data-row output { font: 11px var(--mono); color: var(--ink); white-space: nowrap; }
.price-block { border-top: 1px solid var(--line); padding: 14px 0 0; }
h3 { font-size: 11px; color: var(--muted); font-weight: 400; }
#candidate-prices { display: grid; gap: 6px; margin-top: 8px; }
.candidate-price { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; color: var(--region-blue); font-size: 11px; }
.candidate-price output { font: 13px var(--mono); }
.candidate-price.selected, .candidate-price.selected output { font-weight: 700; }
[hidden] { display: none !important; }
.feedback-block { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 10px; }
.feedback { display: inline-flex; align-items: baseline; gap: 8px; font-size: 11px; color: var(--region-blue); white-space: nowrap; }
.feedback strong { font: 11px var(--mono); }
.feedback span { font-family: var(--serif); font-size: 12px; }
.feedback.neutral { color: var(--muted); }
.posterior-data { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 18px; }
.parameters-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; white-space: nowrap; font-size: 10px; }
#posterior-definition { color: var(--region-blue); }
#posterior-definition .katex { font-size: 1.05em; }
.parameter-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; }
.parameter-row output { font-size: 11px; }
#axes-value { font: 12px var(--mono); color: var(--cut-orange); white-space: nowrap; }
.evolution { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 15px; }
.chart-container { min-width: 0; }
.chart-legend { display: grid; gap: 7px; margin-bottom: 10px; font-size: 10px; }
.chart-legend>span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend small { color: var(--muted); font-size: inherit; }
.chart-key { width: 14px; border-top: 2px solid var(--potential-color); }
.potential-legend { color: var(--potential-color); }
.loss-legend { color: var(--loss-red); }
.history-formula { margin: 10px 0 5px; padding: 3px 0; font-size: 9px; line-height: 1.8; color: var(--muted); overflow-x: auto; overflow-y: hidden; }
.loss-key { border-color: var(--loss-red); border-top-style: dashed; }
#evolution-chart { width: 100%; display: block; cursor: crosshair; overflow: visible; }
#geometry text, #evolution-chart text { font-family: var(--mono); }
#geometry .math-label { font-family: var(--serif); font-style: italic; }
.geometry-dragging { cursor: crosshair; touch-action: none!important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.algorithms { display: grid; gap: 22px; margin-top: 24px; scroll-margin-top: 20px; }
.algorithm-card { background: white; border: 1px solid var(--line); border-radius: 7px; padding: 22px 28px; }
.algorithm-card.selected { border-color: var(--region-blue-65); }
.algorithm-card header { display: flex; align-items: baseline; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--black-25); margin-bottom: 15px; }
.algorithm-number { font-size: 11px; color: var(--muted); white-space: nowrap; }
.algorithm-card h2 { font: 18px var(--serif); }
.algorithm-body { font: 15px/1.65 var(--serif); }
.algorithm-body ol { margin: 12px 0 0; padding-left: 24px; }
.algorithm-body li { padding: 7px 10px; border-left: 2px solid transparent; }
.algorithm-card.selected li.active { background: #f4f7fa; border-left-color: var(--region-blue); }
.algorithm-body .katex { font-size: 1em; }
.algorithm-body .katex-display { margin: 12px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }
@media(max-width:1100px) {
  .site-header { padding: 0 23px; gap: 20px; }
  main { padding: 0 23px 23px; }
  .workspace { grid-template-columns: minmax(0,1fr) 250px; gap: 16px; }
  .inspector { padding: 17px; }
  .legend { gap: 14px; }
  .legend label { font-size: 9px; }
  .transport { gap: 14px; padding: 0 15px; }
}
@media(max-width:800px) {
  .algorithm-link { margin-left: 0; }
  .site-header { height: auto; min-height: 79px; flex-wrap: wrap; gap: 7px 20px; padding-top: 17px; padding-bottom: 17px; }
  h1 { font-size: 19px; }
  .model-label { order: 3; width: 100%; font-size: 12px; }
  .workspace { grid-template-columns: minmax(0,1fr); }
  #geometry { height: auto; aspect-ratio: 800/530; }
  .inspector { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 25px; }
  .main-equation { grid-column: 1; grid-row: 1; padding: 3px 0; border: 0; }
  .round-data { grid-column: 1; grid-row: 2; padding: 0; }
  .round-data .data-row:first-child { margin-top: 0; }
  .price-block { grid-column: 2; grid-row: 1/3; border: 0; border-left: 1px solid var(--line); padding: 5px 0 0 23px; }
  .posterior-data { grid-column: 2; margin-top: 0; }
  .evolution { grid-column: 1/-1; margin-top: 0; }
  .chart-container { max-width: 360px; margin-inline: auto; }
  #evolution-chart { max-height: 220px; }
}
@media(max-width:500px) {
  .experiment-bar { gap: 10px; }
  .experiment-bar .setting-group { width: 100%; justify-content: space-between; }
  .experiment-bar select { max-width: 78%; }
  .algorithm-card { padding: 16px 13px; }
  .algorithm-card header { flex-wrap: wrap; gap: 5px 10px; }
  .algorithm-card h2 { font-size: 16px; }
  .algorithm-body { font-size: 13px; }
  .site-header { padding-left: 15px; padding-right: 15px; }
  h1 { font-size: 17px; }
  .paper-link { font-size: 10px; }
  main { padding: 0 12px 18px; }
  .plot-toolbar { padding: 0 13px; height: 46px; }
  .segmented { font-size: 10px; }
  .segmented button { padding: 5px 7px; }
  .transport { padding: 0 10px; gap: 10px; }
  .playback-buttons { gap: 2px; }
  .icon-button { width: 21px; }
  .play-button { min-width: 61px; }
  #timeline-phase { display: none; }
  #speed { padding: 5px 2px; }
  #geometry { min-height: 290px; }
  .plot-stamp { left: 14px; font-size: 9px; }
  .target-tool { right: 8px; font-size: 9px; }
  .legend { gap: 12px; padding: 11px; }
  .legend label { font-size: 9px; }
  .inspector { gap: 16px; padding: 16px; }
  .data-row, .data-row output { font-size: 10px; }
  .price-block { padding-left: 15px; }
  .feedback span { display: none; }
  .posterior-data { grid-column: 1/-1; }
  #axes-value { font-size: 11px; }
}
