/* Tilt. A dark lacquered tray on the night page: faint wells, raised blocks, sunk holes ringed in
   their ball's colour, and glassy balls in the site's gold, blue and pearl, each with its own mark
   (circle, triangle, square) so colour is never the only cue. The page tokens (--bg, --ink,
   --gold and friends) are set inline by the Function. Every size on the tray is in container
   units of the tray, so balls, holes and blocks scale together.
   One off-white filled button per screen at most, the rest outlined or plain, gold only as an
   accent, never a filled button. Transform and opacity only motion, none when asked for less. */

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.c-gold { --bc: #e8c169; --bl: #fff1c9; --bd: #9a7428; }
.c-blue { --bc: #8db6e8; --bl: #e3efff; --bd: #3f6597; }
.c-pearl { --bc: #ebe7dc; --bl: #ffffff; --bd: #9c978b; }

.tl { width: 100%; max-width: var(--gm-col, 600px); margin: 0 auto; padding: 0 16px 8px; }
html.gm-play .tl { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 16px; }
html.gm-play .tl-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---- the static introduction the script replaces ---- */
.tl-intro { padding: 18px 0 8px; }
.tl-intro-h { margin: 0 0 8px; font-family: var(--serif); font-weight: 400; font-size: 23px; line-height: 1.3; }
.tl-intro-p { margin: 0 0 12px; font-size: 16.5px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.tl-steps { margin: 10px 0 0; padding-left: 22px; }
.tl-steps li { margin: 0 0 6px; padding-left: 2px; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.tl-steps li::marker { color: var(--gold); font-family: var(--serif); }

/* ---- playing: the HUD, the tray filling what is left, the message, the arrows, the tools ---- */
.tl-play { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 0 max(10px, env(safe-area-inset-bottom)); overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.tl-hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 48px; padding: 0 2px 10px; }
.tl-count, .tl-par, .tl-ticks { margin: 0; }
.tl-count { font-size: 15px; color: var(--muted); white-space: nowrap; }
.tl-count b { font-family: var(--serif); font-size: 28px; font-weight: 400; line-height: 1; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; transition: color 300ms var(--ease); }
.tl-count.is-over b { color: var(--ink-2); }
.tl-par { justify-self: end; font-size: 15px; color: var(--muted); white-space: nowrap; }
.tl-par b { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--ink-2); font-variant-numeric: lining-nums; }
.tl-ticks { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.tl-ticks i { display: block; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.4px rgba(241, 239, 233, 0.28); }
.tl-ticks i.is-done { background: var(--gold); box-shadow: none; }
.tl-ticks i.is-now { box-shadow: inset 0 0 0 2px var(--ink); }
.tl-ticks-t { margin-left: 4px; }
.tl-ticks.is-level { font-size: 14.5px; color: var(--ink-2); }
.tl-skip { justify-self: end; min-height: 44px; padding: 0 14px; border: 1px solid rgba(241, 239, 233, 0.22); border-radius: 999px; background: none; font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }

/* The HUD and the tray are one group, centred in the space the controls leave, so there is no
   dead gap between the numbers and the tray on a tall phone. */
.tl-stage { position: relative; flex: 1 1 auto; min-height: 270px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 8px 0 0; container-type: size; }
.tl-group { flex: none; width: min(100cqw, calc(100cqh - 116px), var(--gm-board, 600px)); }
.tl-stage > .tl-msg { flex: 1 1 auto; width: 100%; }
.tl-tipper { position: relative; width: 100%; aspect-ratio: 1; perspective: 1100px; }

.tl-tray {
  --p: 3.4cqw;
  --g: 1.5cqw;
  --c: calc((100cqw - 2 * var(--p) - (var(--n) - 1) * var(--g)) / var(--n));
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(180deg, #18181c, #121215);
  border: 1px solid rgba(241, 239, 233, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 0 0 5px rgba(0, 0, 0, 0.18), 0 26px 50px -28px rgba(0, 0, 0, 0.95), 0 2px 6px rgba(0, 0, 0, 0.35);
  container-type: inline-size;
  overflow: hidden;
  transform: rotateX(0) rotateY(0);
  transition: transform 240ms cubic-bezier(0.25, 1, 0.5, 1), border-color 500ms var(--ease), box-shadow 500ms var(--ease);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.tl-tray:focus { outline: none; }
.tl-tray:focus-visible { outline: 1px solid rgba(241, 239, 233, 0.2); outline-offset: 6px; }
.tl-tipper.is-R .tl-tray { transform: rotateY(4deg); transition-duration: 120ms; }
.tl-tipper.is-L .tl-tray { transform: rotateY(-4deg); transition-duration: 120ms; }
.tl-tipper.is-U .tl-tray { transform: rotateX(4deg); transition-duration: 120ms; }
.tl-tipper.is-D .tl-tray { transform: rotateX(-4deg); transition-duration: 120ms; }

.tl-wells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: var(--g); padding: var(--p); }
.tl-wells i { border-radius: 22%; background: rgba(241, 239, 233, 0.028); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45); }
.tl-fixed, .tl-balls { position: absolute; inset: 0; pointer-events: none; }

.tl-block, .tl-hole, .tl-ball {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--c);
  height: var(--c);
  transform: translate(calc(var(--p) + var(--x, 0) * (var(--c) + var(--g))), calc(var(--p) + var(--y, 0) * (var(--c) + var(--g))));
}
.tl-block {
  border-radius: 22%;
  background: linear-gradient(155deg, #3c3c43, #2b2b31 55%, #222227);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), inset 0 -3px 0 rgba(0, 0, 0, 0.34), 0 2px 3px rgba(0, 0, 0, 0.5), 0 8px 14px -8px rgba(0, 0, 0, 0.8);
}

/* A hole: a dark pit ringed in its ball's colour, the ball's mark drawn in the pit. */
.tl-hole { display: flex; align-items: center; justify-content: center; }
.tl-hole::before { content: ""; position: absolute; inset: 15%; border-radius: 50%; background: radial-gradient(circle at 50% 38%, #040405 0%, #09090b 58%, #141417 100%); box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.9), 0 0 0 2px color-mix(in srgb, var(--bc) 66%, transparent), 0 1px 0 2px rgba(255, 255, 255, 0.04); transition: box-shadow 300ms var(--ease); }
.tl-hole-mark { position: relative; width: 32%; height: 32%; fill: none; stroke: var(--bc); stroke-width: 2.2; opacity: 0.9; transition: opacity 200ms var(--ease); }
.tl-hole.is-filled .tl-hole-mark { opacity: 0; }
.tl-hole.is-filled::before { box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--bc), 0 0 18px -4px color-mix(in srgb, var(--bc) 60%, transparent); }
.tl-hole::after { content: ""; position: absolute; inset: 15%; border-radius: 50%; box-shadow: 0 0 0 2px var(--gold), 0 0 16px 2px rgba(232, 193, 105, 0.5); opacity: 0; pointer-events: none; }

/* A ball: glassy, lit from the top left, its mark in dark ink. Rolls with weight: a slow start
   and an eased stop, the mark turning a quarter a cell. */
.tl-ball { z-index: 1; transition: transform var(--t, 0ms) cubic-bezier(0.36, 0, 0.16, 1); will-change: transform; }
.tl-sphere {
  position: absolute;
  inset: 9%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--bl) 0%, var(--bc) 42%, var(--bd) 100%);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.22), 0 3px 4px rgba(0, 0, 0, 0.45), 0 10px 16px -8px rgba(0, 0, 0, 0.7);
  transition: transform 260ms cubic-bezier(0.25, 1, 0.5, 1), filter 260ms ease;
}
.tl-sphere::before { content: ""; position: absolute; left: 22%; top: 14%; width: 30%; height: 20%; border-radius: 50%; background: rgba(255, 255, 255, 0.55); filter: blur(1.5px); transform: rotate(-24deg); }
.tl-ball-mark { position: relative; width: 46%; height: 46%; fill: rgba(16, 15, 18, 0.7); stroke: none; transition: transform 0ms cubic-bezier(0.36, 0, 0.16, 1); }
.tl-ball.is-home { z-index: 0; }
.tl-ball.is-home .tl-sphere { transform: scale(0.56); filter: brightness(0.82); box-shadow: inset 0 -2px 5px rgba(0, 0, 0, 0.45); }

.tl-arrow { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; pointer-events: none; color: var(--gold); }
.tl-arrow svg { width: 30cqw; height: 30cqw; transform: rotate(var(--turn, 0deg)); opacity: 0.9; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.85)); }

/* The all home moment: a gold edge, each hole rings in turn, a shine crosses the tray. */
.tl-tray.is-done { border-color: rgba(232, 193, 105, 0.5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 0 0 5px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(232, 193, 105, 0.18), 0 26px 60px -24px rgba(232, 193, 105, 0.28); }
.tl-shine { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 236, 190, 0.16) 46%, rgba(255, 236, 190, 0.05) 54%, transparent 70%); transform: translateX(-100%); }

.tl-tray.is-nudge-L { animation: tl-nudge-x 180ms ease-out; --nx: -3px; }
.tl-tray.is-nudge-R { animation: tl-nudge-x 180ms ease-out; --nx: 3px; }
.tl-tray.is-nudge-U { animation: tl-nudge-y 180ms ease-out; --nx: -3px; }
.tl-tray.is-nudge-D { animation: tl-nudge-y 180ms ease-out; --nx: 3px; }
@keyframes tl-nudge-x { 40% { transform: translateX(var(--nx)); } }
@keyframes tl-nudge-y { 40% { transform: translateY(var(--nx)); } }

@media (prefers-reduced-motion: no-preference) {
  .tl-ball.is-sink .tl-sphere { animation: tl-sink 320ms cubic-bezier(0.25, 1, 0.5, 1) both; }
  .tl-hole.is-filled::after { animation: tl-ring 640ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  .tl-hole.is-cheer::after { animation: tl-ring 820ms cubic-bezier(0.2, 0.7, 0.3, 1) var(--d, 0ms) both; }
  .tl-tray.is-done .tl-shine { animation: tl-shine 900ms cubic-bezier(0.25, 1, 0.5, 1) 120ms both; }
  .tl-ball.is-thud-x .tl-sphere { animation: tl-thud-x 200ms ease-out; }
  .tl-ball.is-thud-y .tl-sphere { animation: tl-thud-y 200ms ease-out; }
  .tl-arrow.is-on svg { animation: tl-arrow 1.5s cubic-bezier(0.3, 0.7, 0.4, 1) infinite; }
  .tl-tray.is-arrive { animation: tl-arrive 480ms cubic-bezier(0.25, 1, 0.5, 1) both; }
}
@keyframes tl-sink { 0% { transform: scale(1); filter: brightness(1); } 60% { transform: scale(0.46); filter: brightness(0.7); } 100% { transform: scale(0.56); filter: brightness(0.82); } }
@keyframes tl-ring { 0% { transform: scale(1); opacity: 0.95; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes tl-shine { 0% { opacity: 1; transform: translateX(-100%); } 100% { opacity: 1; transform: translateX(100%); } }
@keyframes tl-thud-x { 35% { transform: scale(0.88, 1.08); } }
@keyframes tl-thud-y { 35% { transform: scale(1.08, 0.88); } }
@keyframes tl-arrow { 0% { opacity: 0; transform: rotate(var(--turn, 0deg)) translateY(12%); } 30% { opacity: 0.95; } 75% { opacity: 0.95; transform: rotate(var(--turn, 0deg)) translateY(-10%); } 100% { opacity: 0; transform: rotate(var(--turn, 0deg)) translateY(-14%); } }
@keyframes tl-arrive { from { opacity: 0; transform: translateX(18px) scale(0.98); } }

/* The message line: one plain sentence, or the way home as a row of small arrows. */
.tl-msg { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 52px; margin: 0; padding: 2px 4px; font-size: 16px; line-height: 1.4; color: var(--ink-2); text-align: center; text-wrap: balance; }
.tl-msg.is-quiet { color: var(--muted); }
.tl-path { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.tl-path i { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); box-shadow: inset 0 0 0 1px rgba(241, 239, 233, 0.16); }
.tl-path i.is-next { color: var(--bg); background: var(--gold); box-shadow: none; }
.tl-path b { align-self: center; font-size: 13px; color: var(--muted); font-weight: 600; }

/* The four arrows: big round targets with a pressed edge. A row on wide screens, a cross on tall phones. */
.tl-pad { flex: none; display: flex; justify-content: center; gap: 14px; padding: 6px 0 2px; }
.tl-dir.is-L { order: 1; } .tl-dir.is-U { order: 2; } .tl-dir.is-D { order: 3; } .tl-dir.is-R { order: 4; }
.tl-dir {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(241, 239, 233, 0.2);
  background: linear-gradient(180deg, rgba(241, 239, 233, 0.07), rgba(241, 239, 233, 0.025));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease), transform 80ms ease-out, box-shadow 80ms ease-out, color 160ms var(--ease);
  touch-action: manipulation;
}
.tl-dir:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06); background: rgba(241, 239, 233, 0.1); }
.tl-dir[disabled] { opacity: 0.35; cursor: default; }
.tl-dir.is-glow { border-color: var(--gold); color: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .tl-dir.is-glow { animation: tl-pulse 1.4s ease-in-out infinite; }
}
@keyframes tl-pulse { 50% { box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55), 0 0 0 5px rgba(232, 193, 105, 0.16); } }

@media (max-aspect-ratio: 3/5) {
  .tl-pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-rows: repeat(3, 56px); grid-template-areas: ". u ." "l . r" ". d ."; gap: 2px 12px; justify-content: center; padding: 4px 0 0; }
  .tl-dir { width: 64px; height: 56px; border-radius: 18px; }
  .tl-dir.is-U { grid-area: u; } .tl-dir.is-L { grid-area: l; } .tl-dir.is-R { grid-area: r; } .tl-dir.is-D { grid-area: d; }
}
@media (max-aspect-ratio: 3/5) and (min-height: 820px) {
  .tl-pad { grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 62px); gap: 4px 14px; }
  .tl-dir { width: 72px; height: 62px; }
}

@media (hover: hover) {
  .tl-dir:hover:not([disabled]) { border-color: rgba(241, 239, 233, 0.45); }
  .tl-tool:hover:not([disabled]) { color: var(--ink); background: rgba(241, 239, 233, 0.05); }
  .tl-skip:hover { border-color: rgba(241, 239, 233, 0.45); color: var(--ink); }
}

/* The tools: undo, start over, hint, show me. */
.tl-tools { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 8px 0 0; }
.tl-tool { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 4px 2px; border: 0; border-radius: 14px; background: none; color: var(--ink-2); font-size: 13.5px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: color 160ms var(--ease), background-color 160ms var(--ease), transform 80ms ease-out; touch-action: manipulation; }
.tl-tool span { white-space: nowrap; }
.tl-tool:active:not([disabled]) { background: rgba(241, 239, 233, 0.08); transform: translateY(1px); }
.tl-tool[disabled] { opacity: 0.32; cursor: default; background: none; }
.tl-tool.is-glow { color: var(--gold); }
.tl-tool::after { content: ""; position: absolute; inset: 2px 6px; border-radius: 14px; box-shadow: 0 0 0 1.5px var(--gold); opacity: 0; pointer-events: none; }
.tl-tool.is-glow::after { opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .tl-tool.is-glow::after { animation: tl-glow 1.4s ease-in-out infinite; }
}
@keyframes tl-glow { 0%, 100% { opacity: 0.35; transform: scale(0.96); } 50% { opacity: 0.95; transform: scale(1); } }

/* Keyboard hints: desktop only. */
.tl-keys { display: none; flex: none; margin: 8px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.tl-keys kbd { display: inline-block; min-width: 22px; padding: 1px 7px; margin: 0 2px 0 10px; border-radius: 6px; border: 1px solid rgba(241, 239, 233, 0.18); border-bottom-width: 2px; font: 600 12.5px var(--sans); color: var(--ink-2); }
.tl-keys kbd:first-child { margin-left: 0; }
@media (hover: hover) and (pointer: fine) { .tl-keys { display: block; } }

/* The tour's hand, and the card when it is done. */
.tl-hand { position: absolute; z-index: 5; width: 64px; height: 64px; color: rgba(241, 239, 233, 0.92); pointer-events: none; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8)); }
.tl-hand.is-tour { left: calc(50% - 22px); top: calc(50% - 10px); --hx: 0; --hy: 0; }
.tl-hand.is-R { --hx: 1; } .tl-hand.is-L { --hx: -1; } .tl-hand.is-D { --hy: 1; } .tl-hand.is-U { --hy: -1; }
@media (prefers-reduced-motion: no-preference) {
  .tl-hand.is-tour { animation: tl-hand 2s cubic-bezier(0.45, 0, 0.2, 1) infinite; }
}
@keyframes tl-hand {
  0% { opacity: 0; transform: translate(calc(-70px * var(--hx)), calc(-70px * var(--hy))); }
  15% { opacity: 0.95; transform: translate(calc(-70px * var(--hx)), calc(-70px * var(--hy))); }
  60% { opacity: 0.95; transform: translate(calc(70px * var(--hx)), calc(70px * var(--hy))); }
  78%, 100% { opacity: 0; transform: translate(calc(70px * var(--hx)), calc(70px * var(--hy))); }
}
.tl-veil { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; border-radius: 20px; background: rgba(12, 12, 14, 0.86); text-align: center; }
.tl-veil-t { margin: 0; font-family: var(--serif); font-size: 26px; line-height: 1.25; color: var(--ink); }
.tl-veil-s { margin: 0 0 10px; font-size: 16px; line-height: 1.45; color: var(--ink-2); max-width: 22em; }
.tl-go { min-width: 220px; }
@media (prefers-reduced-motion: no-preference) { .tl-veil { animation: tl-fade 300ms ease-out both; } }
@keyframes tl-fade { from { opacity: 0; } }

/* ---- the finished day ---- */
.tl-res-head { display: flex; align-items: center; gap: 18px; }
.tl-emblem { flex: none; display: inline-flex; flex-direction: column; gap: 6px; padding: 9px; border-radius: 999px; background: linear-gradient(180deg, #18181c, #111114); border: 1px solid rgba(232, 193, 105, 0.35); box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 18px 36px -22px rgba(232, 193, 105, 0.35); }
.tl-emb { position: relative; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, var(--bl) 0%, var(--bc) 42%, var(--bd) 100%); box-shadow: 0 0 0 2px #09090b, 0 0 0 3.5px color-mix(in srgb, var(--bc) 70%, transparent), inset 0 -2px 4px rgba(0, 0, 0, 0.25); }
.tl-emblem:has(.tl-emb:only-child) { padding: 12px; }
.tl-emblem:has(.tl-emb:only-child) .tl-emb { width: 44px; height: 44px; }

.tl-marks { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 0; }
.tl-marks i { display: block; width: 22px; height: 22px; border-radius: 6px; }
.tl-marks .m-g, .tl-key .m-g { background: var(--green); }
.tl-marks .m-y, .tl-key .m-y { background: var(--gold); }
.tl-marks .m-w, .tl-key .m-w { box-shadow: inset 0 0 0 1.5px rgba(241, 239, 233, 0.45); }
.tl-marks.is-small { gap: 4px; margin: 0; }
.tl-marks.is-small i { width: 13px; height: 13px; border-radius: 3.5px; }
.tl-key { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 7px; margin: 10px 0 0; font-size: 13.5px; color: var(--muted); }
.tl-key i { display: block; width: 10px; height: 10px; border-radius: 3px; }
.tl-key i:not(:first-child) { margin-left: 12px; }

.tl-trays { list-style: none; margin: 22px 0 0; padding: 0; }
.tl-trays li { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px; min-height: 42px; }
.tl-trays li + li { border-top: 1px solid rgba(241, 239, 233, 0.06); }
.tl-trays-n { font-size: 14.5px; color: var(--muted); }
.tl-trays-r { font-size: 14.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-trays li.is-par .tl-trays-r { color: var(--gold); }

.tl-tries { list-style: none; margin: 18px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); }
.tl-tries li { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; min-height: 40px; }
.tl-tries li + li { border-top: 1px solid rgba(241, 239, 233, 0.05); }
.tl-tries-n { font-size: 14px; color: var(--muted); }
.tl-tries-r { font-size: 14.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-tries li.is-best .tl-tries-r { color: var(--gold); font-weight: 600; }

.tl-note { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-line; }
.tl-note:empty { display: none; }
.tl-more-link { margin: 10px 0 0; }
.tl-figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tl-fine { margin: 12px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

/* ---- how to play: three steps, each a tiny tray of the real pieces ---- */
.tl-how { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.tl-how li { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 16px; }
.tl-how li p { margin: 0; font-size: 16.5px; line-height: 1.45; color: var(--ink); }
.tl-howdemo { position: relative; width: 112px; aspect-ratio: 1; container-type: inline-size; }
/* In the kit's How to play box (184px tall): the same tiny tray, a little larger. */
.kt-demo .tl-howdemo { width: 160px; }
.kt-demo .tl-howdemo .tl-hand { width: 48px; height: 48px; }
/* The trays and tries under the kit's result. */
.tl-extra { margin: 26px 0 0; }
.tl-extra .tl-trays { margin-top: 0; }
.tl-howtip { width: 100%; height: 100%; perspective: 600px; }
.tl-tray.is-mini { border-radius: 14px; --p: 5cqw; --g: 2.4cqw; }
.tl-howdemo .tl-hand { width: 40px; height: 40px; left: 18%; top: 46%; opacity: 0; }
.tl-fold { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 4px; }
.tl-fold summary { min-height: 44px; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.tl-fold .tl-fine:first-of-type { margin-top: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .tl-howdemo .tl-hand { animation: tl-demo-hand 3.8s ease-in-out infinite; }
  .tl-howdemo .tl-howtip .tl-tray { animation: tl-demo-lean 3.8s ease-in-out infinite; }
  .tl-howdemo.d1 .tl-ball:nth-child(1) .tl-sphere { animation: tl-demo-3 3.8s cubic-bezier(0.36, 0, 0.16, 1) infinite; }
  .tl-howdemo.d2 .tl-ball:nth-child(1) .tl-sphere { animation: tl-demo-1 3.8s cubic-bezier(0.36, 0, 0.16, 1) infinite; }
  .tl-howdemo.d2 .tl-ball:nth-child(2) .tl-sphere { animation: tl-demo-1 3.8s cubic-bezier(0.36, 0, 0.16, 1) 60ms infinite; }
  .tl-howdemo.d3 .tl-ball:nth-child(1) .tl-sphere { animation: tl-demo-sink 3.8s cubic-bezier(0.36, 0, 0.16, 1) infinite; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-howdemo .tl-hand { display: none; }
  .tl-howdemo.d1 .tl-ball:nth-child(1) .tl-sphere { transform: translateX(calc(3 * (var(--c) + var(--g)))); }
  .tl-howdemo.d2 .tl-ball .tl-sphere { transform: translateX(calc(var(--c) + var(--g))); }
  .tl-howdemo.d3 .tl-ball:nth-child(1) .tl-sphere { transform: translateX(calc(3 * (var(--c) + var(--g)))) scale(0.56); }
}
@keyframes tl-demo-hand { 0%, 6% { opacity: 0; transform: translateX(0); } 12% { opacity: 0.95; transform: translateX(0); } 30% { opacity: 0.95; transform: translateX(40cqw); } 38%, 100% { opacity: 0; transform: translateX(40cqw); } }
@keyframes tl-demo-lean { 0%, 28% { transform: rotateY(0); } 33% { transform: rotateY(6deg); } 46%, 100% { transform: rotateY(0); } }
@keyframes tl-demo-3 { 0%, 30% { transform: translateX(0); opacity: 1; } 48%, 84% { transform: translateX(calc(3 * (var(--c) + var(--g)))); opacity: 1; } 92% { transform: translateX(calc(3 * (var(--c) + var(--g)))); opacity: 0; } 94% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes tl-demo-1 { 0%, 30% { transform: translateX(0); opacity: 1; } 40%, 84% { transform: translateX(calc(var(--c) + var(--g))); opacity: 1; } 92% { transform: translateX(calc(var(--c) + var(--g))); opacity: 0; } 94% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes tl-demo-sink { 0%, 30% { transform: translateX(0); opacity: 1; } 48% { transform: translateX(calc(3 * (var(--c) + var(--g)))) scale(1); opacity: 1; } 56% { transform: translateX(calc(3 * (var(--c) + var(--g)))) scale(0.46); } 60%, 84% { transform: translateX(calc(3 * (var(--c) + var(--g)))) scale(0.56); opacity: 1; } 92% { transform: translateX(calc(3 * (var(--c) + var(--g)))) scale(0.56); opacity: 0; } 94% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }

/* ---- the page under the game ---- */
.tl-about { margin: 44px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.tl-about h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.tl-about p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; color: var(--muted); max-width: 60ch; }

@media (max-height: 700px) {
  .tl-hud { min-height: 42px; padding-bottom: 6px; }
  .tl-dir { width: 54px; height: 54px; }
  .tl-tool { min-height: 48px; }
  .tl-msg { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* A phone on its side (844 by 390): the tray and its numbers take the left half at full height,
   the arrows and the tools stack in the right half (they fell off the bottom before). */
@media (orientation: landscape) and (max-height: 500px) {
  .tl { max-width: 800px; }
  .tl-play { flex-flow: column wrap; justify-content: center; align-content: center; column-gap: 28px; }
  .tl-play > .tl-stage { order: -1; flex: 0 0 100%; min-height: 0; width: calc(50% - 14px); padding-top: 4px; }
  .tl-play > :not(.tl-stage, .sr) { width: calc(50% - 14px); }
  .tl-group { width: min(100cqw, calc(100cqh - 96px), var(--gm-board, 600px)); }
  .tl-hud { min-height: 40px; padding-bottom: 4px; }
  .tl-stage > .tl-msg { min-height: 48px; }
  .tl-tools { padding-top: 10px; }
}
/* The smallest phones: "Skip the tour" keeps inside the screen. */
@media (max-width: 420px) {
  .tl-play.is-tour .tl-hud { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .tl-play.is-tour .tl-ticks { justify-content: center; min-width: 0; overflow: hidden; }
}
@media (max-width: 340px) {
  .tl-skip { padding: 0 11px; font-size: 14px; }
}
