:root {
  color-scheme: dark;
  --bg: #090c0c;
  --line: #373d3d;
  --muted: #8b9595;
  --text: #edf0ed;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    12px/1.5 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
button,
input,
select {
  font: inherit;
}
button,
select {
  color: inherit;
  background: transparent;
  border: 1px solid #596060;
  border-radius: 0;
  padding: 6px 12px;
  cursor: pointer;
}
button:hover,
select:hover {
  border-color: #fff;
  background: #202626;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button[aria-pressed="true"] {
  color: #090c0c;
  background: #edf0ed;
  border-color: #edf0ed;
}
:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}
header {
  height: 55px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
h1 {
  font: inherit;
  font-weight: 400;
  letter-spacing: 1.5px;
  margin: 0;
}
header > span {
  font-size: 10px;
  color: var(--muted);
}
main {
  max-width: 1800px;
  margin: auto;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  gap: 15px;
}
.policy-switch,
.run-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.run-controls span {
  font-size: 10px;
  color: var(--muted);
  margin-right: 8px;
}
.split {
  display: grid;
  grid-template-columns: 2.3fr 1fr;
}
.stage-pane {
  border-right: 1px solid var(--line);
  min-width: 0;
}
.brain-pane {
  min-width: 0;
  position: relative;
}
.pane-heading {
  padding: 17px 24px 0;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1px;
}
.pane-heading > span:last-child {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0;
}
.stage-wrap {
  height: 480px;
  position: relative;
}
#scene-status {
  position: absolute;
  inset: 45% 24px auto;
  text-align: center;
  color: var(--muted);
  font-size: 10px;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
#scene[hidden] {
  visibility: hidden;
}
.stage-wrap canvas,
.brain-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.stage-top,
.stage-bottom {
  position: absolute;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  pointer-events: none;
}
.stage-top {
  top: 16px;
}
.stage-bottom {
  bottom: 8px;
}
#outcome {
  position: absolute;
  left: 24px;
  top: 46px;
  font-size: 12px;
  background: #090c0ce8;
  padding: 6px 0;
}
#outcome small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
#outcome.failure {
  color: #c2a397;
}
.brain-wrap {
  position: absolute;
  inset: 0;
}
.transport {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 24px;
}
.transport button {
  width: 28px;
  height: 27px;
  padding: 0;
}
.transport input {
  min-width: 30px;
  flex: 1;
  height: 3px;
  accent-color: #e2e7e4;
}
.transport select {
  font-size: 10px;
  padding: 4px;
}
.transport #duration {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.training-grid {
  border-top: 1px solid var(--line);
}
.chart-wrap {
  border-top: 1px solid var(--line);
  padding: 12px 24px 8px;
  min-width: 0;
}
.chart-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
}
.chart-wrap canvas {
  width: 100%;
  height: 130px;
  display: block;
}
.chart-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  padding-left: 36px;
}
.results {
  max-width: 480px;
  padding: 20px 24px;
}
.result-heading {
  font-size: 9px;
  color: var(--muted);
  margin-bottom: 12px;
}
.result-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 11px;
}
.result-row strong {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
#compute,
#training-status {
  font-size: 9px;
  color: var(--muted);
}
#compute {
  margin-top: 12px;
}
#training-status {
  padding: 10px 24px;
  margin: 0;
}
footer {
  padding: 12px 24px;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  font-size: 8px;
  color: #7f8a89;
}
footer a {
  color: inherit;
  white-space: nowrap;
  text-underline-offset: 3px;
}
#error {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #341e17;
  border-top: 1px solid #d8aa96;
  padding: 12px 24px;
  z-index: 5;
  font-size: 11px;
}
canvas {
  max-width: 100%;
}
@media (max-width: 1000px) {
  .stage-wrap {
    height: 420px;
  }
  .pane-heading {
    padding-left: 16px;
    padding-right: 16px;
  }
}
@media (max-width: 650px) {
  header {
    height: 47px;
    padding: 0 12px;
  }
  header > span {
    font-size: 8px;
    max-width: 140px;
    text-align: right;
  }
  h1 {
    font-size: 11px;
  }
  .toolbar {
    padding: 10px 12px;
    gap: 8px;
  }
  .policy-switch,
  .run-controls {
    gap: 5px;
  }
  .toolbar button {
    font-size: 10px;
    padding: 6px 8px;
  }
  .run-controls span {
    display: none;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .stage-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .stage-wrap {
    height: 310px;
  }
  .brain-pane {
    height: 475px;
  }
  .transport {
    padding: 10px 12px;
    gap: 8px;
  }
  .chart-wrap {
    padding: 12px 12px 8px;
  }
  .results {
    padding: 16px 12px;
  }
  #training-status {
    padding: 10px 12px;
  }
  footer {
    padding: 12px;
    font-size: 7px;
    gap: 12px;
  }
  footer span {
    max-width: 270px;
  }
}

#replay-view,
#lab-link {
  color: var(--text);
  font-size: 10px;
  white-space: nowrap;
  text-underline-offset: 3px;
}
.replay-view > header,
.replay-view .toolbar,
.replay-view .pane-heading,
.replay-view .stage-top,
.replay-view .stage-bottom,
.replay-view #outcome,
.replay-view .training-section,
.replay-view footer {
  display: none;
}
.replay-view main {
  max-width: none;
}
.replay-view .split {
  height: calc(100dvh - 48px);
  min-height: 640px;
}
.replay-view .stage-pane,
.replay-view .brain-pane {
  min-height: 0;
  height: auto;
}
.replay-view .stage-wrap {
  flex: 1;
  min-height: 0;
  height: auto;
}
.replay-view .stage-pane {
  display: flex;
  flex-direction: column;
}
.replay-view .transport {
  height: 48px;
}
.replay-view .chart-wrap {
  flex: 0 0 166px;
  padding: 10px 24px 8px;
}
.replay-view .chart-wrap canvas {
  height: 120px;
}
@media (max-width: 650px) {
  #replay-view {
    font-size: 9px;
  }
  .replay-view .split {
    grid-template-rows: 1fr 1fr;
  }
}
