/* ------------------------------------------------------------------ */
/* Default tile size: fits the row it's in (--n = tiles in the row)    */
/* ------------------------------------------------------------------ */

.hand { --tw: clamp(24px, calc((min(100vw, 860px) - 56px) / (var(--n, 10) + 4)), 50px); }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 11px 20px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.28);
  font: 400 17px/1 var(--serif);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.35s var(--ease),
    background 0.35s var(--ease),
    transform 0.35s var(--ease),
    opacity 0.35s var(--ease);
}
.btn:hover:not(:disabled) { border-color: var(--ink-3); background: rgba(255, 255, 255, 0.62); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.btn:disabled { cursor: default; }
.btn .jp { font-size: 0.8em; color: var(--red); letter-spacing: 0.04em; }
.btn.seal { color: var(--red); border-color: color-mix(in srgb, var(--red) 38%, transparent); }
.btn.seal:hover:not(:disabled) { border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); font-style: italic; padding: 8px 10px; }
.btn.ghost:hover:not(:disabled) { color: var(--ink); background: transparent; border-color: transparent; }
.btn.tried { opacity: 0.45; text-decoration: line-through; text-decoration-color: var(--ink-3); text-decoration-thickness: 1px; }
.btn.dim { opacity: 0.35; }
.btn.chosen { border-color: transparent; background: transparent; }

/* ------------------------------------------------------------------ */
/* Marks                                                               */
/* ------------------------------------------------------------------ */

.mark { position: absolute; pointer-events: none; overflow: visible; z-index: 3; }
.mark.maru path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}
.mark.batsu { width: 12px; height: 12px; right: -6px; top: -6px; }
.mark.batsu path { fill: none; stroke: var(--ink-3); stroke-width: 1.7; stroke-linecap: round; }

/* the line under a question that says right or wrong */
.quiz-note {
  min-height: 1.6em;
  max-width: 30em;
  font-size: 17px;
  color: var(--ink-2);
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  text-align: left;
  text-wrap: pretty;
  opacity: 0;
}
.quiz-note.show { animation: note-in 0.7s var(--ease) forwards; }
@keyframes note-in {
  from { opacity: 0; translate: 0 4px; filter: blur(2px); }
  to { opacity: 1; translate: 0 0; filter: none; }
}
.quiz-note .mk { flex: none; width: 15px; height: 15px; translate: 0 2px; overflow: visible; }
.mk.ok circle { fill: none; stroke: var(--red); stroke-width: 1.7; }
.mk.no path { fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-linecap: round; }

/* ------------------------------------------------------------------ */
/* Quiz                                                                */
/* ------------------------------------------------------------------ */

.quiz {
  width: min(100%, 760px);
  display: grid;
  justify-items: center;
  gap: 18px;
}
.quiz-label { margin-bottom: -4px; }
.quiz-q {
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.2;
  font-weight: 340;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  text-wrap: balance;
}
.quiz-q .muted, .calls-q .muted { color: var(--ink-3); }
.quiz-ctx { font-style: italic; color: var(--ink-2); max-width: 28em; font-size: 17px; text-wrap: balance; }
.quiz-stage { display: grid; justify-items: center; gap: 22px; width: 100%; }
.quiz-show { min-height: 40px; padding: 8px 0 4px; }
.quiz-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.quiz-opts.tiles { column-gap: clamp(14px, 2.6vw, 24px); padding-top: 6px; }
.quiz-opts .tile.spent { opacity: 0; transition: opacity 0.2s; }
.quiz-stage, .quiz-q { transition: opacity 0.32s var(--ease), translate 0.32s var(--ease); }
.quiz.swapping .quiz-stage, .quiz.swapping .quiz-q,
.calls.swapping .table-wrap, .calls.swapping .calls-q { opacity: 0; translate: 0 6px; }

.quiz-foot { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 38px; }
.quiz-steps { display: inline-flex; gap: 7px; }
.quiz-steps i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background 0.4s, box-shadow 0.4s;
}
.quiz-steps i.on { background: var(--ink-3); box-shadow: none; }
.quiz-steps i.done { box-shadow: inset 0 0 0 1.3px var(--red); }

/* ------------------------------------------------------------------ */
/* Static illustrations                                                */
/* ------------------------------------------------------------------ */

.row9 { --tw: min(54px, calc((100vw - 32px - 8 * 3px) / 9)); --g: max(2px, calc(var(--tw) * 0.06)); }
.row9 .hand { --tw: inherit; }

.honors { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px 56px; }
.honors .col { display: grid; justify-items: center; gap: 4px; --tw: clamp(40px, 7vw, 56px); --g: max(2px, calc(var(--tw) * 0.06)); }
.honors .hand { --tw: inherit; }
.honors .small { margin-top: 10px; }

/* all 34 kinds on one page, named in small type above each row */
.set34 { min-height: 100svh; gap: clamp(18px, 3vh, 30px); }
.set34-grid {
  --gap-x: 2px; /* extra space between tiles, left to right */
  --tw: min(52px, calc((100vw - 2 * var(--gutter) - 8 * var(--gap-x)) / 9.75));
  --g: calc(max(2px, var(--tw) * 0.06) + var(--gap-x));
  display: grid;
  gap: clamp(14px, 2.6vh, 24px);
  justify-items: start;
  text-align: left;
}
.set34-grid .hand { --tw: inherit; --g: inherit; justify-content: flex-start; }
.set34-name {
  font: 500 10.5px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 7px;
  white-space: nowrap;
}
.set34-name .jp { font-family: var(--kanji); font-size: 12px; letter-spacing: 0.06em; color: var(--ink-2); margin: 0 0.3em 0 0.4em; }
.set34-honors { display: flex; gap: calc(var(--tw) * 0.9); }
.set34-honors .row-labels { justify-content: flex-start; margin-top: 6px; }
.set34-honors .row-labels span { font-size: 10px; }
.set34-times { font-size: clamp(20px, 2.4vw, 26px); font-weight: 340; color: var(--ink-2); letter-spacing: 0.02em; }

/* yaku: the same fourteen, changing step by step, the yaku in chips on top */
.yscene .sticky { gap: 20px; cursor: pointer; }
.ys-cap { min-height: calc(4.7em * 1.2 + 30px); display: grid; align-content: end; justify-items: center; gap: 14px; font-size: clamp(27px, 4.4vw, 42px); }
.ys-cap > * { font-size: initial; }
.ys-cap .lead { font-size: clamp(27px, 4.4vw, 42px); }
/* the header over the words: plain small type, dot-separated */
.tags.ys-tags { gap: 0; }
.tags.ys-tags > span { box-shadow: none; padding: 0; }
.ys-tags > span + span::before { content: "·"; margin: 0 0.7em; color: var(--ink-3); }
.ys-tags.show { animation: note-in 0.6s var(--ease) both; }
/* the yaku's name, between the words and the tiles */
.ys-name { min-height: 1.5em; font-size: clamp(19px, 2.2vw, 24px); font-style: italic; color: var(--ink-2); }
.ys-name u { text-decoration-color: var(--red); text-decoration-thickness: 1.5px; text-underline-offset: 0.18em; }
.ys-name .jp { font-style: normal; font-size: 0.7em; letter-spacing: 0.06em; color: var(--ink-3); margin-left: 0.5em; }
.ys-name .under-note { font-size: 0.62em; font-style: normal; translate: -50% 0.1em; }
.ys-name.show { animation: note-in 0.7s var(--ease) 0.1s both; }
.ys-line .ln { display: block; }
/* a small note hung just under a word */
:is(.ys-line, .ys-name) .under { position: relative; display: inline-block; }
:is(.ys-line, .ys-name) .under-note {
  position: absolute;
  left: 50%; top: 100%;
  translate: -50% -0.1em;
  font-size: 0.36em;
  font-family: var(--sans);
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink-3);
}
/* a yaku's name inside the words: italic, quieter */
.ys-line .yname { font-style: italic; opacity: 0.55; }
/* a key word in the words, like riichi: red, as on the table */
.ys-line b.key { font-weight: 520; color: var(--red); }
/* adding up han, line by line */
.ys-line .hn { font-size: 0.6em; color: var(--ink-3); margin-left: 0.5em; white-space: nowrap; }
.ys-line .total { font-size: 0.8em; color: var(--red); }
/* a quiet aside inside the words */
.ys-line .aside { font-size: 0.7em; opacity: 0.5; }
.yscene .ys-hand { margin-top: 18px; }
.ys-line.show { animation: note-in 0.7s var(--ease) both; }
.ys-line .ys-title { font-size: 1.5em; line-height: 1.1; }
/* a short accent rule under a title, with room before the words */
.ys-line .ys-title::after {
  content: "";
  display: block;
  width: 28px;
  height: 1.5px;
  margin: 0.55em auto 0.7em;
  border-radius: 1px;
  background: var(--red);
  opacity: 0.7;
}
.ys-line .jp { font-size: 0.6em; color: var(--ink-3); }
.ys-hand {
  --tw: min(46px, calc((100vw - 2 * var(--gutter)) / 17));
  flex-wrap: nowrap;
  margin: 34px 0 30px;
  min-height: calc(var(--tw) * 1.6);
}
.ys-hand .tile { transition: width 0.5s var(--ease), height 0.5s var(--ease); }
.ys-hand .draw-arrow { opacity: 1; animation: arrow-in 0.5s var(--ease) both; }
@keyframes arrow-in { from { opacity: 0; translate: -50% -6px; } }

/* your hand: the same thirteen, face down → face up → two turns → sets → the win */
.hscene .sticky { gap: 22px; cursor: pointer; }
.hs-line { min-height: 3.5em; display: grid; align-content: end; }
.hs-line .ln { display: block; }
.hs-line.show { animation: note-in 0.7s var(--ease) both; }
.hs-hand {
  --tw: min(46px, calc((100vw - 2 * var(--gutter)) / 16.5));
  --spread: calc(var(--tw) * 0.42); /* the space between sets, once they part */
  flex-wrap: nowrap;
  column-gap: var(--g);
  margin: 44px 0 50px;
}
.hs-hand.spread { column-gap: var(--spread); }

/* under each set: a thin bracket, then its name */
.set-bar {
  position: absolute;
  top: calc(100% + 7px);
  left: 1px; right: 1px;
  height: 5px;
  border: 1px solid var(--line-2);
  border-top: 0;
  border-radius: 0 0 2px 2px;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.set-name {
  position: absolute;
  top: calc(100% + 19px);
  left: -20px; right: -20px;
  text-align: center;
  font: 500 10.5px/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.hs-hand.spread :is(.set-bar, .set-name) { opacity: 1; transition-delay: 0.45s; }
/* the set the winning tile finishes: a tile short until the end, then red */
.hs-fin { display: none; }
.hs-hand.at-win .hs-fin { display: inline-block; }
.hs-hand.at-win .hs-fin-group .set-bar { border-color: var(--red); }
.hs-hand.at-win .hs-fin-group .set-name { color: var(--red); }

/* the stray, sitting over the tile that will take its place */
.hs-keep { opacity: 0; position: relative; z-index: 3; }
.hs-junk { position: absolute; bottom: 0; }
.hs-hand.at-swap .hs-keep { opacity: 1; }
.hs-hand.at-swap .hs-junk { opacity: 0; transform: translateY(calc(var(--tw) * -1.8)) rotate(-8deg); transition: transform 0.7s var(--ease), opacity 0.6s var(--ease) 0.1s; }

/* the slot for the fourteenth: no room for it at first, then an outline */
.hs-win { width: 0; margin-left: calc(-1 * var(--g)); opacity: 0; transition: width 0.6s var(--ease), opacity 0.4s var(--ease); }
.hs-hand.spread .hs-win { margin-left: calc(-1 * var(--spread)); }
.hs-hand.at-slot .hs-win { width: var(--tw); margin-left: calc(var(--tw) * 0.12); opacity: 1; }
/* once the last tile is in, the slot folds away */
.hs-hand.at-win .hs-win { width: 0; margin-left: calc(-1 * var(--spread)); opacity: 0; transition: none; }
.hs-slot {
  position: absolute;
  left: 0; bottom: calc(var(--tw) * var(--tile-depth));
  width: var(--tw);
  height: calc(var(--tw) * var(--tile-ratio));
  border-radius: calc(var(--tw) * var(--tile-radius));
  border: 1.3px dashed var(--line-2);
  box-sizing: border-box;
}
/* each draw drops into the slot; the first is thrown away, the second
   moves into the hand */
.hs-first, .hs-second { position: absolute; left: 0; bottom: 0; }
.hs-first, .hs-second { opacity: 0; transform: translateY(calc(var(--tw) * -0.9)); }
.hs-hand.at-draw .hs-first,
.hs-hand.at-draw2 .hs-second { opacity: 1; transform: none; transition: transform 0.6s var(--ease), opacity 0.35s var(--ease); }
.hs-hand.at-discard .hs-first { opacity: 0; transform: translate(calc(var(--tw) * 0.5), calc(var(--tw) * -1.8)) rotate(8deg); transition: transform 0.7s var(--ease), opacity 0.6s var(--ease) 0.1s; }
.hs-hand.at-swap .hs-second { opacity: 0; transform: none; transition: none; }

.draw-arrow {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  translate: -50% 0;
  width: 12px;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
.hs-hand.arrow .draw-arrow { opacity: 1; }
.draw-arrow svg { display: block; width: 12px; height: 24px; fill: none; stroke: var(--red); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
@keyframes arrow-bob { 50% { translate: -50% calc(-3px * var(--alive)); } }
.hs-hand.still, .hs-hand.still * { transition-delay: 0s !important; }
@media (max-width: 560px) {
  .set-name { left: -2px; right: -2px; font-size: 9px; letter-spacing: 0.04em; white-space: normal; line-height: 1.2; }
}

.two-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  width: min(100%, 860px);
}
.card {
  padding: 26px 22px 30px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: start;
}
.card .hand { --tw: clamp(22px, 2.6vw, 27px); }
.card .lead-sm { font-size: 22px; line-height: 1.25; font-weight: 360; }
.card .body { font-size: 17px; }

.call-demo { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 12px; margin-top: 6px; }
.call-demo .hand { --tw: clamp(26px, 3.4vw, 34px); }
.call-demo .op { color: var(--ink-3); font-size: 20px; }

.hand.inline-tiles { --tw: 21px; display: inline-flex; vertical-align: -0.42em; margin: 0 0.12em; column-gap: 6px; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tags > span {
  font: 500 12px/1 var(--sans);
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink-2);
}
.tags .sum { color: var(--red); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent); }

/* four tiles to turn over */
.flip4-row { --tw: clamp(46px, 8vw, 62px); display: flex; gap: clamp(10px, 2vw, 18px); }
.flip4-row .tile:not(:disabled):hover { transform: translateY(-5px) rotate(-1deg); }
[data-flip4-note] { min-height: 1.6em; opacity: 0; }
[data-flip4-note].show { animation: note-in 0.8s var(--ease) forwards; }

/* ------------------------------------------------------------------ */
/* Scroll-driven sections                                              */
/* ------------------------------------------------------------------ */

.scrub { position: relative; height: var(--len, 300vh); margin-top: calc(-1 * var(--pull, 0px)); }
.sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 26px;
  padding: 64px var(--gutter) 40px;
  text-align: center;
}

.asm { position: relative; width: min(100%, 960px); --tw: clamp(30px, 5.2vw, 52px); }
.asm .tile { position: absolute; left: 0; top: 0; transition: none; will-change: transform; }
.asm-label {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 7px;
  opacity: 0;
}
.asm-label i {
  width: 100%;
  height: 7px;
  border: 1.4px solid var(--ink-3);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  opacity: 0.55;
}
.asm-label span { font: 500 10.5px/1 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-3); }
.asm-label:last-of-type span { color: var(--red); }
[data-after] { opacity: 0; }

/* ------------------------------------------------------------------ */
/* Turn + riichi boards                                                */
/* ------------------------------------------------------------------ */

.turn { width: min(100%, 760px); display: grid; justify-items: center; gap: 20px; margin-top: 10px; }
.turn-board { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 22px 54px; min-height: 80px; }
.turn-spot { display: grid; justify-items: center; gap: 12px; }
.turn-spot .label { font-size: 10px; }

.turn-wall {
  --tw: clamp(20px, 3.4vw, 28px);
  display: flex;
  gap: 2px;
  padding: 6px 4px 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.turn-wall:disabled { cursor: default; }
.turn-wall:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 6px; }
.tile.stacked {
  margin-bottom: calc(var(--w) * (var(--tile-depth) * 2 + 0.01));
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 calc(var(--w) * var(--tile-lip)) 0 0 var(--tile-back-edge),
    0 calc(var(--w) * var(--tile-depth)) 0 0 var(--tile-edge),
    0 calc(var(--w) * (var(--tile-depth) + var(--tile-lip))) 0 0 var(--tile-back-edge),
    0 calc(var(--w) * var(--tile-depth) * 2) 0 0 var(--tile-edge),
    0 calc(var(--w) * (var(--tile-depth) * 2 + 0.04)) calc(var(--w) * 0.3) rgba(60, 40, 15, var(--tile-shadow));
}
.can-draw .turn-wall .tile:first-child { animation: invite 2.4s var(--ease-soft) infinite; }
@keyframes invite {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

.turn-river { --tw: clamp(22px, 3.6vw, 30px); display: flex; gap: 2px; min-height: calc(var(--tw) * 1.5); align-items: flex-end; }

.turn-hand {
  --tw: clamp(21px, calc((min(100vw, 760px) - 40px) / 15.6), 46px);
  flex-wrap: nowrap;
  column-gap: calc(var(--tw) * 0.32);
  min-height: calc(var(--tw) * 1.6);
}
.turn-hand.won { column-gap: calc(var(--tw) * 0.36); flex-wrap: wrap; }
.turn-hand .group.drawn:empty { display: none; }

.turn-msg {
  font-size: clamp(19px, 2.4vw, 22px);
  line-height: 1.4;
  max-width: 28em;
  min-height: 2.9em;
  text-wrap: balance;
}
.turn-msg.show { animation: note-in 0.8s var(--ease) both; }
.turn-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 44px; }

.dots i { font-style: normal; animation: dot 1.4s infinite; opacity: 0.2; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot { 30% { opacity: 1; } 60%, 100% { opacity: 0.2; } }

.riichi-board { gap: 22px 44px; }
.riichi-in { --tw: clamp(26px, 4vw, 34px); min-height: calc(var(--tw) * 1.5); min-width: var(--tw); display: flex; align-items: flex-end; justify-content: center; }
.waiting .riichi-in { opacity: 0.6; }
.stick-slot { height: 46px; min-width: 92px; display: grid; place-items: center; }
.stick {
  display: block;
  width: 88px;
  height: 9px;
  border-radius: 5px;
  background: linear-gradient(#fffdf8, #ede5d6);
  box-shadow: 0 2px 0 #dcd2bf, 0 5px 12px rgba(60, 40, 15, 0.16);
  position: relative;
}
.stick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  translate: -50% -50%;
}
.riichi.locked .turn-hand .tile { filter: saturate(0.92); }

/* ------------------------------------------------------------------ */
/* The table                                                           */
/* ------------------------------------------------------------------ */

.table-wrap {
  position: relative;
  width: min(100%, 470px, calc(100svh - 250px));
  min-width: min(100%, 300px);
  padding: 30px 28px;
  container-type: inline-size;
}
.table {
  --tw: 5cqw;
  --C: calc(var(--tw) * 6 + 7.5px + 3cqw);
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4cqw;
  background: color-mix(in srgb, var(--paper-deep) 55%, var(--paper));
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 rgba(255, 255, 255, 0.7);
}
.table .side { position: absolute; inset: 0; pointer-events: none; }
.table .s1 { rotate: -90deg; }
.table .s2 { rotate: 180deg; }
.table .s3 { rotate: 90deg; }
.table .river {
  position: absolute;
  left: calc(50% - var(--C) / 2 + 1.5cqw);
  top: calc(50% + var(--C) / 2 + 1.6cqw);
  display: grid;
  gap: 0.5cqw;
}
.river-row { display: flex; gap: 1.5px; align-items: flex-end; }
.table .tile { box-shadow:
    inset 0 0 0 0.5px rgba(70, 50, 20, 0.12),
    0 calc(var(--w) * var(--tile-lip)) 0 0 var(--tile-edge),
    0 calc(var(--w) * var(--tile-depth)) 0 0 var(--tile-back),
    0 calc(var(--w) * (var(--tile-depth) + 0.01)) calc(var(--w) * 0.2) rgba(60, 40, 15, var(--tile-shadow)); }
.tile.hidden { display: none; }
.tile.fresh { animation: drop 0.55s var(--ease) both; }
@keyframes drop {
  from { opacity: 0; translate: 0 -55%; scale: 1.18; }
}
.tile.last::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--w) * -0.32);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  translate: -50% 0;
}
.rack {
  position: absolute;
  left: 50%;
  bottom: 2.4cqw;
  translate: -50% 0;
  display: flex;
  gap: 0.35cqw;
  transition: transform 0.7s var(--ease);
}
.rack i {
  width: calc(var(--tw) * 0.9);
  height: calc(var(--tw) * (var(--tile-depth) * 4));
  border-radius: calc(var(--tw) * var(--tile-radius) * 0.9);
  background: linear-gradient(var(--tile-back) 0 46%, var(--tile-face) 46%);
  box-shadow: 0 1px 1.5px rgba(60, 40, 15, 0.2);
}
.rack.on { transform: translateY(-1cqw); }
.center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--C);
  height: var(--C);
  translate: -50% -50%;
  border-radius: 2.6cqw;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}
.wind {
  position: absolute;
  font-family: var(--kanji);
  font-weight: 700;
  font-size: 4.4cqw;
  line-height: 1;
  color: var(--ink-3);
  opacity: 0.6;
  transition: color 0.5s var(--ease), opacity 0.5s var(--ease);
}
.wind.on { color: var(--red); opacity: 1; }
.w0 { left: 50%; bottom: 1.6cqw; transform: translateX(-50%); }
.w1 { right: 1.6cqw; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.w2 { left: 50%; top: 1.6cqw; transform: translateX(-50%) rotate(180deg); }
.w3 { left: 1.6cqw; top: 50%; transform: translateY(-50%) rotate(90deg); }
.seat-label {
  position: absolute;
  font: 500 10px/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  transition: color 0.5s var(--ease);
}
.seat-label.on { color: var(--red); }
.l0 { bottom: 9px; left: 50%; transform: translateX(-50%); }
.l2 { top: 9px; left: 50%; transform: translateX(-50%); }
.l1 { right: 8px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%); }
.l3 { left: 8px; top: 50%; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }

.calls { width: min(100%, 880px); display: grid; justify-items: center; gap: 18px; }
.calls-side { display: grid; justify-items: center; gap: 16px; align-content: center; }
.calls-q { min-height: 2.5em; display: block; }
.calls-q .inline-tiles { --tw: 26px; vertical-align: -0.5em; }
.calls .table-wrap { width: min(100%, 420px); }
@media (min-width: 900px) {
  .calls {
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    grid-template-areas: "table side" "hand hand";
    column-gap: 40px;
    align-items: center;
  }
  .calls .table-wrap { grid-area: table; }
  .calls-side { grid-area: side; justify-items: start; text-align: left; }
  .calls-side .quiz-opts, .calls-side .quiz-foot { justify-content: flex-start; }
  .calls-side .quiz-note { justify-content: flex-start; }
  .calls-hand-row { grid-area: hand; margin-top: 8px; }
}
.calls-hand-row {
  --tw: clamp(20px, calc((min(100vw, 720px) - 40px) / 16), 40px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 10px calc(var(--tw) * 0.6);
  min-height: calc(var(--tw) * 1.6);
}
.calls-hand-row .hand { --tw: inherit; }
.calls-melds:empty { display: none; }

/* ------------------------------------------------------------------ */
/* Yaku                                                                */
/* ------------------------------------------------------------------ */

.yaku-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 16px;
  width: min(100%, 1000px);
  text-align: left;
}
.ycard {
  padding: 24px 24px 30px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.36);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  gap: 8px;
  align-content: start;
}
.ycard header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ycard .ycard-kanji { font-size: 15px; color: var(--ink-3); letter-spacing: 0.06em; }
.ycard .han { font: 500 11px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--red); }
.ycard .title { margin-top: 4px; }
.ycard .body { font-size: 16.5px; }
.ycard .hand { --tw: clamp(18px, 2.3vw, 25px); justify-content: flex-start; margin-top: 14px; }
@media (max-width: 560px) { .ycard { padding: 22px 18px 26px; } }

.yaku-list { width: min(100%, 780px); text-align: left; display: grid; gap: 40px; }
.yaku-han {
  font: 500 11px/1.3 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
}
.yaku-han span { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-3); font-family: var(--serif); font-style: italic; font-size: 14px; }
.yaku { border-bottom: 1px solid var(--line); interpolate-size: allow-keywords; }
.yaku summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 1.2fr) 92px;
  gap: 14px;
  align-items: baseline;
  padding: 15px 4px;
  cursor: pointer;
  transition: background 0.3s;
  border-radius: 6px;
}
.yaku summary::-webkit-details-marker { display: none; }
.yaku summary:hover { background: rgba(255, 255, 255, 0.4); }
.yaku summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.y-name { font-size: 19px; }
.yaku.common .y-name::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  margin-left: 9px;
  vertical-align: 0.2em;
}
.y-kanji { color: var(--ink-3); font-size: 14px; letter-spacing: 0.04em; }
.y-en { color: var(--ink-2); font-size: 15.5px; font-style: italic; }
.y-han { font: 500 13px/1 var(--sans); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.y-han small { color: var(--ink-3); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; margin-left: 5px; }
.y-body { padding: 4px 4px 24px; display: grid; gap: 16px; color: var(--ink-2); font-size: 16.5px; }
.y-body .hand { --tw: clamp(20px, 3vw, 30px); justify-content: flex-start; }
.yaku::details-content {
  block-size: 0;
  overflow: hidden;
  transition: block-size 0.5s var(--ease), content-visibility 0.5s allow-discrete;
}
.yaku[open]::details-content { block-size: auto; }

@media (max-width: 620px) {
  .yaku summary {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name han" "en kanji";
    row-gap: 6px;
  }
  .y-name { grid-area: name; }
  .y-han { grid-area: han; }
  .y-en { grid-area: en; }
  .y-kanji { grid-area: kanji; text-align: right; }
}

/* ------------------------------------------------------------------ */
/* The end                                                             */
/* ------------------------------------------------------------------ */

.recap {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
  text-align: left;
  font-size: clamp(19px, 2.4vw, 24px);
  line-height: 1.3;
  counter-reset: r;
  max-width: 24em;
}
.recap li { text-wrap: pretty; display: grid; grid-template-columns: 44px 1fr; align-items: baseline; counter-increment: r; }
.recap li::before { content: counter(r, cjk-decimal); font-family: var(--kanji); font-weight: 700; color: var(--red); font-size: 0.85em; }

.sticky .rot-caption { min-height: 2.4em; display: grid; align-items: end; font-size: clamp(24px, 3.6vw, 36px); }
.rot-caption.show { animation: note-in 0.8s var(--ease) both; }

/* ------------------------------------------------------------------ */
/* The table, step by step                                             */
/* ------------------------------------------------------------------ */

.ts-sticky { padding: 54px var(--gutter) 22px; gap: 0; }
.ts-stage {
  display: grid;
  justify-items: center;
  align-items: center;
  gap: 10px;
}
.ts-cap {
  height: 7.2em;
  max-width: 30em;
  display: grid;
  align-content: end;
  justify-items: center;
  gap: 12px;
  text-align: center;
}
.ts-line {
  font-size: clamp(20px, 2.5vw, 27px);
  line-height: 1.26;
  font-weight: 340;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  text-wrap: balance;
}
.ts-line b { font-weight: 520; color: var(--red); }
/* a chapter's title, when the table opens the chapter */
.ts-line .ts-title { font-size: clamp(34px, 3.6vw, 46px); font-weight: 320; letter-spacing: -0.012em; }
.ts-line .ln { display: block; }
.ts-line .ln + .ln { margin-top: 0.42em; }
.ts-cap.show .ts-kicker { animation: note-in 0.7s var(--ease) both; }
.ts-cap.show .ts-line { animation: note-in 0.8s var(--ease) 0.06s both; }
/* wide screens: the table sits dead centre, the words to its right */
.ts-stage.side { display: block; position: relative; width: 100%; }
.ts-stage.side .ts-wrap { margin: 0 auto; }
.ts-stage.side .ts-cap {
  position: absolute;
  left: calc(50% + var(--ts-w) / 2 + 44px);
  top: 50%;
  translate: 0 -50%;
  width: var(--cap-w, 260px);
  height: auto;
  align-content: center;
  justify-items: start;
  text-align: left;
}
.ts-stage.side .ts-line { font-size: clamp(21px, 1.9vw, 26px); }

/* "space" — there's still something to see in this step */
.ts-hint { opacity: 0; font: 500 11px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); transition: opacity 0.6s var(--ease); }
.ts-hint.on { opacity: 0.75; transition-delay: 1.4s; }
.ts-hint kbd { margin: 0; }
.ts-hint.on kbd { animation: press 3.2s var(--ease-soft) 2s infinite; }

/* what the next beat will move, picked out during the words */
.board .cue {
  outline: max(2px, 0.42cqw) solid color-mix(in srgb, var(--red) 85%, transparent);
  outline-offset: max(2px, 0.3cqw);
  animation: cue 1.8s var(--ease-soft) infinite;
}
.board .tile.cue:not(.lift) { translate: 0 calc(var(--th) * -0.12); }
.b-wall.on .stk.cue { translate: 0 -0.6cqw; transition-delay: 0s; }
.b-wall.on .stk.one.cue { translate: 0 calc(var(--sd) - 0.6cqw); }
.b-rack i.cue { outline-offset: max(1px, 0.2cqw); }
@keyframes cue { 50% { outline-color: color-mix(in srgb, var(--red) 45%, transparent); } }

/* curved arrows drawn on the table: whose turn it is, whose was skipped */
.b-arrows { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 4; }
.b-arrows path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; }
.b-arrows .arr { opacity: 0; transition: opacity 0.4s var(--ease); }
.b-arrows .arr.on { opacity: 1; }
.b-arrows .skip path { stroke: var(--ink-3); stroke-width: 0.26; }
.b-arrows .skip .x { stroke: var(--red); stroke-width: 0.4; }
.b-arrows .next path { stroke: var(--red); stroke-width: 0.3; }
.b-arrows .on .ln { animation: arr-draw 0.9s var(--ease) forwards; }
.b-arrows .on .hd { animation: arr-draw 0.3s var(--ease) 0.75s forwards; }
.b-arrows .on .x { animation: arr-draw 0.25s var(--ease) 1.05s forwards; }
.b-arrows .on .x + .x { animation-delay: 1.25s; }
.b-arrows .next.on .ln { animation-delay: 1.5s; }
.b-arrows .next.on .hd { animation-delay: 2.25s; }
@keyframes arr-draw { to { stroke-dashoffset: 0; } }

.ts-wrap {
  position: relative;
  width: var(--ts-w, min(100%, 470px));
  max-width: 100%;
  --wp: 26px;
  padding: var(--wp);
  container-type: inline-size;
}

/* All sizes are fractions of the table's width, so it can grow. The wall
   is a pinwheel of four 17-stack sides; ponds sit inside it, hands outside. */
.board {
  --tw: 4.1cqw;
  --th: calc(var(--tw) * var(--tile-ratio, 1.34));
  --dp: calc(var(--tw) * var(--tile-depth, 0.13));
  --sg: 0.12cqw;
  --L: calc(var(--tw) * 17 + var(--sg) * 16);
  /* a wall stack, seen from above and a little in front: the top tile's back
     (a touch foreshortened), then the sides of both tiles */
  --wh: calc(var(--tw) * 1.16);
  --sd: calc(var(--tw) * 0.43); /* one wall tile's side */
  --sj: calc(var(--tw) * 0.13); /* …of which the jade back */
  --D: calc(var(--wh) + var(--sd) * 2);
  --a: calc((var(--L) + var(--D)) / 2);
  --C: 23cqw;
  --hand-y: calc(var(--a) + 2.2cqw);
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4cqw;
  background: color-mix(in srgb, var(--paper-deep) 55%, var(--paper));
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 rgba(255, 255, 255, 0.7);
}
.board .tile {
  box-shadow:
    inset 0 0 0 0.5px rgba(70, 50, 20, 0.12),
    0 calc(var(--w) * var(--tile-lip, 0.055)) 0 0 var(--tile-edge),
    0 calc(var(--w) * var(--tile-depth, 0.13)) 0 0 var(--tile-back),
    0 calc(var(--w) * (var(--tile-depth, 0.13) + 0.01)) calc(var(--w) * 0.2) rgba(60, 40, 15, var(--tile-shadow, 0.14));
  transition: translate 0.5s var(--ease), opacity 0.4s var(--ease);
}
.b-side { position: absolute; inset: 0; pointer-events: none; }
.b-side.s1 { rotate: -90deg; }
.b-side.s2 { rotate: 180deg; }
.b-side.s3 { rotate: 90deg; }
.b-side .tile { pointer-events: auto; }

.b-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--C);
  height: var(--C);
  translate: -50% -50%;
  border-radius: 2.4cqw;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--line);
}
.b-center .wind {
  font-size: 3.4cqw;
  padding: 0.5cqw 0.6cqw;
  border-radius: 0.8cqw;
  box-shadow: inset 0 0 0 max(1px, 0.2cqw) transparent;
  transition: color 0.5s var(--ease), opacity 0.5s var(--ease), box-shadow 0.5s var(--ease);
}
/* whose turn it is: their wind, red and boxed */
.b-center .wind.on { box-shadow: inset 0 0 0 max(1px, 0.2cqw) var(--red); }
.b-center .w0 { bottom: 0.9cqw; }
.b-center .w1 { right: 0.9cqw; }
.b-center .w2 { top: 0.9cqw; }
.b-center .w3 { left: 0.9cqw; }

/* discards: in front of each player, inside the wall */
.b-pond {
  position: absolute;
  left: calc(50% - var(--C) / 2);
  top: calc(50% + var(--C) / 2 + 1.1cqw);
  display: grid;
  gap: 0.45cqw;
}
.b-pond .row { display: flex; gap: 0.15cqw; align-items: flex-end; }
.board .tile.hl {
  outline: max(1.5px, 0.32cqw) solid color-mix(in srgb, var(--red) 75%, transparent);
  outline-offset: max(1.5px, 0.3cqw);
  animation: hl 2.6s var(--ease-soft) 0.6s infinite;
}
.board .tile.hl.fresh { animation: land 0.34s cubic-bezier(.5,0,.85,.45) both, hl 2.6s var(--ease-soft) 0.6s infinite; }
/* a discard falls and lands, so its clack has a moment to match (DROP_MS in tablescene.js) */
.board .b-pond .tile.fresh:not(.hl) { animation: land 0.34s cubic-bezier(.5,0,.85,.45) both; }
@keyframes land {
  from { opacity: 0; translate: 0 -70%; scale: 1.14; }
  35% { opacity: 1; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes hl { 50% { outline-color: color-mix(in srgb, var(--red) 30%, transparent); } }

/* the wall */
.b-wall {
  position: absolute;
  left: calc(50% - var(--a));
  top: calc(50% + var(--a) - var(--D));
  display: flex;
  gap: var(--sg);
}
/* A stack is two tiles face down. The element is the top tile's back (what
   the deal measures); ::before draws the whole stack: that back, then the
   side of each tile facing its player, a jade band (its back) over an ivory
   one (its face). Two ivory bands, two tiles. */
.stk {
  /* from the tile's own colours: a crease where the tiles meet, and the
     lower tile's ivory a shade darker, nearer the table */
  --crease: color-mix(in srgb, var(--tile-edge) 74%, #3c280f);
  --low-hi: color-mix(in srgb, var(--tile-face) 60%, var(--tile-edge));
  --low-lo: color-mix(in srgb, var(--tile-edge) 93%, #3c280f);
  position: relative;
  flex: none;
  width: var(--tw);
  height: var(--wh);
  opacity: 0;
  translate: 0 -1cqw;
  transition: opacity 0.35s var(--ease), translate 0.45s var(--ease), margin 0.7s var(--ease);
}
.stk::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: calc(var(--wh) + var(--sd) * 2);
  border-radius: calc(var(--tw) * var(--tile-radius, 0.15));
  --b1: calc(var(--wh) + var(--sd)); /* where the two tiles meet */
  /* the top, over the bands (which start under it, so no hairline of table
     shows between) */
  background:
    linear-gradient(175deg, var(--tile-back-hi), var(--tile-back)) 0 0 / 100% var(--wh) no-repeat,
    linear-gradient(
      var(--tile-back-edge) 0 calc(var(--wh) + var(--sj)),
      var(--tile-face) calc(var(--wh) + var(--sj)), var(--tile-edge) calc(var(--b1) - 1px),
      var(--crease) calc(var(--b1) - 1px) var(--b1),
      var(--tile-back-edge) var(--b1) calc(var(--b1) + var(--sj)),
      var(--low-hi) calc(var(--b1) + var(--sj)), var(--low-lo) calc(var(--b1) + var(--sd))
    );
  box-shadow:
    inset 0 0 0 0.5px rgba(60, 40, 15, 0.16),
    0 0.15cqw 0.1cqw rgba(60, 40, 15, 0.22),
    0 0.5cqw 0.9cqw -0.2cqw rgba(60, 40, 15, var(--tile-shadow, 0.14));
  transition: height 0.45s var(--ease);
  transition-delay: inherit;
}
.b-wall.on .stk { opacity: 1; translate: 0 0; transition-delay: calc(var(--k) * 9ms); }
.b-wall:not(.on) .stk { transition-delay: calc((67 - var(--k)) * 5ms); }
/* stacking from the shuffle: each stack appears as its two tiles land */
.board.landing .b-wall.on .stk { transition-delay: calc(640ms + var(--k) * 8ms); }

/* the shuffle: all 136 face down in a heap, mixed round a couple of times */
.b-pile { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.b-pile i {
  position: absolute;
  left: calc(50% + var(--x));
  top: calc(50% + var(--y));
  width: var(--tw);
  height: var(--th);
  margin: calc(var(--th) / -2) 0 0 calc(var(--tw) / -2);
  border-radius: calc(var(--tw) * var(--tile-radius, 0.15));
  background: linear-gradient(175deg, var(--tile-back-hi), var(--tile-back));
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.1),
    0 calc(var(--tw) * 0.06) 0 0 var(--tile-back-edge),
    0 calc(var(--tw) * 0.13) 0 0 var(--tile-edge),
    0 calc(var(--tw) * 0.13 + 0.2cqw) 0.6cqw rgba(60, 40, 15, 0.12);
  rotate: var(--r);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.board.pile .b-pile i { opacity: 1; transition-delay: calc(var(--i) * 3ms); animation: mix 1.5s var(--ease-soft) calc(400ms + var(--i) * 2ms) 2; }
@keyframes mix { 50% { translate: var(--dx) var(--dy); rotate: calc(var(--r) + var(--dr)); } }
/* top tile taken: the one underneath shows its back a tile's thickness
   lower, and one side band is left */
.b-wall.on .stk.one { translate: 0 var(--sd); transition-delay: 0s; }
.stk.one::before { height: calc(var(--wh) + var(--sd)); }
.b-wall.on .stk.gone { opacity: 0; transition-delay: 0s; }
/* opened: the wall parts where the taking starts (the dead wall stays put) */
.b-wall.broken .stk:first-child { margin-left: calc(var(--tw) * -0.6); }
.b-wall.broken .stk:nth-child(13) { margin-left: calc(var(--tw) * 0.6); }
/* a stack about to be taken: ring the whole stack, not just its top */
.b-wall .stk.cue { outline: 0; animation: none; }
.b-wall .stk.cue::before {
  outline: max(2px, 0.42cqw) solid color-mix(in srgb, var(--red) 85%, transparent);
  outline-offset: max(2px, 0.3cqw);
  animation: cue 1.8s var(--ease-soft) infinite;
}
.stk.next::after {
  --dot: max(5px, 1.2cqw);
  content: "";
  position: absolute;
  left: 50%;
  top: calc(-0.7cqw - var(--dot));
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background: var(--red);
  translate: -50% 0;
  animation: next-dot 2.2s var(--ease-soft) infinite;
}
@keyframes next-dot { 50% { translate: -50% -0.5cqw; opacity: 0.55; } }

/* hands: yours face up, the others' as a row of tile-tops */
.b-hand, .b-rack {
  position: absolute;
  left: calc(50% - 40cqw);
  display: flex;
  align-items: flex-end;
}
.b-hand { top: calc(50% + var(--hand-y)); gap: 0.15cqw; }
.b-hand .tile.drawn { margin-left: 1.3cqw; }
.b-hand .tile.lift { translate: 0 calc(var(--th) * -0.24); }
.b-rack { left: calc(50% - 26cqw); top: calc(50% + var(--a) + 3.6cqw); gap: 0.35cqw; transition: translate 0.6s var(--ease); }
.b-rack i {
  width: calc(var(--tw) * 0.9);
  height: calc(var(--tw) * (var(--tile-depth) * 4));
  border-radius: calc(var(--tw) * var(--tile-radius) * 0.9);
  background: linear-gradient(var(--tile-back) 0 46%, var(--tile-face) 46%);
  box-shadow: 0 1px 1.5px rgba(60, 40, 15, 0.2);
}
.b-rack i.drawn { margin-left: 1.3cqw; }
.b-side.on .b-rack { translate: 0 -0.7cqw; }

/* called sets, from your right-hand corner inwards */
.b-melds {
  position: absolute;
  right: calc(50% - 46cqw);
  top: calc(50% + var(--hand-y));
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 1.2cqw;
}
.b-meld { position: relative; display: flex; align-items: flex-end; gap: 0.15cqw; transition: translate 0.6s var(--ease); }
.b-meld.pending { translate: 0 calc(-1 * (var(--th) + 2.6cqw)); }
.b-meld .tile.slot { outline-width: max(1px, 0.25cqw); }

.b-callout {
  position: absolute;
  right: calc(100% + 1.6cqw);
  bottom: 22%;
  font-size: 3.4cqw;
  line-height: 1;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: var(--red);
  pointer-events: none;
  animation: callout 0.7s cubic-bezier(.2,1.4,.4,1) 0.25s both;
}
@keyframes callout {
  from { opacity: 0; scale: 0.4; rotate: -10deg; }
  to { opacity: 1; scale: 1; rotate: -4deg; }
}

/* a riichi stick, just inside the middle on your side */
.b-stick {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(50% + var(--C) / 2 - 7.2cqw);
  width: 12cqw;
  height: 1.3cqw;
  translate: -50% 0;
  border-radius: 1cqw;
  background: linear-gradient(#fffdf8, #ede5d6);
  box-shadow: 0 0.25cqw 0 #dcd2bf, 0 0.6cqw 1.4cqw rgba(60, 40, 15, 0.16);
  opacity: 0;
  scale: 0.85;
  transition: opacity 0.5s var(--ease), scale 0.6s var(--ease), translate 0.6s var(--ease);
}
.b-stick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.7cqw;
  height: 0.7cqw;
  border-radius: 50%;
  background: var(--red);
  translate: -50% -50%;
}
.b-stick.on { opacity: 1; scale: 1; }
.board.locked .b-hand .tile { filter: saturate(0.82) brightness(0.98); }

/* a won hand, laid out in its sets */
.b-group { display: flex; align-items: flex-end; gap: 0.15cqw; margin-right: 1.1cqw; }

/* "closed" over your hand, "open" over your called sets */
.b-label {
  position: absolute;
  top: calc(50% + var(--hand-y) - 2.6cqw);
  font: 500 max(8px, 1.25cqw) / 1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  opacity: 0;
  translate: 0 0.6cqw;
  transition: opacity 0.6s var(--ease), translate 0.6s var(--ease);
}
.b-label.closed { left: calc(50% - 40cqw); }
.b-label.open { right: calc(50% - 46cqw); color: var(--red); }
.board.labels .b-label { opacity: 1; translate: 0 0; }

.b-callout.free {
  right: auto;
  bottom: auto;
  left: calc(50% + 15cqw);
  top: calc(50% + var(--hand-y) - 6.4cqw);
  animation: none;
  opacity: 0;
}
.b-callout.free.on { animation: callout 0.7s cubic-bezier(.2,1.4,.4,1) 0.15s both; }

/* things in flight between places */
.b-fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.b-fx > * { position: absolute; left: 0; top: 0; margin: 0; will-change: transform; }

.ts-wrap .seat-label { transition: color 0.5s var(--ease), opacity 0.6s var(--ease); }

/* the first look at the table: N E S W, big and upright */
.cmp {
  position: absolute;
  z-index: 2;
  display: grid;
  justify-items: center;
  font: 330 clamp(28px, 3.6vw, 44px)/1 var(--serif);
  color: var(--ink-2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.cmp small { font: 500 10px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-top: 8px; }
.cmp.dealer { color: var(--red); }
/* "East is the dealer": a red line under the E */
.cmp.dealer::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%;
  top: calc(100% + 2px);
  height: 1.5px;
  border-radius: 1px;
  background: var(--red);
  scale: 0 1;
  transition: scale 0.6s var(--ease);
}
.ts-wrap.cue-dealer .cmp.dealer::after { scale: 1 1; transition-delay: 0.3s; }
.ts-wrap.cue-dealer .cmp.dealer small { translate: 0 4px; }
.cmp small { transition: translate 0.6s var(--ease); }
/* just outside the table's edge, where each player sits */
.c0 { left: 50%; top: calc(100% - var(--wp) + 12px); translate: -50% 0; }
.c1 { left: calc(100% - var(--wp) + 10px); top: 50%; translate: 0 -50%; }
.c2 { left: 50%; bottom: calc(100% - var(--wp) + 12px); translate: -50% 0; }
.c3 { right: calc(100% - var(--wp) + 10px); top: 50%; translate: 0 -50%; }
.cmp small { position: absolute; top: 100%; }
/* a phone has no room beside the table: east and west sit just inside it */
@media (max-width: 560px) {
  .c1 { left: auto; right: calc(var(--wp) + 10px); }
  .c3 { right: auto; left: calc(var(--wp) + 10px); }
}
.ts-wrap.compass .cmp { opacity: 1; transition-delay: 0.15s; }
.ts-wrap.compass .seat-label, .ts-wrap.compass .wind { opacity: 0; }
@media (max-width: 560px) {
  .ts-sticky { align-content: start; padding-top: max(64px, 9svh); }
  .ts-wrap { --wp: 22px; }
  .ts-wrap .seat-label { font-size: 9px; letter-spacing: 0.1em; }
}

/* ------------------------------------------------------------------ */
/* Chapter three, and the extras                                       */
/* ------------------------------------------------------------------ */

.lead-sm { font-size: clamp(21px, 2.6vw, 25px); line-height: 1.25; font-weight: 360; }

/* "closed only", in a soft red */
.closed-tag { color: color-mix(in srgb, var(--red) 80%, var(--ink-3)); }
.tags .closed-tag { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 28%, transparent); }
.y-han small.closed-tag { color: color-mix(in srgb, var(--red) 75%, var(--ink-3)); }
.tags .jp { font-size: 0.95em; letter-spacing: 0.04em; color: var(--ink-3); margin-left: 0.4em; }

/* two small hands, side by side, each with a label */
.pair-hands { display: grid; justify-items: center; gap: 22px; }
.pair-hands > div { display: grid; justify-items: center; gap: 12px; }
.pair-hands .hand { --tw: clamp(22px, 2.9vw, 32px); }

/* the list that crosses itself off */
.nope {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  text-align: left;
  width: min(100%, 560px);
}
.nope li {
  position: relative;
  display: grid;
  grid-template-columns: 6.2em 5.4em 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 2px 4px;
  font-size: 18px;
}
.nope li > span:last-child { color: var(--ink-2); font-size: 16px; }
.nope .jp { color: var(--ink-3); font-size: 13px; letter-spacing: 0.05em; }
.nope li::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0.8em;
  height: 1.6px;
  border-radius: 2px;
  background: var(--red);
  opacity: 0.75;
  transform: scaleX(0) rotate(-0.8deg);
  transform-origin: left center;
}
.nope.in li::after { animation: strike 0.55s cubic-bezier(.55,0,.25,1) calc(0.9s + var(--i) * 0.38s) forwards; }
.nope.in li { animation: struck 0.5s var(--ease) calc(1.1s + var(--i) * 0.38s) forwards; }
@keyframes strike { to { transform: scaleX(1) rotate(-0.8deg); } }
@keyframes struck { to { color: var(--ink-3); } }
@media (max-width: 560px) {
  .nope li { grid-template-columns: 1fr auto; row-gap: 2px; }
  .nope li > span:last-child { grid-column: 1 / -1; }
}

/* caption extras inside the table scenes */
.ts-line .tags { display: flex; margin: 14px 0 10px; justify-content: inherit; }
.ts-stage.side .ts-line .tags { justify-content: flex-start; }
.ts-line .deeper { display: inline-block; font-size: 16px; }

/* links into the deeper notes, and back */
a.deeper, a.back {
  color: var(--ink-2);
  font-style: italic;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  transition: color 0.3s, border-color 0.3s;
}
a.deeper::after { content: " →"; font-style: normal; color: var(--red); }
a.deeper:hover, a.back:hover { color: var(--ink); border-color: var(--red); }

/* dora */
.dora-main { display: flex; align-items: center; gap: 18px; }
.dora-pair { display: grid; justify-items: center; gap: 14px; }
.dora-pair .hand { --tw: clamp(38px, 5vw, 50px); }
.dora-arrow, .dora-wrap { color: var(--ink-3); font-size: 20px; }
.dora-arrow { margin-bottom: 30px; }
.dora-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 30px; }
.dora-wrap > span { display: inline-flex; align-items: center; gap: 6px; }
.dora-wrap .inline-tiles { --tw: 26px; }

/* points ladder */
.ladder {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  width: min(100%, 560px);
  text-align: left;
}
.ladder li {
  display: grid;
  grid-template-columns: 9.5em 1fr 4.6em;
  align-items: center;
  gap: 14px;
  font-size: 16px;
}
.ladder b { font-weight: 450; }
.ladder b em { font-weight: 400; color: var(--ink-3); }
.ladder i {
  height: 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  width: calc(var(--w) * 100%);
  transform-origin: left;
}
.ladder .cap i { background: color-mix(in srgb, var(--red) 55%, transparent); }
.ladder span { font: 500 13px/1 var(--sans); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.in .ladder i, .ladder.in i { animation: grow 1s var(--ease) both; }
.ladder li:nth-child(n) i { animation-delay: calc(0.3s + var(--w) * 0.5s); }
@keyframes grow { from { transform: scaleX(0); } }
@media (max-width: 560px) { .ladder li { grid-template-columns: 7.6em 1fr 4.2em; gap: 10px; font-size: 15px; } }

/* reading discards */
.ranges { display: grid; justify-items: center; gap: 22px; }
.ranges-pond { display: grid; gap: 6px; --tw: clamp(26px, 3.4vw, 34px); }
.ranges-pond .hand { --tw: inherit; justify-content: flex-start; }
.ranges-grid {
  display: grid;
  grid-template-columns: auto repeat(3, 64px);
  gap: 6px;
  align-items: center;
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ranges-grid .h { text-align: center; }
.ranges-grid .s { text-align: right; padding-right: 8px; }
.ranges-grid .c {
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: inset 0 0 0 1px var(--line);
  background: rgba(255, 255, 255, 0.3);
}
.ranges-grid .c i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.ranges-grid .c.none {
  color: var(--red);
  font: 400 15px/1 var(--serif);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 35%, transparent);
  background: color-mix(in srgb, var(--red) 6%, transparent);
}

/* the deeper notes */
.notes { display: grid; gap: 14px; width: min(100%, 640px); text-align: left; }
.note {
  padding: 22px 24px 20px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  gap: 10px;
  color: var(--ink-2);
  font-size: 17px;
  scroll-margin-top: 80px;
}
.note h4 { margin: 0; font-size: 21px; font-weight: 420; color: var(--ink); }
.note ul { margin: 0; padding-left: 1.1em; display: grid; gap: 4px; }
.note b { font-weight: 560; color: var(--ink); }
.note .back { justify-self: start; font-size: 15px; }
.note.arrived { animation: arrived 2.4s var(--ease-soft); }
@keyframes arrived { 0%, 40% { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--red) 45%, transparent); } }

/* glossary */
.glossary { margin: 0; width: min(100%, 720px); display: grid; text-align: left; }
.glossary > div {
  display: grid;
  grid-template-columns: 11em 1fr;
  gap: 18px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.glossary dt { font-size: 18px; }
.glossary dt .jp { font-size: 12px; color: var(--ink-3); margin-left: 6px; letter-spacing: 0.04em; }
.glossary dd { margin: 0; color: var(--ink-2); font-size: 16.5px; }
@media (max-width: 560px) { .glossary > div { grid-template-columns: 1fr; gap: 3px; } }
