* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette from the favicon: ink dots, grey threads, white paper. */
  --ink: #000000;
  --ink-soft: #1e1e1e;
  --thread-strong: #6b6b6b;
  --thread: #b8b8b8;
  --thread-faint: #e6e6e6;
  --paper: #ffffff;
  /* The rest of the design system's tokens (ui.css has them all; it loads
     in the control window only): one palette and one type everywhere. */
  --edge: #000000; /* control borders */
  --dim: #9a9a9a; /* disabled, empty: never text to read */
  --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: ui-monospace, Consolas, 'Courier New', monospace;
  --hairline: 1px;
  --radius-none: 0;
  --radius-round: 50%;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --control-small: 30px;
  /* Hidden button zones, proportional to the screen so they work in phone
     portrait too. Left edge: three stacked zones; top: one centered zone.
     The title in the middle stays clear. */
  /* Capped in px, so on large screens they stay at the edges instead of
     reaching into the paper. */
  --zone-left-w: min(25vw, 280px);
  --zone-left-h: min(31vh, 280px);
  --zone-top-w: min(40vw, 480px);
  --zone-top-h: min(22vh, 180px);
  /* Settings zone: a square in the top-right corner. */
  --zone-corner: min(25vw, 25vh, 200px);
}

/* Everything is fixed to the screen: the page itself never scrolls (on
   phones a swipe used to move the whole page and the address bar). Only the
   settings panel scrolls, inside itself. touch-action also stops the
   browser's double-tap zoom, which competed with the title's double tap. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background: var(--paper);
  font-family: var(--font-sans);
  color: var(--ink);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
}

#canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
  background: transparent;
}

#background-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -3;
  background: #ffffff;
}

/* Fading imprint layers (page.js), over the permanent ones: same z-index,
   later in the page. */
.fade-layer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -3;
}

#title-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  text-align: center;
}

#title-container h1 {
  font-size: 10vw;
  color: rgba(0, 0, 0, 1);
  font-weight: lighter;
  letter-spacing: 0.05em;
  pointer-events: auto;
  cursor: pointer;
  transition:
    color 0.3s ease,
    opacity 0.3s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.2);
}

#title-container h1:hover {
  color: rgba(0, 0, 0, 0.6);
}

/* Pressing the title crossfades it with a negative copy (#title-negative):
   white letters in "difference" mode invert whatever is under them, so the
   title stays readable over any imprint colors. Same duration both ways. */
#title-container h1.is-pressed {
  opacity: 0;
}

/* Its own fixed layer, so the blend applies against the canvases. */
#title-negative {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  text-align: center;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#title-negative.is-visible {
  opacity: 1;
}

/* Same type as the title (sizes per orientation are set below). */
.title-negative-text {
  position: relative;
  color: #ffffff;
  font-size: 10vw;
  font-weight: lighter;
  letter-spacing: 0.05em;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

/* Auto print on (double tap): a dot pulses under the title. */
.latch-dot {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  margin: 10px 0 0 -5px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#title-negative.is-latched .latch-dot {
  opacity: 1;
  animation: latch-pulse 1.2s ease-in-out infinite;
}

@keyframes latch-pulse {
  0%,
  100% {
    transform: scale(0.6);
    opacity: 0.45;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #title-negative.is-latched .latch-dot {
    animation: none;
  }
}

#randomizeShortcutBtn {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--zone-top-w);
  height: var(--zone-top-h);
  z-index: 9;
  pointer-events: auto;
  cursor: pointer;
  background: transparent;
  border: none;
  color: transparent;
  border-radius: 0;
  padding: 0;
  font-size: 1rem;
  -webkit-tap-highlight-color: transparent; /* invisible like the other zones */
}

#randomizeShortcutBtn:hover {
  background-color: transparent;
}

#eraseBtn {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--zone-left-w);
  height: var(--zone-left-h);
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 9;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Middle of the left edge: clears the imprints only (invisible, like #eraseBtn). */
/* Middle of the right edge: keeps creatures on screen or lets them leave. */
#keepOnScreenBtn {
  position: fixed;
  top: 50%;
  right: 0;
  width: var(--zone-left-w);
  height: var(--zone-left-h);
  margin-top: calc(var(--zone-left-h) / -2);
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 9;
  -webkit-tap-highlight-color: transparent;
}

#clearImprintsBtn {
  position: fixed;
  top: 50%;
  left: 0;
  width: var(--zone-left-w);
  height: var(--zone-left-h);
  margin-top: calc(var(--zone-left-h) / -2);
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 9;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Bottom-left corner: opens the print color picker (input.js). */
#printColorBtn {
  position: fixed;
  bottom: 0;
  left: 0;
  width: var(--zone-left-w);
  height: var(--zone-left-h);
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 9;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Settings: an invisible square zone in the top-right corner, like the
   other hidden zones. It only opens the panel; while the panel is open it
   lets clicks through to the panel (which has its own close button). */
#toggleControlsBtn {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 11;
  width: var(--zone-corner);
  height: var(--zone-corner);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Invisible to the mouse; reached with Tab (the keyboard's way to the
   settings), it shows where it is. */
#toggleControlsBtn:focus {
  outline: none;
}
#toggleControlsBtn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -6px;
}

#toggleControlsBtn.is-visible {
  pointer-events: none;
}

.main-content {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  width: 100%;
  position: relative;
  z-index: 10;
  /* Full-width row: let clicks through to the title and the hidden zones;
     only the panel itself catches them. */
  pointer-events: none;
  /* The body centers its content vertically; keep the panel at the top. */
  margin-bottom: auto;
}

/* Controls panel: drawn like the creatures and the favicon.
   White paper, black ink dots, grey hairline threads. */
.controls {
  pointer-events: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--thread);
  border-radius: 2px;
  width: min(700px, calc(100vw - 40px));
  color: var(--ink);
  /* Ends above the statement and the footer links instead of running under
     them; the content scrolls inside .controls-scroll. */
  max-height: calc(100vh - 130px);
  max-height: calc(100dvh - 130px);
  overflow: hidden;
}

/* Thin top bar holding the close button, above the scrolling area, so the
   button never sits on the scrollbar. */
.controls-bar {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 0 30px;
}

/* Share (presets.js) and freeze / resume (page.js): quiet words next to the
   close button. */
#shareBtn,
#freezeBtn {
  -webkit-tap-highlight-color: transparent; /* no grey box after a tap */
  flex: none;
  width: auto; /* not the panel's full-width buttons */
  margin-right: 12px;
  padding: 2px 4px;
  border: none;
  background: none;
  color: var(--thread-strong);
  font-size: 13px;
  cursor: pointer;
}

#shareBtn:hover,
#freezeBtn:hover,
#freezeBtn[aria-pressed='true'] {
  color: var(--ink);
}

#shareBtn:focus-visible,
#freezeBtn:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* Frame rate, always visible at the top of the panel. */
.controls-fps {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--thread-strong);
  font-variant-numeric: tabular-nums;
}

/* Scrolls the settings, with a thin grey scrollbar. */
.controls-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--thread) transparent;
  padding: 6px 30px 10px;
}

/* Close button: same family as the "?" button. */
/* Close button: just an x. */
#closeControlsBtn {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: none;
  color: var(--thread-strong);
  font: 300 24px/1 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: pointer;
  transition: color 0.15s;
}

#closeControlsBtn:hover {
  color: var(--ink);
}

#closeControlsBtn:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* The columns live in an inner wrapper: with a height limit on .controls
   itself, extra columns would overflow sideways instead of scrolling. */
.controls-columns {
  column-count: 2;
  column-gap: 36px;
  column-rule: 1px solid var(--thread-faint);
}

.controls.hidden {
  display: none;
}

.control-group {
  margin-bottom: 26px;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  break-inside: avoid;
}

/* Section title: an ink node on a thread. */
.control-group h3 {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 2px 0 16px;
  color: var(--ink);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
}

/* (The kit's section title: ui.css .iv-title.) */
.control-group h3::before {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.control-group h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--thread);
}

label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Checkbox: an empty node that fills with ink when on. */
input[type='checkbox'] {
  opacity: 0;
  position: absolute;
  width: 0;
  height: 0;
}

.checkbox-label {
  position: relative;
  padding-left: 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  -webkit-user-select: none;
  user-select: none;
  color: var(--ink-soft);
}

/* The kit's checkbox (ui.css .iv-check): a square, a tick when on. */
.checkbox-label::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 1.5px solid var(--edge);
  border-radius: var(--radius-none);
  background: transparent;
}

input[type='checkbox']:checked + .checkbox-label::before {
  background: var(--ink);
  border-color: var(--ink);
}

input[type='checkbox']:checked + .checkbox-label::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 50%;
  width: 4px;
  height: 8px;
  margin-top: -6px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type='checkbox']:focus-visible + .checkbox-label::before {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* Slider: a hairline thread with an ink dot. */
input[type='range'] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  background: transparent;
  outline: none;
  padding: 0;
  margin: 2px 0 12px;
  cursor: pointer;
}

/* The kit's slider (ui.css .iv-slider): a hairline the whole length and a
   3px ink fill up to the value (--fill, kept by input.js). */
input[type='range']::-webkit-slider-runnable-track {
  height: 3px;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / var(--fill, 0%) 3px no-repeat,
    linear-gradient(var(--edge), var(--edge)) 0 50% / 100% var(--hairline) no-repeat;
}

input[type='range']::-moz-range-track {
  height: 3px;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / var(--fill, 0%) 3px no-repeat,
    linear-gradient(var(--edge), var(--edge)) 0 50% / 100% var(--hairline) no-repeat;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px; /* (centred on the 3px track) */
  border: none;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}

input[type='range']::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}

input[type='range']:hover::-webkit-slider-thumb,
input[type='range']:active::-webkit-slider-thumb {
  transform: scale(1.35);
}

input[type='range']:hover::-moz-range-thumb,
input[type='range']:active::-moz-range-thumb {
  transform: scale(1.35);
}

input[type='range']:focus-visible::-webkit-slider-thumb {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* Color picker: an ink dot of the chosen color on a hairline ring. */
.color-control {
  margin-bottom: 12px;
}

input[type='color'] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 3px;
  border: 1px solid var(--thread);
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
}

input[type='color']:hover:not(:disabled) {
  border-color: var(--ink);
}

input[type='color']:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

input[type='color']:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type='color']::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

input[type='color']::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Select and text: no box, just a thread underneath. */
select,
input[type='text'] {
  width: 100%;
  padding: 7px 0;
  margin-bottom: 12px;
  background-color: transparent;
  color: var(--ink);
  border: none;
  border-bottom: 1px solid var(--thread-strong);
  border-radius: 0;
  font-family: inherit;
  font-size: 0.9rem;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

select:hover,
input[type='text']:hover,
select:focus,
input[type='text']:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

/* Keyboard focus visible, as on the other controls. */
select:focus-visible,
input[type='text']:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

/* Sensor readout for development: only with the debug panel (D). */
#debug-info-container {
  display: none;
}

html.debug-open #debug-info-container {
  display: block;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3ccircle cx='10' cy='10' r='3' fill='%23000'/%3e%3c/svg%3e");
  background-position: right 2px center;
  background-repeat: no-repeat;
  background-size: 1.2em 1.2em;
  padding-right: 1.8rem;
}

#letterInput {
  text-align: center;
  font-size: 1.8rem;
  font-weight: lighter;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
}

#letterInputContainer input {
  height: 56px;
}

#letterInputContainer {
  margin-top: 12px;
}

.value-display {
  float: right;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--thread-strong);
  font-variant-numeric: tabular-nums;
}

/* Buttons: ink outline, inverted on hover. */
.controls button {
  padding: 10px 15px;
  background-color: var(--paper);
  color: var(--ink);
  border: var(--hairline) solid var(--edge);
  border-radius: var(--radius-none);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition:
    background-color 0.15s,
    color 0.15s;
}

/* (The kit's hover: the border, not a fill: ui.css .iv-btn.) */
.controls button:hover:not(:disabled) {
  border-color: var(--ink);
}

.controls button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.controls button:disabled {
  opacity: 0.35;
  cursor: default;
}

.sub-control {
  margin-top: 12px;
  padding-left: 0;
}

/* Short statement just above the footer row: quiet, but visible text for
   search engines. */
.statement {
  position: fixed;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 40px));
  z-index: 5;
  display: grid;
  gap: 2px;
  text-align: center;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  color: var(--thread-strong);
  pointer-events: none;
  text-wrap: balance;
}

.statement p {
  margin: 0;
}

/* No room under the title on short screens (phones in landscape). Search
   crawlers render a portrait phone screen, where it stays visible. */
@media (max-height: 480px) {
  .statement {
    display: none;
  }
}

/* A fixed 34px row, so the links line up with the "?" button (30px,
   centered on the same line, see #tourHelpBtn). */
footer {
  position: fixed;
  bottom: 30px;
  left: 0;
  width: 100%;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  /* Above the hidden zones (same z-index, later in the page): the links,
     not the corner zones, take taps on them. Below the panel. */
  z-index: 9;
  pointer-events: none;
}

footer a {
  pointer-events: auto;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 16px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 15px;
  border-radius: 2px;
  border: 1px solid var(--ink);
  transition:
    background-color 0.15s,
    color 0.15s;
}

footer a:hover {
  background-color: var(--ink);
  color: var(--paper);
}

#debug-info {
  background: transparent;
  border: 1px solid var(--thread-faint);
  padding: 10px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

#debug-info p {
  margin: 0;
  padding: 0;
}

#debug-info span {
  font-weight: bold;
  color: var(--ink);
}

#gravity-indicator-canvas {
  border: 1px solid var(--thread);
  border-radius: 50%;
  background: var(--paper);
  display: inline-block;
}

@media (orientation: landscape) {
  #title-container h1,
  .title-negative-text {
    font-size: 8vw;
  }
}

/* Portrait (phones): a bigger title, and narrower left-edge zones so the
   title's first letter stays clear of them (about 10px at 20vw / 20vw). */
@media (orientation: portrait) {
  :root {
    --zone-left-w: 20vw;
  }

  #title-container h1,
  .title-negative-text {
    font-size: 20vw;
  }
}

/* Narrow phones: the links and the "?" share one row. */
@media (max-width: 400px) {
  footer {
    gap: 12px;
  }

  footer a {
    padding: 8px 10px;
  }
}

/* Short screens (phones in landscape): the statement is hidden, so the
   panel takes the full height, in two columns when wide enough. */
@media (max-height: 480px) {
  .controls {
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
  }
}

/* One column below 720px (a 768px tablet in portrait keeps two). */
@media (max-width: 720px) {
  .main-content {
    justify-content: center;
  }

  .controls {
    width: 90vw;
    max-width: 450px;
  }

  .controls-scroll {
    padding: 6px 20px 20px;
  }

  .controls-bar {
    padding-left: 20px;
  }

  .controls-columns {
    column-count: 1;
  }
}

/* ---------- Guided tour and hints (tour.js) ---------- */
/* Same drawing as the creatures: an ink dot, a grey thread, a short label. */
.tour-layer {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.tour-hint {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tour-hint.is-tour.is-visible,
.tour-hint.is-flash.is-visible {
  opacity: 1;
}

/* Proximity cues follow the mouse through inline opacity; hidden during the tour. */
.tour-hint.is-cue {
  transition: opacity 0.15s linear;
}

body.tour-running .tour-hint.is-cue {
  display: none;
}

/* While the color picker is open, the corner hints and the ? button would
   sit under or beside it. */
body:has(.cp-card:not([hidden])) .tour-hint.is-cue,
body:has(.cp-card:not([hidden])) #tourHelpBtn {
  visibility: hidden;
}

/* While a toggle state is flashing, hide the proximity cues so texts don't overlap. */
.tour-layer:has(.is-flash.is-visible) .tour-hint.is-cue {
  visibility: hidden;
}

.tour-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--ink);
}

.tour-hint.is-tour .tour-dot {
  animation: tour-pulse 1.4s ease-in-out infinite;
}

.tour-hint.is-cue .tour-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
}

@keyframes tour-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(0, 0, 0, 0);
  }
}

.tour-thread {
  position: absolute;
  height: 1px;
  background: var(--thread-strong);
  transform-origin: 0 50%;
}

.tour-label {
  position: absolute;
  display: grid;
  gap: 2px;
  padding: 4px 0;
  white-space: nowrap;
  font-size: 0.95rem;
  font-weight: lighter;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.tour-label[data-side='below'] {
  transform: translate(-50%, 2px);
  text-align: center;
}

.tour-label[data-side='right'] {
  transform: translate(6px, -50%);
}

.tour-label[data-side='left'] {
  transform: translate(calc(-100% - 6px), -50%);
  text-align: right;
}

.tour-sub {
  font-size: 0.78rem;
  color: var(--thread-strong);
}

.tour-sub:empty {
  display: none;
}

.tour-hint.is-cue .tour-label {
  font-size: 0.8rem;
  color: var(--thread-strong);
}

/* Title: the hint appears under the word on hover. */
#title-container h1 {
  position: relative;
  /* Box hugs the letters, so the hint sits right under the word. */
  line-height: 1;
}

#title-container h1[data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  /* Just under the letters: tour.js measures the baseline into --hint-top. */
  top: var(--hint-top, 100%);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: var(--thread-strong);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#title-container h1[data-hint]:hover::after {
  opacity: 1;
}

body.tour-running #title-container h1[data-hint]::after {
  opacity: 0;
}

/* "?" button: replays the tour. */
#tourHelpBtn {
  position: fixed;
  right: 20px;
  /* Centered on the footer row: 30px + (34px - 30px) / 2. */
  bottom: 32px;
  z-index: 11;
  width: 30px;
  height: 30px;
  border: 1px solid var(--thread);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--thread-strong);
  font: 300 0.95rem/1 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: pointer;
  transition:
    background-color 0.15s,
    color 0.15s,
    border-color 0.15s;
}

/* A finger: a larger target than the 30px circle (it stays drawn as is). */
@media (pointer: coarse) {
  #tourHelpBtn::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
  }
}

#tourHelpBtn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

#tourHelpBtn:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .tour-hint.is-tour .tour-dot {
    animation: none;
  }
}

/* ---------- Ink color picker (color-picker.js) ---------- */
/* The card and its target dots are shown and hidden with the hidden
   attribute; their display rules below must not override it. */
.cp-card[hidden],
.cp-card [hidden] {
  display: none;
}

/* Minimal: a color square and a thread, on a borderless white card. */
.cp-card {
  --cp-marker: 10px; /* marker width, also used by color-picker.js */
  position: fixed;
  z-index: 30;
  display: grid;
  gap: 10px;
  padding: 8px;
  background: var(--paper);
}

/* Square for the current tint: intensity across, light to dark down. */
.cp-field {
  position: relative;
  width: 168px;
  height: 168px;
  cursor: crosshair;
  touch-action: none;
  outline: none;
}

.cp-field canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cp-field:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: 3px;
}

/* The current color: a thin ink ring. */
.cp-marker {
  position: absolute;
  width: var(--cp-marker);
  height: var(--cp-marker);
  margin: calc(var(--cp-marker) / -2) 0 0 calc(var(--cp-marker) / -2);
  border-radius: 50%;
  box-shadow:
    0 0 0 1.5px var(--paper),
    0 0 0 2.5px var(--ink);
  pointer-events: none;
}

/* Optional row of target dots above the field (main color, shiver). */
.cp-targets {
  display: flex;
  gap: 10px;
  padding: 2px;
}

.cp-target {
  display: flex;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.cp-target-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.cp-toggle {
  margin-left: 6px; /* set apart from the color dots */
}

.cp-target.is-selected .cp-target-dot {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.cp-target:focus-visible {
  outline: 1px dashed var(--ink);
  outline-offset: 3px;
}

/* Tint: a hairline rainbow thread with an ink dot. */
.cp-card input.cp-hue {
  --track: linear-gradient(
    to right,
    #ff0000,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #ff00ff,
    #ff0000
  );
}

/* The tint thread: a bold line in a band taller than it, so the whole
   band catches the pointer (the design system's ColorPicker: a 32 px band,
   an 8 px line, a 20 px dot; a 2 px line was hard to point at). */
.cp-card input.cp-range {
  width: 100%;
  height: 32px;
  margin: 0;
}

.cp-card input.cp-range::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--track, var(--thread));
}

.cp-card input.cp-range::-moz-range-track {
  height: 8px;
  background: var(--track, var(--thread));
}

.cp-card input.cp-range::-webkit-slider-thumb {
  margin-top: -6px; /* (centred on the line: (8 - 20) / 2) */
  width: 20px;
  height: 20px;
}

.cp-card input.cp-range::-moz-range-thumb {
  width: 20px;
  height: 20px;
}

/* The sheet (opened by a finger, color-picker.js): sized for fingers, with
   targets of 44px and more. */
.cp-card.is-sheet {
  --cp-marker: 22px;
  gap: 14px;
  padding: 16px 18px 14px;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

.cp-card.is-sheet .cp-field {
  width: min(76vw, 320px, 46vh);
  height: min(76vw, 320px, 46vh);
}

.cp-card.is-sheet .cp-marker {
  box-shadow:
    0 0 0 2.5px var(--paper),
    0 0 0 4px var(--ink);
}

.cp-card.is-sheet .cp-targets {
  gap: 6px;
  padding: 0;
}

.cp-card.is-sheet .cp-target {
  padding: 7px; /* 30px dot in a 44px target */
}

.cp-card.is-sheet .cp-target-dot {
  width: 30px;
  height: 30px;
}

.cp-card.is-sheet .cp-toggle {
  margin-left: 14px;
}

.cp-card.is-sheet .cp-target.is-selected .cp-target-dot {
  outline-width: 2px;
  outline-offset: 3px;
}

.cp-card.is-sheet input.cp-range {
  height: 44px;
}

.cp-card.is-sheet input.cp-range::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 5px;
}

.cp-card.is-sheet input.cp-range::-moz-range-track {
  height: 10px;
  border-radius: 5px;
}

.cp-card.is-sheet input.cp-range::-webkit-slider-thumb {
  margin-top: -10px;
  width: 30px;
  height: 30px;
}

.cp-card.is-sheet input.cp-range::-moz-range-thumb {
  width: 30px;
  height: 30px;
}

/* ---------- Dark paper (Appearance, or ?dark in the address) ---------- */
/* One full-screen layer inverts everything under it: white paper turns
   black, ink turns white; the hue rotation keeps colors recognizable. It sits
   above the interface too (statement, links, "?", panel, hints), which turns
   to ink on black like the paper; only the color picker (true colors) and
   the debug and key panels stay above it. */
#dark-paper {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  display: none;
  -webkit-backdrop-filter: invert(1) hue-rotate(180deg);
  backdrop-filter: invert(1) hue-rotate(180deg);
}

html.dark-paper #dark-paper {
  display: block;
}
/* A paper flash (Shift+I held, input.js): the paper the other way round
   while held. */
html.paper-flash:not(.dark-paper) #dark-paper {
  display: block;
}
html.paper-flash.dark-paper #dark-paper {
  display: none;
}

/* ---------- Burst long press (input.js) ---------- */
/* An ink ring grows under the finger while pressing; it pops on the burst. */
.press-ring {
  position: fixed;
  z-index: 8;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 1px solid var(--thread-strong);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.2);
}

.press-ring.is-pressing {
  animation: press-grow 0.55s linear forwards;
}

.press-ring.is-charging {
  animation: press-charge 1.45s linear forwards; /* CHARGE_MS - LONG_PRESS_MS (input.js) */
}
.press-ring.is-burst {
  animation: press-pop 0.4s ease-out forwards;
}

@keyframes press-grow {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
  to {
    opacity: 0.8;
    transform: scale(1);
  }
}

/* Charging: the ring keeps growing, darker (RING_CHARGED in input.js). */
@keyframes press-charge {
  from {
    opacity: 0.8;
    transform: scale(1);
  }
  to {
    opacity: 1;
    transform: scale(2.2);
  }
}

/* The pop starts from the size the ring had reached (--ring-scale). */
@keyframes press-pop {
  from {
    opacity: 0.8;
    transform: scale(var(--ring-scale, 1));
  }
  to {
    opacity: 0;
    transform: scale(calc(var(--ring-scale, 1) * 2.2));
  }
}

/* No callout or selection on long press over the paper. */
body {
  -webkit-touch-callout: none;
}

canvas {
  -webkit-user-select: none;
  user-select: none;
}

/* Hidden zones stay invisible with the keyboard too: out of the tab order
   (tabindex -1), never focused by a click (input.js), and no focus outline. */
.hidden-zone:focus,
.hidden-zone:focus-visible {
  outline: none;
}

/* WebGL renderer canvas (renderer-webgl.js): same place as the 2D canvas. */
/* Multiply Ink (panel.js): the live drawing darkens the imprints under it. */
html.ink-multiply #canvas,
html.ink-multiply #gl-canvas {
  mix-blend-mode: multiply;
}
/* Darken (a felt pen: no build-up) and Exclusion (inverts where it
   crosses), page.js inkLayer. The WebGL layer draws Exclusion's inks as
   their negative; Canvas 2D's are turned here. */
html.ink-darken #canvas,
html.ink-darken #gl-canvas {
  mix-blend-mode: darken;
}
html.ink-exclusion #gl-canvas {
  mix-blend-mode: exclusion;
}
html.ink-exclusion #canvas {
  mix-blend-mode: exclusion;
  filter: invert(1);
}

#gl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
  pointer-events: none;
}

/* ---------- Hidden zones and the panel, on every device ---------- */
/* While the settings panel is open the hidden zones are inert: a tap beside
   the panel must not start over or clear (on touch it closes the panel). */
body:has(.controls:not(.hidden)) .hidden-zone {
  pointer-events: none;
}

/* While a slider is held the panel steps aside: only the touched row stays,
   over the creatures it changes (panel.js sets the classes). (Important:
   the visitor's column and studio's panel paint their paper later, more
   specifically; held, it went on hiding the drawing.) */
.controls.is-adjusting {
  background: transparent !important;
  border-color: transparent !important;
}

.controls.is-adjusting .controls-bar,
.controls.is-adjusting .control-group > :not(.is-adjusted) {
  opacity: 0.12;
}

/* Phones in landscape, wide enough: two columns (after the narrow-screen
   rule, which this overrides). */
@media (max-height: 480px) and (min-width: 700px) {
  .controls {
    width: min(700px, calc(100vw - 40px));
    max-width: none;
  }

  .controls-columns {
    column-count: 2;
  }
}

/* Touch screens: zones a little smaller (more paper to touch, still thumb
   sized), and finger-sized targets in the panel with the same look (also on
   touch laptops, whatever pointer is used). */
@media (any-pointer: coarse) {
  :root {
    --zone-left-w: min(18vw, 200px);
    --zone-left-h: min(25vh, 220px);
    --zone-top-h: min(15vh, 150px);
  }

  #closeControlsBtn {
    width: 44px;
    height: 44px;
    margin: -9px -9px -9px 0;
  }

  .controls input[type='range'] {
    height: 34px;
    /* A strip at the right that only scrolls the panel. */
    width: calc(100% - 40px);
  }

  .controls input[type='range']::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -10px;
  }

  .controls input[type='range']::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }

  .checkbox-label {
    min-height: 40px;
  }

  /* 16px: iOS zooms the (fixed) page into smaller form fields. */
  .controls select,
  .controls input[type='text'] {
    font-size: 16px;
  }

  /* The "?" keeps its size; its touch area grows. */
  #tourHelpBtn::before {
    content: '';
    position: absolute;
    inset: -7px;
  }
}

/* Touch screens: a setting's help, shown under its row when its label is
   tapped (control-help.js), in place of the hover tooltip. */
.control-help-line {
  margin: -6px 0 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--thread-strong);
}

/* ---------- Visitors' panel (simple-panel.js) ---------- */
/* The visitor's column (.visit, simple-panel.js) first; "more settings"
   opens the groups under it. */
.simple-panel .controls .controls-columns {
  display: none;
}

/* "all settings" / "fewer settings": a quiet line under the settings. */
.controls button.panel-scope {
  display: block;
  width: auto;
  margin: 4px auto 14px;
  padding: 4px 8px;
  border: none;
  background: none;
  color: var(--thread-strong);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.controls button.panel-scope:hover:not(:disabled) {
  background: none;
  color: var(--ink);
}

#shareBtn {
  margin-left: auto;
}

/* A group's heading says when its settings act (index.html): now, on new
   creatures, kept by R, this device. */
/* A group's heading (a button for visitors): its focus ring clear of the
   bullet, and only for the keyboard; its "when" tag on one line. */
html:not(.show-tools) .controls .group-heading:focus {
  outline: none;
}
html:not(.show-tools) .controls .group-heading:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 6px;
}
.control-group h3 .group-when {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--thread-strong);
  opacity: 0.8;
}

/* Studio: the panel one narrow column docked to the right, so the drawing it
   tunes stays in view (two wide columns covered half the screen). */
.studio-mode .controls {
  width: min(440px, calc(100vw - 40px));
}
.studio-mode .controls-columns {
  column-count: 1;
}

/* What a setting costs, said beside it; what a body costs, under it. */
.controls .setting-cost,
.controls .setting-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--thread-strong);
}
.controls .setting-note {
  display: block;
  margin-top: 2px;
}

/* Visitors: the machine is not theirs (renderer, the point budget, debug,
   the copy buttons, the frame rate); the gravity source stays (a phone's
   tilt is how it is played). */
html:not(.show-tools) .controls .control-group > :has(#rendererMode),
html:not(.show-tools) .controls .control-group > :has(#enablePointLimit),
html:not(.show-tools) #pointLimitContainer,
html:not(.show-tools) #debug-info-container,
html:not(.show-tools) #copyParamsBtn,
html:not(.show-tools) #copyPresetBtn,
html:not(.show-tools) .controls-fps {
  display: none !important;
}

/* The show tools: no phone's tilt on a laptop (the gravity source and its
   picture, which only shows gravity, set nowhere: it looked like a dial). */
html.show-tools .controls .phone-tilt {
  display: none !important;
}

/* ---------- Visitors: five settings, Play, more settings (simple-panel.js) ---------- */
html:not(.show-tools) .controls-scroll {
  display: flex;
  flex-direction: column;
}
html:not(.show-tools) .controls-scroll > * {
  flex: none;
}
.play-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 18px;
}
.play-row button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--thread-strong, #999);
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.play-row button.is-held {
  border-style: dashed;
}
.play-row button:active,
.play-row button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper, #fff);
}
.play-row button[aria-pressed='true'] kbd {
  color: inherit;
  opacity: 0.7;
}
.play-row kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--thread-strong);
}
/* A group closed: its heading only (+ to open). */
html:not(.show-tools) .controls .group-heading {
  cursor: pointer;
}
html:not(.show-tools) .controls .group-heading .group-fold {
  margin-left: auto;
  padding-left: 8px;
  font-weight: 400;
  color: var(--thread-strong);
}
html:not(.show-tools):not(.simple-panel) .controls .control-group.is-closed > :not(h3) {
  display: none !important;
}
/* Not for visitors: burst tuning and randomize mode (Play has the
   actions), the print settings kept from birth, the dot letter. */
html:not(.show-tools) .controls .control-group:has(#burstSize),
html:not(.show-tools) .controls .control-group:has(#softAmount),
html:not(.show-tools) .controls .control-group > :has(#feetOnBeat),
html:not(.show-tools) .controls .control-group > :has(#perCreatureImprintCheck),
html:not(.show-tools) #letterChoiceContainer {
  display: none !important;
}
/* On a phone the panel is a bottom sheet: at most 45% of the screen, the
   drawing above it. */
@media (max-width: 600px) and (pointer: coarse) {
  html:not(.show-tools) .main-content {
    justify-content: flex-end;
    z-index: 30; /* the sheet above the "?" and the links */
  }
  html:not(.show-tools) .controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 45vh;
    max-height: 45dvh;
    background: var(--paper); /* opaque: the footer's links never show through */
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}

/* ---------- The visitor's column (simple-panel.js), after the redesign's
   "Web, settings open": a white column on the right, labels on the left,
   hairlines, square, ink on paper. ---------- */
@media (min-width: 601px), (pointer: fine) {
  html:not(.show-tools) .controls {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 100vw);
    max-height: none;
    border: 0;
    border-left: 1px solid var(--thread);
    border-radius: 0;
    background: var(--paper);
  }
}
/* The bar: "Settings", and close (Esc); share and freeze live below. */
html:not(.show-tools) .controls-bar {
  padding: 22px 32px 6px;
  align-items: center;
}
html:not(.show-tools) .controls-bar .visit-heading {
  margin-right: auto;
  font-size: 15px;
  color: var(--ink);
}
html:not(.show-tools) #shareBtn,
html:not(.show-tools) #freezeBtn {
  display: none !important;
}
html:not(.show-tools) #closeControlsBtn {
  width: auto;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--edge);
  border-radius: 0;
  font-size: 13px;
}
#closeControlsBtn kbd,
.visit kbd {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--thread-strong);
}
html:not(.show-tools) .controls-scroll {
  padding: 8px 32px 28px;
}
.visit-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--ink);
}
.visit-title::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.visit-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--thread);
}
.visit-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin-bottom: 14px;
}
.visit-row[hidden] {
  display: none;
}
.visit-label {
  padding-top: 6px;
  font-size: 13px;
  color: var(--thread-strong);
}
.visit-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  min-width: 0;
}
.visit-field select {
  width: 100%;
}
.visit-seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
  border: 1px solid var(--edge);
}
.visit-seg button {
  min-height: var(--control-small);
  margin: 0;
  background: transparent;
  color: var(--thread-strong); /* the kit's segmented: grey, ink when chosen */
  border: 0;
  border-right: 1px solid var(--edge);
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.visit-seg button:last-child {
  border-right: 0;
}
.visit-seg button[aria-pressed='true'] {
  background: var(--ink);
  color: var(--paper);
}
.visit-letter {
  width: 44px;
  padding: 2px 0 4px;
  border: 0;
  border-bottom: 1px solid var(--edge);
  background: transparent;
  font: inherit;
  font-size: 17px;
  text-align: center;
}
.visit-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}
.visit-swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.visit-swatch-color {
  width: 20px;
  height: 20px;
  border: 1px solid var(--edge);
  box-sizing: border-box;
}
.visit-slider {
  width: 100%;
}
.visit-slider[hidden] {
  display: none;
}
.visit-slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.visit-value {
  font-family: var(--font-mono);
  font-size: 12px;
}
.visit-slider input[type='range'] {
  width: 100%;
}
.visit-share {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 44px;
  margin: 4px 0 0;
  padding: 0 16px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--edge);
  border-radius: 0;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.visit-note {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--thread-strong);
}
.visit-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--thread);
}
.visit-foot .panel-scope,
.visit-keys {
  width: auto;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}
/* With the column, the look's settings are not shown twice in the groups. */
html:not(.show-tools) .controls .control-group:first-child,
html:not(.show-tools) .controls .control-group > :has(#creatureShape),
html:not(.show-tools) #letterInputContainer,
html:not(.show-tools) .controls .control-group > :has(#keepLetterShape),
html:not(.show-tools) .controls .control-group > :has(#creatureColor),
html:not(.show-tools) .controls .control-group > :has(#shiverColor),
html:not(.show-tools) .controls .control-group > :has(#darkPaperCheck),
html:not(.show-tools) .controls .control-group > :has(#colorPerCreature),
html:not(.show-tools) .controls .control-group > :has(#leaveImprints),
html:not(.show-tools) .controls .control-group > :has(#fadeImprintsCheck),
html:not(.show-tools) #fadeTimeContainer,
html:not(.show-tools) .controls .control-group > :has(#keepOnScreenCheck) {
  display: none !important;
}

/* The column's own controls over the panel's general ones (specificity). */
.controls .visit .visit-check input[type='checkbox'] {
  position: static;
  opacity: 1;
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1.5px solid var(--edge);
  border-radius: 0;
  background: transparent;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.controls .visit .visit-check input[type='checkbox']::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
  opacity: 0;
}
.controls .visit .visit-check input[type='checkbox']:checked {
  background: var(--ink);
}
.controls .visit .visit-check input[type='checkbox']:checked::after {
  opacity: 1;
}
.controls .visit .visit-swatch,
.controls .visit .visit-foot button {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}
.controls .visit .visit-letter {
  width: 44px;
  flex: none;
}
html:not(.show-tools) #closeControlsBtn {
  color: var(--ink);
}
/* The panel open: the "?" (tour) leaves its corner to it; "keys and
   gestures" is in the panel. */
html:not(.show-tools) body:has(.controls:not(.hidden)) #tourHelpBtn {
  display: none;
}


.play-row button:disabled {
  opacity: 0.35;
  cursor: default;
}
.control-group h3 .group-when {
  white-space: nowrap;
}

/* Big screens: the visitor's column a little wider. */
@media (min-width: 1600px) {
  html:not(.show-tools) .controls {
    width: 460px;
  }
}

/* The visitor's column on touch screens: rows a finger can hit (they were
   12-20 px tall). */
@media (pointer: coarse) {
  .controls .visit .visit-check,
  .controls .visit .visit-swatch,
  .controls .visit .visit-foot button,
  html .controls .group-heading {
    min-height: 44px;
    align-items: center;
  }
}
