* { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #090a0b;
  --ink: #f2f2ee;
  --line: rgba(217,225,212,.16);
  --acid: #c8fa73;
  --margin: clamp(20px,3.8vw,76px);
  font-family: Inter,"Helvetica Neue",Arial,sans-serif;
}

body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid var(--acid); outline-offset: 4px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }

.lab {
  position: relative;
  isolation: isolate;
  height: 100svh;
  min-height: 310px;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
}
.mast, .console { margin-inline: var(--margin); }
.mast {
  display: flex;
  align-items: center;
  height: clamp(60px,9.3vh,90px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: .4em;
  margin: 0;
  font-size: clamp(24px,2.12vw,34px);
  font-weight: 625;
  letter-spacing: -.065em;
  line-height: 1;
}
.brand img { width: 1.1em; height: 1.1em; }
.stage {
  position: relative;
  min-height: 0;
  touch-action: none;
  cursor: grab;
  background: radial-gradient(ellipse at center,#111413 0,#090a0b 64%);
}
.stage.holding { cursor: grabbing; }
#universe { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.console {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto minmax(0,1fr);
  grid-template-areas: "studies instructions transport";
  align-items: center;
  gap: 12px;
  min-height: clamp(85px,12vh,120px);
  padding-block: 12px;
  border-top: 1px solid #ffffff30;
}
.studies, .study, .instructions, .instructions > span, .transport { display: flex; align-items: center; }
.studies { grid-area: studies; justify-self: start; gap: 4px; }
.study {
  gap: 6px;
  height: 48px;
  padding: 5px 10px 5px 5px;
  white-space: nowrap;
  font-size: .86rem;
  color: #a2a59e;
  border: 1px solid transparent;
  border-radius: 5px;
  transition: background .3s,color .3s,border-color .3s;
}
.study canvas { width: 38px; height: 30px; display: block; }
.study:hover { background: #ffffff06; color: white; }
.study[aria-pressed=true] { border-color: #596047; background: linear-gradient(115deg,#282c20,#161815); color: #eff3e8; }

.instructions {
  grid-area: instructions;
  justify-self: center;
  justify-content: center;
  color: #abafa9;
  font-size: .78rem;
  white-space: nowrap;
}
.instructions > span { gap: 5px; }
.instructions > span + span::before {
  content: "";
  width: 1px;
  height: 10px;
  margin-inline: 8px;
  background: #50554f;
}
.instructions svg { width: 16px; height: 16px; opacity: .85; }
.tap-hint { display: none; }
.transport { grid-area: transport; justify-self: end; gap: 8px; }
.divider { height: 16px; width: 1px; background: var(--line); margin-inline: 7px; }
.icon-button {
  width: 37px;
  height: 37px;
  display: grid;
  place-content: center;
  border: 1px solid #444744;
  border-radius: 50%;
}
.icon-button:hover { background: #ffffff0c; }
.icon-button svg { width: 17px; height: 17px; }
#fps {
  min-width: 46px;
  color: #abafa8;
  font: .73rem "IBM Plex Mono",ui-monospace,SFMono-Regular,Consolas,monospace;
  font-variant-numeric: tabular-nums;
}
.meter { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.meter i { width: 2px; background: var(--acid); height: 4px; }
.meter i:nth-child(2) { height: 6px; }
.meter i:nth-child(3) { height: 9px; }
.meter i:nth-child(4) { height: 11px; }
.lab.paused .meter i { background: #69705e; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.no-js { position: absolute; top: 45%; width: 100%; padding: 1rem; text-align: center; }

@media (max-width: 78rem) {
  .console {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas: "studies transport" "instructions instructions";
    row-gap: 10px;
    padding-bottom: max(14px,env(safe-area-inset-bottom));
  }
}
@media (max-width: 38rem) {
  .mast { height: 60px; }
  .console { column-gap: 4px; padding-top: 7px; }
  .studies { gap: 3px; }
  .study { flex-direction: column; justify-content: center; gap: 0; height: 57px; padding: 1px clamp(5px,1.6vw,12px) 5px; font-size: .75rem; }
  .study canvas { height: 31px; width: 43px; }
  .transport .divider, .transport .meter, #fps { display: none; }
  .instructions { font-size: .75rem; }
  .instructions > span + span::before { margin-inline: 4px; }
  .instructions svg { width: 14px; height: 14px; }
}
@media (max-width: 24rem) {
  .instructions > span + span::before { margin-inline: 3px; }
  .instructions svg { display: none; }
}
@media (pointer: coarse) {
  .wheel-hint, .morph-tip svg { display: none; }
  .tap-hint { display: inline; }
}
@media (max-height: 555px) and (orientation: landscape) {
  .mast { height: 46px; }
  .brand { font-size: 22px; }
  .console { min-height: 54px; row-gap: 3px; padding-block: 5px; }
  .study { height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .study { transition: none; }
}
