/* IBM Plex, shipped with the game (fonts/, SIL Open Font License 1.1). Nothing loads from the web. */
@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/IBMPlexSansCondensed-Regular-Latin1.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/IBMPlexSansCondensed-Medium-Latin1.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Sans Condensed";
  font-weight: 600 900;
  font-display: swap;
  src: url("fonts/IBMPlexSansCondensed-SemiBold-Latin1.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/IBMPlexMono-Medium-Latin1.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Serif";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/IBMPlexSerif-MediumItalic-Latin1.woff2") format("woff2");
}

/* Culture record: a run is an experiment on a plate and every screen is part of its record. A dark lab bench,
   hairline rules, flat surfaces. Colour carries meaning and comes from the Gram stain and the agar:
   culture green is you, violet is Gram-positive and the lab, safranin is Gram-negative, rivals and bosses,
   agar amber is ATP and food. No glows, gradients or blur on controls. The colour values live in tokens/ and
   reach this file through the generated colors.css (docs/colors.md). */
:root {
  --f-ui: "IBM Plex Sans Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --f-name: "IBM Plex Serif", Georgia, "Times New Roman", serif;

  --t-xs: 11px;
  --t-s: 13px;
  --t-m: 15px;
  --t-l: 18px;
  --t-xl: 24px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --r1: 2px;
  --r2: 4px;
  --hit: 46px;
  --col: min(360px, 100%);

  /* The Android app also sets --safe-area-inset-*, because older WebViews report no env() insets. */
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
  --safe-t: max(env(safe-area-inset-top, 0px), var(--safe-area-inset-top, 0px));
  --safe-l: max(env(safe-area-inset-left, 0px), var(--safe-area-inset-left, 0px));
  --safe-r: max(env(safe-area-inset-right, 0px), var(--safe-area-inset-right, 0px));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--f-ui);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#world.aim {
  cursor: crosshair;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.muted {
  color: var(--muted);
}

/* ---------- HUD ---------- */

/* Stats on top, contracts under them, the strain board on the right. On phones both folds share the second row. */
#hud {
  position: fixed;
  top: calc(8px + var(--safe-t));
  left: calc(8px + var(--safe-l));
  right: calc(8px + var(--safe-r));
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "stats . board" "boss . board" "contracts . board";
  align-items: start;
  gap: 6px 8px;
  pointer-events: none;
}

.stats,
.fold {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.stats {
  grid-area: stats;
  justify-self: start;
  display: flex;
  gap: 4px;
  padding: 6px 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 54px;
}

.stat.season {
  min-width: 70px;
}

.stat.season[data-weather="heat"] .label {
  color: var(--game-color-environment-weather-heatwave);
  font-weight: 700;
}

.stat.immune {
  min-width: 70px;
}

.stat.immune .bar i {
  background: var(--game-color-environment-immune);
}

.stat.immune[data-stage="2"] .label,
.stat.immune[data-stage="3"] .label {
  color: var(--game-color-environment-immune);
  font-weight: 700;
}

.stat.season[data-weather="cold"] .label {
  color: var(--game-color-environment-weather-coldfront);
  font-weight: 700;
}

.label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.value.warn {
  color: var(--warn);
}

#ep {
  color: var(--you);
}

#atp {
  color: var(--gold);
}

.bar {
  display: block;
  height: 3px;
  margin-top: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}

/* ---------- folding panels ---------- */
/* Contracts and the strain board fold to their head line. The head of a folded panel sums it up. */

.fold {
  pointer-events: auto;
  min-width: 0;
  max-width: 100%;
}

.fold-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 4px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.fold-head b {
  font-weight: 700;
  color: var(--text);
}

.fold-head::after {
  content: "▸";
  margin-left: auto;
  padding-left: 2px;
}

.fold.open .fold-head::after {
  content: "▾";
}

.fold:not(.open) .fold-body {
  display: none;
}

.fold-body {
  padding: 0 10px 6px;
}

.fold-sum {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.fold-sum .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}

/* ---------- lab contracts ---------- */

#f-contracts {
  grid-area: contracts;
  justify-self: start;
}

#f-contracts.open {
  width: min(250px, 100%);
}

#f-contracts .fold-head b {
  color: var(--gold);
}

/* Folded: one small bar per contract. Open: the tier. */
.minibars {
  display: flex;
  gap: 3px;
}

.minibars i {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold) calc(var(--f) * 100%), rgba(255, 255, 255, 0.14) 0);
}

.minibars i.late {
  background: linear-gradient(90deg, var(--warn) calc(var(--f) * 100%), rgba(var(--game-color-semantic-status-failure-rgb), 0.25) 0);
}

.minibars i.full {
  box-shadow: 0 0 6px var(--gold);
}

.ct-tier {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fold.open .minibars,
.fold:not(.open) .ct-tier {
  display: none;
}

#contracts {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.3;
}

#contracts .ct {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 8px;
  padding-top: 3px;
}

#contracts .ct + .ct {
  margin-top: 4px;
  border-top: 1px solid var(--line);
}

#contracts .ct-n {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

#contracts .bar {
  grid-column: 1 / -1;
}

#contracts .ct-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

#contracts time {
  font-variant-numeric: tabular-nums;
}

#contracts time.warn {
  color: var(--warn);
}

#contracts .ct.full {
  color: var(--gold);
  animation: contract-done 0.6s ease-in-out infinite alternate;
}

@keyframes contract-done {
  to { text-shadow: 0 0 8px rgba(var(--game-color-semantic-highlight-reward-rgb), 0.8); }
}

/* The lab on the title and game over screens: a ruled entry in the record, in the violet of the lab. */
.lab {
  width: var(--col);
  margin: 0;
  padding: var(--s2) var(--s1);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.lab .bar i {
  background: var(--violet);
}

.lab-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.lab-row b {
  font-weight: 600;
  color: var(--violet);
}

.lab-row .lab-xp {
  margin: 0;
  font-family: var(--f-num);
  font-size: var(--t-s);
  color: var(--ink);
}

.lab-row em {
  font-style: normal;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--violet);
}

.lab-row span {
  margin-left: auto;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lab .bar {
  height: 2px;
  margin: 6px 0 5px;
  border-radius: 0;
  background: var(--rule);
}

.lab small {
  display: block;
  color: var(--muted);
  font-size: var(--t-xs);
  line-height: 1.45;
}

.lab small.opened {
  color: var(--violet);
}

.link-lab {
  cursor: pointer;
  pointer-events: auto;
}

.link-lab:hover {
  background: rgba(var(--game-color-palette-violet-500-rgb), 0.06);
}

.link-lab:focus-visible {
  outline: 1px solid var(--violet);
  outline-offset: 2px;
}

.link-lab .lab-row b::after {
  content: " ›";
  color: var(--muted);
}

/* The lab budget in the contracts panel, above the contracts. The budget bumps when experience comes in
   and the bar steps on to it. */
.lab-hud {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 8px;
  padding: 0 0 5px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.lab-hud .lh-label {
  color: var(--ink-dim);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lab-hud .lh-budget {
  justify-self: end;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--violet);
  font-variant-numeric: tabular-nums;
}

.lab-hud .lh-budget.bump {
  animation: lab-bump 0.7s ease-out;
}

@keyframes lab-bump {
  0% { transform: none; color: var(--violet); }
  25% { transform: translateY(-2px); color: var(--ink); }
  100% { transform: none; color: var(--violet); }
}

.lab-hud .bar {
  grid-column: 1 / -1;
  height: 2px;
  margin: 3px 0 0;
  border-radius: 0;
  background: var(--rule);
}

.lab-hud .bar i {
  background: var(--violet);
  transition: width 0.6s ease-out;
}

.lab-hud .lab-next {
  grid-column: 1 / -1;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lab-chip {
  padding: 1px 6px;
  border-radius: var(--r1);
  border: 1px solid rgba(var(--game-color-palette-violet-500-rgb), 0.6);
  color: var(--violet);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- your lab: the microfluidic chip ---------- */
/* Budget and clearance on top, then the chip (labchip.js): the artery with the fluid of lifetime experience,
   a gate per clearance level and the chambers behind them. Locked chambers are faint hairlines, open ones are
   violet and pulse when the budget can buy them, bought ones are filled in ink. */

.lab-screen {
  justify-content: flex-start;
  overflow: hidden;
}

.lab-screen .screen-head {
  width: min(560px, 100%);
}

.chip-head {
  width: min(560px, 100%);
  flex: none;
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: end;
  gap: var(--s2) var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}

.chip-head .ch-label {
  display: block;
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.chip-head b {
  font-family: var(--f-num);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.ch-budget b {
  color: var(--violet);
}

.ch-unit {
  margin-left: 4px;
  font-family: var(--f-num);
  font-size: var(--t-s);
  color: var(--violet);
}

.ch-life {
  margin-left: 8px;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-faint);
}

.ch-gate {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-dim);
  text-align: right;
}

.ch-gate .bar {
  height: 2px;
  margin: 0;
  border-radius: 0;
  background: var(--rule);
}

.ch-gate .bar i {
  background: var(--violet);
}

.ch-note {
  grid-column: 1 / -1;
  margin: 0;
  font-size: var(--t-s);
  color: var(--ink-dim);
}

.ch-news {
  font-weight: 600;
  color: var(--violet);
}

.ch-news i {
  font-family: var(--f-name);
}

.chip-box {
  width: min(560px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
  cursor: grab;
  -webkit-overflow-scrolling: touch;
}

.chip-box:active {
  cursor: grabbing;
}

.chip-pane {
  display: flex;
  justify-content: center;
}

/* The chip and the live cells over it share one stage; the canvas covers only the part in view. */
.chip-stage {
  position: relative;
  flex: none;
}

.chip-svg {
  display: block;
  overflow: visible;
}

.chip-live {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* The glass of the chip: a slightly lighter plate with an etched border, ports, a ruler and its lot. */
.chip-glass {
  fill: var(--bench-raised);
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-etch {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
  stroke-dasharray: 1 3;
}

.chip-hole {
  fill: var(--bench);
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-ruler,
.chip-scale {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-etched {
  font-family: var(--f-num);
  font-size: 8px;
  letter-spacing: 0.12em;
  fill: var(--ink-faint);
  opacity: 0.8;
}

.chip-bed {
  fill: none;
  stroke: var(--bench);
  stroke-width: 14;
}

.chip-wall {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-fluid {
  fill: var(--violet);
  transition: height 1.4s ease-out;
}

.chip-port {
  fill: var(--bench);
  stroke: var(--rule-strong);
  stroke-width: 1;
}

/* The budget reservoir at the head of the artery. */
.chip-res {
  fill: var(--bench);
  stroke: var(--violet);
  stroke-width: 1.5;
}

.chip-res-in {
  fill: rgba(var(--game-color-palette-violet-500-rgb), 0.22);
}

.chip-res-num {
  font-family: var(--f-num);
  font-size: 11px;
  font-weight: 500;
  fill: var(--ink);
}

.chip-cap,
.chip-front {
  font-family: var(--f-num);
  font-size: 9px;
  letter-spacing: 0.1em;
  fill: var(--ink-faint);
}

.chip-front {
  font-size: 9px;
  letter-spacing: 0;
  fill: var(--violet);
}

.chip-ch {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-ch.short {
  stroke: var(--violet);
  stroke-dasharray: 3 3;
}

.chip-ch.ready {
  stroke: var(--violet);
  stroke-width: 1.5;
}

.chip-ch.owned {
  stroke: var(--violet);
  stroke-width: 4;
}

/* The channel into a chamber just bought fills from the artery. */
.chip-ch.fresh {
  stroke-dasharray: var(--len);
  animation: chip-draw 0.5s ease-in both;
}

@keyframes chip-draw {
  from { stroke-dashoffset: var(--len); }
  to { stroke-dashoffset: 0; }
}

.chip-gate path {
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 2;
}

.chip-gate.open path,
.chip-gate.next path {
  stroke: var(--violet);
}

.chip-gate text {
  font-family: var(--f-num);
  font-size: 11px;
  fill: var(--ink-faint);
}

.chip-gate.open text {
  fill: var(--ink-dim);
}

.chip-gate.next text {
  fill: var(--violet);
}

.chip-node {
  cursor: pointer;
  outline: none;
}

.chip-hit {
  fill: transparent;
}

.chip-body {
  fill: var(--bench);
  stroke: var(--ink-faint);
  stroke-width: 1;
}

.chip-node.short .chip-body {
  stroke: var(--violet);
  stroke-dasharray: 3 2;
}

.chip-node.ready .chip-body {
  stroke: var(--violet);
  stroke-width: 1.5;
}

.chip-node.owned .chip-body {
  fill: var(--ink);
  stroke: var(--violet);
  stroke-width: 1.5;
}

.chip-node.owned.off .chip-body {
  fill: var(--bench);
}

.chip-node.sel .chip-body,
.chip-node:focus-visible .chip-body {
  stroke: var(--ink);
  stroke-width: 2;
}

.chip-node.fresh .chip-body {
  animation: chip-fill 0.6s ease-out 0.45s both;
}

.chip-well {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chip-node.owned .chip-well {
  stroke: rgba(var(--game-color-palette-neutral-950-rgb), 0.25);
}

/* A rubber stamp on a chamber just bought. */
.chip-stamp {
  transform-box: fill-box;
  transform-origin: center;
  animation: chip-stamp 2.6s ease-out 0.5s both;
}

.chip-stamp rect {
  fill: var(--bench-raised);
  stroke: var(--violet);
  stroke-width: 1.2;
}

.chip-stamp text {
  font-family: var(--f-num);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  fill: var(--violet);
}

@keyframes chip-stamp {
  0% { opacity: 0; transform: scale(1.8); }
  10% { opacity: 1; transform: scale(0.94); }
  16% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes chip-fill {
  from { fill: var(--violet); }
  to { fill: var(--ink); }
}

.chip-pulse {
  fill: none;
  stroke: var(--violet);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: chip-pulse 2.2s ease-out infinite;
}

@keyframes chip-pulse {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.7); opacity: 0; }
}

.chip-icon {
  fill: none;
  stroke: var(--c, var(--ink-dim));
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip-node.locked .chip-icon {
  stroke: var(--ink-faint);
}

.chip-node.owned .chip-icon {
  stroke: var(--bench);
}

.chip-node.owned.off .chip-icon {
  stroke: var(--ink-dim);
}

.chip-stain.pos {
  fill: var(--violet);
}

.chip-stain.neg {
  fill: var(--safranin);
}

.chip-node.locked .chip-stain {
  fill: var(--ink-faint);
}

.chip-name {
  font-family: var(--f-ui);
  font-size: 12px;
  fill: var(--ink);
}

.chip-name .bin {
  font-family: var(--f-name);
  font-style: italic;
}

.chip-node.locked .chip-name {
  fill: var(--ink-faint);
}

.chip-sub {
  font-family: var(--f-num);
  font-size: 10px;
  fill: var(--ink-faint);
}

.chip-node.ready .chip-sub {
  fill: var(--violet);
}

.chip-node.owned .chip-sub {
  fill: var(--ink-dim);
}

.chip-sub .full {
  fill: var(--agar);
}

.chip-ranks path {
  stroke: var(--rule-strong);
  stroke-width: 1.5;
}

.chip-ranks path.got {
  stroke: var(--violet);
}

.chip-count {
  font-family: var(--f-num);
  font-size: 12px;
  fill: var(--ink);
}

.chip-node.owned .chip-count {
  fill: var(--bench);
}

/* The flat tip of a chamber, inside the chip next to it. */
.chip-tip {
  position: absolute;
  z-index: 2;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  width: min(260px, calc(100vw - 48px));
  padding: var(--s2) var(--s3) var(--s3);
  border: 1px solid var(--violet);
  border-radius: var(--r2);
  background: var(--bench-raised);
  font-size: var(--t-s);
  cursor: default;
}

/* The tip is a requisition slip: a form line on top, perforated off like a tear-off pad. */
.tip-form {
  display: flex;
  justify-content: space-between;
  margin: 0 0 var(--s2);
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--rule-strong);
  font-family: var(--f-num);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tip-done {
  color: var(--violet);
}

.tip-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* The upgrades of an ultimate on its requisition slip (labchip.js). */
.tip-ups {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}

.tip-ups-head {
  font-family: var(--f-num);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tip-ups ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.tip-ups li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.tip-ups li + li {
  border-top: 1px solid var(--rule);
}

.tip-ups b {
  font-weight: 600;
  font-size: 12px;
}

.tip-ups p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-dim);
}

.up-pips {
  display: inline-flex;
  gap: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.up-pips i {
  width: 8px;
  height: 3px;
  background: var(--rule-strong);
}

.up-pips i.got {
  background: var(--violet);
}

.tip-ups li > div {
  flex: 1;
  min-width: 0;
}

.chip-tip .tip-ups button {
  flex: none;
  width: auto;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 11px;
  font-family: var(--f-num);
  border-color: var(--violet);
  color: var(--violet);
}

.up-done,
.up-short {
  flex: none;
  font-family: var(--f-num);
  font-size: 11px;
  color: var(--ink-faint);
}

.up-done {
  color: var(--violet);
}

.tip-head svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--c);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tip-head b {
  font-weight: 600;
}

.tip-head span {
  margin-left: auto;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--violet);
  white-space: nowrap;
}

.chip-tip .bin {
  font-family: var(--f-name);
  font-style: italic;
  font-weight: 500;
}

.tip-text {
  margin: 6px 0 4px;
  color: var(--ink);
  line-height: 1.4;
}

.tip-meta {
  margin: 0 0 var(--s2);
  font-size: var(--t-xs);
  color: var(--ink-faint);
}

.tip-meta .full {
  color: var(--agar);
}

.tip-why {
  margin: 0;
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.chip-tip button {
  width: 100%;
  min-height: 40px;
}

.chip-tip button.primary {
  background: transparent;
  border-color: var(--violet);
  color: var(--violet);
}

.chip-tip button.primary:hover {
  background: rgba(var(--game-color-palette-violet-500-rgb), 0.1);
}

@media (max-width: 560px) {
  .chip-head {
    grid-template-columns: auto 1fr;
  }

  .ch-gate {
    grid-column: 1 / -1;
    text-align: left;
  }

  .chip-head b {
    font-size: 24px;
  }
}

/* A flat entry in the middle of the screen when a clearance gate opens during a run. */
.levelup {
  position: fixed;
  left: 50%;
  top: 34%;
  z-index: 6;
  transform: translate(-50%, -50%);
  width: min(300px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: var(--s3) var(--s4);
  border-radius: var(--r2);
  border: 1px solid var(--violet);
  background: var(--bench-raised);
  pointer-events: none;
}

.lu-head {
  display: flex;
  align-items: baseline;
  margin-bottom: 4px;
}

.lu-head small {
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet);
}

.lu-head b {
  margin-left: auto;
  font-family: var(--f-num);
  font-size: var(--t-xl);
  font-weight: 500;
  color: var(--violet);
}

.lu-sp {
  font-family: var(--f-name);
  font-style: italic;
  font-size: var(--t-m);
  color: var(--ink);
}

.lu-tech {
  font-size: var(--t-s);
  color: var(--ink);
}

.lu-tech::before {
  content: "⚗ ";
  color: var(--violet);
}

.lu-foot {
  margin-top: 4px;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.levelup.show {
  animation: levelup 6s ease forwards;
}

@keyframes levelup {
  0% { opacity: 0; }
  6% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; }
}

#f-board {
  grid-area: board;
  justify-self: end;
}

#board {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 150px;
}

#board li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  border-radius: 4px;
}

#board li:hover {
  background: rgba(255, 255, 255, 0.05);
}

#board li.you {
  font-weight: 700;
}

#board em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

#board .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 6px currentColor;
}

#board .name {
  flex: 1;
  white-space: nowrap;
}

#board .temp {
  color: var(--muted);
}

/* Your profile under the board. It wraps to the width of the board instead of widening it. */
#profile {
  width: 0;
  min-width: 100%;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

#profile b {
  color: var(--you);
  font-weight: 600;
}

/* ---------- edge marks ---------- */
/* Round buttons on the edge of the free screen area. The arrow on the rim points at the target. */

.mark {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--mc);
  background: var(--panel-solid);
  color: var(--mc);
  box-shadow: 0 0 12px color-mix(in srgb, var(--mc) 35%, transparent);
  --mc: var(--you);
}

.mark.find {
  --mc: var(--gold);
}

.mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mark .tip-arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin: -5px 0 0 -4px;
  border: 5px solid transparent;
  border-left: 8px solid var(--mc);
  border-right: 0;
  transform: rotate(var(--a, 0rad)) translateX(24px);
  transform-origin: 4px 5px;
}

body:not([data-phase="play"]) .mark {
  display: none;
}

/* ---------- tooltip and toasts ---------- */

#tip {
  position: fixed;
  pointer-events: none;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  transform: translate(14px, 14px);
  z-index: 5;
}

.warn,
#tip .warn {
  color: var(--warn);
}

/* The last seconds of a hospital defense level: nearly survived. */
#boss-cells .good {
  color: var(--you);
}

#tip .vein {
  color: var(--game-color-terrain-vein-text);
}

#tip .plant {
  color: var(--game-color-terrain-plant-text);
}

#tip .tip-note {
  display: inline-block;
  max-width: 240px;
  white-space: normal;
  color: var(--muted);
}

/* Toasts and the event log sit above the dock in the bottom left while playing, away from the action. */
#feed {
  position: fixed;
  left: calc(8px + var(--safe-l));
  bottom: calc(var(--dock-h, 0px) + 6px);
  width: min(340px, calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  pointer-events: none;
  z-index: 4;
}

body:not([data-phase="play"]) #feed {
  left: 50%;
  bottom: auto;
  top: calc(64px + var(--safe-t));
  transform: translateX(-50%);
  align-items: center;
  /* Above the title and species screens, so their messages are seen. */
  z-index: 10;
}

#toasts {
  display: flex;
  flex-direction: column;
  align-items: inherit;
  gap: 4px;
  width: 100%;
}

.toast {
  max-width: 100%;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-left: 3px solid currentColor;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.94;
  animation: toast 4500ms ease forwards;
}

.toast b {
  margin-left: 6px;
  color: var(--muted);
  font-weight: 600;
}

.toast b:empty {
  display: none;
}

.toast.jump {
  pointer-events: auto;
  cursor: pointer;
}

.toast.jump::after {
  content: " ›";
  color: currentColor;
}

.toast span {
  color: var(--text);
}

/* The Log button and, during a run, the latest message as one line beside it. */
.log-row {
  display: flex;
  flex-direction: column;
  align-items: inherit;
  gap: 5px;
  width: 100%;
}

body[data-phase="play"] .log-row {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

body[data-phase="play"] #toasts {
  flex: 1;
  min-width: 0;
}

.toast.line {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 2px 8px;
  border: 0;
  border-left: 2px solid currentColor;
  border-radius: 3px;
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.72);
  font-size: 11px;
  line-height: 1.5;
  pointer-events: auto;
  cursor: pointer;
}

.toast.line b {
  margin-left: 4px;
}

#log-btn.ping {
  animation: log-ping 0.9s ease-out;
}

@keyframes log-ping {
  0% { box-shadow: 0 0 0 0 rgba(var(--game-color-palette-green-300-rgb), 0.6); border-color: var(--gold); }
  100% { box-shadow: 0 0 0 8px rgba(var(--game-color-palette-green-300-rgb), 0); }
}

#log-btn {
  flex: none;
  pointer-events: auto;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  opacity: 0.85;
}

#log-btn i {
  font-style: normal;
  color: var(--gold);
}

#log {
  pointer-events: auto;
  width: 100%;
  max-height: 38vh;
  display: flex;
  flex-direction: column;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

#log[hidden] {
  display: none;
}

.log-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.log-head button {
  padding: 0 8px;
  min-height: 0;
}

#log-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  font-size: 12px;
}

#log-list li {
  display: flex;
  gap: 8px;
  padding: 3px 10px;
  border-left: 3px solid currentColor;
  margin: 2px 0;
}

#log-list li span {
  color: var(--text);
}

#log-list li.jump {
  cursor: pointer;
}

#log-list li.jump:hover {
  background: rgba(255, 255, 255, 0.05);
}

#log-list time {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

@keyframes toast {
  0% { opacity: 0; transform: translateY(6px); }
  6% { opacity: 0.94; transform: none; }
  85% { opacity: 0.94; }
  100% { opacity: 0; }
}

/* ---------- dock ---------- */

#dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px calc(8px + var(--safe-r)) calc(6px + var(--safe-b)) calc(8px + var(--safe-l));
  background: linear-gradient(transparent, rgba(4, 7, 9, 0.85) 35%);
}

#armies {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 6px;
}

#armies:empty {
  display: none;
}

.army {
  flex: none;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
}

.army.sel {
  border-color: var(--you);
  box-shadow: 0 0 10px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.3);
}

.army button {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  padding: 5px 9px;
}

.army button + button {
  border-left: 1px solid var(--line);
  color: var(--muted);
}

.army button[data-act="select"] {
  color: var(--you);
  font-weight: 600;
}

.dock-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

#tools {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: none;
}

#tools::-webkit-scrollbar,
#armies::-webkit-scrollbar {
  display: none;
}

.controls {
  display: flex;
  gap: 6px;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  padding: 6px 10px;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover {
  border-color: var(--line-strong);
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

.controls button {
  position: relative;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}

.controls svg,
.tool svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#evolve.ready {
  border-color: var(--you);
  color: var(--you);
  box-shadow: 0 0 12px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.35);
  animation: glow 1.6s ease-in-out infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 4px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.2); }
  to { box-shadow: 0 0 14px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.5); }
}

/* The pause card (game.js): what stopped the run and the way back. A smart pause also lines the edges of the
   screen in violet, so a stopped dish never looks like a hang. */
.pause-card {
  position: fixed;
  top: calc(84px + var(--safe-t, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(380px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--violet);
  border-radius: var(--r2);
  background: var(--panel-solid);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  animation: speed-in 0.15s ease-out;
}

.pause-card[hidden] {
  display: none;
}

.pc-label {
  font-family: var(--f-num);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet);
}

.pc-label::before {
  content: "❚❚ ";
  letter-spacing: 0;
}

.pc-why {
  margin: 6px 0 10px;
  font-size: 14px;
  line-height: 1.35;
}

.pc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body[data-halted="smart"]::after,
body[data-halted="paused"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(var(--game-color-palette-violet-500-rgb), 0.5), inset 0 0 80px rgba(var(--game-color-palette-violet-500-rgb), 0.22);
}

body[data-halted="paused"]::after {
  box-shadow: inset 0 0 0 2px rgba(var(--game-color-palette-neutral-100-rgb), 0.25), inset 0 0 60px rgba(0, 0, 0, 0.35);
}

/* The ultimate button: a bar along its foot fills with the ATP bar, then runs through the cooldown in a dim
   tone. It glows amber when an ultimate can be fired (ultimates.js). */
.ult-wrap {
  position: relative;
  display: flex;
}

#ult {
  overflow: hidden;
  color: var(--ink-dim);
}

#ult .ult-time {
  font-family: var(--f-num);
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

#ult .ult-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}

#ult .ult-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}

#ult.cooling .ult-bar i {
  background: var(--ink-faint);
}

#ult.cooling .ult-time {
  color: var(--ink-faint);
}

/* Ready: two sparks of light circle the rim of the button, a halo ripples out from it, the button glows in
   amber and says READY. The ATP block lights up with it: a glowing frame, a shining number and bar. The
   moment it becomes ready, sparks fly from the ATP bar into the button (ui.js) and it flashes. */
@property --ult-a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

#ult.ready {
  border-color: rgba(var(--game-color-palette-green-300-rgb), 0.35);
  background: radial-gradient(120% 140% at 50% 0%, rgba(var(--game-color-palette-green-300-rgb), 0.24) 0%, rgba(var(--game-color-palette-green-300-rgb), 0.06) 70%), var(--bench-raised);
  color: var(--game-color-palette-green-300);
  animation: ult-glow 2s ease-in-out infinite;
}

#ult.ready::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 2px;
  border-radius: inherit;
  background: conic-gradient(from var(--ult-a), transparent 0deg, rgba(var(--game-color-palette-green-300-rgb), 0.2) 40deg, var(--game-color-palette-green-300) 75deg, var(--game-color-palette-white) 90deg, transparent 100deg, transparent 180deg, rgba(var(--game-color-palette-green-300-rgb), 0.2) 220deg, var(--game-color-palette-green-300) 255deg, var(--game-color-palette-white) 270deg, transparent 280deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ult-orbit 2.2s linear infinite;
  pointer-events: none;
}

#ult.ready::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(105deg, transparent 35%, rgba(var(--game-color-palette-green-300-rgb), 0.4) 50%, transparent 65%);
  background-size: 250% 100%;
  animation: ult-sweep 2s ease-in-out infinite;
  pointer-events: none;
}

#ult.ready svg {
  color: var(--game-color-palette-green-300);
  animation: ult-icon 2s ease-in-out infinite;
}

#ult.ready .ult-time {
  color: var(--game-color-palette-green-300);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(var(--game-color-palette-green-300-rgb), 0.9);
}

/* The halo: a ring that leaves the button and fades. */
.ult-wrap.ready::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--game-color-palette-green-300);
  border-radius: var(--r2);
  pointer-events: none;
  animation: ult-ripple 2s ease-out infinite;
}

/* The flash when it has just become ready. */
#ult.charged {
  animation: ult-charged 0.7s ease-out;
}

.ult-spark {
  position: fixed;
  z-index: 60;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--game-color-palette-white);
  box-shadow: 0 0 6px 2px var(--game-color-palette-green-300), 0 0 16px 4px rgba(var(--game-color-palette-green-300-rgb), 0.6);
  pointer-events: none;
}

@keyframes ult-orbit {
  to { --ult-a: 360deg; }
}

@keyframes ult-sweep {
  0%, 40% { background-position: 120% 0; }
  80%, 100% { background-position: -20% 0; }
}

@keyframes ult-icon {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(var(--game-color-palette-green-300-rgb), 0.6)); }
  50% { transform: scale(1.18); filter: drop-shadow(0 0 7px rgba(var(--game-color-palette-green-300-rgb), 1)); }
}

@keyframes ult-ripple {
  0% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35, 1.7); }
}

@keyframes ult-charged {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(var(--game-color-palette-green-300-rgb), 0.9); background: var(--game-color-palette-green-300); }
  35% { transform: scale(1.15); }
  100% { transform: scale(1); box-shadow: 0 0 0 18px rgba(var(--game-color-palette-green-300-rgb), 0); }
}

/* The ATP block while an ultimate is ready. */
.stat.ult-ready {
  position: relative;
}

.stat.ult-ready::before {
  content: "";
  position: absolute;
  inset: -4px -5px;
  border-radius: 8px;
  border: 1px solid rgba(var(--game-color-palette-green-300-rgb), 0.7);
  background: rgba(var(--game-color-palette-green-300-rgb), 0.1);
  animation: atp-frame 2s ease-in-out infinite;
  pointer-events: none;
}

.stat.ult-ready .label {
  color: var(--game-color-palette-green-300);
}

.stat.ult-ready .value {
  color: var(--game-color-palette-green-300);
  animation: atp-glow 2s ease-in-out infinite;
}

.stat.ult-ready .bar {
  height: 3px;
}

.stat.ult-ready .bar i {
  background: linear-gradient(90deg, var(--gold) 0%, var(--game-color-palette-white) 50%, var(--gold) 100%);
  background-size: 200% 100%;
  box-shadow: 0 0 8px rgba(var(--game-color-palette-green-300-rgb), 0.9);
  animation: atp-sheen 1.6s linear infinite;
}

@keyframes atp-frame {
  0%, 100% { box-shadow: 0 0 6px rgba(var(--game-color-palette-green-300-rgb), 0.25); }
  50% { box-shadow: 0 0 18px rgba(var(--game-color-palette-green-300-rgb), 0.6); }
}

@keyframes atp-glow {
  0%, 100% { text-shadow: 0 0 4px rgba(var(--game-color-palette-green-300-rgb), 0.4); }
  50% { text-shadow: 0 0 14px rgba(var(--game-color-palette-green-300-rgb), 1); }
}

@keyframes atp-sheen {
  from { background-position: 200% 0; }
  to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  #ult.ready,
  #ult.ready::before,
  #ult.ready::after,
  #ult.ready svg,
  #ult.charged,
  .ult-wrap.ready::after,
  .stat.ult-ready::before,
  .stat.ult-ready .value,
  .stat.ult-ready .bar i {
    animation: none;
  }

  #ult.ready::after,
  .ult-wrap.ready::after {
    display: none;
  }
}

#ult.armed,
#ult.live {
  border-color: var(--gold);
  color: var(--gold);
  background: linear-gradient(rgba(var(--game-color-palette-green-300-rgb), 0.1), rgba(var(--game-color-palette-green-300-rgb), 0.1)), var(--bench-raised);
}

@keyframes ult-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(var(--game-color-palette-green-300-rgb), 0.35), 0 0 22px rgba(var(--game-color-palette-green-300-rgb), 0.15); }
  50% { box-shadow: 0 0 16px rgba(var(--game-color-palette-green-300-rgb), 0.75), 0 0 40px rgba(var(--game-color-palette-green-300-rgb), 0.4); }
}

.ult-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-solid);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  z-index: 20;
  animation: speed-in 0.12s ease-out;
}

.ult-menu[hidden] {
  display: none;
}

.ult-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.ult-menu button:hover:not(:disabled) {
  background: var(--bench-hi);
}

.ult-menu svg {
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--tc);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A tool: its icon in its own colour, name and cost. Compact screens show icon and cost only. */
.tool {
  flex: none;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 8px;
  padding: 5px 10px 5px 8px;
  text-align: left;
}

.tool svg {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  color: var(--tc, var(--text));
}

.tool .name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.tool .cost {
  font-size: 11px;
  line-height: 1.2;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tool .cost.atp::after {
  content: " ATP";
}

.tool.locked {
  opacity: 0.5;
}

.tool.locked .cost {
  color: var(--off);
}

.tool.armed {
  border-color: var(--you);
  background: rgba(var(--game-color-semantic-highlight-primary-rgb), 0.14);
  box-shadow: 0 0 12px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.35);
}

@media (max-width: 900px), (max-height: 500px) {
  .tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-width: 48px;
    padding: 5px 4px 3px;
    border-radius: 12px;
  }

  .tool .name {
    display: none;
  }

  .tool .cost {
    font-size: 10px;
  }

  .tool .cost.atp::after {
    content: none;
  }

  .controls .lbl {
    display: none;
  }

  .controls button {
    min-width: 44px;
  }
}

/* ---------- cards ---------- */

.card {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-b));
  transform: translateX(-50%);
  width: min(92vw, 440px);
  max-height: calc(100vh - 32px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 6;
}

.card.wide {
  width: min(94vw, 620px);
}

.card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--you);
  text-shadow: 0 0 16px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.5);
}

.card h2 {
  margin: 12px 0 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.card p {
  margin: 0 0 8px;
}

.card .hint {
  color: var(--you);
  font-weight: 600;
  margin-top: 12px;
}

.small {
  color: var(--muted);
  font-size: 12px;
}

.card p.small:last-child {
  margin: 0;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.primary {
  background: rgba(var(--game-color-semantic-highlight-primary-rgb), 0.15);
  border-color: var(--you);
  color: var(--you);
  font-weight: 600;
  padding: 10px 16px;
}

.close {
  float: right;
  font-size: 12px;
  padding: 4px 10px;
}

#diplo .row button {
  flex: 1;
  min-width: 160px;
}

.rel-ally {
  color: var(--you);
}

.rel-hostile,
.rel-furious {
  color: var(--warn);
}

[hidden] {
  display: none !important;
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  .stat {
    min-width: 40px;
  }

  .stat.season,
  .stat.immune {
    min-width: 56px;
  }

  .stats {
    padding: 5px 8px;
    gap: 8px;
  }

  /* Stats over the full width, the two folds side by side under them. */
  #hud {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    grid-template-areas: "stats stats" "boss boss" "contracts board";
  }

  #f-contracts.open {
    width: min(230px, 100%);
  }

  #board {
    min-width: 0;
  }

  #board .temp {
    display: none;
  }

  body:not([data-phase="play"]) #feed {
    top: calc(120px + var(--safe-t));
  }

  /* All tools in one row. */
  #tools {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .tool {
    min-width: 0;
  }

  /* Evolve, speed and menu float in a column on the right, above the tools. */
  .controls {
    position: fixed;
    right: calc(8px + var(--safe-r));
    bottom: calc(var(--dock-h, 0px) + 8px);
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
  }

  .controls button {
    height: 44px;
    padding: 0 10px;
    border-radius: 22px;
    background: var(--panel-solid);
    font-size: 12px;
  }

  #evolve {
    width: 52px;
    height: 52px;
    border-radius: 50%;
  }

  #evolve svg {
    width: 24px;
    height: 24px;
  }

  .ult-wrap.ready::after {
    border-radius: 22px;
  }

  /* Toasts stay clear of that column. */
  #feed {
    width: calc(100vw - 16px - 64px);
  }
}

/* ---------- phases ---------- */

body:not([data-phase="play"]) #hud,
body:not([data-phase="play"]) #dock {
  display: none;
}

body[data-phase="place"] #hud {
  display: none;
}

/* ---------- full screens: title, picker, help, pause, game over ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* A screen taller than the window scrolls from its top instead of losing it. */
  justify-content: safe center;
  gap: 14px;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(4, 7, 9, 0.25) 0%, rgba(4, 7, 9, 0.85) 75%);
}

.screen.dim {
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.94);
}

/* The wordmark: "Age of" set small and tracked like a label, "Bacteria" in italic like a genus name. */
.logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Colonies eat the wordmarks of the title and the splash (logoeater.js). The canvas draws the letters
   meanwhile, so the page's own keep their place but turn invisible, also against the colours of their own
   rules. Canvas and spore never catch a tap. */
.eating,
.eating * {
  color: transparent !important;
}

.logo-eater {
  position: absolute;
  pointer-events: none;
}

.logo-spore {
  position: fixed;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
}

.logo .l1 {
  font-size: var(--t-s);
  font-weight: 500;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.logo .l2 {
  font-family: var(--f-name);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(42px, min(13vw, 6.4vh), 76px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: var(--t-s);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(340px, 86vw);
}

/* Buttons: flat rectangles. One filled culture-green action per screen, the rest outlined or plain. */
.big {
  min-height: 50px;
  border-radius: var(--r2);
  font-size: var(--t-l);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 1px solid var(--rule-strong);
  background: var(--bench-raised);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.big:hover {
  border-color: var(--ink-faint);
}

.big:active {
  background: var(--bench-hi);
}

.big small {
  font-size: var(--t-xs);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

.big.primary {
  color: var(--culture-ink);
  border-color: var(--culture);
  background: var(--culture);
}

.big.primary:active {
  background: var(--game-color-semantic-interactive-pressed);
}

.big.primary small {
  color: rgba(var(--game-color-palette-green-950-rgb), 0.72);
}

.big.ghost {
  background: transparent;
  font-weight: 500;
  font-size: var(--t-m);
  min-height: var(--hit);
}

.screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, 100%);
}

.screen-head h2 {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
}

.screen-title {
  margin: 0 0 var(--s1);
  font-size: clamp(30px, 9vw, 44px);
  font-weight: 600;
  line-height: 1.1;
  color: var(--ink);
  text-wrap: balance;
}

.screen-title.extinct {
  color: var(--safranin);
}

/* Options button in the top right corner of the title screen. */
.icon-btn.corner {
  position: absolute;
  top: calc(12px + var(--safe-t));
  right: calc(12px + var(--safe-r));
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- options ---------- */
/* Per sound: name, an on and off switch and a volume slider under them. */

.options {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.opt {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px 12px;
}

.opt-row b {
  display: block;
  font-size: 16px;
  color: var(--text);
}

.opt-row small {
  color: var(--muted);
  font-size: 12px;
}

.opt input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  accent-color: var(--you);
}

.opt input[type="range"]:disabled {
  opacity: 0.35;
}

.switch {
  position: relative;
  width: 56px;
  height: 32px;
  padding: 0;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] {
  border-color: var(--you);
  background: rgba(var(--game-color-semantic-highlight-primary-rgb), 0.25);
}

.switch[aria-checked="true"]::after {
  transform: translateX(24px);
  background: var(--you);
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--r2);
  padding: 0;
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(340px, 86vw);
  margin-bottom: 8px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(16, 26, 30, 0.85);
}

.tile b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.tile span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#m-status {
  min-height: 1.4em;
}

/* species picker */

#pick {
  justify-content: flex-start;
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.95);
}

/* The species plate: the chosen species in the middle of an agar plate, every species as a small colony
   on its rim, in its Gram stain colour. Hairlines split the rim into sectors by how a species wins. A green
   ring marks the choice, a safranin notch the species that counter it, a green notch those it counters. */
.species {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(560px, 100%);
}

.sp-dish {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.sp-plate {
  position: relative;
  align-self: center;
  /* room on the right for the objective arc (34 px), the pair centred together */
  width: min(100% - 40px, 440px);
  left: -17px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bench-raised);
  box-shadow:
    inset 0 0 0 1px rgba(var(--game-color-palette-neutral-100-rgb), 0.2),
    inset 0 0 42px 4px rgba(12, 14, 11, 0.7);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* The rim of the glass dish, as on the title screen. */
.sp-plate::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(var(--game-color-palette-neutral-100-rgb), 0.1);
  pointer-events: none;
}

.sp-rim,
.sp-ring {
  position: absolute;
  inset: 0;
}

.sp-rim {
  pointer-events: none;
}

#portrait {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.sp-thumb {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.sp-thumb canvas {
  border-radius: 50%;
}

/* Open species stand out: full colour on a lit disc with a solid rim. Locked ones fade back: dim, washed
   out, no disc, a dashed rim and the lab level that opens them on a tag; a species that only needs the full
   game gets agar-amber dashes instead. The portrait in the middle always stays bright: the chips on the card
   and the start button say when it is locked. */
.sp-thumb:not(.locked) canvas {
  background: var(--bench-hi);
  box-shadow: inset 0 0 0 1px var(--rule-strong);
}

.sp-thumb:not(.locked):hover canvas,
.sp-thumb:not(.locked).peek canvas {
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}

.sp-thumb.locked canvas {
  opacity: 0.35;
  filter: saturate(0.35);
}

/* The dashed rim sits on the button, so the dimming of the picture does not fade it. */
.sp-thumb.locked::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1px dashed var(--ink-faint);
  pointer-events: none;
}

.sp-thumb.locked:hover canvas,
.sp-thumb.locked.peek canvas {
  opacity: 0.6;
}

.sp-thumb.full::before {
  border-color: rgba(var(--game-color-palette-green-300-rgb), 0.8);
}

.sp-thumb.on canvas {
  box-shadow: 0 0 0 2px var(--culture);
}

.sp-thumb:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 1px;
}

.sp-thumb-lab {
  position: absolute;
  /* on the inner edge, towards the middle, clear of the counter notch on the outer edge */
  left: calc(50% - var(--x) * 42%);
  top: calc(50% - var(--y) * 42%);
  transform: translate(-50%, -50%);
  padding: 0 2px;
  border-radius: var(--r1);
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.8);
  font-family: var(--f-num);
  font-size: 9px;
  line-height: 12px;
  color: var(--ink-dim);
  pointer-events: none;
}

.sp-thumb-lab:empty {
  display: none;
}

/* How many species are open and which one opens next, under the plate. */
.sp-open {
  margin: 0;
  font-size: var(--t-xs);
  color: var(--muted);
  text-align: center;
}

.sp-open b {
  color: var(--ink);
  font-weight: 600;
}

.sp-open i {
  font-family: var(--f-name);
  font-weight: 500;
}

/* The counter notches sit on the outer edge of a species, pointing away from the middle. */
.sp-thumb.threat::after,
.sp-thumb.prey::after {
  content: "";
  position: absolute;
  left: calc(50% + var(--x) * 50%);
  top: calc(50% + var(--y) * 50%);
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--safranin);
  transform: rotate(45deg);
}

.sp-thumb.prey::after {
  background: var(--culture);
}

/* The name of the species under the mouse or a resting finger. */
.sp-peek {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: var(--r1);
  background: var(--bench);
  border: 1px solid var(--rule-strong);
  font-size: var(--t-xs);
  white-space: nowrap;
  pointer-events: none;
}

/* Previous, the key to the notches, next. */
.sp-nav {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: var(--s2);
}

.sp-key {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px var(--s3);
  font-size: var(--t-xs);
  color: var(--muted);
}

.sp-key span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--safranin);
  transform: rotate(45deg);
}

.sp-key .prey::before {
  background: var(--culture);
}

.arrow {
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border-radius: var(--r2);
  font-size: 22px;
}

.sp-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  touch-action: pan-y;
}

.sp-card.enter {
  animation: cardin 0.25s ease;
}

@keyframes cardin {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-card.enter {
    animation: none;
  }
}

.sp-id {
  min-width: 0;
  margin-bottom: var(--s3);
}

.sp-name {
  font-family: var(--f-name);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.05;
}

.sp-role {
  margin-top: 2px;
  color: var(--ink-dim);
  font-size: var(--t-s);
}

/* Traits on a scale of ten steps. */
.sp-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: var(--s2);
  font-size: var(--t-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.st i {
  display: block;
  height: 6px;
  background: linear-gradient(90deg, var(--culture) calc(var(--v) * 100%), var(--rule) 0);
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%);
  mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%);
}

/* Description, facts and signature techs, a tap away. */
.sp-more {
  margin-top: var(--s3);
}

.sp-more summary {
  cursor: pointer;
  padding: var(--s1) 0;
  font-size: var(--t-s);
  font-weight: 500;
  color: var(--ink-dim);
  list-style: none;
}

.sp-more summary:hover {
  color: var(--ink);
}

.sp-more summary::-webkit-details-marker {
  display: none;
}

.sp-more summary::after {
  content: " ›";
}

.sp-more[open] summary::after {
  content: " ˅";
}

.sp-text {
  margin: var(--s2) 0 var(--s3);
  color: var(--muted);
  font-size: var(--t-s);
  line-height: 1.5;
}

.sp-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 0;
  font-size: var(--t-s);
  border-top: 1px solid var(--rule);
}

.sp-facts dt,
.sp-facts dd {
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.sp-facts dt {
  padding-right: var(--s3);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
  line-height: 1.9;
}

.sp-facts dd {
  margin: 0;
}

.sp-sig {
  margin-top: var(--s3);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sp-techs {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  font-size: var(--t-s);
}

.sp-techs li + li::before {
  content: "·";
  padding: 0 6px;
  color: var(--ink-faint);
}

.dots {
  display: flex;
  gap: 4px;
}

.dots button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(var(--rule-strong), var(--rule-strong)) center / 100% 3px no-repeat;
}

.dots button.on {
  background: linear-gradient(var(--culture), var(--culture)) center / 100% 3px no-repeat;
}

/* Difficulty, mode and genes as a ruled list. A row shows its choice; difficulty and mode open their
   options in place. */
.run-setup {
  /* Never squeezed by a short window: the screen scrolls instead. */
  flex: none;
  display: flex;
  flex-direction: column;
  width: min(560px, 100%);
  border-top: 1px solid var(--rule);
}

.setup-row {
  border-bottom: 1px solid var(--rule);
}

.setup-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: var(--hit);
  padding: 6px var(--s1);
  border: 0;
  border-radius: 0;
  background: none;
  text-align: left;
}

.setup-head:hover {
  background: var(--bench-raised);
}

.setup-head .label {
  flex: none;
  font-size: var(--t-xs);
}

.setup-head b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.setup-head b.none {
  font-weight: 400;
  color: var(--muted);
}

.setup-head b.premium::after {
  content: " ★";
  color: var(--agar);
}

.setup-head .chev {
  flex: none;
  font-style: normal;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.setup-head .chev::before {
  content: "›";
}

.setup-head[aria-expanded="true"] .chev {
  color: var(--ink);
  transform: rotate(90deg);
}

.setup-body {
  padding: var(--s1) var(--s1) var(--s3);
}

.setup-body p {
  margin: var(--s2) 0 0;
}

/* Difficulty: a live dish next to the name, a slider under it. The slider is inset by half a name's width
   minus half a thumb, so its --n stops (five here) sit over the centres of the names. */
.threat {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.threat-dish {
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(var(--game-color-palette-neutral-100-rgb), 0.2), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 0 5px var(--bench), 0 0 0 6px rgba(var(--game-color-palette-neutral-100-rgb), 0.07);
}

/* A new scene fades in, so the jump when the slider moves or the scene starts over is soft. */
.threat-dish.fresh {
  animation: dishin 0.35s ease;
}

@keyframes dishin {
  from { opacity: 0.2; }
  to { opacity: 1; }
}

.threat-dish[data-level="3"] {
  box-shadow: inset 0 0 0 1px var(--alert), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 0 5px var(--bench), 0 0 0 6px rgba(var(--game-color-palette-red-500-rgb), 0.3);
}

.threat-dish[data-level="4"] {
  box-shadow: inset 0 0 0 1px var(--safranin), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 0 5px var(--bench), 0 0 0 6px rgba(var(--game-color-palette-red-500-rgb), 0.45);
}

.threat-info {
  flex: 1;
  min-width: 0;
}

.threat-name {
  font-size: var(--t-xl);
  font-weight: 600;
  transition: color 0.2s ease;
}

.threat-name.premium::after,
.tier-name.premium::after,
.threat-ticks .premium::after {
  content: " ★";
  color: var(--agar);
}

.threat-info p {
  margin: var(--s1) 0 0;
}

.threat-range {
  --tc: var(--culture);
  display: block;
  width: calc(100% - 100% / var(--n, 5) + 20px);
  height: 28px;
  margin: var(--s3) calc(50% / var(--n, 5) - 10px) 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.threat-range:focus {
  outline: none;
}

.threat-range::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule-strong);
}

.threat-range::-moz-range-track {
  height: 2px;
  background: var(--rule-strong);
}

.threat-range::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -9px;
  border: 4px solid var(--bench);
  border-radius: 50%;
  background: var(--tc);
  box-shadow: 0 0 0 1px var(--tc);
  transition: background 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.threat-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 4px solid var(--bench);
  border-radius: 50%;
  background: var(--tc);
  box-shadow: 0 0 0 1px var(--tc);
}

.threat-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 1px var(--tc), 0 0 0 4px rgba(var(--game-color-palette-neutral-100-rgb), 0.45);
}

.threat-ticks {
  display: grid;
  grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr));
  margin-top: 2px;
  font-size: var(--t-xs);
  color: var(--muted);
  text-align: center;
}

.threat-ticks span {
  padding: 4px 0;
  cursor: pointer;
  white-space: nowrap;
}

.threat-ticks span.on {
  color: var(--text);
  font-weight: 600;
}

/* The tier slider of the boss fights and the hospital defense (tierpick.js): the slider and names of the
   difficulty above, the chosen name large in its colour. The line to a locked tier is dotted, like the way
   to a locked boss on the plate; --k is the last open stop. A beaten tier has a green line under its name. */
.tier-pick {
  --n: 3;
}

/* The live dish (dish.js) ringed in the tier's colour. */
.tier-dish {
  width: 120px;
  height: 120px;
  box-shadow: inset 0 0 0 1px var(--tc), inset 0 0 18px rgba(0, 0, 0, 0.6), 0 0 0 5px var(--bench), 0 0 0 6px color-mix(in srgb, var(--tc) 40%, transparent);
  transition: box-shadow 0.2s ease;
}

/* The hospital screen has room: its dish is the picture of the screen, large and centred, the tier's name
   and text under it. */
#ho-tier .threat {
  flex-direction: column;
  gap: var(--s4);
  text-align: center;
}

#ho-tier .tier-dish {
  width: min(240px, 62vw, 28vh);
  height: min(240px, 62vw, 28vh);
  box-shadow: inset 0 0 0 1px var(--tc), inset 0 0 28px rgba(0, 0, 0, 0.6), 0 0 0 8px var(--bench), 0 0 0 9px color-mix(in srgb, var(--tc) 40%, transparent), 0 0 48px color-mix(in srgb, var(--tc) 18%, transparent);
}

#ho-tier .threat-info {
  width: 100%;
}

#ho-tier .tier-head {
  justify-content: center;
}

.tier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}

.tier-name {
  font-size: var(--t-l);
  font-weight: 600;
  transition: color 0.2s ease;
}

.tier-note {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.tier-text {
  margin: var(--s1) 0 0;
  color: var(--ink-dim);
}

.tier-range {
  --open-at: calc(10px + (100% - 20px) * var(--k, 0) / (var(--n) - 1));
}

.tier-range.gated::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--rule-strong) 0 var(--open-at), transparent 0), repeating-linear-gradient(to right, var(--ink-faint) 0 2px, transparent 2px 6px);
}

.tier-range.gated::-moz-range-track {
  background: linear-gradient(to right, var(--rule-strong) 0 var(--open-at), transparent 0), repeating-linear-gradient(to right, var(--ink-faint) 0 2px, transparent 2px 6px);
}

.tier-ticks span {
  position: relative;
}

.tier-ticks span.locked {
  color: var(--ink-faint);
  cursor: not-allowed;
}

.tier-ticks span.beaten::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 14px;
  margin-left: -7px;
  border-top: 2px solid var(--culture);
}

.tier-ticks span.nudge {
  animation: nudge 0.3s ease;
}

@keyframes nudge {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .tier-ticks span.nudge {
    animation: none;
  }
}

/* Mode: one row per mode with its run clock to scale. The stage colours are the game's: green while the
   host is calm, the antibiotic blue, the pale violet of macrophages and the autoclave's white heat. */
.setup-head b small {
  font-weight: 400;
  color: var(--muted);
}

.runs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.run {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: var(--s3);
  min-height: 40px;
  padding: 5px 10px;
  border-color: transparent;
  border-radius: var(--r2);
  background: none;
  text-align: left;
}

.run:hover {
  border-color: var(--rule);
}

.run.on {
  border-color: rgba(var(--game-color-palette-green-500-rgb), 0.6);
  background: rgba(var(--game-color-palette-green-500-rgb), 0.06);
}

.run-id {
  white-space: nowrap;
}

.run-id b {
  font-size: var(--t-m);
  font-weight: 600;
}

.run.on .run-id b {
  color: var(--culture);
}

.run-id small {
  margin-left: 5px;
  font-size: var(--t-xs);
  color: var(--muted);
}

.run-track {
  position: relative;
  display: flex;
  align-items: center;
  height: 10px;
}

.run-track i {
  height: 4px;
  opacity: 0.5;
}

.run.on .run-track i {
  opacity: 1;
}

.st0 {
  background: var(--culture);
}

.st1 {
  background: var(--cold);
}

.st2 {
  background: var(--game-color-gameplay-macrophage-stage);
}

.st3,
.run-track .clave {
  background: var(--ink);
}

.run-track .clave {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.run-track .endless {
  flex: 1;
  background: linear-gradient(90deg, var(--culture), rgba(var(--game-color-palette-green-500-rgb), 0));
}

.run-track .inf {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-55%);
  font-size: 16px;
  color: var(--culture);
}

/* On the chosen mode your culture, a green dot, runs the clock: Blitz faster than Standard. */
.run-track .head {
  display: none;
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--culture);
  box-shadow: 0 0 0 2px var(--bench);
}

.run.on .run-track .head {
  display: block;
  animation: runclock var(--dur) linear infinite;
}

@keyframes runclock {
  from { left: 0; opacity: 1; }
  92% { left: 100%; opacity: 1; }
  to { left: 100%; opacity: 0; }
}

.run-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px var(--s3);
  margin-top: var(--s2);
  font-size: var(--t-xs);
  color: var(--muted);
}

.run-legend i {
  display: inline-block;
  width: 8px;
  height: 3px;
  margin-right: 5px;
  vertical-align: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .run.on .run-track .head {
    animation: none;
    display: none;
  }
}

/* A segmented choice: tabs of the legal and score screens. */
.seg {
  display: flex;
  gap: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r2);
  overflow: hidden;
}

.seg button {
  flex: 1;
  min-height: 40px;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: none;
  font-size: var(--t-s);
  font-weight: 500;
}

.seg button + button {
  border-left: 1px solid var(--rule-strong);
}

.seg button.on {
  color: var(--culture-ink);
  background: var(--culture);
}

#p-go {
  width: min(560px, 100%);
}

/* On phones the card, the run setup and the start button follow the plate in one column. */
.sp-side {
  display: contents;
}

/* Wide screens: the plate on the left; on the right a column at least as tall as the plate with the species
   card at the top and the run setup and start button at the bottom. The card always shows in full. */
@media (min-width: 960px) {
  #pick .screen-head,
  #pick-boss {
    width: min(928px, 100%);
  }

  #pick .species {
    display: grid;
    grid-template-columns: minmax(0, 480px) minmax(0, 400px);
    column-gap: 48px;
    justify-content: center;
    width: min(928px, 100%);
  }

  .sp-dish {
    align-self: start;
  }

  .sp-plate {
    width: calc(100% - 40px);
    left: 0;
  }

  /* At least as tall as the plate; a long card makes the column taller and the screen scrolls. */
  .sp-side {
    display: flex;
    flex-direction: column;
    gap: var(--s4);
  }

  .sp-card {
    flex: none;
    margin-bottom: auto;
  }

  #run-setup,
  #p-go {
    flex: none;
    width: 100%;
  }
}

.help-card {
  width: min(560px, 100%);
  padding: var(--s4);
  border-radius: var(--r2);
  border: 1px solid var(--rule);
  background: var(--bench-raised);
}

.help-card p {
  margin: 0 0 12px;
}

/* ---------- how to play ---------- */
/* A live scene from the game on top, the lesson under it, all rules folded away below. */

.lesson {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}

.lesson-stage {
  position: relative;
  width: 100%;
  height: clamp(200px, 34vh, 320px);
  border-radius: var(--r2);
  border: 1px solid var(--rule-strong);
  overflow: hidden;
  background: var(--bench);
}

#tut-scene {
  display: block;
  width: 100%;
  height: 100%;
}

.lesson-caption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 58px;
  padding: 6px 10px;
  border-radius: var(--r1);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: var(--t-s);
  font-weight: 500;
  text-align: center;
}

.lesson-caption:empty {
  display: none;
}

/* The tool bar of the game along the bottom of a lesson, icons and costs, not clickable. */
.tut-tools {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 3px;
  pointer-events: none;
}

.tut-tools .tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 4px 2px 2px;
  border-radius: var(--r1);
  background: var(--panel-solid);
}

.tut-tools .tool svg {
  width: 18px;
  height: 18px;
}

.tut-tools .tool .name {
  display: none;
}

.tut-tools .tool .cost {
  font-size: 9px;
}

.tut-tools .tool .cost.atp::after {
  content: none;
}

.lesson-stage {
  height: clamp(250px, 40vh, 360px);
}

/* The finger that shows where to tap or drag. */
.tut-finger {
  position: absolute;
  z-index: 1;
  left: -14px;
  top: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: rgba(var(--game-color-palette-neutral-100-rgb), 0.25);
  pointer-events: none;
  transition: scale 0.15s ease;
}

.tut-finger.down {
  scale: 0.75;
}

.lesson-nav {
  display: flex;
  align-items: center;
  gap: var(--s4);
}

.lesson-title {
  margin: var(--s1) 0 0;
  font-size: var(--t-xl);
  font-weight: 600;
}

.lesson-text {
  margin: 0;
  max-width: 46ch;
  text-align: center;
  color: var(--muted);
  font-size: var(--t-m);
  line-height: 1.5;
}

.help-rules summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ink-dim);
}

.help-rules summary:hover {
  color: var(--ink);
}

.help-rules[open] summary {
  margin-bottom: var(--s3);
}

.help-card b {
  font-weight: 600;
  color: var(--ink);
}

.banner {
  position: fixed;
  top: calc(12px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 18px 6px 6px;
  border-radius: 28px;
  border: 1px solid rgba(var(--game-color-semantic-highlight-primary-rgb), 0.5);
  background: rgba(8, 13, 16, 0.92);
  color: var(--you);
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 20px rgba(var(--game-color-semantic-highlight-primary-rgb), 0.25);
  animation: bob 3s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -4px); }
}

.banner .spot-btn {
  flex: none;
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 18px;
  border-color: rgba(var(--game-color-semantic-highlight-primary-rgb), 0.6);
  background: rgba(var(--game-color-semantic-highlight-primary-rgb), 0.15);
  color: var(--you);
  font-size: 13px;
  font-weight: 700;
}

.banner .icon-btn {
  width: 36px;
  height: 36px;
}

/* ---------- evolution ---------- */

/* The DNA to spend: a reading, not a badge. */
.pill {
  font-family: var(--f-num);
  font-size: var(--t-s);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pill b {
  font-size: var(--t-l);
  font-weight: 500;
  color: var(--culture);
}

/* Tabs: text with an underline in the colour of the branch. */
.tabs {
  display: flex;
  gap: 2px var(--s1);
  overflow-x: auto;
  padding: 0 var(--s3);
  border-bottom: 1px solid var(--rule);
  scrollbar-width: none;
  flex: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

/* --c: an accent colour for the tab. */
.tab {
  --c: var(--culture);
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  font-weight: 500;
  font-size: var(--t-s);
  color: var(--muted);
}

.tab:hover {
  color: var(--ink);
}

.tab svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--c);
}

.tab.on {
  color: var(--ink);
  border-bottom-color: var(--c);
}

/* How many techs of a branch can be evolved now: a plain number after its name. */
.badge {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  font-style: normal;
  color: var(--culture);
}

#evolve .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: var(--r1);
  background: var(--culture);
  color: var(--culture-ink);
  line-height: 18px;
  text-align: center;
}

#evolve {
  position: relative;
}

.traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-family: var(--f-num);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.traits i {
  font-family: var(--f-ui);
  font-style: normal;
  color: var(--muted);
}

/* The evolution tree (js/techtree.js) is a slide under a dark-field microscope: techs are cells and only
   evolved ones glow, softly, in the colour of their branch. Everything around the tree stays flat. */
.evo {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
  background: var(--bench);
}

.evo-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3) var(--s1) var(--s4);
}

.evo-head h1 {
  margin: 0;
  flex: 1;
  font-size: var(--t-xl);
  font-weight: 600;
}

.evo .binomial {
  font-family: var(--f-name);
  font-style: italic;
  letter-spacing: 0;
}

/* The branches as chips: icon, name and how many techs there can be evolved now. */
.evo-nav {
  display: flex;
  gap: var(--s1);
  overflow-x: auto;
  padding: var(--s1) var(--s3) var(--s2);
  border-bottom: 1px solid var(--rule);
  scrollbar-width: none;
  flex: none;
}

.evo-nav::-webkit-scrollbar {
  display: none;
}

.tt-chip {
  --c: var(--ink);
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: none;
  color: var(--ink-dim);
  font-size: var(--t-s);
  font-weight: 500;
}

.tt-chip svg,
.tt-d-head > svg,
.tt-req svg,
.tt-zoom svg {
  fill: none;
  stroke: var(--c, currentColor);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-chip.on {
  color: var(--ink);
  border-color: var(--c);
}

.tt-chip.all svg {
  stroke: var(--ink-dim);
}

.tt-chip .badge {
  color: var(--c);
}

.evo-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: radial-gradient(ellipse 80% 60% at 50% 75%, #171d17 0%, var(--bench) 100%);
}

.evo-view.panning {
  cursor: grabbing;
}

.evo-svg {
  --inv: 1;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  font-family: var(--f-ui);
  user-select: none;
  -webkit-user-select: none;
}

.evo-svg .binomial {
  font-family: var(--f-name);
  font-style: italic;
}

/* Backdrop: blurred cells and drifting motes, far behind the tree. */
.tt-ghost {
  fill: var(--culture);
  opacity: 0.03;
}

.tt-mote {
  fill: var(--ink);
  opacity: 0.16;
  animation: tt-drift 30s linear infinite alternate;
}

@keyframes tt-drift {
  to { transform: translate(46px, -70px); }
}

/* A branch: a faint band in its colour and the limb that carries it from the core. */
.tt-band {
  fill: var(--c);
  fill-opacity: 0.04;
  stroke: var(--c);
  stroke-opacity: 0.16;
}

.tt-limb,
.tt-limb-core,
.tt-strand,
.tt-root-stem,
.tt-edge {
  fill: none;
  stroke-linecap: round;
}

.tt-limb {
  stroke: var(--c);
  stroke-width: 18;
  stroke-opacity: 0.08;
}

.tt-limb-core {
  stroke: var(--c);
  stroke-width: 2;
  stroke-opacity: 0.5;
}

.tt-strand {
  stroke-width: 3;
}

.tt-strand.a {
  stroke: var(--culture);
}

.tt-strand.b {
  stroke: var(--violet);
}

.tt-rung {
  stroke: var(--ink-faint);
  stroke-width: 2;
}

.tt-root-stem {
  stroke: var(--c);
  stroke-width: 1.5;
  stroke-opacity: 0.55;
}

/* Prerequisites: faint until the tech below is evolved. Lines between branches are dashed: synergies. */
.tt-edge {
  stroke: var(--c);
  stroke-width: 2;
  stroke-opacity: 0.22;
}

.tt-edge.open {
  stroke-opacity: 0.55;
}

.tt-edge.on {
  stroke-width: 2.5;
  stroke-opacity: 0.95;
}

.tt-edge.cross {
  stroke-opacity: 0.3;
  stroke-dasharray: 8 7;
}

.tt-edge.hl {
  stroke-width: 3;
  stroke-opacity: 1;
}

.tt-edge.grow {
  stroke-dasharray: 1;
  animation: tt-grow 0.9s ease-out;
}

@keyframes tt-grow {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

.tt-head {
  cursor: pointer;
}

.tt-head-name {
  fill: var(--c);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-anchor: middle;
}

.tt-head-name.binomial {
  font-size: 18px;
  letter-spacing: 0;
}

.tt-head-sub {
  fill: var(--ink-dim);
  font-size: 11.5px;
  text-anchor: middle;
}

.tt-sec {
  fill: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.tt-sec-rule {
  stroke: var(--rule-strong);
  stroke-dasharray: 3 5;
}

/* Far out only the branches and their names show. */
.tt-far-name {
  fill: var(--c);
  font-size: calc(var(--inv) * 17px);
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: var(--bench);
  stroke-width: calc(var(--inv) * 4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.evo-svg.tall .tt-far-name {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(-90deg);
}

.tt-name,
.tt-cost,
.tt-mark,
.tt-from,
.tt-head,
.tt-sec,
.tt-sec-rule,
.tt-core-name {
  transition: opacity 0.25s;
}

.evo-svg.far .tt-far-name {
  opacity: 0.95;
  pointer-events: auto;
  cursor: pointer;
}

.evo-svg.far :is(.tt-name, .tt-cost, .tt-mark, .tt-from, .tt-head, .tt-sec, .tt-sec-rule, .tt-core-name) {
  opacity: 0;
}

/* A tech. Its state shows in shape too: a lock, a check, a cross or a pulse, not only in colour. */
.tt-tech,
.tt-core {
  cursor: pointer;
  outline: none;
}

.tt-halo {
  opacity: 0;
}

.tt-body {
  fill: var(--bench-raised);
  stroke: var(--c);
  stroke-width: 2;
}

.tt-ico {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-ring2 {
  fill: none;
  stroke: var(--c);
  stroke-opacity: 0.5;
}

.tt-pulse {
  fill: none;
  stroke: none;
}

.tt-name,
.tt-cost,
.tt-core-name,
.tt-core-count {
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--bench);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.tt-name {
  fill: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}

.tt-tech.major .tt-name {
  font-size: 13.5px;
  font-weight: 600;
}

.tt-cost {
  fill: var(--ink-dim);
  font-family: var(--f-num);
  font-size: 10.5px;
}

.tt-mark {
  display: none;
}

.tt-mark-bg,
.tt-from-bg {
  fill: var(--bench);
  stroke: var(--rule-strong);
  stroke-width: 1.5;
}

.tt-mark-ico {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-from {
  fill: none;
  stroke: var(--ink-dim);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-tech:is(.owned, .locked, .closed, .premium) .tt-mark {
  display: inline;
}

.tt-tech.owned .tt-body {
  fill: var(--c);
}

.tt-tech.owned .tt-ico {
  stroke: var(--bench);
}

.tt-tech.owned .tt-halo {
  opacity: 1;
}

.tt-tech.owned .tt-cost {
  fill: var(--c);
}

.tt-tech.owned .tt-mark-bg {
  stroke: var(--c);
}

.tt-tech.owned .tt-mark-ico {
  stroke: var(--c);
}

.tt-tech.ready .tt-body {
  stroke-width: 2.6;
}

.tt-tech.ready .tt-pulse {
  stroke: var(--c);
  stroke-width: 1.5;
  animation: tt-pulse 1.8s ease-out infinite;
}

@keyframes tt-pulse {
  from { transform: scale(1); opacity: 0.85; }
  to { transform: scale(1.5); opacity: 0; }
}

.tt-tech.ready .tt-cost {
  fill: var(--culture);
}

.tt-tech.saving .tt-body {
  stroke-opacity: 0.55;
}

.tt-tech.saving .tt-ico {
  stroke-opacity: 0.65;
}

.tt-tech:is(.locked, .premium) .tt-body {
  stroke: var(--rule-strong);
  stroke-dasharray: 3 3;
}

.tt-tech:is(.locked, .premium) .tt-ico {
  stroke: var(--ink-faint);
}

.tt-tech:is(.locked, .premium) .tt-name {
  fill: var(--ink-dim);
}

.tt-tech.closed {
  opacity: 0.4;
}

/* The selected tech: a dashed ring in ink. */
.tt-tech.sel .tt-pulse,
.tt-core.sel .tt-core-ring {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-dasharray: 4 3;
  opacity: 1;
  animation: none;
}

.tt-tech:focus-visible .tt-body,
.tt-core:focus-visible .tt-body {
  stroke: var(--ink);
  stroke-width: 3;
}

/* Evolving: the cell blooms out of the branch and its lines grow in from below. */
.tt-tech.born .tt-cell {
  animation: tt-born 0.8s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.tt-tech.born .tt-halo {
  animation: tt-flare 1.2s ease-out;
}

@keyframes tt-born {
  from { transform: scale(0.5); }
  to { transform: scale(1); }
}

@keyframes tt-flare {
  0% { opacity: 1; transform: scale(0.6); }
  35% { opacity: 1; transform: scale(1.7); }
  100% { opacity: 1; transform: scale(1); }
}

.tt-core .tt-body {
  stroke: var(--ink);
  stroke-width: 2.5;
}

.tt-core .tt-halo {
  opacity: 0.8;
}

.tt-core .tt-ico {
  stroke: var(--culture);
  stroke-width: 1.4;
}

.tt-core-ring {
  fill: none;
  stroke: var(--culture);
  stroke-opacity: 0.55;
  stroke-dasharray: 2 7;
  animation: tt-spin 60s linear infinite;
}

@keyframes tt-spin {
  to { transform: rotate(360deg); }
}

.tt-core-name {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tt-core-count {
  fill: var(--culture);
  font-family: var(--f-num);
  font-size: 10.5px;
}

.tt-zoom {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (min-width: 900px) {
  .tt-zoom {
    top: auto;
    bottom: var(--s3);
  }
}

.tt-zoom .icon-btn {
  width: 40px;
  height: 40px;
  font-size: 22px;
  background: var(--bench-raised);
  border: 1px solid var(--rule-strong);
}

/* Details: a panel at the foot on a phone, at the side on a wide screen. */
.tt-detail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-height: 56%;
  overflow-y: auto;
  padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-b));
  border-top: 1px solid var(--rule-strong);
  background: var(--bench-raised);
  cursor: auto;
  touch-action: pan-y;
}

@media (min-width: 900px) {
  .tt-detail {
    top: var(--s3);
    right: var(--s3);
    bottom: auto;
    left: auto;
    width: 360px;
    max-height: calc(100% - 2 * var(--s3));
    padding-bottom: var(--s3);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r2);
  }
}

.tt-d-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
}

.tt-d-head > svg {
  flex: none;
  margin-top: 3px;
}

.tt-d-head > div {
  flex: 1;
  min-width: 0;
}

.tt-d-head h2 {
  margin: 0;
  font-size: var(--t-l);
  font-weight: 600;
}

.tt-d-head .icon-btn {
  width: 36px;
  height: 36px;
  margin: -4px -6px 0 0;
}

.tt-d-cat {
  margin: 2px 0 0;
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.tt-d-tags {
  margin: var(--s2) 0 0;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tt-d-tags .binomial {
  text-transform: none;
  font-weight: 500;
}

.tt-d-desc {
  margin: var(--s2) 0 0;
  font-size: var(--t-s);
  color: var(--ink-dim);
}

.tt-d-effect {
  margin: var(--s1) 0 0;
  font-size: var(--t-m);
}

.tt-d-fork {
  margin: var(--s2) 0 0;
  font-size: var(--t-s);
  color: var(--agar);
}

.tt-d-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--s2);
}

.tt-d-row > span {
  min-width: 62px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tt-req {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: none;
  color: var(--ink);
  font-size: var(--t-s);
}

.tt-req.owned {
  border-color: var(--c);
}

.tt-d-foot {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s3);
}

.tt-d-state {
  flex: 1;
  margin: 0;
  font-size: var(--t-s);
  color: var(--ink-dim);
}

.tt-d-state b {
  font-weight: 600;
  color: var(--ink);
}

.tt-d-state:is(.ready, .owned) b {
  color: var(--culture);
}

.tt-buy {
  flex: none;
  min-width: 124px;
  min-height: var(--hit);
  padding: 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  border: 1px solid var(--culture);
  border-radius: var(--r2);
  background: var(--culture);
  color: var(--culture-ink);
  font-size: var(--t-m);
  font-weight: 600;
}

.tt-buy b {
  font-family: var(--f-num);
  font-size: var(--t-s);
  font-weight: 500;
}

.tt-buy:disabled {
  border-color: var(--rule);
  background: none;
  color: var(--ink-faint);
  opacity: 1;
}

/* A fork asks once more: amber, since it closes another tech for the run. */
.tt-buy.sure,
.tt-buy.premium {
  border-color: var(--agar);
  background: var(--agar);
  color: var(--culture-ink);
}

.tt-detail .traits {
  margin-top: var(--s3);
}

@media (prefers-reduced-motion: reduce) {
  .tt-mote,
  .tt-core-ring,
  .tt-tech.ready .tt-pulse {
    animation: none;
  }
}






















@media (max-width: 560px) {
  .seg button {
    font-size: 12px;
  }

  .screen {
    gap: 10px;
  }
}

/* ---------- developer splash ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bench);
  transition: opacity 0.55s ease;
}

.splash.out {
  opacity: 0;
  pointer-events: none;
}

.studio {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: clamp(34px, 10vw, 72px);
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: studio-in 0.9s 0.2s ease forwards;
}

.studio .slash {
  color: var(--safranin);
  transform: skewX(-12deg);
  animation: slash-cut 0.7s 0.1s ease both;
}

.studio .name {
  color: var(--ink);
}

.studio .name b {
  color: var(--culture);
}

.presents {
  color: var(--muted);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  font-size: 12px;
  opacity: 0;
  animation: fade-in 0.6s 1s ease forwards;
}

@keyframes studio-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes slash-cut {
  from { transform: skewX(-12deg) translateY(-40px) scaleY(1.6); opacity: 0; }
  to { transform: skewX(-12deg); opacity: 1; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

/* ---------- title footer and legal ---------- */

/* The footer closes the column: at the bottom when there is room, right under the buttons when there is not. */
.title-foot {
  margin-top: auto;
  padding-top: var(--s2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  font-size: var(--t-xs);
  color: var(--muted);
}

.title-foot b {
  font-weight: 500;
  color: var(--text);
}

.link {
  border: 0;
  background: none;
  padding: 6px 10px;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
  font-size: var(--t-xs);
}

.link:hover {
  color: var(--text);
}

#legal {
  justify-content: flex-start;
}

.legal-tabs {
  width: min(560px, 100%);
}

.legal-frame {
  flex: 1;
  width: min(720px, 100%);
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #06090c;
}

/* ---------- full game ---------- */

.big.gold {
  color: var(--culture-ink);
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 4px 0 var(--culture), 0 0 24px rgba(var(--game-color-palette-green-300-rgb), 0.35);
}

.big.gold:active {
  box-shadow: 0 1px 0 var(--culture), 0 0 24px rgba(var(--game-color-palette-green-300-rgb), 0.35);
}

.big.gold small {
  color: var(--culture-ink);
}

.unlock-card {
  width: min(460px, 100%);
  padding: 18px 18px 8px;
  border-radius: 22px;
  border: 1px solid rgba(var(--game-color-semantic-highlight-reward-rgb), 0.5);
  background: radial-gradient(ellipse at 50% 0%, rgba(var(--game-color-palette-green-300-rgb), 0.18), rgba(var(--game-color-palette-neutral-950-rgb), 0.95) 65%);
  box-shadow: 0 0 30px rgba(var(--game-color-palette-green-300-rgb), 0.15);
}

.unlock-title {
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(var(--game-color-palette-green-300-rgb), 0.5);
  margin-bottom: 10px;
}

.perks {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.perks li {
  padding-left: 22px;
  position: relative;
  color: var(--muted);
  font-size: 14px;
}

.perks li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

.perks b {
  display: block;
  color: var(--text);
}

#u-status {
  min-height: 1.4em;
  text-align: center;
  max-width: 420px;
}

.sp-card {
  position: relative;
}

/* Why a species cannot be started yet, under its Gram stain. */
.sp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sp-chips:has(> :not([hidden])) {
  margin-top: var(--s2);
}

.lock-chip {
  padding: 1px 6px;
  border-radius: var(--r1);
  border: 1px solid rgba(var(--game-color-palette-green-300-rgb), 0.6);
  color: var(--agar);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ---------- high scores ---------- */

.score-tabs {
  width: min(560px, 100%);
  padding-left: 0;
  padding-right: 0;
}

.score-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.score-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.score-list li.empty {
  color: var(--muted);
  border: 0;
}

.score-list .rank {
  flex: none;
  width: 24px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.score-list li:first-child .rank {
  color: var(--gold);
  font-weight: 800;
}

.score-list .who {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.score-list .who em {
  color: #ff8a8a;
  font-style: normal;
}

.score-list .who small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.score-list .pts {
  flex: none;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--you);
}

.over-score {
  margin: -6px 0 0;
  text-align: center;
  max-width: min(440px, 92vw);
}

.over-score b {
  display: block;
  font-size: 30px;
  font-weight: 900;
  color: var(--gold);
}

.over-score small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

#over-rank {
  margin: 0;
  text-align: center;
}

/* ---------- stacks ---------- */

.stat.rank {
  min-width: 64px;
  --rc: var(--game-color-gameplay-rank-0);
}

.stat.rank .label {
  color: var(--rc);
  font-weight: 700;
}

.pips {
  display: flex;
  gap: 3px;
  height: 12px;
  align-items: center;
}

.pips i {
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.pips i.on {
  background: var(--rc);
  border-color: var(--rc);
  box-shadow: 0 0 6px var(--rc);
}

.stat.rank .bar i {
  display: block;
  height: 100%;
  background: var(--rc);
}

.r1 { --rc: var(--game-color-gameplay-rank-1); }
.r2 { --rc: var(--game-color-gameplay-rank-2); }
.r3 { --rc: var(--game-color-gameplay-rank-3); }
.r4 { --rc: var(--game-color-gameplay-rank-4); }
.r5 { --rc: var(--game-color-gameplay-rank-5); }
.r6 { --rc: var(--game-color-gameplay-rank-6); }
.r7 { --rc: var(--game-color-gameplay-rank-7); }

.stat.rank.r7 .label {
  animation: superbug 1.6s ease-in-out infinite;
}

@keyframes superbug {
  50% { text-shadow: 0 0 10px var(--game-color-gameplay-rank-7), 0 0 18px var(--game-color-semantic-highlight-reward); }
}

.rank-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #071015;
  background: var(--rc, var(--game-color-gameplay-rank-0));
  box-shadow: 0 0 8px var(--rc, transparent);
}

/* ---------- daily quest, trophies ---------- */

.big.daily {
  color: var(--ink);
  border-color: var(--rule-strong);
  background: none;
}

.big.daily small {
  color: var(--muted);
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.over-extra {
  margin: 0;
  max-width: min(440px, 92vw);
  text-align: center;
  color: var(--gold);
}

/* ---------- trophies ---------- */
/* Each trophy is a seal shaped like a colony (trophyart.js): earned, it is a solid agar disc with its emblem
   pressed in; open, it is a faint dashed outline with the emblem in faint ink. The colony margin grows more
   ragged the more a trophy pays. On top the latest trophy with the picture of the dish it was earned on,
   then a line through time with every trophy on it, then the cabinet in groups. */

.seal {
  display: block;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seal-body {
  stroke-width: 1.5;
}

.seal-rim {
  fill: none;
  stroke-width: 1;
}

.seal-hair {
  stroke-width: 1.4;
}

.seal-emblem {
  stroke-width: 1.5;
}

.seal-emblem .f {
  stroke: none;
}

.seal.got .seal-body {
  fill: var(--agar);
  stroke: var(--agar);
}

.seal.got .seal-hair {
  stroke: var(--agar);
}

.seal.got .seal-rim {
  stroke: rgba(var(--game-color-palette-neutral-950-rgb), 0.35);
}

.seal.got .seal-emblem {
  stroke: var(--bench);
}

.seal.got .seal-emblem .f {
  fill: var(--bench);
}

.seal.open .seal-body {
  fill: var(--bench);
  stroke: var(--ink-faint);
  stroke-dasharray: 3 3;
}

.seal.open .seal-hair {
  stroke: var(--rule-strong);
}

.seal.open .seal-rim {
  stroke: var(--rule);
}

.seal.open .seal-emblem {
  stroke: var(--ink-faint);
}

.seal.open .seal-emblem .f {
  fill: var(--ink-faint);
}

.seal-track {
  fill: none;
  stroke: var(--rule);
  stroke-width: 3;
}

.seal-prog {
  fill: none;
  stroke: var(--agar);
  stroke-width: 3;
}

/* Lab routine, the longest commitment: a double violet rule around the seal. */
.seal-rule {
  fill: none;
  stroke: var(--violet);
  stroke-width: 1.5;
}

.seal.open .seal-rule {
  stroke: rgba(var(--game-color-palette-violet-500-rgb), 0.5);
}

.trophies {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.tr-side,
.tr-main {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.tr-main {
  gap: var(--s5);
}

/* The culture plate puzzle (trophypuzzle.js), drawn on a canvas as wide as the column. */
.tr-plate {
  display: block;
  width: min(100%, 440px);
  aspect-ratio: 1;
  margin: 0 auto;
  touch-action: manipulation;
}

.tr-where {
  margin-bottom: var(--s4);
  text-align: center;
}

/* The latest trophy: the dish as it was at that moment, the seal pressed onto its edge, and what happened. */
.tr-hero {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: var(--s4);
  align-items: center;
  width: 100%;
  padding: var(--s4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r2);
  background: var(--bench-raised);
  color: inherit;
  font: inherit;
  text-align: left;
}

.tr-hero.empty {
  grid-template-columns: 88px minmax(0, 1fr);
}

.tr-hero:hover {
  border-color: var(--ink-faint);
}

.tr-kicker {
  display: block;
  margin-bottom: 2px;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.tr-kicker.new {
  color: var(--culture);
}

.tr-hero h3 {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

.tr-hero p {
  margin: 4px 0 0;
  font-size: var(--t-s);
  color: var(--ink-dim);
}

/* The memory of a trophy: species in italic serif, then where in the run it happened. */
.tr-memo {
  color: var(--ink-dim);
}

.tr-memo i {
  font-family: var(--f-name);
  color: var(--ink);
}

.tr-fact {
  display: block;
  margin-top: 6px;
  font-family: var(--f-num);
  font-size: var(--t-m);
  color: var(--agar);
}

/* A dish with a seal on its rim. Without a picture, the seal alone. */
.tr-dish {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

.tr-dish img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  box-shadow: 0 0 0 4px var(--bench), 0 0 0 5px var(--rule);
  object-fit: cover;
}

.tr-dish .seal {
  position: absolute;
  right: -8%;
  bottom: -8%;
  width: 48%;
  height: 48%;
}

.tr-dish.bare .seal {
  position: static;
  width: 100%;
  height: 100%;
}

/* Every trophy on a line through time, from the first one to today. */
.tr-time {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tr-time[hidden] {
  display: none;
}

.tr-time-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-faint);
}

.tr-line {
  position: relative;
  height: 34px;
  margin: 0 7px;
}

.tr-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--rule-strong);
}

.tr-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: calc(50% - 5px);
  height: 10px;
  border-right: 1px solid var(--ink-faint);
}

.tr-tick {
  position: absolute;
  top: calc(50% - 7px + var(--lift, 0px));
  left: calc(var(--at) * 100% - 7px);
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  background: none;
}

.tr-tick::before {
  content: "";
  position: absolute;
  inset: 3px;
  transform: rotate(45deg);
  background: var(--agar);
  outline: 2px solid var(--bench);
}

.tr-tick.special::before {
  background: var(--violet);
}

.tr-tick.new::before {
  background: var(--culture);
}

/* A wide tap target around the small mark. */
.tr-tick::after {
  content: "";
  position: absolute;
  inset: -10px -4px;
}

.tr-time-ends {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--ink-faint);
}

.tr-sum {
  margin: 0;
  font-family: var(--f-num);
  font-size: var(--t-s);
  color: var(--ink-faint);
}

.tr-sum b {
  font-weight: 500;
  color: var(--agar);
}

.tr-next {
  display: block;
  margin-top: 4px;
  font-family: var(--f-ui);
  color: var(--ink-dim);
}

/* The four colony margins, from the trophies that pay least to those that pay most. */
.tr-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s2);
  font-family: var(--f-ui);
  font-size: var(--t-xs);
  text-align: center;
  color: var(--ink-dim);
}

.tr-legend > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.tr-legend .seal {
  width: 30px;
  height: 30px;
  margin-bottom: 2px;
}

.tr-legend .seal-emblem {
  display: none;
}

.tr-legend small {
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--ink-faint);
}

/* The cabinet. */
.tr-group {
  display: flex;
  flex-direction: column;
}

/* A heading docks to the top of the screen while its group scrolls past, with a slight blur behind it,
   until the next heading pushes it up. */
.tr-group h3 {
  position: sticky;
  top: calc(-16px - var(--safe-t));
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding: calc(10px + var(--safe-t)) 0 8px;
  border-bottom: 1px solid var(--rule-strong);
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: var(--f-num);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.tr-group h3 small {
  font-size: var(--t-xs);
  letter-spacing: 0;
  color: var(--ink-faint);
}

.tr-group h3 small.full {
  color: var(--agar);
}

.tr-seals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4) var(--s1);
  padding: var(--s4) 0 var(--s5);
}

.tr-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: var(--s1) 2px;
  border: 0;
  border-radius: var(--r2);
  background: none;
  color: var(--ink-faint);
  font: inherit;
  text-align: center;
}

.tr-seal:hover {
  background: var(--bench-raised);
}

.tr-seal .seal {
  width: 64px;
  height: 64px;
  margin-bottom: 4px;
}

.tr-seal b {
  font-size: var(--t-s);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink-dim);
}

.tr-seal small {
  font-size: var(--t-xs);
  overflow-wrap: anywhere;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tr-seal time,
.tr-seal .tr-count {
  font-family: var(--f-num);
  font-size: var(--t-xs);
}

.tr-seal.got b {
  color: var(--ink);
}

.tr-seal.got time {
  color: var(--agar);
}

.tr-seal .tr-count {
  color: var(--ink-dim);
}

.tr-badge {
  font-family: var(--f-num);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--culture);
}

/* Lab routine spans its row: the seal beside twenty days in blocks of five. */
.tr-seal.special {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  column-gap: var(--s4);
  align-items: center;
  padding: var(--s3);
  border: 3px double var(--violet);
  text-align: left;
}

.tr-seal.special .seal {
  grid-row: 1 / 6;
  width: 88px;
  height: 88px;
  margin: 0;
}

.tr-seal.special b {
  font-size: var(--t-m);
  color: var(--violet);
}

.tr-seal.special small {
  -webkit-line-clamp: 2;
}

/* Pips in blocks of five for the trophies that count over all runs. */
.tr-pips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.tr-pips span {
  display: flex;
  gap: 2px;
}

.tr-pips i {
  width: 10px;
  height: 10px;
  border: 1px solid var(--rule-strong);
}

.tr-pips i.on {
  background: var(--agar);
  border-color: var(--agar);
}

.tr-pips small {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

/* Trophies earned since the last visit are stamped in when the screen opens. */
.tr-seal.stamp .seal,
.tr-hero.new .seal {
  animation: tr-stamp 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
  animation-delay: calc(0.2s + var(--k, 0) * 0.12s);
}

/* Back from the genes screen: everything is already in place. */
#trophies.calm .seal {
  animation: none;
}

@keyframes tr-stamp {
  0% {
    transform: scale(1.6) rotate(-14deg);
    opacity: 0;
  }

  60% {
    transform: scale(0.94) rotate(2deg);
    opacity: 1;
  }

  100% {
    transform: none;
  }
}

/* The sheet of one trophy. */
.tr-sheet {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 11, 9, 0.7);
}

.tr-sheet[hidden] {
  display: none;
}

.tr-sheet-card {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100% - 24px - var(--safe-t));
  overflow-y: auto;
  padding: var(--s5) var(--s4) calc(var(--s5) + var(--safe-b));
  border: 1px solid var(--rule-strong);
  border-bottom: 0;
  border-radius: var(--r2) var(--r2) 0 0;
  background: var(--bench-raised);
  animation: tr-rise 0.22s ease-out;
}

@keyframes tr-rise {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

.tr-x {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
  border: 0;
  background: none;
  color: var(--ink-dim);
}

.tr-sheet .tr-dish {
  width: min(200px, 56%);
  margin: 0 auto var(--s5);
}

.tr-sheet .tr-dish.bare {
  width: 132px;
}

.tr-sheet h3 {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

.tr-sheet .tr-task {
  margin: 4px 0 0;
  font-size: var(--t-m);
  text-align: center;
  color: var(--ink-dim);
}

.tr-sheet .tr-pips {
  justify-content: center;
  margin-top: var(--s3);
}

.tr-entry-meta {
  margin: var(--s4) 0 0;
  border-top: 1px solid var(--rule);
}

.tr-entry-meta div {
  display: flex;
  justify-content: space-between;
  gap: var(--s4);
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-s);
}

.tr-entry-meta dt {
  color: var(--ink-faint);
}

.tr-entry-meta dd {
  margin: 0;
  text-align: right;
  color: var(--ink);
}

.tr-entry-meta dd.num {
  font-family: var(--f-num);
}

.tr-entry-meta dd.xp {
  font-family: var(--f-num);
  color: var(--agar);
}

.tr-sheet.open .tr-entry-meta dd.xp {
  color: var(--ink-dim);
}

.tr-gene {
  padding: 2px 8px;
  border: 1px solid rgba(var(--game-color-palette-violet-500-rgb), 0.45);
  border-radius: var(--r1);
  background: transparent;
  font-size: var(--t-s);
  color: var(--violet);
}

.tr-gene:hover {
  border-color: var(--violet);
}

/* The record is read, not glanced at: a solid bench behind it instead of the live demo dish. */
#trophies {
  justify-content: flex-start;
  background: var(--bench);
}


@keyframes tr-flash {
  0%,
  30% {
    background: rgba(var(--game-color-palette-green-300-rgb), 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tr-seal.stamp .seal,
  .tr-hero.new .seal,
  .tr-sheet-card {
    animation: none;
  }
}

@media (max-width: 380px) {
  .tr-hero {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .tr-seal .seal {
    width: 56px;
    height: 56px;
  }
}

/* Wide screens: the latest trophy and the time line stay in view on the left, the cabinet beside them. */
@media (min-width: 960px) {
  #trophies .screen-head {
    width: min(1100px, 100%);
  }

  .trophies {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: 440px minmax(0, 1fr);
    column-gap: 48px;
    align-items: start;
  }

  .tr-side {
    position: sticky;
    top: 0;
  }

  .tr-hero {
    grid-template-columns: 168px minmax(0, 1fr);
    gap: var(--s5);
    padding: var(--s5);
  }

  .tr-hero.empty {
    grid-template-columns: 104px minmax(0, 1fr);
  }

  .tr-seals {
    grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
    gap: var(--s5) var(--s2);
  }

  .tr-seal .seal {
    width: 80px;
    height: 80px;
  }

  .tr-sheet {
    align-items: center;
  }

  .tr-sheet-card {
    border-bottom: 1px solid var(--rule-strong);
    border-radius: var(--r2);
  }
}

/* ---------- mutation draft ---------- */

.draft {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: var(--s2);
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  overflow-y: auto;
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.88);
}

.draft h1 {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
  text-align: center;
}

.draft p {
  margin: 0 0 var(--s3);
  max-width: 44ch;
  text-align: center;
  color: var(--muted);
}

/* The mutations as slides under the microscope: a lens with a drawing of what the mutation does, in the colour
   of its role (--kc, --kc2, set per card from js/boonart.js). The rarity is the rule along the top, the label
   and the lens frame: one ring common, two rare, a turning reticle and a double top rule epic. */
.boons {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 220px);
  gap: var(--s3);
}

.boon {
  --rc: var(--culture);
  --kc: var(--culture);
  --kc2: var(--kc);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s2);
  padding: var(--s3) var(--s4) var(--s5);
  border-radius: var(--r2);
  border: 1px solid var(--rule-strong);
  border-top: 2px solid var(--rc);
  background: var(--bench-raised);
  color: var(--text);
  text-align: left;
  animation: boon-in 0.35s ease backwards;
  transition: opacity 0.2s, transform 0.2s, border-color 0.15s;
}

.boon:nth-child(2) {
  animation-delay: 0.08s;
}

.boon:nth-child(3) {
  animation-delay: 0.16s;
}

.boon:nth-child(4) {
  animation-delay: 0.24s;
}

.boon:hover {
  border-color: var(--ink-faint);
  border-top-color: var(--rc);
}

.boon:active {
  background: var(--bench-hi);
}

.bc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}

.bc-head small {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bc-rar {
  color: var(--rc);
}

.bc-role {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--kc);
  white-space: nowrap;
}

.ba-glyph {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bc-lens {
  position: relative;
  display: block;
  width: 136px;
  margin: 2px auto var(--s1);
}

.bc-owned {
  position: absolute;
  right: -10px;
  bottom: 4px;
  padding: 1px 5px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r1);
  background: var(--bench-raised);
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--ink-dim);
}

.bc-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bc-body b {
  font-size: var(--t-l);
  font-weight: 600;
  line-height: 1.2;
}

.bc-text {
  font-size: var(--t-s);
  color: var(--muted);
}

/* What the card changes: the trait now and after the pick, with a meter. */
.bc-read {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--s1);
  padding-top: var(--s2);
  border-top: 1px solid var(--rule);
}

.bc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: var(--s2);
  row-gap: 3px;
}

.bc-row small {
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.bc-val {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-faint);
  white-space: nowrap;
}

.bc-val em {
  font-style: normal;
  color: var(--kc);
}

.bc-bar {
  grid-column: 1 / -1;
  display: flex;
  height: 3px;
  background: var(--bench);
}

.bc-bar i {
  display: block;
  height: 100%;
  background: var(--rule-strong);
}

.bc-bar i.gain {
  background: var(--kc);
  animation: bc-fill 0.6s 0.35s ease backwards;
}

.bc-bar i.cut {
  background: repeating-linear-gradient(135deg, var(--kc) 0 2px, transparent 2px 4px);
  animation: bc-fill 0.6s 0.35s ease backwards;
}

.boon kbd {
  position: absolute;
  right: var(--s3);
  bottom: var(--s2);
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--ink-faint);
}

/* Rare in the antibiotic blue, epic in agar amber with a second rule under the top one. */
.boon.r1 {
  --rc: var(--cold);
}

.boon.r2 {
  --rc: var(--agar);
}

.boon.r2::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  border-top: 1px solid var(--rc);
}

/* The pick: the card holds, its top rule thickens, the others step back. */
.draft.picking .boon {
  pointer-events: none;
}

.draft.picking .boon:not(.picked) {
  opacity: 0.25;
  transform: scale(0.97);
}

.boon.picked {
  border-color: var(--rc);
  border-top-width: 4px;
}

.boon.picked .ba-art {
  animation: ba-take 0.32s ease;
}

@keyframes boon-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes bc-fill {
  from {
    width: 0;
  }
}

/* ---------- the lens (js/boonart.js) ---------- */

.ba {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.ba-disc {
  fill: var(--bench);
}

.ba-reticle {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 0.8;
}

.ba-rim {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1.2;
}

.ba-rim2 {
  fill: none;
  stroke: var(--rc);
  stroke-width: 0.8;
}

.ba-r1 .ba-rim,
.ba-r2 .ba-rim {
  stroke: var(--rc);
}

.ba-reticle2 {
  fill: var(--rc);
  stroke: var(--rc);
  stroke-width: 1;
  transform-box: view-box;
  transform-origin: 50px 50px;
  animation: ba-spin 40s linear infinite;
}

.ba-reticle2 circle {
  fill: none;
}

.ba-art {
  fill: none;
  stroke: var(--kc);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform-box: view-box;
  transform-origin: 50px 50px;
  animation: ba-focus 0.7s 0.15s ease-out backwards;
}

.ba-art .f {
  fill: var(--kc);
  fill-opacity: 0.16;
}

.ba-art .s {
  fill: var(--kc);
  stroke: none;
}

.ba-art .thin {
  stroke-width: 1.2;
}

.ba-art .thick {
  stroke-width: 3.6;
}

.ba-art .k2 {
  stroke: var(--kc2);
}

.ba-art .s.k2,
.ba-art .f.k2 {
  fill: var(--kc2);
}

.ba-art .s.k2 {
  stroke: none;
}

.ba-art g[class*="ba-"] {
  transform-box: view-box;
  transform-origin: 50px 50px;
}

.ba-band {
  fill: none;
  stroke: var(--kc);
  stroke-width: 7;
  stroke-opacity: 0.35;
  stroke-linecap: butt;
  stroke-dasharray: 0 32 36 32;
  animation: ba-widen 3s ease-in-out infinite alternate;
}

.ba-gene {
  fill: none;
  stroke: var(--kc2);
  stroke-width: 5;
  stroke-opacity: 0.55;
  stroke-linecap: butt;
  stroke-dasharray: 18 82;
  animation: ba-read 6s linear infinite;
}

.ba-part.l {
  animation: ba-part-l 2.4s ease-in-out infinite alternate;
}

.ba-part.r {
  animation: ba-part-r 2.4s ease-in-out infinite alternate;
}

.ba-pulse {
  animation: ba-pulse 2.4s ease-in-out infinite;
}

.ba-art g.ba-pulse,
.ba-art g.ba-pop,
.ba-art g.ba-charge,
.ba-art g.ba-blink {
  transform-box: fill-box;
  transform-origin: center;
}

.ba-spray {
  animation: ba-spray 1.8s ease-out infinite;
}

.ba-spray circle {
  animation: ba-fade-out 1.8s ease-out infinite;
  animation-delay: inherit;
}

.ba-breathe {
  animation: ba-breathe 3s ease-in-out infinite;
}

.ba-charge {
  animation: ba-charge 2.1s steps(1) infinite;
}

.ba-bob {
  animation: ba-bob 1.4s ease-in-out infinite alternate;
}

.ba-push.l {
  animation: ba-push-l 3s ease-in-out infinite alternate;
}

.ba-push.r {
  animation: ba-push-r 3s ease-in-out infinite alternate;
}

.ba-blink {
  animation: ba-blink 2.2s ease-in-out infinite;
}

.ba-prey {
  animation: ba-prey 2.6s ease-in infinite;
}

.ba-spin {
  animation: ba-spin 16s linear infinite;
}

.ba-spin.slow {
  animation-duration: 30s;
}

.ba-rise {
  animation: ba-rise 2.1s ease-out infinite;
}

.ba-pop {
  animation: ba-pop 2.8s ease-out infinite;
}

.ba-thrust {
  animation: ba-thrust 1.6s cubic-bezier(0.6, 0, 0.2, 1) infinite;
}

.ba-out {
  animation: ba-out 2.1s ease-in infinite;
}

.ba-blast {
  animation: ba-blast 1.8s ease-out infinite;
}

.ba-blast circle {
  vector-effect: non-scaling-stroke;
}

.ba-march {
  animation: ba-march 1.2s ease-in-out infinite alternate;
}

@keyframes ba-focus {
  from {
    opacity: 0.2;
    transform: scale(1.08);
    filter: blur(3px);
  }
}

@keyframes ba-take {
  50% {
    transform: scale(1.06);
  }
}

@keyframes ba-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ba-part-l {
  to {
    transform: translateX(-2.5px);
  }
}

@keyframes ba-part-r {
  to {
    transform: translateX(2.5px);
  }
}

@keyframes ba-pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes ba-spray {
  from {
    transform: translateY(4px);
  }
  to {
    transform: translateY(-9px);
  }
}

@keyframes ba-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes ba-breathe {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes ba-charge {
  0% {
    opacity: 0.15;
  }
  33% {
    opacity: 1;
  }
}

@keyframes ba-bob {
  to {
    transform: translateY(-3px);
  }
}

@keyframes ba-push-l {
  to {
    transform: translateX(-5px);
  }
}

@keyframes ba-push-r {
  to {
    transform: translateX(5px);
  }
}

@keyframes ba-widen {
  to {
    stroke-dasharray: 0 22 56 22;
  }
}

@keyframes ba-read {
  to {
    stroke-dashoffset: -100;
  }
}

@keyframes ba-blink {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

@keyframes ba-prey {
  0% {
    transform: translateX(6px);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  85% {
    transform: translateX(-22px) scale(0.6);
    opacity: 0.8;
  }
  100% {
    transform: translateX(-24px) scale(0.4);
    opacity: 0;
  }
}

@keyframes ba-rise {
  from {
    transform: translateY(4px);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  to {
    transform: translateY(-8px);
    opacity: 0;
  }
}

@keyframes ba-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  25%,
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
}

@keyframes ba-thrust {
  0%,
  100% {
    transform: translateX(-6px);
  }
  45%,
  60% {
    transform: translateX(2px);
  }
}

@keyframes ba-out {
  from {
    transform: translateY(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  to {
    transform: translateY(-58px);
    opacity: 0;
  }
}

@keyframes ba-blast {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes ba-march {
  to {
    transform: translateX(6px);
  }
}

/* Phones: the cards stack as rows, the lens on the left. */
@media (max-width: 560px) {
  .boons {
    grid-auto-flow: row;
    grid-template-columns: minmax(0, 380px);
    gap: var(--s2);
  }

  .boon {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    grid-template-areas: "lens head" "lens body";
    column-gap: var(--s3);
    row-gap: 2px;
    padding: var(--s3) var(--s3) var(--s3) var(--s2);
  }

  .bc-head {
    grid-area: head;
  }

  .bc-lens {
    grid-area: lens;
    align-self: center;
    width: 76px;
    margin: 0;
  }

  .bc-owned {
    right: auto;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    white-space: nowrap;
  }

  .bc-body {
    grid-area: body;
    gap: 2px;
  }

  .bc-body b {
    font-size: var(--t-m);
  }

  .bc-read {
    gap: 4px;
    margin-top: 2px;
    padding-top: 6px;
  }

  .boon kbd {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .boon,
  .boon.r2,
  .ba-art,
  .ba-art *,
  .ba-reticle2,
  .boon.picked .ba-art,
  .bc-bar i {
    animation: none;
  }

  .levelup.show {
    animation: none;
  }

  .chip-pulse,
  .chip-node.fresh .chip-body,
  .chip-ch.fresh,
  .lab-hud .lh-budget.bump {
    animation: none;
  }

  .chip-fluid,
  .lab-hud .bar i {
    transition: none;
  }
}

/* ---------- run modes, genes and forks ---------- */

/* The gene screen (menu.js): three slots, a coverflow of gene cards, a counter. */
.genes-wrap {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 4px 0 24px;
}

.gene-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px;
}

.gene-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 10px;
  border: 1px solid var(--gc, var(--rule));
  border-radius: var(--r2);
  background: var(--bench-raised);
  color: var(--ink);
  text-align: left;
  position: relative;
}

.gene-slot.empty {
  border-style: dashed;
  border-color: var(--rule-strong);
  color: var(--ink-faint);
}

.gs-socket {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px dashed var(--rule-strong);
}

.gene-slot:not(.empty) .gs-socket {
  border: 0;
  background: color-mix(in srgb, var(--gc) 22%, transparent);
  box-shadow: inset 0 0 0 1px var(--gc);
}

.gs-socket svg,
.gc-icon svg {
  width: 60%;
  height: 60%;
  fill: none;
  stroke: var(--gc);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gs-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gene-slot i {
  font-style: normal;
  color: var(--ink-faint);
}

.gene-slot.waiting .gs-socket {
  visibility: hidden;
}

.gene-slot.landed .gs-socket {
  animation: gs-land 0.6s ease-out;
}

@keyframes gs-land {
  0% { box-shadow: inset 0 0 0 1px var(--gc), 0 0 0 0 color-mix(in srgb, var(--gc) 70%, transparent); }
  100% { box-shadow: inset 0 0 0 1px var(--gc), 0 0 0 14px transparent; }
}

.gene-stage {
  position: relative;
  margin: 14px 0 6px;
}

.gene-track {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 18px calc(50% - 120px) 22px;
  scrollbar-width: none;
  outline: none;
  cursor: grab;
}

.gene-track::-webkit-scrollbar {
  display: none;
}

.gene-track.dragging {
  cursor: grabbing;
}

.gene-card {
  flex: none;
  position: relative;
  width: 240px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bench-raised), var(--bench));
  text-align: center;
  user-select: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  will-change: transform;
}

.gene-card.center {
  border-color: color-mix(in srgb, var(--gc) 70%, var(--rule-strong));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}

.gene-card.on {
  border-color: var(--gc);
  box-shadow: 0 0 0 1px var(--gc), 0 0 26px color-mix(in srgb, var(--gc) 35%, transparent), 0 12px 30px rgba(0, 0, 0, 0.45);
}

.gc-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-family: var(--f-num);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gc-kind {
  color: var(--gc);
}

.gc-state {
  color: var(--ink-faint);
}

.gene-card.on .gc-state {
  color: var(--gc);
}

.gc-helix {
  width: 100%;
  height: 34px;
  overflow: hidden;
}

.gc-helix path {
  fill: none;
  stroke: var(--gc);
  stroke-width: 2.2;
  opacity: 0.85;
}

.gc-helix path.r {
  stroke-width: 1.2;
  opacity: 0.35;
}

.gene-card.closed .gc-helix path {
  stroke: var(--ink-faint);
}

.gene-card.center .gc-dna,
.gene-card.on .gc-dna {
  animation: gc-turn 5s linear infinite;
}

.gene-card.on .gc-dna {
  animation-duration: 2.4s;
}

@keyframes gc-turn {
  to { transform: translateX(-100px); }
}

.gc-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-top: -2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--gc) 30%, transparent), transparent 70%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gc) 60%, transparent);
}

.gene-card.closed .gc-icon {
  --gc: var(--ink-faint);
}

.gene-fly {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 0 18px var(--gc);
}

.gene-card h3 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 600;
}

.gene-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-dim);
}

.gene-card .gc-lock {
  color: var(--ink-faint);
  font-style: italic;
}

.gc-btn {
  margin-top: auto;
  padding: 6px 14px;
  border: 1px solid var(--gc);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gc);
  opacity: 0;
  transition: opacity 0.2s;
}

.gene-card.center .gc-btn {
  opacity: 1;
}

.gene-card.on .gc-btn {
  background: var(--gc);
  color: var(--bench);
}

.gene-card.closed .gc-btn {
  border-color: var(--rule-strong);
  color: var(--ink-faint);
}

.gene-card.pulse {
  animation: gc-pulse 0.7s ease-out;
}

@keyframes gc-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gc) 80%, transparent); }
  100% { box-shadow: 0 0 0 22px transparent; }
}

.gene-card.nope {
  animation: gc-nope 0.4s ease;
}

@keyframes gc-nope {
  20%, 60% { margin-left: -6px; margin-right: 6px; }
  40%, 80% { margin-left: 6px; margin-right: -6px; }
}

.gene-card.dropped .gc-icon {
  animation: gc-drop 0.5s ease-out;
}

@keyframes gc-drop {
  0% { transform: scale(1.25); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

.gc-arrow {
  position: absolute;
  top: 50%;
  z-index: 120;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  background: var(--panel-solid);
}

#gene-prev {
  left: 8px;
}

#gene-next {
  right: 8px;
}

.gene-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--f-num);
  font-size: 11px;
  color: var(--ink-faint);
}

.gene-prog {
  width: 120px;
  height: 2px;
  background: var(--rule);
}

.gene-prog i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--ink-dim);
  transition: width 0.2s;
}

#gene-sum {
  max-width: 560px;
  margin: 14px auto 0;
  padding: 0 16px;
  text-align: center;
}

@media (max-width: 560px) {
  .gene-slots {
    gap: 6px;
    padding: 0 10px;
  }

  .gene-track {
    padding-left: calc(50% - 100px);
    padding-right: calc(50% - 100px);
  }

  .gene-card {
    width: 200px;
    min-height: 290px;
  }

  .gene-slot {
    flex-direction: column;
    gap: 4px;
    padding: 6px 4px;
    text-align: center;
  }

  .gene-slot i {
    position: absolute;
    top: 2px;
    right: 6px;
  }

  .gs-name {
    font-size: 11px;
  }

  .gc-arrow {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gene-card.center .gc-dna,
  .gene-card.on .gc-dna,
  .gene-card.pulse,
  .gene-card.nope,
  .gene-slot.landed .gs-socket {
    animation: none;
  }
}

#gene-sum .ok {
  color: var(--game-color-lab-highlight);
}

#gene-sum .warn {
  color: var(--warn);
}





.draft .reroll {
  margin-top: var(--s3);
  min-height: 42px;
  padding: 6px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 500;
}

.draft .reroll small {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
}

.score-modes {
  width: min(560px, 100%);
}

/* ---------- boss fights ---------- */

/* Fight: the one filled button of the boss screen, in the bosses' safranin. */
.big.boss {
  color: #1c0910;
  border-color: var(--safranin);
  background: var(--safranin);
}

.big.boss:active {
  background: var(--game-color-boss-pressed);
}

.big.boss small {
  color: rgba(28, 9, 16, 0.72);
}

.mark.boss {
  --mc: var(--boss);
}

/* The boss's health in the HUD: name, cells and a bar that runs down. */
.boss-hud {
  grid-area: boss;
  justify-self: start;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 8px;
  width: min(360px, 100%);
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid rgba(var(--game-color-boss-signal-rgb), 0.55);
  background: var(--panel);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 12px;
  pointer-events: none;
}

.boss-hud b {
  color: var(--boss);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boss-hud span:not(.bar) {
  justify-self: end;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.boss-hud .bar {
  grid-column: 1 / -1;
  height: 5px;
}

.boss-hud .bar i {
  background: var(--boss);
  transition: width 0.3s ease;
}

/* What the boss fight asks of you now (ui.js bossCue): a tell to counter in safranin, an opening in culture green. */
.boss-cue {
  grid-column: 1 / -1;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink-dim);
}

.boss-hud .boss-cue {
  justify-self: start;
}

.boss-cue.tell {
  color: var(--safranin);
}

.boss-cue.open {
  color: var(--culture);
}

/* The tools that answer the boss right now: a bar on top of the button, safranin for a counter, green for an
   opening. It blinks slowly, or stands still with reduced motion. */
.tool.cue {
  position: relative;
  border-color: var(--safranin);
}

.tool.cue::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: -1px;
  height: 3px;
  background: var(--safranin);
  animation: cue 0.8s ease-in-out infinite alternate;
}

.tool.cue-open {
  border-color: var(--culture);
}

.tool.cue-open::before {
  background: var(--culture);
}

@keyframes cue {
  from { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .tool.cue::before {
    animation: none;
  }
}

/* Hospital defense: how close a heat or cryo bomb is to breeding its counter strain (defense.js), a safranin
   bar along the bottom of the button that fills with the pressure. */
.tool.press {
  position: relative;
}

.tool.press::after {
  content: "";
  position: absolute;
  left: 6px;
  bottom: -1px;
  height: 3px;
  width: calc((100% - 12px) * var(--press, 0));
  background: var(--safranin);
  opacity: 0.8;
  transition: width 0.3s;
}

/* Hospital defense: its button on the title screen and the hospital's health in the boss's place in the HUD. */
.big.defense {
  color: var(--cold);
  border-color: rgba(var(--game-color-palette-violet-500-rgb), 0.6);
  background: none;
}

.big.defense small {
  color: var(--muted);
}

.boss-hud.hospital {
  border-color: rgba(var(--game-color-hospital-identity-rgb), 0.55);
}

.boss-hud.hospital b {
  color: var(--hospital);
}

.boss-hud.hospital .bar i {
  background: var(--hospital);
}

/* A hit on the hospital: red for a moment and a short shake. */
.boss-hud.hospital.hit {
  border-color: var(--game-color-semantic-status-danger);
  animation: hospital-hit 0.4s ease;
}

.boss-hud.hospital.hit .bar i {
  background: var(--game-color-semantic-status-danger);
}

.boss-hud .warn {
  color: var(--game-color-semantic-status-danger);
}

/* The daily quest, in the boss's place in the HUD and on the species screen. */
.boss-hud.quest {
  border-color: var(--violet);
}

.boss-hud.quest b {
  color: var(--violet);
}

.boss-hud.quest .bar i {
  background: var(--violet);
}

.pick-boss.quest {
  border-color: var(--violet);
  background: none;
}

.pick-boss.quest b {
  font-family: inherit;
  font-style: normal;
  font-weight: 600;
  color: var(--violet);
}

@keyframes hospital-hit {
  30% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .boss-hud.hospital.hit {
    animation: none;
  }
}

/* The boss plate (bossplate.js): the species plate seen another way. A dark-field slide instead of agar:
   the bosses glow on black, the way from the soil to the ward runs along the rim, safranin marks the choice. */
.bosses {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: min(560px, 100%);
}

.bo-dish {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.bo-plate {
  position: relative;
  align-self: center;
  width: min(100%, 440px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bench);
  box-shadow:
    inset 0 0 0 1px rgba(var(--game-color-palette-neutral-100-rgb), 0.16),
    inset 0 0 0 7px var(--bench-raised),
    inset 0 0 0 8px rgba(var(--game-color-palette-neutral-100-rgb), 0.08);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* The slide is square glass under the round field: corner marks instead of the dish's glass ring. */
.bo-plate::before {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
  background:
    linear-gradient(var(--rule-strong), var(--rule-strong)) top left / 10px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top left / 1px 10px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top right / 10px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) top right / 1px 10px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom left / 10px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom left / 1px 10px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom right / 10px 1px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) bottom right / 1px 10px no-repeat;
}

.bo-rim,
.bo-ring {
  position: absolute;
  inset: 0;
}

.bo-rim,
.bo-field {
  pointer-events: none;
}

.bo-field {
  position: absolute;
  border-radius: 50%;
}

.bo-thumb {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bench);
}

.bo-thumb canvas {
  border-radius: 50%;
}

.bo-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--rule);
  pointer-events: none;
}

.bo-thumb:hover::before,
.bo-thumb.peek::before {
  box-shadow: inset 0 0 0 1px var(--rule-strong);
}

.bo-thumb.on::before {
  box-shadow: 0 0 0 2px var(--safranin);
}

.bo-thumb:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* The number of the encounter on the inner edge, towards the middle. */
.bo-num {
  position: absolute;
  left: calc(50% - var(--x) * 46%);
  top: calc(50% - var(--y) * 46%);
  transform: translate(-50%, -50%);
  min-width: 14px;
  padding: 0 2px;
  border-radius: var(--r1);
  background: var(--bench);
  font-family: var(--f-num);
  font-size: 9px;
  line-height: 12px;
  text-align: center;
  color: var(--ink-faint);
  pointer-events: none;
}

.bo-thumb.beaten .bo-num {
  color: var(--culture);
}

.bo-thumb.next .bo-num {
  color: var(--safranin);
}

/* On the outer edge: a green tick for a beaten boss, a safranin diamond for the next one. */
.bo-thumb.beaten::after,
.bo-thumb.next::after {
  content: "";
  position: absolute;
  left: calc(50% + var(--x) * 50%);
  top: calc(50% + var(--y) * 50%);
  width: 7px;
  height: 4px;
  margin: -3px 0 0 -4px;
  border-left: 2px solid var(--culture);
  border-bottom: 2px solid var(--culture);
  transform: rotate(-45deg);
}

.bo-thumb.next::after {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border: 0;
  background: var(--safranin);
  transform: rotate(45deg);
}

.bo-key {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px var(--s3);
  font-size: var(--t-xs);
  color: var(--muted);
}

.bo-key span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 0;
  margin-right: 6px;
  vertical-align: 3px;
  border-top: 2px solid var(--culture);
}

.bo-key .next::before {
  border-top: 2px dashed var(--safranin);
}

.bo-key .locked::before {
  border-top: 1px dotted var(--ink-faint);
}

/* The card: who it is, how the tools hurt it and how to beat it. */
.bo-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  touch-action: pan-y;
}

.bo-card.enter {
  animation: cardin 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
  .bo-card.enter {
    animation: none;
  }
}

.bo-id {
  min-width: 0;
  margin-bottom: var(--s3);
}

.bo-n {
  margin-bottom: 2px;
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.bo-card.locked .sp-name {
  color: var(--ink-faint);
}

.bo-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px var(--s3);
}

.gram-chip.other {
  color: var(--agar);
}

.bo-state {
  margin-top: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.bo-state.beaten {
  color: var(--culture);
}

.bo-state.next {
  color: var(--safranin);
}

.bo-label {
  margin: var(--s2) 0 6px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* How hard each tool hits it, in the tool's colour, on the scale of the species traits. */
.bo-weak {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bo-weak .st {
  grid-template-columns: 82px 1fr 40px;
}

.bo-weak .st i {
  background: linear-gradient(90deg, var(--tc) calc(var(--v) * 100%), var(--rule) 0);
}

.bo-weak .st b {
  font-family: var(--f-num);
  font-weight: 500;
  text-align: right;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-dim);
}

.bo-weak .st.none b {
  color: var(--ink-faint);
}

.bo-hidden {
  margin: 0;
  font-size: var(--t-s);
  color: var(--ink-faint);
}

/* Tell, counter, opening: a ruled list with the step on the left. */
.bo-plan {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  font-size: var(--t-s);
  line-height: 1.45;
}

.bo-plan li {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: var(--s2);
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.bo-plan b {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--safranin);
}

.bo-plan li:nth-child(3) b {
  color: var(--culture);
}

.bo-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.bo-tool {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r1);
  font-size: var(--t-xs);
  color: var(--ink);
}

.bo-tool::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tc);
}

.bo-science b {
  color: var(--ink);
  font-weight: 600;
}

.bo-go {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  width: min(560px, 100%);
}

.bo-go .big {
  width: 100%;
}

.big.boss.t-hard,
.big.primary.t-hard {
  color: #1c0910;
  border-color: var(--alert);
  background: var(--alert);
}

.big.boss.t-nightmare,
.big.primary.t-nightmare {
  color: #fff3f3;
  border-color: var(--game-color-gameplay-tier-nightmare);
  background: var(--game-color-gameplay-tier-nightmare);
}

/* The builds of a fight above Fight: three cards with an icon, the chosen one in its colour (--pc). */
.bo-preset-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s2);
  margin-top: var(--s2);
}

.bo-preset {
  --pc: var(--culture);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--s3) var(--s1) 10px;
  border: 1px solid var(--rule);
  border-radius: var(--r2);
  background: none;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.bo-preset:hover {
  border-color: var(--rule-strong);
}

.bo-preset svg {
  width: 34px;
  height: 34px;
  margin-bottom: var(--s1);
  fill: none;
  stroke: var(--ink-dim);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s ease, transform 0.15s ease;
}

.bo-preset b {
  font-size: var(--t-s);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
}

.bo-preset small {
  font-size: var(--t-xs);
  line-height: 1.3;
  color: var(--ink-faint);
}

.bo-preset.on {
  border-color: var(--pc);
  background: color-mix(in srgb, var(--pc) 9%, transparent);
}

.bo-preset.on svg {
  stroke: var(--pc);
  fill: color-mix(in srgb, var(--pc) 18%, transparent);
  transform: scale(1.08);
}

.bo-preset.on b {
  color: var(--pc);
}

.bo-preset.on small {
  color: var(--ink-dim);
}

.bo-preset-text {
  margin: var(--s2) 0 0;
  font-size: var(--t-xs);
  color: var(--ink-dim);
}

.bo-rules summary {
  cursor: pointer;
  padding: var(--s1) 0;
  font-size: var(--t-s);
  font-weight: 500;
  color: var(--ink-dim);
  list-style: none;
}

.bo-rules summary::-webkit-details-marker {
  display: none;
}

.bo-rules summary::after {
  content: " ›";
}

.bo-rules[open] summary::after {
  content: " ˅";
}

/* Wide screens: the plate on the left, the card and the fight button on the right. */
@media (min-width: 960px) {
  #bosses {
    display: grid;
    grid-template-columns: minmax(0, 480px) minmax(0, 400px);
    grid-template-areas: "head head" "plate card" "go card";
    grid-template-rows: auto auto 1fr;
    column-gap: 48px;
    row-gap: var(--s4);
    justify-content: center;
    align-content: safe center;
  }

  #bosses .screen-head {
    grid-area: head;
    width: 100%;
  }

  #bosses .bosses {
    display: contents;
  }

  .bo-dish {
    grid-area: plate;
    align-self: start;
  }

  .bo-plate {
    width: 100%;
  }

  .bo-card {
    grid-area: card;
    align-self: start;
  }

  #bosses .bo-go {
    grid-area: go;
    align-self: start;
    width: 100%;
  }
}

.pick-boss {
  width: min(560px, 100%);
  padding: var(--s2) var(--s3);
  border-radius: var(--r2);
  border: 1px solid rgba(var(--game-color-palette-red-500-rgb), 0.5);
  background: rgba(var(--game-color-palette-red-500-rgb), 0.06);
  color: var(--ink-dim);
  font-size: var(--t-s);
  text-align: center;
}

/* The boss of a hospital defense boss level, in the hospital's HUD line. */
.boss-life {
  color: var(--boss);
  font-weight: 700;
}

.pick-boss b {
  font-family: var(--f-name);
  font-style: italic;
  font-weight: 500;
  color: var(--safranin);
}

/* A won fight on the game over screen: what science learned. */
.over-story {
  width: min(440px, 92vw);
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.screen-title.won {
  color: var(--culture);
}

.pick-boss {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.pick-boss canvas {
  flex: none;
  width: 96px;
  height: 66px;
}

.over-score canvas {
  display: block;
  width: min(260px, 70vw);
  height: 120px;
  margin: 0 auto 4px;
}

/* ---------- speed ---------- */

/* The speed button opens a row of speeds beside it: above it in the dock, to its left in the phone column.
   Holding the button snaps back to 1×. */
.speed-wrap {
  position: relative;
  display: flex;
}

.speed-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--panel-solid);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  z-index: 20;
  animation: speed-in 0.12s ease-out;
}

.speed-menu[hidden] {
  display: none;
}

.speed-menu button {
  min-width: 36px;
  height: 34px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speed-menu button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

/* 1× is the way back, so it always stands out a little. */
.speed-menu button[data-s="1"] {
  color: var(--you);
}

.speed-menu button.on {
  background: var(--you);
  color: var(--culture-ink);
}

#speed.snap {
  animation: speed-snap 0.35s ease-out;
}

@keyframes speed-in {
  from { opacity: 0; transform: translateY(4px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

@keyframes speed-snap {
  from { box-shadow: 0 0 0 0 rgba(var(--game-color-semantic-highlight-primary-rgb), 0.7); border-color: var(--you); }
  to { box-shadow: 0 0 0 12px rgba(var(--game-color-semantic-highlight-primary-rgb), 0); }
}

@media (max-width: 560px) {
  .speed-menu {
    bottom: auto;
    top: 50%;
    right: calc(100% + 8px);
    transform: translateY(-50%);
    animation-name: speed-in-side;
  }

  .speed-menu button {
    min-width: 34px;
    height: 36px;
  }
}

@keyframes speed-in-side {
  from { opacity: 0; transform: translate(6px, -50%) scale(0.96); }
  to { opacity: 1; transform: translateY(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .speed-menu,
  #speed.snap {
    animation: none;
  }
}

/* ---------- hospital defense: next wave ---------- */

/* Under the hospital's health once the dish is clear, where no message covers it. */
.next-wave {
  grid-column: 1 / -1;
  justify-self: stretch;
  margin-top: 6px;
  padding: 7px 14px;
  border: 1px solid var(--hospital);
  border-radius: 999px;
  background: rgba(var(--game-color-hospital-identity-rgb), 0.12);
  color: var(--hospital);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: auto;
  animation: next-wave-in 0.2s ease-out, next-wave-glow 1.6s ease-in-out 0.2s infinite alternate;
}

.next-wave[hidden] {
  display: none;
}

@keyframes next-wave-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes next-wave-glow {
  from { box-shadow: 0 0 4px rgba(var(--game-color-hospital-identity-rgb), 0.15); }
  to { box-shadow: 0 0 14px rgba(var(--game-color-hospital-identity-rgb), 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  .next-wave {
    animation: none;
  }
}

/* ---------- title screen ---------- */
/* Top to bottom: the wordmark, a petri dish that shows the live demo world, the lab record, Play, the other
   ways to play as a ruled list and the small links. On wide screens the dish stands left of the record.
   The dish is a hole: its shadow paints the bench over the whole screen around it. */

#title {
  justify-content: flex-start;
  gap: 10px;
  background: none;
}

#title .logo {
  margin-top: var(--s2);
}

.plate {
  position: relative;
  z-index: -1;
  flex: none;
  /* The dish takes the height the controls leave, so tall phones and tablets get a bigger one. */
  width: clamp(190px, min(68vw, 100vh - 634px), 460px);
  width: clamp(190px, min(68vw, 100svh - 634px), 460px);
  aspect-ratio: 1;
  margin: var(--s1) 0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(var(--game-color-palette-neutral-100-rgb), 0.2),
    inset 0 0 42px 4px rgba(12, 14, 11, 0.7),
    0 0 0 200vmax var(--bench);
}

/* A saved run adds the Continue button: the dish leaves it the room. */
#title:has(#t-continue:not([hidden])) .plate {
  width: clamp(170px, min(68vw, 100svh - 696px), 460px);
}

/* The rim of the glass dish, a little outside the agar. */
.plate::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 1px solid rgba(var(--game-color-palette-neutral-100-rgb), 0.1);
}

/* A tap on the dish: it gives a little (outbreak.js cracks it now and then). */
.plate.knock {
  animation: knock 0.3s ease;
}

@keyframes knock {
  35% { transform: scale(0.985); }
  70% { transform: scale(1.005); }
}

/* The bacteria that break out of the cracked dish swim over everything, but never catch a tap. */
#outbreak {
  position: fixed;
  inset: 0;
  z-index: 11;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Light on the rim. */
.plate::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.26);
  transform: rotate(-40deg);
}

.title-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s3);
  width: var(--col);
}

.title-main .lab {
  width: auto;
}

#title .stack {
  width: 100%;
  gap: var(--s3);
}

/* Daily, bosses and hospital: rows of a ruled list, each with its own state on the right. */
.modes {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--rule);
}

.mode {
  display: grid;
  grid-template-columns: 20px auto minmax(0, 1fr);
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  padding: 2px var(--s1);
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: none;
  text-align: left;
  font-size: var(--t-m);
}

.mode:hover {
  background: var(--bench-raised);
}

.mode:active {
  background: var(--bench-hi);
}

.mode b {
  font-weight: 500;
}

.mode svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink-dim);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode.boss svg {
  stroke: var(--safranin);
}

.mode small {
  justify-self: end;
  max-width: 100%;
  font-size: var(--t-xs);
  line-height: 1.3;
  text-align: right;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Unlock: agar amber, the colour of what you pay with, outlined so Play stays the one filled button. */
#title .big.gold {
  color: var(--agar);
  border-color: rgba(var(--game-color-palette-green-300-rgb), 0.55);
  background: none;
  box-shadow: none;
}

#title .big.gold:active {
  background: rgba(var(--game-color-palette-green-300-rgb), 0.08);
}

.big.slim {
  min-height: var(--hit);
  font-size: var(--t-m);
  font-weight: 500;
  flex-direction: row;
  gap: var(--s2);
}

.big.slim small {
  display: none;
}

.title-nav {
  display: flex;
  justify-content: center;
  width: 100%;
}

.title-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--hit);
  padding: var(--s1);
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: var(--t-s);
  font-weight: 500;
}

.title-nav button + button {
  border-left: 1px solid var(--rule);
}

.title-nav button:hover {
  background: var(--bench-raised);
}

.title-nav small {
  display: block;
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--muted);
}

.title-nav small:empty {
  display: none;
}

/* The first start: the tutorial offers itself. */
.welcome {
  width: var(--col);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r2);
  border: 1px solid var(--rule-strong);
  background: var(--bench-raised);
  animation: welcome-in 0.5s 0.2s ease both;
}

.welcome h2 {
  margin: 0;
  font-size: var(--t-xl);
  font-weight: 600;
  line-height: 1.15;
}

.welcome p {
  margin: 0 0 var(--s1);
  line-height: 1.5;
  color: var(--muted);
}

.welcome .link {
  align-self: center;
  font-size: var(--t-s);
}

@keyframes welcome-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* Wide screens: the dish on the left, as large as the height allows, the record beside it. */
@media (min-width: 880px) and (orientation: landscape) {
  #title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    grid-template-rows: repeat(4, auto);
    align-content: center;
    column-gap: 7vw;
    padding-inline: 6vw;
  }

  #title > :not(.plate) {
    grid-column: 2;
  }

  #title .plate {
    grid-column: 1;
    grid-row: 1 / 5;
    justify-self: end;
    align-self: center;
    width: min(74vh, 42vw, 640px);
    margin: 0;
  }

  #title .logo {
    align-items: flex-start;
    margin-top: 0;
  }

  #title .logo .l1 {
    margin-right: 0;
  }

  #title .tagline {
    margin-top: calc(-1 * var(--s2));
  }

  #title .title-main,
  #title .welcome {
    width: 100%;
  }

  #title .title-foot {
    align-items: flex-start;
    margin-top: var(--s3);
  }

  #title .title-foot .link {
    padding-left: 0;
  }
}

/* The record of the demo plate (notes.js): only where the screen is wide enough for a third column. Written
   like the label on a culture plate and the notes beside a scientific drawing: mono for numbers and codes,
   italic serif for names, hairlines from each name to its colony in the dish. */
.plate-notes,
.leaders {
  display: none;
}

@media (min-width: 1200px) and (orientation: landscape) {
  #title {
    grid-template-columns: minmax(200px, 260px) auto minmax(300px, 360px);
    /* at least the objective arc on the dish's right edge (34 px) plus some air */
    column-gap: max(3vw, 44px);
    padding-inline: 3vw;
    justify-content: center;
  }

  #title > :not(.plate) {
    grid-column: 3;
  }

  #title .plate {
    grid-column: 2;
    justify-self: center;
    width: min(84vh, 44vw, 780px);
  }

  #title .plate-notes {
    display: block;
    grid-column: 1;
    grid-row: 1 / 5;
    align-self: center;
  }

  .leaders {
    display: block;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
}

.plate-notes {
  font-size: var(--t-s);
  color: var(--ink-dim);
}

.pn-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--rule);
}

.pn-plate {
  font-family: var(--f-num);
  font-size: var(--t-l);
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: uppercase;
}

.pn-meta {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  color: var(--ink-faint);
}

.plate-notes h3 {
  margin: var(--s4) 0 var(--s2);
  font-family: var(--f-num);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.pn-colonies,
.pn-log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pn-colonies li {
  display: grid;
  grid-template-columns: 8px auto 1fr auto;
  align-items: baseline;
  gap: var(--s2);
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
}

.pn-colonies i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  align-self: center;
}

.pn-colonies b {
  font-family: var(--f-name);
  font-style: italic;
  font-weight: 500;
  font-size: var(--t-m);
  color: var(--ink);
}

.pn-colonies span,
.pn-colonies em {
  font-family: var(--f-num);
  font-size: var(--t-xs);
  font-style: normal;
  color: var(--ink-faint);
}

.pn-colonies em {
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

.pn-log li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: var(--s2);
  padding: 3px 0;
  font-size: var(--t-xs);
  line-height: 1.4;
  animation: note-in 0.4s ease;
}

.pn-log time {
  font-family: var(--f-num);
  color: var(--ink-faint);
}

@keyframes note-in {
  from { opacity: 0; }
}

.leaders polyline {
  fill: none;
  stroke: rgba(var(--game-color-palette-neutral-100-rgb), 0.32);
  stroke-width: 1;
}

.leaders circle {
  stroke: var(--bench);
  stroke-width: 1.5;
}

/* ---------- species card: Gram stain ---------- */
/* Gram-positive cells stain purple, Gram-negative ones pink. */

.gram-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--safranin);
}

.gram-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.gram-chip.pos {
  color: var(--violet);
}

/* ---------- options: saved games ---------- */

.opt-saves .big {
  min-height: 44px;
  font-size: 15px;
}

/* ---------- how to play: the tutorial ---------- */

.tut-card {
  width: min(560px, 100%);
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s1);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tut-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tut-card-text b {
  font-weight: 600;
  font-size: var(--t-l);
}

.tut-card-text small {
  color: var(--muted);
}

.tut-card .big {
  min-height: 44px;
  padding: 0 22px;
  font-size: var(--t-m);
}

/* ---------- tutorial: coach card ---------- */

.coach {
  position: fixed;
  z-index: 12;
  left: calc(10px + var(--safe-l));
  right: calc(10px + var(--safe-r));
  top: calc(12px + var(--safe-t));
  margin: 0 auto;
  max-width: 460px;
  padding: var(--s3) var(--s4) var(--s3);
  border-radius: var(--r2);
  border: 1px solid var(--rule-strong);
  background: var(--panel-solid);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: coach-in 0.3s ease both;
  transition: border-color 0.2s ease;
}

/* In the dish the card sits under the stats. */
.coach[data-phase="play"] {
  top: calc(66px + var(--safe-t));
}

.coach[data-phase="place"] {
  top: calc(70px + var(--safe-t));
}

body.tut #pick {
  padding-top: calc(var(--coach-h, 150px) + 24px + var(--safe-t));
}

@media (min-width: 961px) {
  .coach,
  .coach[data-phase="play"] {
    left: auto;
    right: calc(12px + var(--safe-r));
    top: calc(12px + var(--safe-t));
    width: 400px;
  }

  .coach[data-phase="pick"] {
    top: auto;
    bottom: calc(16px + var(--safe-b));
  }

  body.tut #pick {
    padding-top: calc(16px + var(--safe-t));
  }
}

@keyframes coach-in {
  from { opacity: 0; transform: translateY(-10px); }
}

.coach-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-family: var(--f-num);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.coach-count {
  white-space: nowrap;
}

.coach-dots {
  flex: 1;
  display: flex;
  gap: 4px;
  min-width: 0;
}

.coach-dots i {
  display: block;
  flex: 0 1 16px;
  min-width: 6px;
  height: 3px;
  background: var(--rule-strong);
}

.coach-dots i.done {
  background: var(--culture);
}

.coach-dots i.on:not(.done) {
  background: var(--ink);
}

.coach-skip {
  border: 0;
  background: none;
  padding: 4px 2px 4px 8px;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: var(--t-xs);
  text-transform: none;
  letter-spacing: 0;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

.coach-title {
  display: block;
  margin-top: var(--s2);
  font-size: var(--t-l);
  font-weight: 600;
}

.coach-text {
  margin: var(--s1) 0 0;
  line-height: 1.45;
  color: var(--ink-dim);
}

.coach-next {
  display: block;
  margin: var(--s3) 0 0 auto;
  min-height: 40px;
  padding: 6px 20px;
  border-color: var(--culture);
  background: var(--culture);
  color: var(--culture-ink);
  font-weight: 600;
}

.coach-next:active {
  background: var(--game-color-semantic-interactive-pressed);
}

/* The goal of a step: what to do, in agar amber, and how far you are. */
.coach-goal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--s3);
  padding-top: var(--s2);
  border-top: 1px solid var(--rule);
  font-size: var(--t-s);
  font-weight: 500;
  color: var(--agar);
}

.coach-goal .bar {
  display: block;
  height: 3px;
  background: var(--rule);
  overflow: hidden;
}

.coach-goal .bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--agar);
  transition: width 0.3s ease;
}

.coach-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.coach-ask span {
  flex: 1 1 100%;
}

.coach-ask button {
  flex: 1;
  min-height: 40px;
  font-weight: 500;
}

.coach-ask .stay {
  border-color: var(--culture);
  color: var(--culture-ink);
  background: var(--culture);
}

.coach.shake {
  animation: coach-shake 0.4s ease;
}

@keyframes coach-shake {
  20%, 60% { translate: -6px 0; }
  40%, 80% { translate: 6px 0; }
}

.coach.flash {
  border-color: var(--alert);
}

.coach.flash.good {
  border-color: var(--culture);
}

.coach.won {
  border-color: var(--culture);
}

.coach.won .coach-title {
  color: var(--culture);
  animation: won-pop 0.4s ease;
}

@keyframes won-pop {
  0% { transform: translateY(4px); opacity: 0.4; }
}

/* What the step is about gets an amber frame that breathes. */
.coach-focus {
  outline: 2px solid var(--agar);
  outline-offset: 3px;
  animation: coach-focus 1.1s ease-in-out infinite;
}

@keyframes coach-focus {
  50% { outline-offset: 6px; outline-color: rgba(var(--game-color-palette-green-300-rgb), 0.35); }
}

/* Tools the step does not use step back. */
#tools .tool.tut-off {
  opacity: 0.28;
  filter: grayscale(1);
}

/* Marks on the map: labels over colonies and rings to aim at. */
#coach-marks {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
}

.cmark {
  position: absolute;
  left: 0;
  top: 0;
}

.cmark:not(.ring) {
  transform: translate(-50%, -100%);
  padding: 2px 6px;
  border-radius: var(--r1);
  background: rgba(var(--game-color-palette-neutral-950-rgb), 0.88);
  border: 1px solid var(--rule-strong);
  font-size: var(--t-xs);
  font-weight: 600;
  white-space: nowrap;
}

.cmark.raid {
  color: var(--safranin);
  border-color: rgba(var(--game-color-palette-red-500-rgb), 0.7);
}

.cmark.ring {
  border-radius: 50%;
  border: 2px dashed var(--agar);
  animation: cmark-spin 6s linear infinite, cmark-pulse 1.2s ease-in-out infinite;
}

.cmark.ring.safe {
  border-color: var(--culture);
}

@keyframes cmark-spin {
  to { rotate: 360deg; }
}

@keyframes cmark-pulse {
  50% { scale: 1.12; }
}

/* A tutorial run has no saves, contracts or strain board. */
.tut-only {
  display: none;
}

body.tut .tut-only {
  display: flex;
}

body.tut #evolve,
body.tut #m-save,
body.tut #m-load,
body.tut #m-export,
body.tut #m-import,
body.tut #m-end,
body.tut #m-score,
body.tut #f-contracts,
body.tut #f-board,
body.tut #find-mark,
body.tut #run-setup,
body.tut #pick-boss {
  display: none !important;
}

/* ---------- tutorial: the end ---------- */

.badges {
  list-style: none;
  margin: var(--s2) 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--s4);
  width: var(--col);
  border-top: 1px solid var(--rule);
  text-align: left;
}

.badges li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 40px;
  border-bottom: 1px solid var(--rule);
  font-weight: 500;
  animation: badge-in 0.35s calc(var(--i) * 0.1s + 0.2s) ease both;
}

/* A tick in culture green. */
.badges li i {
  flex: none;
  width: 6px;
  height: 11px;
  margin: 0 5px 3px 4px;
  border: solid var(--culture);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

@keyframes badge-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .coach,
  .coach.shake,
  .coach-focus,
  .cmark.ring,
  .badges li,
  .welcome {
    animation: none;
  }
}

.title-hint {
  margin: -4px 0 0;
  color: var(--gold);
  font-size: 12px;
  text-align: center;
  animation: fade-in 0.4s ease both;
}

#graduate {
  text-align: center;
}

#graduate .small {
  max-width: 420px;
  margin: 0;
}

#graduate .stack {
  width: var(--col);
}

.cmark.hot {
  color: var(--alert);
  border-color: rgba(var(--game-color-palette-red-500-rgb), 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .plate.knock {
    animation: none;
  }
}

/* The objective switch on the species plate and the title dish: 10×, 40×, 100× as round buttons on an arc
   outside the dish's right edge, along a hairline arc like an objective turret (placed by Mag in menu.js).
   A gimmick, so it stays small and quiet: mono numerals, the chosen one outlined. */
.mag {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* The turret: a hairline circle around the dish, cut down to the arc the buttons sit on. */
.mag::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--arc, 19px));
  border-radius: 50%;
  border: 1px solid var(--rule);
  clip-path: polygon(50% 50%, 100% 18%, 100% 82%);
}

.mag button {
  position: absolute;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bench-raised);
  font-family: var(--f-num);
  font-size: 9px;
  letter-spacing: -0.02em;
  color: var(--ink-dim);
  pointer-events: auto;
}

.mag button:hover {
  color: var(--ink);
  border-color: var(--rule-strong);
}

.mag button.on {
  color: var(--ink);
  border-color: var(--ink-dim);
}

/* A change of objective on the title dish: the world behind it blurs and comes back into focus. */
.plate.refocus {
  animation: refocus 0.7s ease;
}

@keyframes refocus {
  50% {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .plate.refocus {
    animation: none;
  }
}
