:root {
  color-scheme: dark;
  --bg: #101117;
  --panel: #171820;
  --inset: #101117;
  --line: #2c2d39;
  --line-strong: #373846;
  --text: #f2f1f9;
  --muted: #a2a3b5;
  --quiet: #85869e;
  --accent: #c8adff;
  --accent-strong: #b49afa;
  --accent-wash: #29233e;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 300px;
  color: var(--text);
  background: radial-gradient(ellipse at 18% 0, #1d172e 0, transparent 480px), var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); }

.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.accent { color: var(--accent); }
.shell { width: min(1410px, calc(100% - 72px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid #ffffff11; background: #13131caa; }
.header-content { display: flex; align-items: center; gap: 15px; height: 65px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 740; letter-spacing: -.05em; }
.header-divider { height: 18px; width: 1px; background: var(--line-strong); margin-inline: 2px; }
.product-label, .eyebrow { color: var(--accent); font: 650 10px/1.25 var(--mono); letter-spacing: .115em; }
.product-label { color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 30px; padding: 7px 11px; color: var(--muted); font: 11px/1.2 var(--mono); white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #d9b479; }
.status-badge[data-backend="gpu"] .status-dot { background: #76deb3; box-shadow: 0 0 9px #76deb366; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 7px; background: #20212b; padding: 0 10px; height: 34px; font-size: 12px; font-weight: 620; white-space: nowrap; }
.button:not(:disabled):hover { background: #2b2c3c; border-color: #54536b; }
.method-button { background: #1a1b24; }

.hero { display: flex; align-items: end; justify-content: space-between; gap: 25px; padding: 36px 0 28px; }
.hero .eyebrow { display: flex; align-items: center; gap: 9px; }
.section-dash { display: inline-block; width: 19px; height: 2px; background: var(--accent); }
.eyebrow-divider { color: #77738d; }
.hero h1 { margin: 8px 0 7px; font-size: clamp(40px, 4.15vw, 61px); line-height: 1.04; font-weight: 740; letter-spacing: -.065em; }
.hero-copy { color: #bcbbcd; font-size: 15px; line-height: 1.5; }
.workflow { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 600; padding-bottom: 5px; }
.workflow span { white-space: nowrap; }
.workflow b { color: var(--accent); margin-right: 3px; font: 11px var(--mono); }
.workflow i { display: block; width: 16px; height: 1px; background: #4e465e; }

.workspace { display: grid; align-items: start; grid-template-columns: minmax(323px, 1.05fr) minmax(220px, .67fr) minmax(363px, 1.33fr); gap: 16px; }
.panel { padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); min-width: 0; box-shadow: 0 12px 26px #0002; }
.panel-heading { margin-bottom: 17px; }
.panel-heading h2 { margin: 5px 0 3px; font-size: 23px; font-weight: 690; letter-spacing: -.035em; }
.panel-heading p { color: var(--muted); font-size: 12px; line-height: 1.45; }

label, .seed-settings { color: var(--muted); font-size: 11px; font-weight: 620; }
select, .number { min-width: 0; height: 34px; width: 100%; color: var(--text); border: 1px solid var(--line-strong); border-radius: 6px; background: var(--inset); padding: 0 8px; font-size: 12px; }
select { cursor: pointer; padding-right: 23px; appearance: none; background: var(--inset) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%23aaa7bd' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 6px center; }
label > select { display: block; margin-top: 6px; }
.editor-selects { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, .85fr) minmax(0, 1fr); gap: 8px; }
.editor-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 11px; }
.tool-group { display: inline-flex; align-items: center; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--inset); }
.tool { height: 28px; min-width: 29px; padding: 0 7px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; }
.tool.active, .tool.active:not(:disabled):hover { background: var(--accent-wash); color: #dbcaff; border-color: #443660; }
.zoom-step { font: 16px var(--mono); }
.zoom-value { min-width: 40px; font: 10px var(--mono); }

.editor-chart { display: grid; grid-template-columns: 15px minmax(0, 1fr); grid-template-rows: auto 15px; gap: 5px 6px; }
.viewport { aspect-ratio: 1; overflow: auto; border: 1px solid var(--line-strong); background: #101117; border-radius: 5px; scrollbar-color: #5b5372 #181820; }
#paint { display: block; width: 100%; height: auto; aspect-ratio: 1; cursor: crosshair; touch-action: none; }
#paint[data-tool="pan"] { cursor: grab; }
#paint[data-panning] { cursor: grabbing; }
#paint:focus-visible { outline-offset: -3px; }
.axis-y, .axis-x { display: flex; justify-content: space-between; align-items: center; color: var(--quiet); font: 9px/1 var(--mono); }
.axis-y { flex-direction: column; }
.axis-x { grid-column: 2; }
.axis-y b, .axis-x b { color: #b6a8ce; font-weight: 600; }
.editor-readout { display: flex; justify-content: space-between; gap: 5px; margin: 7px 0 13px; color: var(--muted); font: 10px/1.3 var(--mono); }
.editor-readout span:last-child { white-space: nowrap; }
.brush-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.brush-settings label > span { display: flex; justify-content: space-between; gap: 4px; }
output { color: var(--accent); font: 10px/1.4 var(--mono); }
.fine-print { color: var(--quiet); font-size: 11px; line-height: 1.45; }
#paint-help { margin-top: 8px; }

#run-form { display: flex; flex-direction: column; gap: 15px; }
.form-select { display: block; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.field-heading .number { width: 79px; height: 30px; text-align: right; font: 12px var(--mono); }
.number { appearance: textfield; }
.number::-webkit-inner-spin-button, .number::-webkit-outer-spin-button { appearance: none; }
input[type="range"] { accent-color: var(--accent-strong); margin: 8px 0 2px; width: 100%; height: 16px; cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--quiet); font: 10px/1.3 var(--mono); }
.seed-settings { margin-top: -3px; }
.seed-settings summary { width: fit-content; cursor: pointer; }
.seed-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; margin-top: 6px; }
.seed-row input { font: 11px var(--mono); padding-inline: 6px; }
.seed-row .button { padding-inline: 6px; font-size: 11px; }
.mechanism-note { display: flex; align-items: flex-start; gap: 7px; color: var(--accent); background: #221e32; border: 1px solid #352b4c; border-radius: 7px; padding: 10px 8px; }
.mechanism-note .icon { width: 15px; height: 15px; }
.mechanism-note strong { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 650; }
.mechanism-note span { display: block; color: #bbadcf; font: 10px/1.35 var(--mono); }
.run-button { height: 40px; width: 100%; border-color: #cfb8ff; background: #c4a8ff; color: #191125; font-weight: 730; font-size: 13px; }
.run-button:not(:disabled):hover { background: #dbc5ff; border-color: #eadbff; }
.run-button .icon { width: 16px; height: 16px; }
.run-status { margin-top: -8px; min-height: 1.45em; }
.run-status[data-state="stale"] { color: #e0b982; }

.result-heading { display: flex; justify-content: space-between; align-items: end; gap: 8px; }
.result-palette { min-width: 105px; }
.result-palette select { height: 31px; }
.scoreboard { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #1d1b29; border: 1px solid #332e45; border-radius: 8px; margin-bottom: 14px; }
.scoreboard > div { padding: 9px clamp(5px, 1vw, 12px); }
.scoreboard > div + div { border-left: 1px solid #332e45; }
.scoreboard span { display: block; margin-bottom: 3px; color: #bdb1d4; font: 600 9px/1.35 var(--mono); letter-spacing: .07em; }
.scoreboard strong { display: block; font: 650 21px/1.12 var(--mono); color: #eadfff; }
.plot-heading { display: flex; align-items: center; justify-content: space-between; gap: 5px; margin-bottom: 8px; }
.plot-heading h3 { font-size: 13px; font-weight: 660; }
.plot-heading span { color: var(--quiet); font-size: 10px; }
.plots { display: grid; grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr)); gap: 7px; }
.plot-card { margin: 0; min-width: 0; overflow: hidden; border: 1px solid #343446; border-radius: 7px; background: #1d1d28; }
.plot-card canvas { display: block; width: 100%; aspect-ratio: 1; height: auto; image-rendering: pixelated; background: #171323; cursor: crosshair; }
.plot-card canvas:focus-visible { outline-offset: -2px; }
.plot-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 3px; padding: 6px; color: var(--muted); font: 10px/1.3 var(--mono); white-space: nowrap; }
.plot-card figcaption span:first-child { color: var(--text); }
.legend { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; align-items: center; gap: 7px; margin-top: 7px; color: var(--quiet); font: 9px/1.2 var(--mono); }
.legend.symmetric { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr) max-content; }
.legend-bar { height: 5px; border-radius: 8px; border: 1px solid #ffffff1a; }
.loss-section { padding-top: 11px; margin-top: 11px; border-top: 1px solid var(--line); }
.loss-section .tool { height: 24px; }
.result-readout { margin-top: 10px; min-height: 2.6em; color: var(--muted); font: 10px/1.35 var(--mono); }
.batch-info { margin-top: 4px; }
.empty-results { min-height: 240px; display: grid; place-items: center; padding: 15px; text-align: center; color: var(--muted); background: var(--inset); border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 13px; }

.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 19px; color: var(--quiet); font: 10px/1.35 var(--mono); }
.site-footer span:first-child { display: flex; align-items: center; gap: 6px; }
.site-footer .icon { color: var(--accent); }
dialog { width: min(600px, calc(100% - 32px)); max-height: calc(100% - 32px); border: 1px solid #4a405f; border-radius: 12px; background: #1a1924; color: var(--text); padding: 20px; }
dialog::backdrop { background: #0a0812cc; }
.dialog-header { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.dialog-header h2 { font-size: 22px; }
dialog ul { padding-left: 21px; }
.dialog-header + p { margin-top: 12px; }
dialog li, dialog p { margin-bottom: 10px; color: #c7c5d6; font-size: 14px; line-height: 1.55; }
dialog a { font-size: 13px; }

@media (max-width: 1100px) {
  .shell { width: calc(100% - 40px); }
  .workspace { gap: 11px; }
  .panel { padding: 13px; }
}
@media (max-width: 990px) {
  .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: 14px; }
  .panel { padding: 17px; }
  .results { grid-column: 1 / -1; }
}
@media (max-width: 615px) {
  .shell { width: calc(100% - 24px); }
  .hero { padding-top: 26px; padding-bottom: 21px; }
  .workflow, .product-label, .header-divider { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results { grid-column: auto; }
  .panel { padding: 14px; }
  .hero-copy { font-size: 14px; }
  .site-footer span:last-child { text-align: right; }
}
@media (max-width: 374px) {
  .plots { gap: 4px; }
  .plot-card figcaption { font-size: 9px; padding-inline: 3px; }
}
