:root {
  color-scheme: dark;
  --bg: #10151b;
  --panel: #151b22;
  --stage: #10171d;
  --raised: #1d252e;
  --border: #2b343e;
  --grid: #253039;
  --text: #e9eee9;
  --muted: #99a6af;
  --faint: #7d8a94;
  --accent: #c5ed99;
  --accent-dark: #203124;
  --cell: #b8e891;
  --young: #74b9a0;
  --ghost: #426355;
  --mono:
    ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
body {
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s;
}
button:hover {
  background: var(--raised);
  border-color: #596775;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button.active {
  color: var(--accent);
  background: var(--accent-dark);
  border-color: #486140;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a2b1a;
  font-weight: 650;
}
button.primary:hover {
  background: #d5f7b0;
}
button.danger {
  color: #f8a6a0;
}
svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
a {
  color: var(--accent);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input,
textarea,
select {
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 11px;
}
input::placeholder,
textarea::placeholder {
  color: var(--faint);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}
kbd {
  font: 10px var(--mono);
  padding: 3px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  white-space: nowrap;
}
h1,
h2,
h3,
p {
  margin: 0;
}
.icon-button {
  width: 34px;
  flex-shrink: 0;
  padding: 7px;
}
.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
.eyebrow {
  display: block;
  color: var(--faint);
  font: 9px var(--mono);
  letter-spacing: 1.6px;
}
.app-header {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 27px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--text);
  font-size: 23px;
  letter-spacing: -0.8px;
  font-weight: 650;
  flex-shrink: 0;
}
.brand small {
  display: block;
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: 1.5px;
  margin-top: 4px;
}
.back-link {
  text-decoration: none;
  color: var(--faint);
  font-size: 11px;
}
.back-link span {
  color: var(--accent);
  margin-left: 3px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.count {
  font: 10px var(--mono);
  padding: 2px 4px;
  background: var(--raised);
  color: var(--accent);
  border-radius: 3px;
}
.app-layout {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  height: calc(100dvh - 76px);
}
.sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}
.sidebar-heading {
  padding: 25px 20px 19px;
}
.sidebar-heading h2 {
  font-size: 14px;
  letter-spacing: -0.2px;
  font-weight: 600;
  margin-bottom: 7px;
}
.sidebar-heading h2 span {
  font: 10px var(--mono);
  color: var(--faint);
  margin-left: 6px;
}
.segmented {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  margin: 0 16px 14px;
}
.segmented button {
  min-height: 29px;
  flex: 1;
  border: 0;
  font-size: 11px;
  color: var(--muted);
}
.segmented button.active {
  background: var(--raised);
  color: var(--text);
}
.segmented span {
  color: var(--faint);
  font-size: 10px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 16px 13px;
}
.search-box svg {
  position: absolute;
  left: 10px;
  color: var(--faint);
  width: 14px;
}
.search-box input {
  width: 100%;
  padding: 9px 10px 9px 32px;
  font-size: 11px;
}
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 16px 17px;
}
.categories button {
  font-size: 10px;
  min-height: 25px;
  border-radius: 5px;
  padding: 4px 7px;
  color: var(--muted);
  border-color: transparent;
  background: #ffffff04;
}
.categories button.active {
  background: var(--accent-dark);
  color: var(--accent);
  border-color: #516648;
}
.pattern-list {
  overflow: auto;
  flex: 1;
  padding: 0 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.pattern-card {
  padding: 12px 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 7px;
  margin-bottom: 9px;
  transition: border-color 0.15s;
}
.pattern-card:hover {
  border-color: #4b5a64;
}
.pattern-card.selected {
  border-color: #779b58;
  background: #1c2921;
}
.pattern-card-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
}
.pattern-thumb {
  width: 44px;
  height: 39px;
  flex-shrink: 0;
  background: #121b18;
  border: 1px solid #27382c;
  border-radius: 5px;
  padding: 4px;
}
.pattern-thumb svg {
  width: 100%;
  height: 100%;
  fill: var(--accent);
  stroke: none;
}
.pattern-card h3 {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  line-height: 1.3;
}
.pattern-meta {
  font: 9px var(--mono);
  color: var(--faint);
}
.pattern-card p {
  font-size: 10px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 9px;
}
.pattern-card-actions {
  display: flex;
  gap: 5px;
}
.pattern-card-actions button {
  font-size: 10px;
  min-height: 25px;
  padding: 4px 8px;
}
.pattern-card-actions button:first-child {
  flex: 1;
}
.pattern-card-actions .icon-button {
  width: 27px;
}
.pattern-card-actions svg {
  width: 12px;
  height: 12px;
}
.pattern-empty {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  padding: 20px 8px;
}
.pattern-notes-link {
  padding: 0;
  min-height: 24px;
  margin: -3px 0 7px;
  border: 0;
  color: var(--accent);
  font-size: 10px;
  gap: 6px;
}
.pattern-notes-link svg {
  width: 11px;
  height: 11px;
}
.specimen-dialog {
  width: min(680px, calc(100vw - 28px));
}
.specimen-overview {
  display: flex;
  gap: 22px;
  align-items: center;
  margin: 16px 0;
}
.specimen-preview {
  width: 144px;
  height: 144px;
  padding: 8px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--stage);
}
.specimen-preview svg {
  width: 100%;
  height: 100%;
  fill: var(--accent);
  stroke: none;
}
.specimen-preview .missing-cell-marker {
  fill: none;
  stroke: var(--chart-deaths);
  stroke-width: 0.7;
}
.specimen-facts {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 12px;
}
.specimen-facts dt {
  font: 9px var(--mono);
  color: var(--faint);
  margin-bottom: 7px;
}
.specimen-facts dd {
  font: 13px var(--mono);
  color: var(--text);
  margin: 0;
}
.specimen-trace {
  background: var(--stage);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 10px 3px;
  margin-bottom: 20px;
}
.specimen-trace > span {
  font: 8px var(--mono);
  letter-spacing: 0.5px;
  color: var(--muted);
  padding-left: 7px;
}
.specimen-trace svg {
  display: block;
  width: 100%;
  height: auto;
  fill: var(--accent);
  stroke: none;
}
.specimen-trace text {
  font: 9px monospace;
  fill: var(--muted);
}
.reference-grid {
  stroke: var(--grid);
  fill: none;
  stroke-width: 1;
}
.reference-fill {
  fill: var(--accent);
  opacity: 0.13;
}
.reference-curve {
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
}
.specimen-dialog h3 {
  font-size: 13px;
  font-weight: 500;
}
.specimen-watch {
  padding-left: 18px;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.specimen-watch li + li {
  margin-top: 7px;
}
.specimen-origin {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.specimen-origin summary {
  cursor: pointer;
  color: var(--text);
  font-size: 11px;
}
.specimen-origin p {
  font-size: 11px;
}
.specimen-origin a,
.specimen-downloads a {
  color: var(--accent);
  font-size: 10px;
  text-underline-offset: 3px;
}
.specimen-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 18px;
}
.gun-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--stage);
  flex-shrink: 0;
}
.gun-controls > div {
  flex: 1;
  min-width: 0;
}
.gun-controls strong {
  display: block;
  font-size: 11px;
}
.gun-controls span {
  display: block;
  margin-top: 4px;
  font: 9px var(--mono);
  color: var(--muted);
}
.gun-controls button {
  font-size: 10px;
  padding: 7px 9px;
  white-space: nowrap;
}
.specimen-firing {
  margin: 20px 0;
}
.specimen-firing .hint {
  font-size: 10px;
}
.firing-lane {
  margin-top: 14px;
}
.firing-lane > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}
.firing-lane > div:first-child span {
  color: var(--muted);
}
.firing-track {
  position: relative;
  height: 18px;
  margin: 5px 5px 0;
  background: linear-gradient(
    transparent 8px,
    var(--border) 8px,
    var(--border) 10px,
    transparent 10px
  );
}
.firing-dot {
  position: absolute;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.firing-lane:nth-child(2) .firing-dot {
  background: #e9be82;
}
.firing-lane:nth-child(3) .firing-dot {
  background: #9bb9f6;
}
.firing-lane small {
  font: 9px var(--mono);
  color: var(--muted);
}
.firing-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font: 9px var(--mono);
  color: var(--faint);
}
@media (max-width: 570px) {
  .gun-controls {
    flex-wrap: wrap;
    gap: 5px;
    padding: 8px;
  }
  .gun-controls > div {
    flex-basis: 100%;
  }
  .gun-controls strong,
  .gun-controls span {
    display: inline;
  }
  .gun-controls span {
    margin-left: 8px;
    font-size: 8px;
  }
  .gun-controls button {
    flex: 1;
    padding: 5px 7px;
    font-size: 9px;
  }
  .specimen-dialog {
    padding: 18px;
  }
  .specimen-overview {
    gap: 12px;
  }
  .specimen-preview {
    width: 92px;
    height: 110px;
  }
  .specimen-facts {
    gap: 15px 8px;
  }
  .specimen-facts dt {
    font-size: 8px;
  }
  .specimen-facts dd {
    font-size: 10px;
  }
  .specimen-dialog .dialog-actions {
    justify-content: stretch;
  }
  .specimen-dialog .dialog-actions button {
    flex: 1;
    font-size: 10px;
  }
}
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 17px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-footer p {
  font-size: 10px;
  color: var(--faint);
  line-height: 1.7;
}
.sidebar-footer strong {
  font-weight: 400;
  color: var(--muted);
}
.sidebar-footer button {
  margin-left: auto;
}
.tiny-glider {
  font: 12px/10px var(--mono);
  letter-spacing: 1px;
  color: var(--accent);
}
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0 24px;
}
.experiment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 91px;
  flex-shrink: 0;
}
.experiment-title .eyebrow {
  margin-bottom: 5px;
}
.experiment-title input {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.6px;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 0;
  width: min(390px, 36vw);
  text-overflow: ellipsis;
}
.experiment-title input:hover {
  border-bottom-color: var(--border);
}
.experiment-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 10px var(--mono);
  color: var(--muted);
  padding: 7px 9px;
  border-radius: 5px;
  background: var(--panel);
}
.status-pill > span {
  background: #f0c582;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.status-pill.running > span {
  background: var(--accent);
}
.experiment-actions button {
  font-size: 11px;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-bottom: 0;
  padding: 9px 11px;
  border-radius: 8px 8px 0 0;
  background: var(--panel);
  flex-shrink: 0;
}
.tool-group {
  display: flex;
  gap: 4px;
}
.tool-group .icon-button {
  border-color: transparent;
}
.tool-group .icon-button.active {
  border-color: #455d3d;
}
.toolbar-divider {
  height: 21px;
  border-left: 1px solid var(--border);
  margin: 0 2px;
}
.toolbar-spacer {
  flex: 1;
}
.editor-toolbar > button {
  font-size: 11px;
}
.canvas-wrap {
  container-type: size;
  position: relative;
  flex: 1;
  min-height: 180px;
  overflow: hidden;
  background: var(--stage);
  border: 1px solid var(--border);
}
#board {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  outline-offset: -3px;
}
#board[data-tool="pan"] {
  cursor: grab;
}
#board.dragging {
  cursor: grabbing;
}
.canvas-topline,
.canvas-bottomline {
  position: absolute;
  left: 17px;
  right: 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  font: 9px var(--mono);
  color: var(--faint);
}
.canvas-topline {
  top: 15px;
}
.canvas-bottomline {
  bottom: 15px;
  justify-content: flex-start;
  gap: 22px;
}
.universe-label {
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 1px;
  background: var(--stage);
  padding: 3px;
}
.universe-label span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.rule-chip {
  min-height: 23px;
  pointer-events: auto;
  font: 9px var(--mono);
  padding: 4px 6px;
  background: var(--stage);
  color: var(--muted);
}
.zoom-controls {
  position: absolute;
  right: 13px;
  bottom: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 4px 15px #0003;
}
.zoom-controls button {
  min-height: 27px;
  height: 27px;
  border: 0;
  font: 10px var(--mono);
  padding: 5px;
  width: 28px;
}
.zoom-controls #zoom-reset {
  width: 48px;
}
.zoom-controls svg {
  width: 15px;
}
.zoom-controls > span {
  border-left: 1px solid var(--border);
  height: 17px;
  margin: 0 4px;
}
.empty-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  width: 90%;
}
.empty-hint h2 {
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.6px;
  margin: 12px 0;
}
.empty-hint p {
  color: var(--muted);
  font-size: 12px;
}
.welcome-rules {
  max-width: 420px;
  margin: 18px auto 0;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}
.welcome-rules h3 {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 9px;
}
.welcome-rules p,
.welcome-rules li {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}
.welcome-rules strong {
  color: var(--text);
}
.welcome-rules ul {
  margin: 10px 0;
  padding-left: 16px;
}
.welcome-rules li + li {
  margin-top: 6px;
}
.welcome-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 11px;
}
.welcome-actions button,
.welcome-actions a {
  pointer-events: auto;
  font-size: inherit;
}
.welcome-actions button {
  background: var(--panel);
}
@container (max-height: 400px) {
  .welcome-rules {
    display: none;
  }
}
.stamp-banner {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #567549;
  background: var(--accent-dark);
  padding: 7px 9px 7px 13px;
  border-radius: 6px;
  box-shadow: 0 4px 15px #0003;
  font-size: 11px;
  max-width: 95%;
  color: var(--accent);
}
.stamp-banner button {
  font-size: 10px;
  min-height: 27px;
  padding: 4px 6px;
}
.stamp-banner .icon-button {
  width: 25px;
}
.stamp-hint {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}
.transport {
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-top: 0;
  padding: 12px;
  background: var(--panel);
  border-radius: 0 0 8px 8px;
  flex-shrink: 0;
}
.playback {
  display: flex;
  align-items: center;
  gap: 5px;
}
.playback button {
  font-size: 11px;
}
.playback > .icon-button {
  border-color: transparent;
  margin-right: 4px;
}
.play-button {
  min-width: 111px;
}
.play-button kbd {
  border-color: #6f98544d;
  color: #355123;
  margin-left: 6px;
  font-size: 9px;
  padding: 1px 4px;
}
.play-button svg {
  width: 14px;
}
.speed-control {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 10px;
  margin-left: auto;
}
.speed-control input {
  width: 100px;
  height: 18px;
}
.speed-control output {
  font: 10px var(--mono);
  width: 68px;
  color: var(--text);
}
.checkpoint {
  font-size: 10px;
  border-color: transparent;
  padding: 6px;
  color: var(--muted);
}
.checkpoint svg {
  width: 14px;
}
.statistics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px 18px;
  flex-shrink: 0;
}
.statistics > div > span {
  display: block;
  font: 8px var(--mono);
  letter-spacing: 1.1px;
  color: var(--faint);
  margin-bottom: 8px;
}
.statistics strong {
  font: 21px var(--mono);
  font-weight: 400;
  letter-spacing: -0.6px;
}
.statistics .change-stat strong {
  font-size: 17px;
}
.change-stat b {
  font-weight: 400;
}
.change-stat #births {
  color: var(--accent);
}
.change-stat #deaths {
  color: #ce9387;
}
.change-stat em {
  font-style: normal;
  color: var(--faint);
}
.statistics .bounds-stat strong {
  font-size: 17px;
}
.statistics .outcome-stat strong {
  font: 11px var(--mono);
  color: var(--accent);
  letter-spacing: 0;
  display: block;
  max-width: 175px;
  line-height: 1.5;
}
.outcome-stat {
  min-width: 125px;
}
.history-stat canvas {
  width: 130px;
  height: 30px;
  display: block;
}
.workspace-footer {
  margin-top: auto;
  padding: 12px 1px 15px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 9px;
  flex-shrink: 0;
}
.workspace-footer > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.connection-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.workspace-footer button {
  border: 0;
  padding: 0;
  min-height: 20px;
  color: var(--faint);
  font-size: 9px;
}
.workspace-footer kbd {
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 4px;
}
.mobile-only {
  display: none;
}
dialog {
  width: min(540px, calc(100vw - 28px));
  max-height: calc(100dvh - 40px);
  background: var(--panel);
  border: 1px solid #46515c;
  border-radius: 12px;
  color: var(--text);
  padding: 25px;
  box-shadow: 0 25px 100px #0008;
}
dialog::backdrop {
  background: #050a10aa;
  backdrop-filter: blur(5px);
}
.wide-dialog {
  width: min(880px, calc(100vw - 28px));
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 17px;
}
.dialog-heading .eyebrow {
  color: var(--accent);
  font-size: 8px;
}
.dialog-heading h2 {
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.6px;
  margin-top: 7px;
}
.dialog-heading button {
  border-color: transparent;
  align-self: flex-start;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}
.wrap-actions {
  flex-wrap: wrap;
}
.dialog-actions button {
  font-size: 11px;
}
dialog p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.75;
  margin: 10px 0 17px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 11px;
  margin: 17px 0;
}
.field input,
.field textarea,
.field select {
  width: 100%;
}
.field textarea {
  font: 11px/1.6 var(--mono);
}
.field .optional {
  color: var(--faint);
  font-size: 10px;
}
.input-action {
  display: flex;
  gap: 7px;
}
.input-action input {
  flex: 1;
}
.input-action button {
  flex-shrink: 0;
  font-size: 11px;
}
.field-row {
  display: flex;
  gap: 14px;
}
.field-row .field {
  flex: 1;
}
.file-drop {
  display: block;
  cursor: pointer;
  border: 1px dashed #4b5e55;
  padding: 18px;
  background: var(--accent-dark);
  border-radius: 6px;
  color: var(--accent);
  font-size: 12px;
}
.file-drop input {
  margin-top: 10px;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}
.hint,
dialog .hint {
  font-size: 10px;
  line-height: 1.7;
  color: var(--faint);
}
.form-error,
dialog .form-error {
  color: #f6ab9e;
  font-size: 11px;
  line-height: 1.6;
  min-height: 0;
  margin: 8px 0;
}
.form-error:empty {
  display: none;
}
.settings-options {
  margin: 18px 0;
  border-top: 1px solid var(--border);
}
.settings-options > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}
.settings-options small {
  display: block;
  font-size: 10px;
  color: var(--faint);
  margin-top: 4px;
}
.bench-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.bench-toolbar label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
}
.bench-toolbar select {
  padding: 8px;
}
.bench-toolbar button {
  font-size: 11px;
}
.bench-toolbar .primary {
  margin-left: auto;
}
.bench-results {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.bench-results table {
  width: 100%;
  border-collapse: collapse;
  font: 11px var(--mono);
}
.bench-results th {
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--faint);
  padding: 12px 10px;
  background: var(--bg);
  font-weight: 400;
  white-space: nowrap;
}
.bench-results td {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  font-size: 10px;
  line-height: 1.6;
}
.bench-results td:first-child {
  min-width: 130px;
  font-family: var(--sans);
  font-size: 12px;
}
.bench-results td small {
  display: block;
  font: 9px var(--mono);
  color: var(--faint);
}
.bench-results td:last-child {
  color: var(--accent);
}
.bench-results button {
  width: 24px;
  min-height: 24px;
  padding: 3px;
  border: 0;
  margin-left: 6px;
}
.bench-results svg {
  width: 13px;
  height: 13px;
}
.bench-empty {
  text-align: center;
  padding: 40px 20px;
}
.bench-empty svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  margin-bottom: 8px;
}
.bench-empty p {
  margin: 0;
  font-size: 12px;
}
.help-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.help-columns h3 {
  font-size: 13px;
  font-weight: 500;
  margin: 12px 0;
}
.help-columns ol {
  padding-left: 17px;
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
}
.help-columns li {
  margin: 8px 0;
}
.shortcuts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 11px;
  font-size: 11px;
  color: var(--muted);
}
.shortcuts dd {
  margin: 0;
  text-align: right;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 12px);
  padding: 12px 18px;
  max-width: min(620px, 92vw);
  border: 1px solid #627653;
  background: var(--accent-dark);
  box-shadow: 0 4px 25px #0005;
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 100;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.noscript {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 24px;
  z-index: 200;
}
.canvas-wrap.drop-active {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
body[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f2eb;
  --panel: #fafbf5;
  --stage: #e9ede3;
  --raised: #e2e7da;
  --border: #cdd4c6;
  --grid: #cdd8c6;
  --text: #233023;
  --muted: #566753;
  --faint: #647361;
  --accent: #326626;
  --accent-dark: #e0ebd6;
  --cell: #3e7830;
  --young: #77a65b;
  --ghost: #b9c9ac;
}
body[data-theme="light"] button.primary {
  background: #c5ed99;
  border-color: #9cba7c;
}
body[data-theme="light"] .pattern-card.selected {
  background: #e3edda;
}
body[data-theme="light"] .pattern-thumb {
  background: #e8efdf;
  border-color: #c9d6bf;
}
@media (min-width: 1600px) {
  .app-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .workspace {
    padding: 0 36px;
  }
  .sidebar-heading {
    padding-top: 30px;
  }
  .pattern-card {
    padding: 14px;
  }
  .pattern-card h3 {
    font-size: 12px;
  }
  .pattern-card p {
    font-size: 11px;
  }
  .pattern-card-actions button {
    font-size: 11px;
  }
  .canvas-wrap {
    min-height: 350px;
  }
  .experiment-header {
    height: 104px;
  }
  .statistics {
    padding: 26px 8px;
  }
  .statistics > div > span {
    font-size: 9px;
  }
  .statistics strong {
    font-size: 25px;
  }
  .history-stat canvas {
    width: 180px;
  }
}
@media (max-width: 1150px) {
  .back-link {
    display: none;
  }
  .app-layout {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .workspace {
    padding: 0 16px;
  }
  .app-header {
    padding: 0 20px;
  }
  .transport {
    gap: 10px;
  }
  .speed-control {
    gap: 7px;
  }
  .speed-control input {
    width: 70px;
  }
  .checkpoint span {
    display: none;
  }
  .statistics {
    gap: 10px;
  }
  .history-stat {
    display: none;
  }
  #tool-hint {
    display: none;
  }
  .stamp-hint {
    display: none;
  }
  .experiment-actions {
    gap: 7px;
  }
  .statistics .bounds-stat strong {
    font-size: 14px;
  }
}
@media (max-width: 850px) {
  .app-header {
    height: 66px;
    padding: 0 15px;
    gap: 12px;
  }
  .brand {
    font-size: 21px;
  }
  .brand small {
    font-size: 7px;
  }
  .header-actions {
    gap: 5px;
  }
  .header-actions button {
    padding: 7px 9px;
  }
  .header-actions #import-open span,
  .header-actions #export-open span {
    display: none;
  }
  .header-actions #help-open {
    display: none;
  }
  .app-layout {
    height: calc(100dvh - 66px);
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 66px;
    bottom: 0;
    width: 280px;
    z-index: 20;
    box-shadow: 15px 0 50px #0008;
  }
  .sidebar.open {
    display: flex;
  }
  .mobile-only {
    display: inline-flex;
  }
  .workspace {
    padding: 0 14px;
  }
  .experiment-header {
    height: 79px;
  }
  .experiment-title input {
    width: 48vw;
    font-size: 21px;
  }
  .statistics {
    padding: 18px 4px;
  }
  .history-stat {
    display: block;
  }
  .speed-control input {
    width: 90px;
  }
  .checkpoint span {
    display: inline;
  }
  .canvas-wrap {
    min-height: 120px;
  }
  .workspace-footer {
    padding: 10px 1px;
  }
  .help-columns {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
@media (max-width: 570px) {
  .app-header {
    padding: 0 12px;
    height: 65px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .brand {
    font-size: 20px;
    gap: 8px;
  }
  .brand small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .header-actions {
    gap: 4px;
  }
  .header-actions button {
    min-height: 32px;
    width: 32px;
    padding: 6px;
  }
  .header-actions svg {
    width: 16px;
  }
  .header-actions #bench-open {
    width: auto;
    gap: 4px;
  }
  .header-actions #bench-open span:not(.count),
  .header-actions #share-open span {
    display: none;
  }
  .app-layout {
    height: calc(100dvh - 65px);
  }
  .sidebar {
    top: 65px;
  }
  .workspace {
    padding: 0 9px;
  }
  .experiment-header {
    height: 75px;
  }
  .experiment-title input {
    font-size: 19px;
    width: 49vw;
  }
  .experiment-title .eyebrow {
    font-size: 8px;
  }
  .experiment-actions {
    gap: 5px;
  }
  .status-pill {
    font-size: 9px;
    padding: 6px;
  }
  .experiment-actions #save-top {
    width: 30px;
    padding: 6px;
  }
  .experiment-actions #save-top span {
    display: none;
  }
  .experiment-actions .icon-button {
    width: 30px;
  }
  .editor-toolbar {
    gap: 4px;
    padding: 7px 5px;
  }
  .editor-toolbar .icon-button {
    width: 29px;
    min-height: 30px;
    padding: 6px;
  }
  .tool-group {
    gap: 0;
  }
  .toolbar-divider {
    margin: 0 1px;
    height: 17px;
  }
  .editor-toolbar #random-open {
    width: 29px;
    padding: 6px;
  }
  .editor-toolbar #random-open span {
    display: none;
  }
  .editor-toolbar #copy-selection {
    display: none;
  }
  .toolbar-spacer {
    min-width: 0;
  }
  .canvas-topline {
    left: 10px;
    right: 10px;
    top: 10px;
    font-size: 8px;
  }
  .canvas-bottomline {
    left: 10px;
    font-size: 8px;
    bottom: 17px;
  }
  .zoom-controls {
    right: 8px;
    bottom: 9px;
  }
  .zoom-controls button {
    width: 24px;
  }
  .zoom-controls #zoom-reset {
    width: 43px;
  }
  .transport {
    flex-wrap: wrap;
    padding: 9px;
    gap: 10px;
  }
  .playback {
    gap: 4px;
    flex: 1;
  }
  .playback > .icon-button {
    margin: 0;
    width: 28px;
  }
  .play-button {
    min-width: 88px;
    flex: 1;
  }
  .play-button kbd {
    display: none;
  }
  .playback button {
    font-size: 10px;
    min-height: 32px;
    padding: 6px 8px;
  }
  .speed-control {
    order: 3;
    width: 100%;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 8px;
  }
  .speed-control input {
    flex: 1;
    max-width: 190px;
  }
  .speed-control output {
    width: 60px;
  }
  .checkpoint {
    padding: 5px;
    min-height: 32px;
  }
  .checkpoint span {
    display: none;
  }
  .statistics {
    gap: 8px;
    flex-wrap: wrap;
    padding: 15px 4px 12px;
  }
  .statistics > div > span {
    font-size: 7px;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
  }
  .statistics strong {
    font-size: 21px;
  }
  .statistics .change-stat strong {
    font-size: 16px;
  }
  .statistics .bounds-stat strong {
    font-size: 13px;
  }
  .history-stat {
    display: none;
  }
  .outcome-stat {
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .outcome-stat > span {
    margin: 0 !important;
  }
  .statistics .outcome-stat strong {
    font-size: 10px;
    max-width: none;
  }
  .workspace-footer {
    font-size: 8px;
    padding: 8px 1px;
  }
  .workspace-footer button {
    font-size: 8px;
  }
  .workspace-footer kbd {
    display: none;
  }
  .stamp-banner {
    font-size: 10px;
    gap: 7px;
    top: 42px;
    left: 8px;
    right: 8px;
    transform: none;
    width: max-content;
    max-width: calc(100% - 16px);
  }
  .stamp-banner #stamp-label {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .empty-hint h2 {
    font-size: 19px;
    margin: 8px 0;
  }
  .empty-hint p {
    font-size: 10px;
  }
  .welcome-rules {
    margin-top: 12px;
    padding: 10px 14px;
  }
  .welcome-rules h3 {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .welcome-rules p,
  .welcome-rules li {
    font-size: 10px;
    line-height: 1.5;
  }
  .welcome-rules ul {
    margin: 8px 0;
  }
  .welcome-rules li + li {
    margin-top: 4px;
  }
  .welcome-actions {
    gap: 12px;
    font-size: 10px;
  }
  dialog {
    padding: 20px;
    max-height: calc(100dvh - 24px);
  }
  .dialog-heading h2 {
    font-size: 21px;
  }
  .bench-toolbar {
    gap: 8px;
  }
  .bench-toolbar label {
    font-size: 10px;
  }
  .bench-toolbar .primary {
    margin-left: 0;
  }
  .shortcuts {
    font-size: 10px;
    gap: 12px 5px;
  }
  .shortcuts kbd {
    font-size: 9px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .dialog-actions button {
    flex: 1;
  }
  .toast {
    bottom: 14px;
    width: max-content;
    font-size: 11px;
    line-height: 1.6;
  }
}
@media (max-height: 680px) and (min-width: 851px) {
  .app-header {
    height: 60px;
  }
  .app-layout {
    height: calc(100dvh - 60px);
  }
  .experiment-header {
    height: 70px;
  }
  .statistics {
    padding: 12px 4px;
  }
  .workspace-footer {
    padding: 8px 0;
  }
  .sidebar-heading {
    padding-top: 18px;
  }
  .transport {
    padding: 8px 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
