:root {
  color-scheme: dark;
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #dce8e5;
  background: #0b171b;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: #9fdccc;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
header {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid #2b3d40;
  padding: 0 26px;
}
.brand {
  font-size: 23px;
  letter-spacing: -0.7px;
  color: #e9f4ef;
}
.brand strong {
  font-weight: 600;
}
.edition {
  color: #9caeac;
  font-size: 13px;
}
.site-backlink {
  color: #6f8683;
  font-size: 12px;
}
.site-backlink:hover {
  color: #9fdccc;
}
.badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border: 1px solid #456258;
  padding: 4px 7px;
  border-radius: 4px;
  margin-left: 8px;
  color: #a9c6b6;
}
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  min-height: calc(100vh - 66px);
}
.laboratory {
  min-width: 0;
  padding: 18px;
  position: sticky;
  top: 0;
  height: calc(100dvh - 66px);
  min-height: 540px;
  display: flex;
  flex-direction: column;
}
button,
select,
input {
  font: inherit;
}
button,
select,
input[type="number"] {
  border: 1px solid #3b5052;
  background: #14272c;
  color: #dbe9e5;
  border-radius: 6px;
  padding: 7px 10px;
  min-height: 34px;
}
button {
  cursor: pointer;
  white-space: nowrap;
}
button:hover {
  background: #254039;
  border-color: #6eaa94;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
.primary,
#pause {
  background: #afd9a8;
  color: #14271e;
  border-color: #afd9a8;
  font-weight: 600;
}
.toolbar {
  flex-shrink: 0;
  flex-wrap: wrap;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.toolbar label,
.view-controls label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #aebdb8;
  font-size: 12px;
}
.toolbar-spacer {
  flex: 1;
}
.viewport {
  position: relative;
  min-height: 240px;
  flex: 1;
  border: 1px solid #2b4246;
  border-radius: 10px;
  overflow: hidden;
  background: #071014;
}
.simulation-info {
  flex: 0 0 clamp(160px, 24dvh, 240px);
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #456258 transparent;
  padding-right: 8px;
  margin-top: 12px;
  border-top: 1px solid #273b3e;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
  cursor: crosshair;
}
#notice {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #13282ee8;
  border: 1px solid #466164;
  border-radius: 7px;
  padding: 11px 16px;
  max-width: 90%;
  width: max-content;
  font-size: 12px;
  pointer-events: none;
}
#notice.error {
  color: #ffc5aa;
  pointer-events: auto;
}
.view-key {
  position: absolute;
  left: 16px;
  bottom: 15px;
  display: flex;
  gap: 16px;
  color: #95aeab;
  font-size: 10px;
  align-items: center;
  pointer-events: none;
}
.view-key span {
  display: flex;
  gap: 5px;
  align-items: center;
}
.view-key i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.cyan {
  background: #53c5c8;
}
.amber {
  background: #d6a156;
}
.gesture {
  position: absolute;
  top: 13px;
  left: 15px;
  color: #849d9b;
  font-size: 10px;
  pointer-events: none;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 18px 2px 14px;
  gap: 9px;
}
.metrics strong {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.5px;
}
.metrics span {
  color: #869e9c;
  font-size: 10px;
  display: block;
  margin-top: 4px;
}
.view-controls {
  display: flex;
  align-items: center;
  gap: 17px;
  border-top: 1px solid #273b3e;
  padding: 11px 0;
}
.view-controls select {
  font-size: 11px;
  padding: 4px 7px;
  min-height: 29px;
}
.view-controls input {
  accent-color: #afd9a8;
}
#render-note {
  margin-left: auto;
  font-size: 10px;
  color: #7f9897;
}
.history {
  position: relative;
  height: 72px;
  border-top: 1px solid #273b3e;
}
.history canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.history > span {
  position: absolute;
  top: 8px;
  left: 3px;
  color: #88a2a0;
  font-size: 10px;
}
.predation-history,
.energy-history {
  border-top: 1px solid #273b3e;
  padding: 12px 0;
}
.predation-heading,
.event-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.predation-heading {
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.predation-heading h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}
.predation-heading h2 span {
  color: #88a2a0;
  font-size: 10px;
}
.energy-chart-panel {
  margin: 16px 0;
}
.energy-chart-panel canvas {
  width: 100%;
  height: 160px;
  display: block;
}
.energy-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 16px;
  font-size: 10px;
  color: #a3b9b5;
}
.energy-legend > div {
  display: flex;
  gap: 6px;
  align-items: center;
}
.energy-legend i {
  height: 7px;
  width: 7px;
  border-radius: 2px;
  flex-shrink: 0;
}
.energy-legend strong {
  margin-left: auto;
  color: #dce8e5;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.predation-heading label,
.event-heading {
  font-size: 11px;
}
.predation-heading select {
  margin-left: 6px;
  min-height: 30px;
}
.predation-charts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.predation-charts > div:first-child .event-heading {
  color: #ecad71;
}
.predation-charts > div:nth-child(2) .event-heading {
  color: #ec797c;
}
.predation-charts > div:last-child .event-heading {
  color: #a8a4d6;
}
.predation-charts canvas {
  display: block;
  width: 100%;
  height: 100px;
}
@media (max-width: 600px) {
  .predation-charts {
    grid-template-columns: 1fr;
  }
}
aside {
  height: calc(100dvh - 66px);
  min-height: 540px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #456258 transparent;
  border-left: 1px solid #2b3d40;
  background: #102026;
  padding: 22px 22px 12px;
  overflow-wrap: anywhere;
}
h1 {
  font-size: 18px;
  letter-spacing: -0.3px;
  margin: 0;
  font-weight: 550;
}
h2 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}
.section-heading,
.selection-heading,
.genome-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dot {
  width: 6px;
  height: 6px;
  background: #abd797;
  border-radius: 50%;
}
p {
  font-size: 12px;
  color: #9fb4b1;
  line-height: 1.7;
  margin: 12px 0 17px;
}
.selection-heading {
  padding-top: 17px;
  border-top: 1px solid #2d4346;
  margin-top: 23px;
}
.selection-heading label {
  font-size: 11px;
  color: #a1b5b0;
}
.selection-heading input {
  accent-color: #afd9a8;
}
.selected-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 18px;
}
.selected-stats b {
  display: block;
  font-size: 21px;
  font-weight: 500;
}
.selected-stats span {
  display: block;
  font-size: 10px;
  color: #91aaa6;
  margin-top: 4px;
}
#cell-detail,
#genome-detail {
  font-size: 10px;
  margin: 12px 0;
}
.enzyme-meter {
  height: 5px;
  border-radius: 3px;
  background: #dc9a53;
  overflow: hidden;
}
.enzyme-meter div {
  height: 100%;
  width: 50%;
  background: #4cc9ca;
  float: right;
}
.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #8da7a4;
  margin-top: 5px;
}
.genome-heading {
  margin-top: 22px;
  font-size: 12px;
}
.genome-heading button {
  font-size: 10px;
  min-height: 28px;
  padding: 4px 7px;
}
pre {
  font:
    11px/1.65 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  max-height: 250px;
  overflow: auto;
  padding: 12px;
  background: #0a191e;
  border: 1px solid #294147;
  border-radius: 5px;
  color: #bdd8be;
  white-space: pre;
}
details {
  border-top: 1px solid #2c4246;
  margin-top: 20px;
  padding-top: 16px;
}
summary {
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.settings > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #abc0bb;
  margin: 12px 0;
}
.settings input[type="number"] {
  width: 90px;
  font-size: 11px;
  padding: 5px 7px;
  min-height: 29px;
}
.settings select {
  font-size: 11px;
  min-height: 29px;
  padding: 5px 7px;
}
.settings input[type="range"] {
  width: 100%;
  accent-color: #afd9a8;
}
.settings output {
  color: #d1e5d7;
}
.hint {
  font-size: 10px;
  color: #839e9b;
  line-height: 1.7;
  margin: 12px 0;
}
.world-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.world-actions button {
  width: 100%;
}
.reference code {
  font-size: 11px;
  color: #c6dfb8;
}
.reference dl {
  font-size: 11px;
}
.reference dt {
  color: #c6dfb8;
  margin-top: 15px;
  font-family: ui-monospace, monospace;
}
.reference dd {
  color: #8fa9a4;
  line-height: 1.6;
  margin: 5px 0;
}
.reference p,
.explanation p {
  font-size: 11px;
}
footer {
  font-size: 10px;
  color: #7d9694;
  line-height: 1.8;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid #2c4246;
}
:focus-visible {
  outline: 2px solid #bfe49b;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1600px) {
  main {
    grid-template-columns: minmax(0, 1fr) 390px;
  }
  aside {
    padding: 26px 28px;
  }
  .metrics strong {
    font-size: 26px;
  }
}
@media (max-width: 1050px) {
  main {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  aside {
    padding: 20px 16px;
  }
  .laboratory {
    padding: 12px;
  }
  .toolbar {
    gap: 5px;
  }
  .toolbar button {
    font-size: 11px;
    padding: 6px 8px;
  }
  .toolbar select {
    font-size: 11px;
    padding: 6px;
  }
  .metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  #render-note {
    display: none;
  }
  .view-controls {
    gap: 10px;
  }
  .edition {
    font-size: 11px;
  }
  .badge {
    display: none;
  }
}
@media (max-width: 760px) {
  header {
    height: 55px;
    padding: 0 15px;
    gap: 12px;
  }
  .brand {
    font-size: 20px;
  }
  .edition {
    font-size: 10px;
  }
  .site-backlink {
    font-size: 10px;
  }
  main {
    display: block;
  }
  .laboratory {
    position: relative;
    height: calc(100dvh - 55px);
    min-height: 640px;
    padding: 12px;
  }
  .viewport {
    min-height: 230px;
  }
  aside {
    height: auto;
    min-height: 0;
    overflow-y: visible;
    border-left: 0;
    border-top: 1px solid #2b3d40;
    padding: 23px 20px;
  }
  .metrics {
    grid-template-columns: repeat(3, 1fr);
    padding: 12px 2px;
    gap: 8px;
  }
  .metrics strong {
    font-size: 20px;
  }
  .metrics span {
    font-size: 9px;
  }
  .history {
    height: 45px;
  }
  .toolbar {
    gap: 5px;
  }
  .toolbar label {
    font-size: 10px;
    gap: 4px;
  }
  .view-key {
    gap: 10px;
  }
  .gesture {
    font-size: 9px;
  }
  .badge {
    display: none;
  }
}

.settings details > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: #abc0bb;
  margin: 12px 0;
}
@media (max-width: 760px) {
  .toolbar {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 6px;
  }
  .toolbar-spacer {
    display: none;
  }
  .toolbar label {
    justify-content: flex-end;
  }
  .toolbar #find {
    grid-column: 1 / 3;
  }
  .toolbar #fit {
    grid-column: 3;
  }
  .toolbar button {
    font-size: 11px;
  }
}

dialog {
  max-width: min(620px, calc(100vw - 30px));
  width: 620px;
  border: 1px solid #466164;
  border-radius: 10px;
  padding: 22px;
  background: #102026;
  color: #dce8e5;
}
dialog::backdrop {
  background: #0009;
}
dialog h2 {
  font-size: 16px;
}
dialog textarea {
  width: 100%;
  resize: vertical;
  font:
    11px/1.6 ui-monospace,
    monospace;
  background: #0a191e;
  color: #bdd8be;
  border: 1px solid #3b5052;
  padding: 12px;
  border-radius: 5px;
}
.export-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
}
.export-actions span {
  font-size: 11px;
  color: #9eb6ac;
}

.sunny {
  background: #d3d993;
}
.cloudy {
  background: #65758b;
}
.corpse-key {
  background: #bb8950;
}
.activity-key {
  font-size: 10px;
  margin: 0 0 9px;
  color: #8ca7a3;
}
.enzyme-meter {
  background: #172b40;
}
.enzyme-meter div {
  float: none;
  background: #d3d993;
}
.selected-stats {
  row-gap: 14px;
}
#settings-fields details > label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #adc3bd;
  margin: 12px 0;
}
.view-controls {
  flex-wrap: wrap;
  gap: 12px;
}
.toolbar #find-moving {
  font-size: 11px;
}
@media (max-width: 760px) {
  .toolbar #find {
    grid-column: 1 / 3;
  }
  .toolbar #find-moving {
    grid-column: 3;
  }
  .toolbar #fit {
    grid-column: 1 / 4;
  }
}

.cell-memory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 8px;
  margin: 12px 0;
}
.cell-memory span {
  display: block;
  color: #adc3bd;
  font-size: 10px;
}
.cell-memory b {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.behavior-panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #2b3d40;
  border-radius: 10px;
}
.behavior-panel h2 {
  font-size: 17px;
  margin: 0;
}
.behavior-panel p {
  color: #9baead;
  line-height: 1.5;
}
.behavior-panel .section-heading {
  gap: 12px;
  flex-wrap: wrap;
}
.behavior-values {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.behavior-values strong {
  display: block;
  font-size: 20px;
  color: #dce8e5;
}
.behavior-values span {
  display: block;
  color: #9baead;
  font-size: 12px;
  margin-top: 4px;
}
#epi-history {
  width: 100%;
  height: 90px;
  display: block;
}
.behavior-legend {
  font-size: 12px;
}
.behavior-panel details {
  margin-bottom: 16px;
}
@media (max-width: 600px) {
  .behavior-values {
    grid-template-columns: 1fr;
  }
}

/* The primary interaction is rolling a fresh feature soup. */
.world-play {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.world-play .world-roll {
  font-size: 18px;
  padding: 14px 22px;
  min-height: 54px;
  background: #caf392;
  color: #172716;
  border: 1px solid #dafcae;
  border-radius: 10px;
  box-shadow: 0 4px 22px #9fdb6330;
  font-weight: 750;
}
.world-play .world-roll:hover {
  background: #ddffb4;
  box-shadow: 0 5px 26px #b9ed7545;
}
.world-play p {
  color: #a9bdb3;
  font-size: 11px;
  line-height: 1.55;
  margin: 0;
  max-width: 650px;
}
#pause {
  background: #14272c;
  color: #dbe9e5;
  border-color: #3b5052;
  font-weight: 400;
}
#settings-fields .setting-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 5px 10px;
  margin: 15px 0;
}
.setting-control > span {
  grid-column: 1 / -1;
  font-size: 11px;
}
.setting-control input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: #caf392;
}
.setting-control input[type="number"] {
  width: 78px;
  padding: 5px;
  font-size: 11px;
}
.world-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.function-entry {
  padding: 12px 0;
  border-bottom: 1px solid #294044;
}
.function-entry label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.function-entry input {
  accent-color: #caf392;
}
.function-entry small {
  color: #89a69b;
  font-size: 10px;
}
.function-entry p {
  margin: 6px 0;
}
.function-entry pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 10px;
}
.reference input[type="search"] {
  width: 100%;
  padding: 10px;
  background: #0b1b20;
  color: #dbe9e5;
  border: 1px solid #3b5052;
  border-radius: 6px;
}
@media (max-width: 760px) {
  .world-play {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
  }
  .world-play .world-roll {
    width: 100%;
  }
  .world-play p {
    font-size: 10px;
  }
}

.settings .habitat-control {
  display: grid;
  grid-template-columns: 1fr 90px;
}
.habitat-control input[type="range"] {
  grid-column: 1 / -1;
}

.reference h2 {
  margin-top: 22px;
  color: #d7ebcc;
  font-size: 12px;
}
.surface-form {
  border-left: 2px solid #5b8050;
  padding-left: 10px;
  margin-top: 10px;
}
