:root {
  color-scheme: light;
  --page: #f9f9f3;
  --panel: #fffefa;
  --tile: #fffef9;
  --edge: #dedfd8;
  --ink: #192138;
  --muted: #585c71;
  --accent: #f2dc73;
  --violet: #514494;
  --control: #efedf6;
  --scene-ink: #f0fff9;
  --body: "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 0;
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 var(--body);
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

.lab {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(325px, 1fr);
  grid-template-areas: "header header" "brief bench" "stage bench";
  grid-template-rows: auto auto 1fr;
  column-gap: clamp(18px, 3vw, 38px);
  max-width: 1256px;
  margin-inline: auto;
  padding: 24px clamp(22px, 4vw, 58px) 18px;
}

.lab-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 17px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--edge);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font: 800 clamp(22px, 3.2vw, 32px)/1.03 var(--body);
  letter-spacing: -.04em;
}
.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border-radius: 23%;
  background: #f6d478;
  color: #35244d;
}
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; }
.brand-mark::before { inset: 22%; border: 2px solid currentColor; border-radius: 24%; transform: rotate(-8deg); }
.brand-mark::after { top: 16%; right: 16%; width: 25%; height: 25%; border-radius: 28%; background: currentColor; }
.task-mark { display: none; }
.tools { display: flex; gap: 7px; flex-shrink: 0; }
.tools button, #hint {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 9px;
  min-height: 40px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 650;
}
#sound[aria-pressed="true"] { color: var(--violet); border-color: var(--violet); }

.brief {
  grid-area: brief;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
}
#task-title {
  margin: 5px 0 7px;
  font: 800 clamp(36px, 4.45vw, 68px)/1.05 var(--body);
  letter-spacing: -.047em;
  text-wrap: balance;
}
.challenge-progress {
  color: var(--violet);
  font-size: 10px;
  font-weight: 740;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.stage {
  --opal-finish: saturate(.58) hue-rotate(109deg) brightness(1.20) contrast(1.08) drop-shadow(0 0 5px #c4f7f65e);
  grid-area: stage;
  align-self: start;
  position: relative;
  isolation: isolate;
  height: clamp(370px, 42vw, 526px);
  overflow: hidden;
  border-radius: 21px;
  background: radial-gradient(ellipse at 45% 52%, #4d948d 0%, #215d61 53%, #142d43 100%);
}
.stage :focus-visible { outline-color: #f0fff9; }
.stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0;
  background: radial-gradient(ellipse at 78% 6%, #adffd16b, transparent 66%);
}
.stage[data-finale="steam"] { --finale-light: #ffc388; }
.stage[data-finale="balloon"] { --finale-light: #eafdb9; }
.stage[data-finale="frost"] { --finale-light: #9be5ff; }
.stage:is([data-finale="steam"], [data-finale="frost"]) { --opal-finish: brightness(1); }
.stage[data-finale]:not([data-finale=""])::before {
  background: radial-gradient(ellipse at 48% 65%, color-mix(in srgb, var(--finale-light), transparent 48%), transparent 72%);
  animation: chamber-reveal 1.45s ease-out both;
}
@keyframes chamber-reveal {
  0% { opacity: .18; }
  44% { opacity: 1; }
  100% { opacity: .59; }
}
.stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  width: 69%;
  max-width: 430px;
  height: 74px;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid #cfffe654;
  background: radial-gradient(ellipse at 45% 15%, #8dccbc, #437d8c 64%, #305064);
  box-shadow: 0 5px 0 #224359, 0 12px 19px #11303f87;
}
.stage-goal {
  position: absolute;
  top: 22px;
  left: 24px;
  width: 36%;
  margin: 0;
  color: var(--scene-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.stage-goal p { margin: 0; }
#case-number {
  display: block;
  margin-bottom: 6px;
  color: #c7e9dc;
  font-weight: 500;
  font-size: 10px;
}
#case-number:empty { display: none; }
.trial-station {
  position: absolute;
  display: none;
  width: clamp(42px, 14%, 72px);
  aspect-ratio: 1;
  place-items: center;
  right: 5%;
  bottom: 24%;
  border: 1px solid #c7e9dc66;
  border-radius: 18px;
  background: #173e53;
  color: #def8ee;
  font-size: clamp(22px, 7vw, 36px);
  pointer-events: none;
}
.stage[data-station]:not([data-station=""]) .trial-station { display: grid; }
.stage[data-station="workshop"] .trial-station:empty::before { content: "◆"; }
.stage[data-station="weather"] .trial-station:empty::before { content: "☁"; }
.stage[data-station="signal"] .trial-station:empty::before { content: "◉"; }
.stage[data-station="show"] .trial-station:empty::before { content: "✦"; }
.trial-station:has(.symbol) { box-shadow: 0 0 15px #c1f3e669; }
.trial-station .symbol { animation: discover .48s ease-out; }
.stage[data-trial="complete"] .trial-station {
  color: #26393a;
  background: #c1efc9;
  box-shadow: 0 0 20px #d4ffd862;
}
.speech {
  position: absolute;
  z-index: 2;
  top: 22px;
  right: 24px;
  max-width: min(54%, 240px);
  padding: 11px 14px;
  border-radius: 13px 13px 13px 2px;
  color: var(--ink);
  background: var(--page);
  box-shadow: 0 4px 10px #14112e45;
  font-size: 12px;
  font-weight: 660;
  line-height: 1.35;
  pointer-events: none;
}
.speech::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 12px;
  height: 8px;
  background: var(--page);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}
.creature {
  position: absolute;
  width: min(82%, clamp(316px, 38vw, 480px));
  height: auto;
  aspect-ratio: 16 / 15;
  left: 50%;
  bottom: 57px;
  transform: translateX(-50%);
  background: transparent;
  padding: 0;
  touch-action: manipulation;
}
.creature svg { width: 100%; height: 100%; overflow: visible; }
.body { transform-origin: 150px 220px; }
.subject-art {
  display: none;
  width: 100%;
  height: 100%;
  transform-origin: 50% 94%;
}
.has-subject-art svg { display: none; }
.has-subject-art .subject-art { display: block; }
.creature.has-subject-art { cursor: grab; touch-action: none; user-select: none; }
.creature.has-subject-art.grabbing { cursor: grabbing; }

.creature[data-surface="slime"] {
  --surface-filter: saturate(1.18) drop-shadow(0 1px 2px #c8ffd199);
}
.creature[data-surface="glue"] {
  --surface-filter: drop-shadow(0 1px 3px #ffd189a6);
}
.creature[data-shape="frost"] {
  --opal-finish: brightness(1);
  --shape-filter: saturate(.55) contrast(1.10) brightness(1.16);
}
.creature .subject-art {
  filter: var(--opal-finish) var(--shape-filter, brightness(1)) var(--surface-filter, brightness(1)) drop-shadow(0 7px 5px #18344775);
}
.creature.idle:not(.has-subject-art) .body { animation: waiting-sway 5.5s ease-in-out infinite; }
.creature:not(.has-subject-art)[data-reaction]:not([data-reaction=""]) .body { animation: wobble .23s 5; }
.eyes { transform-origin: 150px 130px; animation: blink 5s infinite; }
.stage-floor {
  position: absolute;
  z-index: 2;
  inset: auto 0 0;
  min-height: 42px;
  padding: 2px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 9px;
  color: var(--scene-ink);
  background: #142d4338;
  font-size: 11px;
}
.stage-floor button {
  background: transparent;
  color: var(--scene-ink);
  border-radius: 6px;
  min-height: 35px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 720;
}
.stage-floor button:disabled { opacity: .5; }
#stage-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; }
.stage-floor #next-challenge {
  min-height: 35px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--accent);
  white-space: nowrap;
}
.stage-floor #next-challenge:hover { background: #f7e695; }
.stage:has(~ .bench #try-other:not([hidden])) #next-challenge {
  background: transparent;
  color: var(--scene-ink);
}
.fan-prop, .fan-wind, .fan-anchor { display: none; position: absolute; pointer-events: none; }
.stage[data-apparatus="fan"] :is(.fan-prop, .fan-wind) { display: block; }
.fan-prop {
  right: clamp(9px, 3%, 25px);
  bottom: 24%;
  width: clamp(65px, 20%, 115px);
  aspect-ratio: 1;
  border: 4px solid #9cd0ce;
  border-radius: 50%;
  background: #142d43;
  box-shadow: 3px 7px 0 #173f4e, 4px 11px 12px #102c3f77, inset 0 0 11px #091c32;
}
.fan-prop::before {
  content: "";
  position: absolute;
  inset: 100% 33% auto;
  height: 24%;
  border-bottom: 4px solid #90c3c5;
  border-radius: 0 0 5px 5px;
  background: #315d68;
}
.fan-prop::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, #bce0d9 0 10%, #355c69 11% 14%, transparent 15%),
    repeating-radial-gradient(circle, transparent 0 7px, #b7d9d873 8px, transparent 9px);
}
.fan-prop i {
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 15deg, #6da4ad 0 32deg, transparent 42deg 120deg);
  animation: spin-fan 1.1s linear infinite;
}
.fan-wind { right: 14%; bottom: 28%; width: 56%; height: 90px; }
.fan-wind i {
  position: absolute;
  top: 13%;
  right: 0;
  width: 60%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #cbfff1c9, transparent);
  animation: fan-flow 2s linear infinite;
}
.fan-wind i:nth-child(2) { top: 44%; width: 70%; animation-delay: -.86s; }
.fan-wind i:nth-child(3) { top: 82%; width: 41%; animation-delay: -1.37s; }
.stage[data-wind="gust"] .fan-prop i { animation-duration: .28s; }
.stage[data-wind="gust"] .fan-wind i { animation-duration: .51s; opacity: .95; }
.stage[data-anchor="glue"] .fan-anchor {
  display: block;
  width: 44%;
  height: 16px;
  left: 28%;
  bottom: 56px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 45% 30%, #ffe39bc4, #daa045a6 55%, transparent 77%);
}
@keyframes spin-fan { to { transform: rotate(1turn); } }
@keyframes fan-flow {
  from { transform: translateX(18%); }
  to { transform: translateX(-96%); }
}
.particle {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
  font-weight: 750;
  animation: particle 1.5s ease-out forwards;
  z-index: 3;
}

.bench {
  grid-area: bench;
  align-self: start;
  display: grid;
  min-width: 0;
  padding: clamp(15px, 2.2vw, 27px);
  border-radius: 19px;
  border: 1px solid var(--edge);
  background: var(--page);
}
#hint {
  min-height: 34px;
  padding-inline: 10px;
  flex-shrink: 0;
  color: var(--ink);
}
.mixer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px minmax(0, 1fr) minmax(56px, .85fr) 44px;
  align-items: stretch;
  gap: 8px;
}
.slot {
  background: var(--control);
  border: 1px dashed #a29bb8;
  border-radius: 11px;
  min-width: 0;
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.08;
}
.slot.filled { border-style: solid; background: var(--panel); color: var(--ink); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }
.slot.dropover { outline: 2px solid var(--violet); outline-offset: 2px; }
.plus { align-self: center; text-align: center; color: var(--muted); font-size: 14px; }
.mix, .result button, #confirm-reset button[value="reset"] {
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 780;
  font-size: 12px;
}
.mix:disabled, .result button:disabled {
  background: #ecebe6;
  color: #616475;
}
.message {
  min-height: 44px;
  padding: 9px 0 6px;
  color: var(--muted);
  font-size: 12px;
}
.result {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid #e1ded4;
  background: var(--panel);
  box-shadow: 0 2px 5px #17203b08;
}
.result-element { display: flex; align-items: center; gap: 9px; min-width: 0; }
.result-info { flex: 1; min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.2; }
.result strong { display: block; overflow-wrap: anywhere; margin-bottom: 3px; color: var(--ink); font-size: 13px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.result-actions button { flex: 1 1 110px; min-height: 43px; line-height: 1.18; }
.result-actions .secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #dcd8e4;
}
.result-actions .secondary:not(:disabled):hover { background: var(--control); }
.result-actions .secondary:disabled { opacity: .65; }
.inventory { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.element {
  display: grid;
  align-content: center;
  justify-items: center;
  position: relative;
  min-width: 0;
  min-height: 83px;
  border: 1px solid #deded5;
  border-radius: 11px;
  background: var(--tile);
  box-shadow: 0 1px 1px #1f223909;
  text-align: center;
  padding: 6px 3px;
  gap: 6px;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  transition: transform .15s, border-color .15s, background-color .15s;
}
#basics .element { background: #efefe7; border-color: #e2e3d9; }
.symbol {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #fff9;
  border-radius: 46% 54% 50% 50%;
  color: #302433;
  background: radial-gradient(circle at 32% 22%, #fffaf2, var(--reagent) 48%, color-mix(in srgb, var(--reagent), #504176 23%));
  box-shadow: 0 1px 2px #1c18322e;
  font: 650 21px/1 var(--body);
}
.element strong { min-width: 0; font-size: 11px; line-height: 1.12; overflow-wrap: anywhere; }
.element .symbol { width: 37px; height: 37px; font-size: 23px; }
.element small { display: none; }
.element.selected, #basics .element.selected {
  border-color: #8072af;
  box-shadow: inset 0 0 0 1px #8072af;
  background-color: #eeebf6;
}
.element.new { animation: discover .42s ease-out; }
.element.dragging { opacity: .45; }
.element.dropover { box-shadow: inset 0 0 0 2px var(--violet); }
.stage.dropover { box-shadow: inset 0 0 0 2px #b0eadb; }
.reagent-drag {
  position: fixed;
  z-index: 10;
  pointer-events: none;
  transform: translate(-50%, -80%);
  filter: drop-shadow(0 3px 7px #120e14);
}
.reagent-drag .symbol { width: 38px; height: 38px; }
.quick-shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.quick-shelf .inventory { grid-column: span 3; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: inherit; }
.empty-shelf { grid-column: 1 / -1; align-self: center; padding-inline: 6px; color: var(--muted); font-size: 11px; }
#open-collection, .collection-tools button, #close-mix, .journal-tools button, .journal-pages button {
  min-height: 44px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1px solid #e1dcef;
  background: var(--control);
  font-size: 12px;
  font-weight: 680;
}
#open-collection { display: grid; align-content: center; justify-items: center; }
#count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.collection-tools, .journal-pages, .journal-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}
.collection-tools { width: 100%; }
.collection-tools button { background: #142d4347; border-color: #f0fff94d; }
#collection { margin-top: 5px; }
.collection-tools span { color: var(--scene-ink); font-size: 11px; }
.untested-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: #6551a3; }
#previous-elements, #next-elements { min-width: 44px; font-size: 22px; line-height: 1; }
.collection-tools button:disabled { opacity: .45; }
#element-page { font-variant-numeric: tabular-nums; text-align: center; }
.is-untested .untested-dot { position: absolute; display: block; top: 5px; right: 6px; }
#derived { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
#derived .element { min-height: 60px; }
.element.undiscovered { color: var(--muted); background: #efeee9; }
body:has(.only-untested:not([hidden])) #basics .element:not(.is-untested) { opacity: .38; }
#untested[aria-pressed="true"] { color: #e0d5ff; text-decoration: underline; text-underline-offset: 3px; }
.bench-controls { display: grid; align-content: start; }
#open-mix, #try-other { min-height: 44px; }
.journal-tools { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--edge); }
.journal-pages { margin-top: 8px; }
.journal-pages button:disabled { opacity: .45; }
@media (hover: hover) {
  .element:not(:disabled):hover { transform: translateY(-2px); outline: 1px solid #9182bc; }
  .tools button:hover, #hint:hover { background-color: var(--control); }
  .stage-floor button:hover { background-color: #f0fff926; }
  .mix:not(:disabled):hover, .result button:not(:disabled):hover { background: #f7e695; }
}
button:not(:disabled):active { transform: translateY(1px); }
.creature:not(:disabled):active { transform: translateX(-50%); }

dialog {
  width: min(440px, calc(100% - 32px));
  max-height: 82dvh;
  padding: 22px;
  border: 1px solid var(--edge);
  border-radius: 19px;
  background: var(--panel);
  color: var(--ink);
}
dialog::backdrop { background: #150e18a8; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-heading h2 { margin: 0; font: 800 27px/1.1 var(--body); }
.dialog-heading button { background: transparent; min-width: 37px; min-height: 37px; font-size: 26px; }
dialog p, .recipe { font-size: 13px; }
dialog p, .recipe small { color: var(--muted); }
.recipe { position: relative; padding: 10px 0; border-bottom: 1px solid var(--edge); }
.recipe:has(.tested) { padding-right: 56px; }
.recipe .tested { position: absolute; top: 10px; right: 0; color: #235d56; font-size: 11px; }
.case-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 9px;
  padding: 5px 0;
  border-bottom: 1px solid var(--edge);
  background: transparent;
  text-align: left;
  font-size: 13px;
}
.case-row span, .case-row small { color: var(--muted); }
.case-row:not(:disabled):hover { background: var(--control); }
.case-row:disabled { opacity: .58; }
#confirm-reset form { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
#confirm-reset button { min-height: 44px; padding: 8px 16px; border-radius: 9px; }
.recipe small { display: block; margin-top: 4px; }

@keyframes waiting-sway {
  25% { transform: rotate(-1.3deg); }
  75% { transform: rotate(1.3deg); }
}
@keyframes blink { 0%, 43%, 47%, 100% { transform: scaleY(1); } 45% { transform: scaleY(.08); } }
@keyframes wobble { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes particle { to { transform: translate(var(--x), var(--y)) rotate(85deg); opacity: 0; } }
@keyframes discover { 40% { box-shadow: 0 0 18px #f1d08d80, inset 0 0 0 1px #ffdc9c; transform: translateY(-3px); } }

@media (max-width: 770px) {
  .lab {
    --top: 44px;
    --tray: 248px;
    display: grid;
    grid-template: "brief header" var(--top) "stage stage" auto "bench bench" var(--tray) / minmax(0, 1fr) auto;
    gap: 0;
    width: 100%;
    max-width: 560px;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
    min-height: 100dvh;
    align-content: start;
  }
  .lab-header { margin: 0; padding: 0 6px 0 0; border: 0; }
  .brand, .challenge-progress { display: none; }
  .tools { gap: 4px; }
  .tools button, #hint { min-width: 44px; min-height: 44px; padding: 0 7px; border: 0; background: transparent; }
  .tools #book { font-size: 17px; }
  .tools #book span { margin: 0; }
  .brief { padding-left: 12px; margin: 0; }
  .brief > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .task-mark { display: block; width: 19px; height: 19px; }
  #task-title { font-size: clamp(19px, 6vw, 25px); margin: 0; text-wrap: initial; }
  .stage {
    width: 100%;
    height: min(100vw, 560px, calc(100dvh - var(--top) - var(--tray) - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    border-radius: 0;
  }
  .stage::after { bottom: 48px; height: 50px; }
  .stage-goal { left: 13px; top: 13px; font-size: 11px; width: 40%; }
  .speech { top: 12px; right: 12px; max-width: 53%; padding: 7px 9px; font-size: 11px; }
  .creature { width: min(80%, calc((100dvh - var(--top) - var(--tray) - 54px) * 1.05), 380px); bottom: 55px; }
  .stage-floor { min-height: 44px; padding: 0 13px; font-size: 11px; background: transparent; }
  .stage-floor button, .stage-floor #next-challenge { min-height: 44px; }
  .bench { padding: 8px 10px 0; height: 100%; grid-template-rows: auto 1fr; border: 0; border-radius: 0; }
  .bench-controls { align-content: end; padding-bottom: 6px; }
  .inventory { gap: 5px; }
  #basics .element { min-height: 48px; }
  .quick-shelf, .quick-shelf .inventory { gap: 5px; }
  .quick-shelf .element, #open-collection { min-height: 46px; }
  .element { padding: 2px; gap: 2px; }
  .element strong { font-size: 11px; line-height: 1.05; }
  .element .symbol, .slot .symbol, .result .symbol { width: 20px; height: 20px; font-size: 13px; }
  .collection-tools button { border: 0; background: transparent; padding-inline: 5px; }
  #derived { gap: 3px; }
  #derived .element { height: 44px; min-height: 44px; }
  #derived .element .symbol { width: 15px; height: 15px; font-size: 10px; }
  #derived .element strong { max-width: 100%; }
  #derived .untested-dot { width: 5px; height: 5px; right: 3px; top: 3px; }
  .mixer { gap: 5px; }
  .slot { min-height: 49px; gap: 2px; }
  .message { display: grid; align-content: center; min-height: 26px; padding: 2px 1px; font-size: 11px; line-height: 1.23; }
  .message:empty { min-height: 7px; padding: 0; }
  .result { gap: 4px; border-radius: 8px; padding: 5px 7px; }
  .result-element { min-height: 29px; }
  .result strong { margin-bottom: 1px; }
  .result .symbol { width: 23px; height: 23px; font-size: 14px; }
  .result-actions button { min-height: 44px; padding: 3px 6px; font-size: 12px; }
  #journal { padding: 12px 14px; max-height: calc(100dvh - 16px); }
  #journal-count { margin: 4px 0; }
  .recipe { padding-block: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .fan-prop i, .fan-wind i { animation: none !important; }
}

.game-name { margin: 0; font: inherit; letter-spacing: inherit; }
.game-guide a { color: var(--violet); }
#journal .game-guide { margin-bottom: 0; }
@media (max-width: 770px) {
  .lab-header .brand {
    display: block; position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

/* Low landscape screens put the tools next to the creature. */
@media (orientation: landscape) and (max-height: 500px) {
  .lab {
    --top: 44px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    min-height: 100dvh;
    grid-template: "brief header" var(--top) "stage bench" minmax(0, 1fr) /
      minmax(0, 1fr) minmax(300px, 1fr);
    gap: 0;
  }
  .stage {
    width: 100%;
    height: calc(100dvh - var(--top) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 0;
  }
  .creature { width: min(78%, calc((100dvh - 100px) * 1.05), 380px); bottom: 55px; }
  .bench { padding: 8px 10px 0; border: 0; min-height: 0; overflow-y: auto; }
  .bench-controls { align-content: start; }
  .lab-header { margin: 0; padding: 0 8px 0 0; border: 0; justify-content: end; }
  .brief { margin: 0; padding-inline: 12px; align-self: center; }
  .lab-header .brand { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
  .challenge-progress { display: none; }
  .stage-floor { padding-inline: 8px; }
}
