/*
 * Mossling Matcha Bar — a one-page project in live 3D (tickets/SC-12.md).
 *
 * Layers of the pinned stage, back to front:
 *   .field     z0  a flat field of moss with the word on it: only what a page without
 *                  the script (or without WebGL) shows
 *   #gl        z2  the room and the set, drawn by the script: the stone counter, the
 *                  painted wall with the word, the light through the leaves, the things
 *   .shade     z3  shade along the top of the frame, under the bar
 *   .bar …     z4  the interface, which stands still: the captions of act 1, the callouts
 *                  of act 2, the line and the button of act 4
 * After the stage, in the flow of the page: .foot.
 *
 * Brand colours (tickets/SC-12.md): matcha, moss, a green for each powder. The wall of
 * the room takes four greens in turn — moss, matcha (the Ceremonial green), the Daily
 * green, the Culinary green; cream is the colour of the bowl and of type, never of a field.
 */

:root {
  --ms-cream: #f4f1e8;
  --ms-paper: #e6eedc;
  --ms-matcha: #7da453;
  --ms-moss: #2e3b22;
  --ms-ink: #18210f;
  --ms-daily: #9bb86a;
  --ms-culinary: #5e7f3b;

  --ease-camera: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-text: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(16px, 2.6vw, 40px);

  /* The bar's own pair: Young Serif — the face of its labels — for every large word, and
     Zen Kaku Gothic New for everything small. The studio's Onest is only in the lime corner. */
  --face-display: "Young Serif", Georgia, "Times New Roman", serif;
  --face-text: "Zen Kaku Gothic New", system-ui, -apple-system, "Segoe UI", sans-serif;
  --face-studio: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--ms-moss);
  /* The type of the page is cream on moss from the root down, not only inside the body. */
  color: var(--ms-cream);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ms-cream);
  font-family: var(--face-text);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

::selection {
  background-color: var(--ms-matcha);
  color: var(--ms-ink);
}

p,
h1,
h2,
h3,
ol,
ul {
  margin: 0;
  padding: 0;
}

/* ——— The pinned scene ——— */

/* 6.2 screens of scroll for the four acts, and the screen the stage itself takes. */
.scene {
  position: relative;
  height: 720vh;
}

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

/* ——— z0: the field ——— */

/* Even flat, it is the same place: the wall in its light, and the dark counter along its foot. */
.field {
  position: absolute;
  inset: 0;
  background-color: var(--f);
  background-image:
    linear-gradient(to bottom, rgb(28 35 25 / 0) 0 78%, #1c2319 78.2% 100%),
    radial-gradient(120% 88% at 38% 36%, var(--f-hi) 0%, var(--f) 48%, var(--f-lo) 100%);
}

.field[data-tone="moss"] {
  --f: #2e3b22;
  --f-hi: #3a4a2b;
  --f-lo: #222c18;
  --w: var(--ms-matcha);
}

/* ——— z1: the monument word (with the script it is painted on the wall of the room) ——— */

.word {
  position: absolute;
  left: 0;
  right: 0;
  top: 45%;
  transform: translate3d(0, -50%, 0);
  color: var(--w);
  font-family: var(--face-display);
  font-size: var(--word-size, 15vw);
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

/* When the script draws, the room itself is in the canvas — the counter, the wall, the word
   on it, the phrase in powder — and these flat layers are not needed. */
.is-live .stage .field {
  display: none;
}

/* Without the room there is nothing for the shade to fall on. */
html:not(.is-live) .shade {
  display: none;
}

/* ——— z2: the set and the room ——— */

#gl {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 900ms var(--ease-camera);
}

#gl.is-ready {
  opacity: 1;
}

/* ——— z3: shade along the top of the frame ——— */

/* The wall behind the bar is now moss, now a light green with leaf shadows across it. A soft
   shade along the top, as under a lintel, keeps the bar's cream type well over 4.5:1 on any of them. */
.shade {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: clamp(96px, 17vh, 160px);
  background-image: linear-gradient(
    to bottom,
    rgb(12 17 8 / 0.82) 0%,
    rgb(12 17 8 / 0.6) 42%,
    rgb(12 17 8 / 0) 100%
  );
  pointer-events: none;
}

/* ——— The interface is cream type: it lies on the dark stone of the counter, or under the shade ——— */

[data-ui] {
  --ui: var(--ms-cream);
  --ui-dim: rgb(244 241 232 / 0.8);
  --ui-line: rgb(244 241 232 / 0.4);
  --ui-small: var(--ms-matcha);
  color: var(--ui);
}

/* ——— z4: the interface ——— */

.bar {
  position: absolute;
  top: var(--gutter);
  left: var(--gutter);
  right: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
}

.brand > span {
  font-family: var(--face-display);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  flex: none;
  width: 30px;
  height: 30px;
  margin-top: -6px;
  fill: currentColor;
}

.brand-small {
  fill: var(--ui-small);
  transition: fill 420ms var(--ease-camera);
}

.bar-note {
  color: var(--ui-dim);
  transition: color 420ms var(--ease-camera);
}

/* The captions share one cell; one is shown at a time. */
.captions {
  position: absolute;
  left: var(--gutter);
  bottom: calc(var(--gutter) + 4px);
  display: grid;
  width: min(30vw, 440px);
}

.caption {
  grid-area: 1 / 1;
  align-self: end;
}

.title {
  font-family: var(--face-display);
  font-size: clamp(32px, 3.4vw, 56px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.02;
}

.notes {
  margin-top: 16px;
  color: var(--ui-dim);
  font-size: clamp(14px, 1.15vw, 17px);
  font-weight: 500;
  line-height: 1.35;
  transition: color 420ms var(--ease-camera);
}

/* A powder's own green, as a round chip beside its name. */
.chip {
  display: inline-block;
  width: 0.78em;
  height: 0.78em;
  margin-right: 0.6em;
  border-radius: 50%;
  background-color: var(--ms-matcha);
  box-shadow: 0 0 0 1.5px currentColor;
  vertical-align: -0.04em;
}

.chip[data-sort="daily"] {
  background-color: var(--ms-daily);
}

.chip[data-sort="culinary"] {
  background-color: var(--ms-culinary);
}

/* A line comes up from under a mask and leaves the way it came. */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.line > span {
  display: block;
  transform: translate3d(0, 118%, 0);
  transition: transform 320ms var(--ease-camera);
}

.caption.is-on .line > span,
.callout.is-on .line > span,
.final.is-on .line > span {
  transform: none;
  transition: transform 700ms var(--ease-text) calc(var(--i, 0) * 70ms + 160ms);
}

/* The pointer of the three powders. */
.index {
  position: absolute;
  right: var(--gutter);
  top: 71%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
  transform: translateY(-50%);
  transition:
    opacity 420ms var(--ease-camera),
    visibility 0s linear 0s,
    color 420ms var(--ease-camera);
}

.count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1;
  opacity: 0.82;
  transition: opacity 420ms var(--ease-camera);
}

.stage:not([data-act="0"]) .index {
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 420ms var(--ease-camera),
    visibility 0s linear 420ms;
}

.stage[data-state="1"] .count,
.stage[data-state="2"] .count,
.stage[data-state="3"] .count {
  opacity: 1;
}

.count-now {
  display: block;
  height: 1em;
  overflow: hidden;
}

.roll {
  display: flex;
  flex-direction: column;
  transform: translate3d(0, calc(var(--n, 0) * -1em), 0);
  transition: transform 700ms var(--ease-text);
}

.roll > span {
  display: block;
  height: 1em;
}

.ticks {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  list-style: none;
}

.ticks button {
  position: relative;
  display: block;
  width: 44px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

.ticks button::after {
  content: "";
  position: absolute;
  right: 0;
  top: 10px;
  width: 16px;
  height: 2px;
  background-color: currentColor;
  opacity: 0.45;
  transition:
    width 500ms var(--ease-text),
    opacity 300ms linear;
}

.ticks button:hover::after,
.ticks button:focus-visible::after {
  opacity: 0.8;
}

.ticks button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.stage[data-state="1"] .ticks li:nth-child(1) button::after,
.stage[data-state="2"] .ticks li:nth-child(2) button::after,
.stage[data-state="3"] .ticks li:nth-child(3) button::after {
  width: 40px;
  opacity: 1;
}

.hint {
  position: absolute;
  right: var(--gutter);
  bottom: calc(var(--gutter) + 4px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ui-dim);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  transition:
    opacity 420ms var(--ease-camera),
    color 420ms var(--ease-camera);
}

.hint i {
  display: block;
  width: 1px;
  height: 34px;
  background-color: currentColor;
}

.stage.is-moving .hint {
  opacity: 0;
}

/* ——— Act 2: the bowl in detail ——— */

.detail,
.final {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.leader path {
  fill: none;
  stroke: var(--ui);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 300ms var(--ease-camera);
}

.leader .dot {
  fill: var(--ui);
  opacity: 0;
  transition: opacity 200ms linear;
}

.leader .ring {
  fill: none;
  stroke: var(--ui);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 200ms linear;
}

.leader.is-on path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 700ms var(--ease-text) 140ms;
}

.leader.is-on .dot {
  opacity: 1;
  transition: opacity 240ms linear 520ms;
}

.leader.is-on .ring {
  opacity: 0.5;
  transition: opacity 240ms linear 620ms;
}

.callout {
  position: absolute;
  left: var(--gutter);
  width: min(27vw, 420px);
}

.callout[data-n="0"] {
  top: 60%;
}

.callout[data-n="1"] {
  left: auto;
  right: var(--gutter);
  top: 36%;
  text-align: right;
}

.callout[data-n="1"] .callout-word {
  margin-left: auto;
}

.callout[data-n="2"] {
  top: 17%;
}

.callout-word {
  width: -webkit-fit-content;
  width: fit-content;
  font-family: var(--face-display);
  font-size: clamp(30px, 3.4vw, 56px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.02;
}

/* ——— Act 4: the set together ——— */

.final-body {
  position: absolute;
  left: var(--gutter);
  bottom: calc(var(--gutter) + 8px);
  width: min(46vw, 700px);
}

.final-title {
  font-family: var(--face-display);
  font-size: clamp(2.75rem, 5.4vw, 5.75rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 0.98;
}

/* The button: a capsule with its arrow in a round — cream on the stone, ink inside. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  height: 56px;
  margin-top: clamp(24px, 4vh, 44px);
  padding: 6px 6px 6px 24px;
  border-radius: 999px;
  background-color: var(--ms-cream);
  color: var(--ms-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 240ms linear,
    transform 320ms var(--ease-camera),
    background-color 180ms linear;
}

.final.is-on .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    opacity 420ms linear 500ms,
    transform 700ms var(--ease-text) 500ms,
    background-color 180ms linear;
}

.pill:hover {
  background-color: #ffffff;
}

.pill:focus-visible {
  outline: 2px solid var(--ms-cream);
  outline-offset: 3px;
}

.pill-round {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--ms-ink);
  color: var(--ms-cream);
  transition: transform 180ms var(--ease-camera);
}

.pill-round svg,
.studio svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms var(--ease-camera);
}

.pill:hover .pill-round,
.pill:focus-visible .pill-round {
  transform: scale(1.06);
}

.pill:hover .pill-round svg,
.pill:focus-visible .pill-round svg {
  transform: rotate(45deg);
}

/*
 * ——— The footer: the card of the tea room, on the stone of its counter ———
 *
 * A quiet, lopsided card with a lot of air: the name small in the top left corner, the
 * three powders as a numbered list that steps down to the right like stones in a
 * garden, the line of the bar low on the left. The shade of the leaves from the room
 * lies across it too. Cream is the colour of the type only.
 */

.foot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: auto 1fr;
  column-gap: var(--gutter);
  min-height: max(66vh, 540px);
  padding: clamp(36px, 6vh, 64px) var(--gutter) clamp(92px, 13vh, 124px);
  overflow: hidden;
  isolation: isolate;
  background-color: #232c1e;
  /* Two soft bars of the lattice the light comes through; the light itself, from the upper
     left, and the shade away from it; under them the slate of the counter — the same
     photograph the room is built with (textures/stone.webp), laid once, so it has no seam. */
  background-image:
    linear-gradient(104deg, rgb(9 13 6 / 0) calc(31% - 18px), rgb(9 13 6 / 0.22) 31%, rgb(9 13 6 / 0) calc(31% + 18px)),
    linear-gradient(104deg, rgb(9 13 6 / 0) calc(66% - 18px), rgb(9 13 6 / 0.18) 66%, rgb(9 13 6 / 0) calc(66% + 18px)),
    radial-gradient(90% 130% at 14% -12%, rgb(44 56 37 / 0.42) 0%, rgb(27 35 23 / 0.6) 52%, rgb(18 24 15 / 0.78) 100%),
    url("textures/stone.webp");
  background-position: 0 0, 0 0, 0 0, center top;
  background-repeat: no-repeat;
  background-size: auto, auto, auto, max(100%, 960px) auto;
  color: var(--ms-cream);
}

/* A spray of leaves outside the paper screen: only its shade, swinging a little about where it
   grows from. It is softened inside the drawing (an SVG filter), not by a CSS filter here. */
.foot-spray {
  position: absolute;
  z-index: -1;
  overflow: visible;
  fill: #070b05;
  opacity: 0.52;
  pointer-events: none;
  animation: foot-sway 11s ease-in-out infinite alternate;
  will-change: transform;
}

.foot-spray .stem {
  fill: none;
  stroke: #070b05;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foot-spray[data-at="a"] {
  right: 7%;
  top: -28px;
  width: min(44vw, 600px);
  transform-origin: 78% 0;
}

.foot-spray[data-at="b"] {
  left: -36px;
  top: 30%;
  width: min(34vw, 460px);
  transform-origin: 0 24%;
  animation-duration: 14s;
  animation-delay: -5s;
}

.foot-spray[data-at="c"] {
  left: 36%;
  bottom: -64px;
  width: min(28vw, 380px);
  transform-origin: 94% 100%;
  animation-duration: 9s;
  animation-delay: -3s;
}

@keyframes foot-sway {
  from {
    transform: rotate(-1.6deg);
  }

  to {
    transform: rotate(2deg);
  }
}

/* The name, as on the label of a tin: small, in the bar's own face, in the top left corner. */
.foot-brand {
  grid-column: 1 / span 5;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  justify-self: start;
}

.foot-mark {
  grid-row: 1 / span 2;
  width: 40px;
  height: 40px;
  margin-top: -8px;
}

.foot-name {
  font-family: var(--face-display);
  font-size: clamp(1.5rem, 2vw, 1.875rem);
  font-weight: 400;
  line-height: 1;
}

.foot-kind {
  margin-top: 5px;
  color: rgb(244 241 232 / 0.84);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

/* The powders: a large figure, the name, one line of fact. Each row begins a step further right. */
.foot-list {
  grid-column: 5 / -1;
  grid-row: 2;
  align-self: end;
  margin-top: clamp(48px, 10vh, 104px);
  list-style: none;
}

.foot-list li {
  --n: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  column-gap: clamp(16px, 2.2vw, 32px);
  margin-left: calc(var(--n) * clamp(20px, 6.5vw, 104px));
  padding: 20px 0;
  border-bottom: 1px solid rgb(244 241 232 / 0.18);
}

.foot-list li:nth-child(2) {
  --n: 1;
}

.foot-list li:nth-child(3) {
  --n: 2;
}

.foot-num {
  color: var(--ms-matcha);
  font-family: var(--face-display);
  font-size: clamp(3.75rem, 8vw, 6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.8;
}

.foot-sort {
  padding-bottom: 0.15em;
}

.foot-sort b {
  display: flex;
  align-items: center;
  font-family: var(--face-display);
  font-size: clamp(1.375rem, 2vw, 1.875rem);
  font-weight: 400;
  letter-spacing: -0.005em;
  line-height: 1.1;
}

.foot-sort span,
.foot-note {
  color: rgb(244 241 232 / 0.82);
  font-size: 15px;
  line-height: 1.4;
}

.foot-sort span {
  display: block;
  margin-top: 6px;
}

.foot-note {
  grid-column: 1 / span 4;
  grid-row: 2;
  align-self: end;
  max-width: 24ch;
  padding-bottom: 20px;
}

/* The studio signs in its own colours, not the brand's: volt and ink, in the corner. */
.studio {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px var(--gutter) 18px 26px;
  border-top-left-radius: 28px;
  background-color: #d6fa50;
  color: #0a0a0a;
  font-family: var(--face-studio);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 180ms linear;
}

.studio:hover,
.studio:focus-visible {
  background-color: #b8dc2c;
}

.studio:focus-visible {
  outline: 2px solid var(--ms-cream);
  outline-offset: 3px;
}

.studio svg {
  width: 16px;
  height: 16px;
}

.studio:hover svg,
.studio:focus-visible svg {
  transform: rotate(45deg);
}

/* ——— A tall screen: the word in two halves, over the set and under it ——— */

@media (max-aspect-ratio: 4 / 5) {
  .scene {
    height: 700vh;
    height: 700svh;
  }

  /* The callouts share the foot of the screen; the newest one is shown. */
  .callout[data-n="0"],
  .callout[data-n="1"],
  .callout[data-n="2"] {
    left: var(--gutter);
    right: var(--gutter);
    top: auto;
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
    width: auto;
    text-align: left;
  }

  .callout-word,
  .callout[data-n="1"] .callout-word {
    margin-left: 0;
    font-size: 36px;
  }

  .final-body {
    bottom: calc(var(--gutter) + 10px + env(safe-area-inset-bottom, 0px));
    width: auto;
  }

  .final-title {
    font-size: clamp(2.75rem, 13vw, 3.75rem);
  }

  .pill {
    height: 52px;
    margin-top: 20px;
  }

  .pill-round {
    width: 40px;
    height: 40px;
  }

  /* The card on a phone: one column, the steps of the list shorter. */
  .foot {
    display: block;
    min-height: 0;
    padding-bottom: 104px;
  }

  .foot-list {
    margin-top: 64px;
  }

  .foot-list li {
    margin-left: calc(var(--n) * 22px);
  }

  .foot-num {
    font-size: 3.5rem;
  }

  .foot-note {
    max-width: none;
    margin-top: 28px;
    padding-bottom: 0;
  }

  .foot-spray[data-at="a"] {
    right: -8%;
    width: 78vw;
  }

  .foot-spray[data-at="b"] {
    top: 44%;
    width: 64vw;
  }

  .foot-spray[data-at="c"] {
    display: none;
  }

  .word {
    top: 10%;
    bottom: 21%;
    left: 5%;
    right: 5%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transform: none;
    font-size: var(--word-size, 21vw);
  }

  .word span:first-child {
    text-align: left;
  }

  .word span:last-child {
    text-align: right;
  }

  .brand > span {
    font-size: 20px;
  }

  .bar-note {
    display: none;
  }

  .captions {
    width: min(76vw, 320px);
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
  }

  .title {
    font-size: 34px;
  }

  .notes {
    margin-top: 10px;
    font-size: 14px;
  }

  .index {
    top: var(--gutter);
    transform: none;
    gap: 14px;
  }

  .count {
    height: 26px;
  }

  .ticks button {
    width: 44px;
    height: 20px;
  }

  .hint {
    bottom: calc(var(--gutter) + 6px + env(safe-area-inset-bottom, 0px));
  }

  .hint span {
    display: none;
  }
}

/*
 * ——— Reduced motion (or ?still): the acts become plain sections ———
 *
 * No pinned stage and no long scroll: the script draws one frame of each act
 * and sets it in a section of its own (.still) — the field, the picture of
 * the set, the words — one under another.
 */

.rm .scene {
  height: auto;
}

.rm .stage {
  position: relative;
}

.rm .stage[hidden] {
  display: none;
}

.still {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.still-shot {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.rm .hint,
.rm .index {
  display: none;
}

.rm .foot-spray {
  animation: none;
}

.rm #gl,
.rm [data-ui],
.rm .line > span,
.rm .roll,
.rm .leader path,
.rm .leader circle,
.rm .pill {
  transition: none !important;
}

.rm .line > span {
  transform: none;
}

.rm .caption:not(.is-on) {
  display: none;
}

.rm .leader path {
  stroke-dashoffset: 0;
}

.rm .leader .dot {
  opacity: 1;
}

.rm .leader .ring {
  opacity: 0.5;
}

.rm .pill {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

@media (max-aspect-ratio: 4 / 5) {
  /* On a phone the three callouts stand in a column at the foot, without their lines. */
  .rm .detail {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    padding: 0 var(--gutter) calc(var(--gutter) + 6px);
  }

  .rm .callout,
  .rm .callout[data-n="1"] {
    position: static;
  }

  .rm .callout-word {
    font-size: 28px;
  }

  .rm .callout-word .line {
    display: inline;
    overflow: visible;
  }

  .rm .callout-word .line > span {
    display: inline;
  }

  .rm .leaders {
    display: none;
  }
}

/* Before the script has run, or without it. */
@media (prefers-reduced-motion: reduce) {
  .scene {
    height: auto;
  }

  .stage {
    position: relative;
  }

  #gl,
  [data-ui],
  .line > span,
  .roll {
    transition: none;
  }

  .foot-spray {
    animation: none;
  }
}

/* ——— No WebGL: the field, the word and the words stay ——— */

.no-gl #gl {
  display: none;
}

/* ——— Checks ——— */

.hud {
  position: fixed;
  left: 8px;
  top: 64px;
  z-index: 20;
  margin: 0;
  padding: 8px 10px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.82);
  color: #b6ff7a;
  font: 11px/1.45 ui-monospace, Menlo, monospace;
  white-space: pre;
  pointer-events: none;
}

.labels {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  padding: 8px;
  overflow: auto;
  background: #222;
}

.labels canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
