/* Gilt. Brass and paper on the night page: a lifted panel, faint wells, tiles that warm from cool
   paper through sand to gold and end dark with a gold numeral and a ring. The page tokens
   (--bg, --ink, --gold and friends) are set inline by the Function; the tile colours come from
   rules.js (TILE_RAMP, tested for contrast) as .t-1 to .t-11 { --tb, --tf }.
   One off-white filled button per screen at most, the rest outlined or plain text, gold only as
   an accent, never a filled button. Transform only motion, none when the reader asks 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; }

.gl-band { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--panel); font-size: 15px; line-height: 1.45; color: var(--ink-2); text-align: center; }
.gl-band-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }

.gl { width: 100%; max-width: 552px; margin: 0 auto; padding: 0 16px 8px; }
html.gm-play .gl { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 16px; }
html.gm-play .gl-app { flex: 1; min-height: 0; display: flex; flex-direction: column; }

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

/* ---- playing: the counters under the bar, the board as large as the space, a swipe anywhere ---- */
.gl-play { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 0 max(12px, env(safe-area-inset-bottom)); touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.gl-status { flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 2px 0; }
.gl-movesbox { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.gl-meter { display: block; width: 132px; height: 4px; border-radius: 2px; background: rgba(241, 239, 233, 0.1); overflow: hidden; }
.gl-meter i { display: block; height: 100%; border-radius: 2px; background: var(--ink-2); transform-origin: 0 50%; transition: transform 260ms cubic-bezier(0.25, 1, 0.5, 1), background-color 200ms var(--ease); }
.gl-meter.is-low i { background: var(--gold); }
.gl-diff { margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-align: right; }
.gl-moves { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; transition: color 200ms var(--ease); }
.gl-moves.is-low { color: var(--gold); }
.gl-score { margin: 0; font-size: 14.5px; color: var(--muted); }
.gl-score b { margin-left: 6px; font-family: var(--serif); font-size: 24px; font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.gl-score b { display: inline-block; }

/* A replay (run 2 or 3): the run and the best to beat, quiet under the counters. */
.gl-runbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 0; }
.gl-runtag { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.gl-target { margin: 0; font-size: 14px; line-height: 1.4; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; transition: color 260ms var(--ease); }
.gl-target.is-gold { color: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .gl-score b.is-shine {
    background: linear-gradient(105deg, var(--ink) 0%, var(--ink) 38%, var(--gold) 50%, var(--ink) 62%, var(--ink) 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gl-shine 440ms ease-out both;
  }
}
@keyframes gl-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* The run marks: gold ring for the best run, ink for the others played, an outline for each left. */
.gl-marks { flex: none; display: inline-flex; align-items: center; gap: 7px; }
.gl-marks i { display: block; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1.25px rgba(241, 239, 233, 0.3); }
.gl-marks i.is-done { background: var(--ink-2); box-shadow: none; }
.gl-marks i.is-best { background: var(--gold); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.25px rgba(232, 193, 105, 0.7); }
.gl-marks i.is-now { box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.gl-marks.is-small { gap: 8px; }
.gl-marks.is-small i { width: 8px; height: 8px; }
.gl-marks.is-small i.is-best { box-shadow: 0 0 0 1.5px var(--bg), 0 0 0 2.5px rgba(232, 193, 105, 0.7); }
.gl-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px 0; container-type: size; }
/* measured: the stage holds just the board, and the whole stack sits centred on the screen */
.gl-stage.is-fit { flex: 0 0 auto; height: calc(var(--fit) + 24px); }
html.gm-play .gl-play { justify-content: center; }
/* the climb: a chip per level, lit to the highest tile, the next one dashed */
.gl-climb { flex: none; display: flex; justify-content: center; gap: 6px; padding: 14px 0 0; }
.gl-climb .gl-chip { flex: 0 1 30px; width: auto; min-width: 0; height: auto; aspect-ratio: 1; font-size: 14.5px; }
.gl-chip.is-next { background: none; box-shadow: none; outline: 1.5px dashed rgba(241, 239, 233, 0.38); outline-offset: -1.5px; color: var(--ink-2); }
.gl-chip.is-off { background: rgba(241, 239, 233, 0.045); color: rgba(241, 239, 233, 0.3); }
.gl-climb .gl-chip.is-goal { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.25px var(--gold); }
@media (prefers-reduced-motion: no-preference) { .gl-chip.is-new { animation: gl-pop 320ms cubic-bezier(0.25, 1, 0.5, 1) both, gl-glow 700ms ease-out both; } }
.gl-veil .gm-primary { min-width: min(240px, 80%); }
/* Under the board: the line (controls, a challenge, or "Stuck? A hint is ready.") and Hint. */
.gl-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 2px 2px 0; }
.gl-hint { flex: 1; min-width: 0; margin: 0; font-size: 15px; line-height: 1.4; color: var(--muted); text-wrap: balance; transition: color 200ms var(--ease); }
.gl-hint.is-ready { color: var(--ink); }
.gl-challenge { color: var(--ink-2); }
.gl-k-desk { display: none; }
@media (hover: hover) and (pointer: fine) { .gl-k-desk { display: inline; } .gl-k-touch { display: none; } p.gl-k-desk { display: block; } }
.gl-hintbtn { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px 0 14px; border-radius: 999px; border: 1px solid rgba(241, 239, 233, 0.26); background: #151518; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35); color: var(--ink); font-size: 15.5px; font-weight: 600; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), transform 80ms ease-out; }
.gl-hintbtn:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35); }
.gl-hint-ic { display: inline-flex; color: var(--muted); transition: color 200ms var(--ease); }
.gl-hintbtn.is-ready { border-color: rgba(232, 193, 105, 0.85); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(232, 193, 105, 0.12); }
.gl-hintbtn.is-ready .gl-hint-ic { color: var(--gold); }
@media (hover: hover) { .gl-hintbtn:hover { border-color: rgba(241, 239, 233, 0.5); } }
@media (prefers-reduced-motion: no-preference) { .gl-hintbtn.is-ready { animation: gl-ready 1.8s ease-in-out infinite; } }
@keyframes gl-ready { 50% { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 0 0 7px rgba(232, 193, 105, 0.06); } }

/* The board: a lifted panel, sized to fit a phone screen with the counters above it. Every size
   inside is in container units of the board, so tiles, wells and numerals scale together. */
.gl-board {
  position: relative;
  width: min(100cqw, 100cqh, 560px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(241, 239, 233, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 24px 48px -28px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.35);
  container-type: inline-size;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 4px;
}
.gl-board:focus-visible { outline: 1.5px solid rgba(232, 193, 105, 0.6); outline-offset: 5px; border-radius: 18px; }
/* on a phone the board takes focus for the keys it never gets; no ring there */
@media (hover: none) { .gl-board:focus-visible { outline: none; } }
.gl-board { --n: 4; }
.gl-wells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: 3cqw; padding: 3cqw; }
.gl-wells i { border-radius: 12px; background: rgba(241, 239, 233, 0.032); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(241, 239, 233, 0.025); }
.gl-tiles { position: absolute; inset: 0; }
/* The size of one tile: the board less its gaps and edges, shared out. */
.gl-tile {
  --sz: calc((100cqw - 3cqw * (var(--n) + 1)) / var(--n));
  position: absolute;
  left: 0;
  top: 0;
  width: var(--sz);
  height: var(--sz);
  transform: translate(calc(3cqw + var(--x, 0) * (var(--sz) + 3cqw)), calc(3cqw + var(--y, 0) * (var(--sz) + 3cqw)));
  /* a slide with weight: quick away, easing into the wall (ease out quart) */
  transition: transform 120ms cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}
.gl-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 58%), var(--tb);
  color: var(--tf);
  font-family: var(--serif);
  font-weight: 500;
  font-size: calc(var(--sz) * 0.5);
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  /* depth: a lit top edge and a darker 3px bottom edge, so a tile reads as a piece */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 0 rgba(60, 40, 10, 0.22), 0 1px 1.5px rgba(0, 0, 0, 0.4), 0 6px 12px -8px rgba(0, 0, 0, 0.6);
}
.gl-face { position: relative; }
.gl-face.t-8, .gl-face.t-9 { background: linear-gradient(180deg, rgba(255, 236, 190, 0.14), rgba(255, 236, 190, 0) 60%), var(--tb); box-shadow: inset 0 1px 0 rgba(255, 236, 190, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.28), 0 1px 1.5px rgba(0, 0, 0, 0.5), 0 6px 12px -8px rgba(0, 0, 0, 0.7); }
.gl-face.is-ring { background: linear-gradient(180deg, rgba(232, 193, 105, 0.08), rgba(232, 193, 105, 0) 60%), var(--tb); font-size: calc(var(--sz) * 0.42); box-shadow: inset 0 0 0 1px rgba(232, 193, 105, 0.55), inset 0 1px 0 rgba(232, 193, 105, 0.18), 0 1px 1.5px rgba(0, 0, 0, 0.5); }
.gl-face.t-11.is-ring { box-shadow: inset 0 0 0 1.5px var(--gold), 0 0 0 1px rgba(232, 193, 105, 0.12), 0 0 22px -8px rgba(232, 193, 105, 0.55); }
/* A join pops and glows; a new highest tile also sends out a gold ring; a new tile fades up. */
.gl-face.is-pop { animation: gl-pop 220ms cubic-bezier(0.25, 1, 0.5, 1) both, gl-glow 520ms ease-out both; }
.gl-face.is-new { animation: gl-new 170ms cubic-bezier(0.25, 1, 0.5, 1) both; }
@keyframes gl-pop { 0% { transform: scale(0.72); } 55% { transform: scale(1.09); } 100% { transform: scale(1); } }
@keyframes gl-glow { 0% { filter: brightness(1.35); } 100% { filter: brightness(1); } }
@keyframes gl-new { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.gl-face.is-up::after { content: ""; position: absolute; inset: -2px; border-radius: 14px; box-shadow: 0 0 0 2px var(--gold), 0 0 22px 2px rgba(232, 193, 105, 0.55); opacity: 0; pointer-events: none; animation: gl-up 900ms cubic-bezier(0.25, 1, 0.5, 1) 60ms both; }
@keyframes gl-up { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }
/* The hint: the tiles that would join breathe a gold outline, an arrow sits on the edge to swipe toward. */
.gl-face.is-hint { box-shadow: 0 0 0 2.5px var(--gold), 0 0 18px -2px rgba(232, 193, 105, 0.6), inset 0 -3px 0 rgba(60, 40, 10, 0.22); }
@media (prefers-reduced-motion: no-preference) { .gl-face.is-hint { animation: gl-breathe 1.2s ease-in-out infinite; } }
@keyframes gl-breathe { 50% { box-shadow: 0 0 0 2.5px rgba(232, 193, 105, 0.45), 0 0 8px -2px rgba(232, 193, 105, 0.3), inset 0 -3px 0 rgba(60, 40, 10, 0.22); } }
.gl-arrow { position: absolute; z-index: 1; width: 13cqw; height: 13cqw; pointer-events: none; }
.gl-arrow span { position: relative; display: block; width: 100%; height: 100%; border-radius: 50%; background: rgba(12, 12, 14, 0.85); box-shadow: 0 0 0 2px var(--gold), 0 8px 18px -6px rgba(0, 0, 0, 0.8); }
.gl-arrow span::before { content: ""; position: absolute; inset: 0; margin: auto; width: 30%; height: 30%; border: solid var(--gold); border-width: 0 0 2.5px 2.5px; transform: translateX(15%) rotate(45deg); }
.gl-arrow[data-dir="L"] { left: -4cqw; top: calc(50% - 6.5cqw); }
.gl-arrow[data-dir="R"] { right: -4cqw; top: calc(50% - 6.5cqw); transform: rotate(180deg); }
.gl-arrow[data-dir="U"] { top: -4cqw; left: calc(50% - 6.5cqw); transform: rotate(90deg); }
.gl-arrow[data-dir="D"] { bottom: -4cqw; left: calc(50% - 6.5cqw); transform: rotate(-90deg); }
@media (prefers-reduced-motion: no-preference) { .gl-arrow span { animation: gl-point 1s ease-in-out infinite; } }
@keyframes gl-point { 50% { transform: translateX(-1.6cqw); } }
.gl-board.is-nudge-L { animation: gl-nudge-x 180ms ease-out; --n: -3px; }
.gl-board.is-nudge-R { animation: gl-nudge-x 180ms ease-out; --n: 3px; }
.gl-board.is-nudge-U { animation: gl-nudge-y 180ms ease-out; --n: -3px; }
.gl-board.is-nudge-D { animation: gl-nudge-y 180ms ease-out; --n: 3px; }
@keyframes gl-nudge-x { 40% { transform: translateX(var(--n)); } }
@keyframes gl-nudge-y { 40% { transform: translateY(var(--n)); } }

.gl-veil { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; border-radius: 17px; background: rgba(12, 12, 14, 0.86); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); text-align: center; animation: gl-fade 260ms ease-out both; }
.gl-veil p { max-width: 15em; margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.35; color: var(--ink); text-wrap: balance; }
@keyframes gl-fade { from { opacity: 0; } }

/* practice */
.gl-practice-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px 0; }
.gl-practice-tag { flex: none; display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; margin: 0; padding: 6px 14px; border: 1px dashed rgba(241, 239, 233, 0.28); border-radius: 999px; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }
.gl-goal { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; color: var(--ink-2); }
.gl-goal .gl-chip { width: 32px; height: 32px; font-size: 17px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.25px rgba(232, 193, 105, 0.7); }
.gl-fine-inline { font-size: 14px; color: var(--muted); }
.gl-veil p.gl-veil-k { font-size: 26px; }
.gl-veil p.gl-veil-s { font-family: var(--sans); font-size: 15.5px; color: var(--ink-2); }
.gl-veil.is-win { box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.55); }
.gl-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.gl-under { flex: none; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 20px; margin: 0; padding: 0 2px; }

.gl-small { min-height: 42px; padding: 0 20px; font-size: 15px; }
.gl-small[disabled] { opacity: 0.4; cursor: default; }
.gl-text { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; font-size: 15px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(241, 239, 233, 0.25); text-underline-offset: 4px; }
.gl-text:hover { color: var(--ink); }

/* ---- the finished day ---- */
.gl-res-head { display: flex; align-items: center; gap: 18px; }
.gl-medal { flex: none; display: flex; align-items: center; justify-content: center; width: 84px; height: 84px; border-radius: 20px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 58%), var(--tb); color: var(--tf); font-family: var(--serif); font-weight: 500; font-size: 42px; line-height: 1; font-variant-numeric: lining-nums; box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--gold), inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 22px 44px -22px rgba(232, 193, 105, 0.4); }
.gl-medal.is-ring { background: linear-gradient(180deg, rgba(232, 193, 105, 0.08), rgba(232, 193, 105, 0) 60%), var(--tb); font-size: 36px; }
.gl-medal { position: relative; }
.gl-medal::after { content: ""; position: absolute; inset: -4.5px; border-radius: 24px; border: 1.5px solid var(--gold); opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .gl-medal.is-newbest::after { animation: gl-ring 950ms cubic-bezier(0.2, 0.7, 0.3, 1) 260ms both; }
}
@keyframes gl-ring { 0% { transform: scale(1); opacity: 0.95; } 100% { transform: scale(1.28); opacity: 0; } }
.gl-newbest { margin: 0 0 2px; font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--gold); }

/* The runs: marks and their line, then the ladder of runs with the best gilded. */
.gl-runs { margin: 22px 0 0; }
.gl-marks-row { display: flex; align-items: flex-start; gap: 14px; }
.gl-marks-row .gl-marks { padding-top: 5px; }
.gl-runs-cap { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.gl-ladder { list-style: none; margin: 14px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); }
.gl-ladder li { display: grid; grid-template-columns: 52px 28px 1fr auto; align-items: center; gap: 10px; min-height: 42px; }
.gl-ladder li + li { border-top: 1px solid rgba(241, 239, 233, 0.05); }
.gl-ladder-n { font-size: 14.5px; color: var(--muted); }
.gl-chip { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 58%), var(--tb); color: var(--tf); font-family: var(--serif); font-weight: 500; font-size: 15px; line-height: 1; font-variant-numeric: lining-nums; }
.gl-chip.is-ring { box-shadow: inset 0 0 0 1px rgba(232, 193, 105, 0.55); }
.gl-ladder li.is-best .gl-chip { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.25px var(--gold); }
.gl-ladder-l { font-size: 14.5px; color: var(--ink-2); }
.gl-ladder-s { font-family: var(--serif); font-size: 19px; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; text-align: right; }
.gl-ladder li.is-best .gl-ladder-s { color: var(--ink); }
.gl-best-line { margin: 6px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--muted); text-align: right; }
.gl-best-line b { margin-left: 6px; font-family: var(--serif); font-weight: 400; font-size: 19px; color: var(--gold); font-variant-numeric: lining-nums tabular-nums; }
.gl-after { display: flex; justify-content: center; margin: 6px 0 0; }
.gl-note { min-height: 0; margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-line; }
.gl-note:empty { display: none; }

.gl-stats { text-align: left; }
.gl-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gl-fig b { display: block; font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 1.15; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; }
.gl-fig span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.gl-spread { margin: 20px 0 0; }
.gl-spread-h { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.gl-row { display: grid; grid-template-columns: 22px 1fr 26px; align-items: center; gap: 10px; min-height: 26px; }
.gl-row-l { font-family: var(--serif); font-size: 16px; color: var(--muted); text-align: right; font-variant-numeric: lining-nums tabular-nums; }
.gl-row-bar { display: block; height: 10px; border-radius: 5px; background: rgba(241, 239, 233, 0.055); overflow: hidden; }
.gl-row-bar i { display: block; height: 100%; border-radius: 5px; background: rgba(241, 239, 233, 0.34); }
.gl-row-n { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gl-row.is-today .gl-row-l, .gl-row.is-today .gl-row-n { color: var(--gold); }
.gl-row.is-today .gl-row-bar i { background: var(--gold); }

.gl-fine { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* The five second how to: a ghost hand swipes, two level 3 tiles join into a 4. */
.gl-demo { width: min(100%, 300px); margin: 4px auto 6px; container-type: inline-size; }
.gl-demo-row { position: relative; height: 31cqw; }
.gl-demo-row > i { position: absolute; top: 0; width: 22cqw; height: 22cqw; border-radius: 10px; background: rgba(241, 239, 233, 0.04); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.gl-demo-row > i:nth-child(1) { left: 0; }
.gl-demo-row > i:nth-child(2) { left: 26cqw; }
.gl-demo-row > i:nth-child(3) { left: 52cqw; }
.gl-demo-row > i:nth-child(4) { left: 78cqw; }
.gl-demo-t { position: absolute; top: 0; display: flex; align-items: center; justify-content: center; width: 22cqw; height: 22cqw; border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 58%), var(--tb); color: var(--tf); font-family: var(--serif); font-weight: 500; font-size: 11cqw; line-height: 1; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 1.5px rgba(0, 0, 0, 0.4); }
.gl-demo-t.a { left: 0; }
.gl-demo-t.b { left: 52cqw; }
.gl-demo-t.c { left: 78cqw; transform: scale(0); }
.gl-demo-hand { position: absolute; top: 9cqw; left: 6cqw; width: 17cqw; height: 17cqw; color: rgba(241, 239, 233, 0.85); opacity: 0; pointer-events: none; }
.gl-demo-cap { margin: 0 0 4px; font-size: 14.5px; line-height: 1.5; color: var(--muted); text-align: center; }
.gm-sheet .gl-steps { margin-top: 14px; }

@media (prefers-reduced-motion: no-preference) {
  .gl-demo-t.a { animation: gl-demo-a 5s ease-in-out infinite; }
  .gl-demo-t.b { animation: gl-demo-b 5s ease-in-out infinite; }
  .gl-demo-t.c { animation: gl-demo-c 5s ease-out infinite; }
  .gl-demo-hand { animation: gl-demo-hand 5s ease-in-out infinite; }
}
@keyframes gl-demo-a { 0%, 20% { transform: translateX(0); opacity: 1; } 24.4% { transform: translateX(78cqw); opacity: 1; } 24.5%, 92% { transform: translateX(78cqw); opacity: 0; } 92.1% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes gl-demo-b { 0%, 20% { transform: translateX(0); opacity: 1; } 24.4% { transform: translateX(26cqw); opacity: 1; } 24.5%, 92% { transform: translateX(26cqw); opacity: 0; } 92.1% { transform: translateX(0); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
@keyframes gl-demo-c { 0%, 24.4% { transform: scale(0); opacity: 1; } 26.8% { transform: scale(1.12); } 28.4%, 86% { transform: scale(1); opacity: 1; } 92% { transform: scale(1); opacity: 0; } 100% { transform: scale(0); opacity: 0; } }
@keyframes gl-demo-hand { 0%, 8% { transform: translateX(0); opacity: 0; } 13% { transform: translateX(0); opacity: 0.9; } 34% { transform: translateX(60cqw); opacity: 0.9; } 42%, 100% { transform: translateX(60cqw); opacity: 0; } }

/* ---- the guided first round: a 3 by 3 board, a hand that shows the swipe, "Skip the tour" ---- */
.gl-tour-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px 0; }
.gl-tour-h { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 25px; line-height: 1.25; }
.gl-tour-t { flex: none; min-height: 3.1em; margin: 8px 2px 0; font-size: 18px; line-height: 1.45; color: var(--ink); text-wrap: balance; }
.gl-tour-board { position: relative; width: min(100cqw, 100cqh, 420px); aspect-ratio: 1; }
.gl-tour-board .gl-board { width: 100%; }
.gl-tour-hand { position: absolute; z-index: 3; left: 40%; top: 40%; width: 21%; height: 21%; color: rgba(241, 239, 233, 0.92); pointer-events: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6)); }
.gl-tour-k { flex: none; margin: 4px 0 0; font-size: 15px; color: var(--muted); text-align: center; }
.gl-tour-end { flex: none; display: flex; justify-content: center; padding: 10px 0 max(14px, env(safe-area-inset-bottom)); }
.gl-tour-go { min-width: min(100%, 300px); }
@media (prefers-reduced-motion: no-preference) {
  .gl-tour-hand { opacity: 0; }
  .gl-tour-hand.is-go[data-dir="L"] { animation: gl-hand-l 1.7s cubic-bezier(0.45, 0, 0.2, 1) 250ms infinite; }
  .gl-tour-hand.is-go[data-dir="D"] { animation: gl-hand-d 1.7s cubic-bezier(0.45, 0, 0.2, 1) 250ms infinite; }
}
@keyframes gl-hand-l { 0% { opacity: 0; transform: translateX(70%); } 14% { opacity: 0.95; transform: translateX(70%); } 62% { opacity: 0.95; transform: translateX(-110%); } 80%, 100% { opacity: 0; transform: translateX(-110%); } }
@keyframes gl-hand-d { 0% { opacity: 0; transform: translateY(-90%); } 14% { opacity: 0.95; transform: translateY(-90%); } 62% { opacity: 0.95; transform: translateY(100%); } 80%, 100% { opacity: 0; transform: translateY(100%); } }

/* ---- how to play: three steps, each a tiny demo from the real pieces and one sentence ---- */
.gl-hw-steps { list-style: none; display: grid; gap: 16px; margin: 2px 0 0; padding: 0; }
.gl-hw-step { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; gap: 16px; }
.gl-hw-text { margin: 0; font-size: 17px; line-height: 1.42; color: var(--ink); text-wrap: pretty; }
.gl-hw { --sz: 22cqw; width: 128px; padding: 8px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); container-type: inline-size; }
.gl-hw-row { position: relative; height: 22cqw; margin: 12cqw 0; }
.gl-hw-well { position: absolute; top: 0; width: 22cqw; height: 22cqw; border-radius: 6px; background: rgba(241, 239, 233, 0.045); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5); }
.gl-hw-well:nth-child(1) { left: 0; }
.gl-hw-well:nth-child(2) { left: 26cqw; }
.gl-hw-well:nth-child(3) { left: 52cqw; }
.gl-hw-well:nth-child(4) { left: 78cqw; }
.gl-hw .gl-face { position: absolute; top: 0; width: 22cqw; height: 22cqw; border-radius: 6px; font-size: 12cqw; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -2px 0 rgba(60, 40, 10, 0.22); }
.gl-hw-hand { position: absolute; top: 9cqw; width: 22cqw; height: 22cqw; color: rgba(241, 239, 233, 0.9); pointer-events: none; }
/* end frames (also what reduced motion sees) */
.gl-hw-a { left: 78cqw; }
.gl-hw-hand-r { left: 60cqw; opacity: 0; }
.gl-hw-b1, .gl-hw-b2 { left: 78cqw; opacity: 0; }
.gl-hw-b3 { left: 78cqw; }
.gl-hw-hand-j { left: 60cqw; opacity: 0; }
.gl-hw-runs { display: grid; gap: 8cqw; padding-top: 12px; padding-bottom: 12px; }
.gl-hw-meter { height: 4cqw; border-radius: 2cqw; background: rgba(241, 239, 233, 0.1); overflow: hidden; }
.gl-hw-meter i { display: block; height: 100%; background: var(--gold); transform: scaleX(0.08); transform-origin: 0 50%; }
.gl-hw-lv { position: relative; height: 26cqw; }
.gl-hw-lv .gl-face { width: 26cqw; height: 26cqw; font-size: 14cqw; }
.gl-hw-c1 { left: 0; }
.gl-hw-c2 { left: 37cqw; box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px var(--gold) !important; }
.gl-hw-c3 { left: 74cqw; }
.gl-hw-marks { display: flex; justify-content: center; gap: 6cqw; }
.gl-hw-marks i { width: 8cqw; height: 8cqw; border-radius: 50%; background: var(--ink-2); }
.gl-hw-marks .gl-hw-m2 { background: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .gl-hw-a { animation: gl-hw-slide 3.4s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .gl-hw-hand-r { animation: gl-hw-hand 3.4s ease-in-out infinite; }
  .gl-hw-b1 { animation: gl-hw-b1 3.8s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .gl-hw-b2 { animation: gl-hw-b2 3.8s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .gl-hw-b3 { animation: gl-hw-b3 3.8s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .gl-hw-hand-j { animation: gl-hw-hand 3.8s ease-in-out infinite; }
  .gl-hw-meter i { animation: gl-hw-meter 4.2s linear infinite; }
  .gl-hw-c1 { animation: gl-hw-c 4.2s ease-out infinite; }
  .gl-hw-c2 { animation: gl-hw-c2 4.2s ease-out infinite; }
  .gl-hw-c3 { animation: gl-hw-c3 4.2s ease-out infinite; }
}
@keyframes gl-hw-slide { 0%, 22% { transform: translateX(-78cqw); } 34%, 100% { transform: translateX(0); } }
@keyframes gl-hw-hand { 0%, 6% { transform: translateX(-60cqw); opacity: 0; } 12% { opacity: 0.9; transform: translateX(-60cqw); } 34% { opacity: 0.9; transform: translateX(0); } 44%, 100% { opacity: 0; transform: translateX(0); } }
@keyframes gl-hw-b1 { 0%, 22% { transform: translateX(-78cqw); opacity: 1; } 33% { transform: translateX(0); opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes gl-hw-b2 { 0%, 22% { transform: translateX(-26cqw); opacity: 1; } 33% { transform: translateX(0); opacity: 1; } 34%, 100% { opacity: 0; } }
@keyframes gl-hw-b3 { 0%, 33% { transform: scale(0.6); opacity: 0; filter: brightness(1.4); } 40% { transform: scale(1.09); opacity: 1; } 46% { transform: scale(1); } 70%, 100% { transform: scale(1); opacity: 1; filter: brightness(1); } }
@keyframes gl-hw-meter { 0% { transform: scaleX(1); } 90%, 100% { transform: scaleX(0.08); } }
@keyframes gl-hw-c { 0%, 10% { opacity: 0; transform: translateY(20%); } 20%, 100% { opacity: 1; transform: none; } }
@keyframes gl-hw-c2 { 0%, 35% { opacity: 0; transform: translateY(20%); } 45%, 100% { opacity: 1; transform: none; } }
@keyframes gl-hw-c3 { 0%, 60% { opacity: 0; transform: translateY(20%); } 70%, 100% { opacity: 1; transform: none; } }
.gl-more { margin: 18px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.gl-more summary { display: flex; align-items: center; min-height: 44px; font-size: 15.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.gl-more summary::marker { color: var(--gold); }
.gl-more .gl-fine { margin: 6px 0 10px; }
@media (max-width: 380px) {
  .gl-hw-step { grid-template-columns: 104px minmax(0, 1fr); gap: 12px; }
  .gl-hw { width: 104px; padding: 6px; }
  .gl-hw-text { font-size: 16px; }
}

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

@media (max-width: 400px) {
  .gl-figs { gap: 6px; }
  .gl-fig b { font-size: 24px; }
  .gl-fig span { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- round 9 kit: Gilt's demo pieces inside the shared How to play box, the runs on the result ---- */
.kt-demo .gl-hw { width: 216px; padding: 0; background: none; box-shadow: none; }
.gl-result-extra .gl-runs { margin: 4px 0 18px; }

/* ---- the kit's sizes: the column follows var(--gm-col), the board var(--gm-board) (fitStage), and
   the counters and the Hint row match the board's width ---- */
.gl { max-width: calc(var(--gm-col, 600px) - 48px); }
.gl-play > :not(.gl-stage) { width: 100%; max-width: var(--gl-w, none); margin-left: auto; margin-right: auto; }
.gl-board { width: min(100cqw, 100cqh, var(--gm-board, 560px)); }
/* a phone: the counters and the board sit at the top, the Hint row at the thumb, no gap above */
@media (max-width: 700px) {
  html.gm-play .gl-play { justify-content: flex-start; }
  html.gm-play .gl-play > .gl-foot { margin-top: auto; }
  html.gm-play .gl-play.gl-tour { justify-content: flex-start; }
}
/* A phone on its side (844 by 390): the board takes the left half at full height, the counters,
   the climb and the Hint stack in the right half at their own width (they were squeezed to the
   board's width over the bar before, and Hint fell off the bottom). */
@media (orientation: landscape) and (max-height: 500px) {
  .gl { max-width: 800px; }
  html.gm-play .gl-play, .gl-play { flex-flow: column wrap; justify-content: center; align-content: center; column-gap: 28px; }
  .gl-play > .gl-stage, .gl-play > .gl-stage.is-fit { order: -1; flex: 0 0 100%; height: auto; width: calc(50% - 14px); padding: 6px 0; }
  .gl-play > :not(.gl-stage, .sr) { width: calc(50% - 14px); max-width: none; margin-left: 0; margin-right: 0; }
  html.gm-play .gl-play > .gl-foot { margin-top: 6px; }
  .gl-status, .gl-practice-top, .gl-tour-top { padding-top: 0; }
  .gl-tour-t { min-height: 0; }
}
