/* Pack. A glazed tile grid on a deep green felt: seven by seven wells, blocks in five calm glazes
   (sage, sea, clay, lilac, straw) with a soft diagonal sheen and a darker lower lip, no numerals.
   The page tokens (--bg, --ink, --gold and friends) are set inline by the Function; the glazes
   come from rules.js (GLAZES) as .pk-g1 to .pk-g5 { --gf, --ge }.
   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 motion, none when asked for less. */

:root { --pk-felt: #0f1915; --pk-felt-2: #13201b; --pk-well: rgba(196, 232, 210, 0.05); --pk-fit: #86d9a6; }
: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; }

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

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

/* ---- the glazed tile, shared by the grid, the tray, the float and the demo ---- */
.pk-tile {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 22%;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.08) 38%, rgba(255, 255, 255, 0) 55%), var(--gf);
  box-shadow: inset 0 -0.16em 0 var(--ge), inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 1px 1.5px rgba(0, 0, 0, 0.45), 0 4px 10px -6px rgba(0, 0, 0, 0.7);
}

/* ---- playing ---- */
/* The play area is a size container: the grid takes what the status, tray and tools leave, and
   the spare height goes to three gaps (a little above the grid, most between grid and tray). */
.pk-play { position: relative; flex: 1; min-height: 0; container-type: size; display: flex; flex-direction: column; padding: 0 0 max(8px, env(safe-area-inset-bottom)); touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
.pk-status { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px 0; }
.pk-status-l { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pk-lines { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.2; color: var(--ink); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.pk-lines.is-met { color: var(--pk-fit); }
.pk-left { margin: 0; font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pk-skip { 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 message line under the grid: an offer, a nudge, the goal reached. */
.pk-msg { flex: none; min-height: 24px; margin: 8px 0 0; font-size: 15.5px; line-height: 1.4; color: var(--ink-2); text-align: center; text-wrap: balance; }
.pk-msg.is-quiet { color: var(--muted); }
.pk-msg.is-gold { color: var(--gold); }

/* The goal as small wells that fill green, one per line. */
.pk-goal { display: inline-flex; flex-wrap: nowrap; gap: 3px; }
.pk-goal i { display: block; width: 9px; height: 9px; border-radius: 3px; background: rgba(241, 239, 233, 0.08); box-shadow: inset 0 0 0 1px rgba(241, 239, 233, 0.1); transition: background-color 260ms var(--ease), transform 260ms var(--ease); }
.pk-goal i.is-on { background: var(--pk-fit); box-shadow: none; }
.pk-goal i.is-extra.is-on { background: #b9e8c9; }
.pk-goal.is-big { gap: 6px; }
.pk-goal.is-big i { width: 26px; height: 26px; border-radius: 7px; }
.pk-goal.is-big i.is-on { background: linear-gradient(150deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%), var(--pk-fit); box-shadow: inset 0 -3px 0 #4f9a6d, 0 1px 2px rgba(0, 0, 0, 0.4); }
.pk-goal.is-tiny { gap: 2px; }
.pk-goal.is-tiny i { width: 7px; height: 7px; border-radius: 2px; }
@media (max-width: 380px) { .pk-goal i { width: 7px; height: 7px; } .pk-lines { font-size: 17px; } }

.pk-runbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 0; }
.pk-runtag { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.pk-target { margin: 0; font-size: 14px; font-weight: 500; color: var(--muted); transition: color 260ms var(--ease); }
.pk-target.is-gold { color: var(--gold); }

.pk-marks { flex: none; display: inline-flex; align-items: center; gap: 7px; }
.pk-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); }
.pk-marks i.is-done { background: var(--ink-2); box-shadow: none; }
.pk-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); }
.pk-marks i.is-now { box-shadow: inset 0 0 0 1.5px var(--ink-2); }
.pk-marks.is-small { gap: 8px; }
.pk-marks.is-small i { width: 8px; height: 8px; }
.pk-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); }

/* Spare height: small capped gaps between the parts, the rest split above and below the whole
   group, so the grid, the tray and the tools read as one game and nothing floats. */
.pk-play::before, .pk-play::after { content: ""; flex: 1 1 0; min-height: 0; }
.pk-play::before { flex-grow: 0.15; max-height: 16px; }
.pk-play::before { order: -1; }
.pk-gap { display: block; flex: 1 1 0; min-height: 8px; }
.pk-gap.a { max-height: 32px; }
.pk-gap.b { min-height: 12px; max-height: 40px; }
.pk-gap.c { min-height: 6px; max-height: 28px; }
.pk-stage { position: relative; flex: none; display: flex; justify-content: center; }

/* The grid: felt panel, wells, glazed tiles. Sizes inside are in the board's own units. */
.pk-board {
  position: relative;
  width: min(100cqw, calc(100cqh - 5 * var(--pk-m) - 4 * var(--pk-mg) - var(--pk-rest)), var(--gm-board, 520px));
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 2.6%;
  border-radius: 20px;
  background: radial-gradient(120% 90% at 30% 0%, var(--pk-felt-2), var(--pk-felt) 70%);
  border: 1px solid rgba(160, 214, 182, 0.1);
  box-shadow: inset 0 1px 0 rgba(220, 255, 235, 0.04), 0 26px 50px -30px rgba(0, 0, 0, 0.95), 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;
}
.is-replay .pk-board { --pk-rest: calc(var(--pk-rest-0) + 26px); }
/* Blocks in the tray stop growing past 26px a square, so a wide desktop column gives its height to the grid. */
.pk-play { container-name: pkplay; --pk-m: min(5.2cqw, 26px); --pk-mg: min(0.8cqw, 4px); --pk-rest-0: 222px; --pk-rest: var(--pk-rest-0); }
@media (hover: hover) and (pointer: fine) { .pk-play { --pk-rest-0: 240px; } }
/* A short desktop window (1024 by 768): slimmer tray blocks, so the grid keeps its size. */
@media (hover: hover) and (pointer: fine) and (max-height: 820px) { .pk-play { --pk-m: min(5.2cqw, 22px); --pk-mg: min(0.8cqw, 3px); --pk-rest-0: 226px; } }
/* Tall phones: bigger blocks in the tray, easier to grab, and no dead space. */
@container pkplay (min-height: 760px) and (max-width: 520px) {
  .pk-stage, .pk-traywrap { --pk-m: 6.4cqw; --pk-mg: 1cqw; }
}
.pk-board:focus-visible { outline: 1.5px solid rgba(134, 217, 166, 0.55); outline-offset: 5px; border-radius: 20px; }
.pk-grid { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); gap: 1.5cqw; width: 100%; height: 100%; font-size: 11cqw; }
.pk-cell { position: relative; display: block; border-radius: 22%; background: var(--pk-well); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(196, 232, 210, 0.03); }
.pk-cell > .pk-tile { position: absolute; inset: 0; }
.pk-cell.is-ghost, .pk-cell.is-hint { background: rgba(134, 217, 166, 0.26); box-shadow: inset 0 0 0 1.5px rgba(134, 217, 166, 0.8); }
.pk-cell.is-hint { background: rgba(134, 217, 166, 0.2); box-shadow: inset 0 0 0 1.5px rgba(134, 217, 166, 0.9), 0 0 14px -4px rgba(134, 217, 166, 0.6); }
.pk-cell.is-cursor { box-shadow: inset 0 0 0 1.5px rgba(241, 239, 233, 0.35); }
.pk-cell.is-glow > .pk-tile { filter: brightness(1.14) saturate(1.1); box-shadow: inset 0 -0.16em 0 var(--ge), inset 0 0 0 2px rgba(243, 212, 136, 0.9), 0 0 14px -2px rgba(232, 193, 105, 0.75); }
.pk-cell.is-glow.is-ghost { background: rgba(232, 193, 105, 0.34); box-shadow: inset 0 0 0 1.5px rgba(243, 212, 136, 0.95); }
.pk-cell.is-glow:not(.is-ghost):not(.is-hint):not(:has(.pk-tile)) { background: rgba(232, 193, 105, 0.12); }

/* The hint patch, and the idle glow (softer). */
.pk-spot { position: relative; z-index: 1; margin: -0.6cqw; border-radius: 3cqw; background: rgba(134, 217, 166, 0.07); box-shadow: 0 0 0 1.5px rgba(134, 217, 166, 0.55), 0 0 22px -6px rgba(134, 217, 166, 0.5); pointer-events: none; }
.pk-spot.is-soft { background: rgba(134, 217, 166, 0.04); box-shadow: 0 0 0 1px rgba(134, 217, 166, 0.3); }

/* Rescue: every row a quiet button while choosing. */
.pk-rowbtn { display: none; position: relative; z-index: 2; margin: -0.5cqw -1cqw; padding: 0; border: 0; border-radius: 2.4cqw; background: transparent; cursor: pointer; }
.pk-board.is-rescue .pk-rowbtn { display: block; }
.pk-board.is-rescue .pk-rowbtn:not([disabled]) { box-shadow: inset 0 0 0 1px rgba(232, 193, 105, 0.18); }
.pk-board.is-rescue .pk-rowbtn:not([disabled]):hover, .pk-board.is-rescue .pk-rowbtn:not([disabled]):focus-visible { background: rgba(232, 193, 105, 0.12); box-shadow: inset 0 0 0 1.5px rgba(232, 193, 105, 0.7); outline: none; }
.pk-board.is-rescue .pk-rowbtn[disabled] { cursor: default; }

.pk-banner .pk-stuck-t { color: var(--gold); }

.pk-veil { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; border-radius: 19px; background: rgba(10, 16, 13, 0.82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); text-align: center; }
.pk-veil p { max-width: 14em; margin: 0; font-family: var(--serif); font-size: 22px; line-height: 1.35; color: var(--ink); text-wrap: balance; }
.pk-veil .pk-veil-s { margin: 8px 0 16px; font-family: var(--sans); font-size: 16px; color: var(--ink-2); }
.pk-veil .gm-primary { min-width: 220px; }

/* ---- the tray: three blocks, big enough to grab ---- */
.pk-traywrap { flex: none; position: relative; container-type: inline-size; }
.pk-tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; height: calc(5 * var(--pk-m) + 4 * var(--pk-mg) + 18px); }
.pk-slot { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; padding: 0; border: 0; border-radius: 16px; background: rgba(241, 239, 233, 0.025); cursor: grab; touch-action: none; transition: background-color 180ms var(--ease), box-shadow 180ms var(--ease), transform 180ms var(--ease); }
.pk-slot:disabled { cursor: default; background: transparent; }
.pk-slot.is-held { background: rgba(134, 217, 166, 0.08); box-shadow: inset 0 0 0 1.5px rgba(134, 217, 166, 0.6); }
.pk-slot.is-held .pk-mini { transform: translateY(-3px) scale(1.04); }
.pk-slot.is-nofit .pk-mini { opacity: 0.32; filter: saturate(0.4); }
.pk-slot.is-lifted .pk-mini { opacity: 0.18; }
.pk-mini { display: grid; grid-template-columns: repeat(var(--w), var(--pk-m)); grid-template-rows: repeat(var(--h), var(--pk-m)); gap: var(--pk-mg); font-size: calc(var(--pk-m) * 0.77); transition: transform 180ms var(--ease), opacity 160ms var(--ease); }
.pk-mini .pk-tile { border-radius: 24%; }
@media (prefers-reduced-motion: no-preference) {
  .pk-mini.is-in { animation: pk-in 320ms var(--gm-quart) both; }
  .pk-slot.is-idle .pk-mini { animation: pk-breathe 2.4s ease-in-out infinite; }
  .pk-spot:not([hidden]) { animation: pk-glow 2.2s ease-in-out infinite; }
}
@keyframes pk-in { from { opacity: 0; transform: translateY(14px) scale(0.9); } }
@keyframes pk-breathe { 50% { transform: translateY(-3px) scale(1.06); } }
@keyframes pk-glow { 50% { opacity: 0.55; } }

.pk-stuck { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: calc(5 * var(--pk-m) + 4 * var(--pk-mg) + 18px); padding: 0 8px; text-align: center; }
.pk-stuck-t { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.3; color: var(--ink); }
.pk-stuck-s { margin: 0; font-size: 14px; line-height: 1.4; color: var(--muted); }
.pk-stuck-a { display: flex; gap: 10px; margin-top: 8px; }
.pk-small { min-height: 42px; padding: 0 20px; font-size: 15px; }
.pk-small[disabled] { opacity: 0.4; cursor: default; }

/* ---- the four quiet tools ---- */
.pk-tools { flex: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 6px 0 0; }
.pk-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 4px 2px; border: 0; border-radius: 12px; background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 600; line-height: 1.15; cursor: pointer; transition: color 160ms var(--ease), background-color 160ms var(--ease); }
@media (hover: hover) { .pk-tool:hover:not([disabled]) { color: var(--ink); background: rgba(241, 239, 233, 0.05); } }
.pk-tool:active:not([disabled]) { transform: scale(0.96); }
.pk-tool[disabled] { opacity: 0.32; cursor: default; }
.pk-tool.is-on { color: var(--gold); }
.pk-tool span { white-space: nowrap; }
.pk-tool { position: relative; }
.pk-tool.is-glow { color: var(--gold); }
.pk-tool::after { content: ""; position: absolute; inset: 2px 6px; border-radius: 12px; box-shadow: 0 0 0 1.5px var(--gold); opacity: 0; pointer-events: none; }
.pk-tool.is-glow::after { opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) { .pk-tool.is-glow::after { animation: pk-offer 1.4s ease-in-out infinite; } }
@keyframes pk-offer { 0%, 100% { opacity: 0.35; transform: scale(0.96); } 50% { opacity: 0.95; transform: scale(1); } }

/* Keyboard hints: desktop only. */
.pk-keys { display: none; flex: none; margin: 8px 0 0; font-size: 13.5px; line-height: 1.4; color: var(--muted); text-align: center; }
.pk-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); }
.pk-keys kbd:first-child { margin-left: 0; }
@media (hover: hover) and (pointer: fine) { .pk-keys { display: block; } }

/* The tour's hand: from the block to the gap, again and again. */
.pk-hand { position: absolute; z-index: 60; width: 56px; height: 56px; color: rgba(241, 239, 233, 0.92); pointer-events: none; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.8)); }
.pk-hand.is-tour { left: 0; top: 0; transform: translate(calc(var(--tx, 0px) - 27px), calc(var(--ty, 0px) - 9px)); }
@media (prefers-reduced-motion: no-preference) {
  .pk-hand.is-tour { animation: pk-hand 2.4s cubic-bezier(0.45, 0, 0.2, 1) infinite; }
  .pk-hand.is-tour.is-tap { animation: pk-tap 1.4s ease-in-out infinite; }
}
@keyframes pk-hand {
  0% { opacity: 0; transform: translate(calc(var(--fx) - 27px), calc(var(--fy) - 9px)); }
  14% { opacity: 0.95; transform: translate(calc(var(--fx) - 27px), calc(var(--fy) - 9px)); }
  62% { opacity: 0.95; transform: translate(calc(var(--tx) - 27px), calc(var(--ty) - 9px)); }
  80%, 100% { opacity: 0; transform: translate(calc(var(--tx) - 27px), calc(var(--ty) - 9px)); }
}
@keyframes pk-tap { 0%, 100% { transform: translate(calc(var(--tx) - 27px), calc(var(--ty) - 9px)); } 45% { transform: translate(calc(var(--tx) - 27px), calc(var(--ty) - 7px)) scale(0.9); } }

/* ---- the block in hand ---- */
.pk-float { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; will-change: transform; }
.pk-float-in { display: grid; grid-template-columns: repeat(var(--w), var(--c)); grid-template-rows: repeat(var(--h), var(--c)); gap: var(--gap); font-size: calc(var(--c) * 0.22); transform-origin: 50% 100%; transition: transform 140ms var(--gm-quart); filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.55)); }
.pk-float.is-back { transition: transform 180ms var(--gm-quart), opacity 180ms ease; opacity: 0.6; }

/* ---- motion: a block settles, a line sweeps away ---- */
@media (prefers-reduced-motion: no-preference) {
  .pk-tile.is-set { animation: pk-set 200ms var(--gm-quart) both; }
  .pk-tile.is-clear { position: absolute; inset: 0; animation: pk-clear 340ms cubic-bezier(0.4, 0, 0.2, 1) both; }
  .pk-board.is-fresh .pk-cell { animation: pk-fresh 420ms var(--gm-quart) both; }
  .pk-board.is-nudge { animation: pk-nudge 200ms ease-out; }
  .pk-veil { animation: pk-fade 260ms ease-out both; }
}
.pk-tile.is-clear { position: absolute; inset: 0; }
@keyframes pk-set { 0% { transform: scale(1.16); filter: brightness(1.25); } 100% { transform: scale(1); filter: brightness(1); } }
@keyframes pk-clear { 0% { transform: scale(1); opacity: 1; } 34% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(0.24); opacity: 0; } }
@keyframes pk-flash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0.6; } }
@keyframes pk-goal { 0% { box-shadow: inset 0 1px 0 rgba(220, 255, 235, 0.04), 0 0 0 0 rgba(232, 193, 105, 0.8); } 40% { box-shadow: inset 0 1px 0 rgba(220, 255, 235, 0.04), 0 0 0 4px rgba(232, 193, 105, 0.55), 0 0 40px 4px rgba(232, 193, 105, 0.3); } 100% { box-shadow: inset 0 1px 0 rgba(220, 255, 235, 0.04), 0 0 0 0 rgba(232, 193, 105, 0); } }
.pk-tile.is-clear::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 40% 35%, #fff4d6, #e8c169 55%, #b8913d); box-shadow: 0 0 14px 2px rgba(232, 193, 105, 0.6); opacity: 0; }
.pk-tile.is-clear.is-plain::after { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .pk-tile.is-clear::after { animation: pk-flash 340ms ease-out both; animation-delay: inherit; }
  .pk-board.is-goal { animation: pk-goal 1.1s cubic-bezier(0.25, 1, 0.5, 1) both; }
  .pk-board.is-goal .pk-goal i.is-on { animation: pk-pop 520ms var(--gm-quart) both; }
}
.pk-status .pk-goal i.is-on:last-child { transition: background-color 260ms var(--ease); }
@keyframes pk-fresh { from { opacity: 0.2; } }
@keyframes pk-nudge { 30% { transform: translateX(-3px); } 65% { transform: translateX(3px); } }
@keyframes pk-fade { from { opacity: 0; } }

/* ---- the finished run ---- */
.pk-res-art { margin: 0 0 18px; }
.pk-newbest { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  .pk-result.is-newbest .pk-goal.is-big i.is-on { animation: pk-pop 520ms var(--gm-quart) both; }
  .pk-result.is-newbest .pk-goal.is-big i:nth-child(2) { animation-delay: 50ms; }
  .pk-result.is-newbest .pk-goal.is-big i:nth-child(3) { animation-delay: 100ms; }
  .pk-result.is-newbest .pk-goal.is-big i:nth-child(4) { animation-delay: 150ms; }
  .pk-result.is-newbest .pk-goal.is-big i:nth-child(5) { animation-delay: 200ms; }
  .pk-result.is-newbest .pk-goal.is-big i:nth-child(n + 6) { animation-delay: 250ms; }
}
@keyframes pk-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1); } }
.pk-res-art .pk-goal { flex-wrap: wrap; }

.pk-runs { margin: 22px 0 0; }
.pk-marks-row { display: flex; align-items: flex-start; gap: 14px; }
.pk-marks-row .pk-marks { padding-top: 5px; }
.pk-runs-cap { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.pk-ladder { list-style: none; margin: 14px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); }
.pk-ladder li { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; min-height: 40px; }
.pk-ladder li + li { border-top: 1px solid rgba(241, 239, 233, 0.05); }
.pk-ladder-n { font-size: 14.5px; color: var(--muted); }
.pk-ladder-s { font-family: var(--serif); font-size: 18px; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; text-align: right; }
.pk-ladder li.is-best .pk-ladder-s { color: var(--ink); }
.pk-ladder li.is-best .pk-ladder-n { color: var(--gold); }

.pk-more-link { margin: 12px 0 0; }
.pk-share-preview { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(241, 239, 233, 0.035); border: 1px solid var(--line); font-family: var(--sans); font-size: 13.5px; line-height: 1.55; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.pk-note { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); overflow-wrap: anywhere; white-space: pre-line; }
.pk-note:empty { display: none; }

.pk-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pk-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; }
.pk-fig span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.3; color: var(--muted); }
.pk-fine { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---- the five second how to: a square drops into the gap, the row sweeps away ---- */
.pk-demo { width: min(100%, 280px); margin: 6px auto 8px; container-type: inline-size; }
.pk-demo-row { position: relative; height: 38cqw; }
.pk-demo-w, .pk-demo-t { position: absolute; top: 20cqw; width: 18cqw; height: 18cqw; }
.pk-demo-w { border-radius: 22%; background: var(--pk-well); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55); }
.pk-demo-row { font-size: 18cqw; }
.w0, .t0 { left: 0; } .w1, .t1 { left: 20.5cqw; } .w2, .drop { left: 41cqw; } .w3, .t3 { left: 61.5cqw; } .w4, .t4 { left: 82cqw; }
.pk-demo-t.drop { top: 0; }
.pk-demo-cap { margin: 0 0 4px; font-size: 14.5px; line-height: 1.5; color: var(--muted); text-align: center; }
.gm-sheet .pk-steps { margin-top: 14px; }
@media (prefers-reduced-motion: no-preference) {
  .pk-demo-t.drop { animation: pk-demo-drop 4.2s var(--gm-quart) infinite; }
  .pk-demo-t.t0, .pk-demo-t.t1, .pk-demo-t.t3, .pk-demo-t.t4 { animation: pk-demo-row 4.2s ease-out infinite; }
  .pk-demo-t.t1 { animation-delay: 30ms; } .pk-demo-t.t3 { animation-delay: 90ms; } .pk-demo-t.t4 { animation-delay: 120ms; }
}
@media (prefers-reduced-motion: reduce) { .pk-demo-t.drop { top: 20cqw; } }
@keyframes pk-demo-drop { 0%, 12% { transform: translateY(0); opacity: 0; } 18% { opacity: 1; } 34% { transform: translateY(20cqw); opacity: 1; } 44% { transform: translateY(20cqw) scale(1.06); opacity: 1; } 54%, 100% { transform: translateY(20cqw) scale(0.3); opacity: 0; } }
@keyframes pk-demo-row { 0%, 40% { transform: scale(1); opacity: 1; } 46% { transform: scale(1.06); opacity: 1; } 56% { transform: scale(0.3); opacity: 0; } 82% { transform: scale(0.8); opacity: 0; } 92%, 100% { transform: scale(1); opacity: 1; } }

/* ---- how to play: three steps, real tiles and wells ---- */
.pk-how { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.pk-how li { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 16px; }
.pk-how li p { margin: 0; font-size: 16.5px; line-height: 1.45; color: var(--ink); }
.pk-howdemo { position: relative; width: 112px; aspect-ratio: 1; border-radius: 14px; background: radial-gradient(120% 90% at 30% 0%, var(--pk-felt-2), var(--pk-felt) 70%); border: 1px solid rgba(160, 214, 182, 0.1); container-type: inline-size; overflow: hidden; }
.pk-dgrid { position: absolute; inset: 7cqw; display: grid; grid-template-columns: repeat(var(--n), 1fr); grid-template-rows: repeat(var(--n), 1fr); gap: 2.6cqw; font-size: 9cqw; }
.pk-dwell { position: relative; border-radius: 22%; background: var(--pk-well); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55); }
.pk-dwell > .pk-tile { position: absolute; inset: 0; }
.pk-dblock { position: absolute; display: grid; grid-template-columns: repeat(var(--w), 19.6cqw); grid-template-rows: repeat(var(--h), 19.6cqw); gap: 2.6cqw; font-size: 9cqw; }
/* step one: the corner block lands on columns 2 and 3 of rows 2 and 3 */
.pk-dblock.d1 { left: calc(7cqw + 22.2cqw); top: calc(7cqw + 22.2cqw); }
.pk-howdemo .pk-hand { width: 34px; height: 34px; }
/* In the kit's How to play box (184px tall): the same demo, a little larger. */
.kt-demo .pk-howdemo { width: 160px; }
.kt-demo .pk-howdemo .pk-hand { width: 46px; height: 46px; }
/* The goal, the runs and the stats under the kit's result. */
.pk-extra { margin: 26px 0 0; }
.pk-hand.is-d1 { left: 50%; top: 58%; opacity: 0; }
/* step two: one square fills the gap in row 2, the row flashes and clears */
.pk-dblock.d2 { left: calc(7cqw + 2 * 22.2cqw); top: calc(7cqw + 22.2cqw); }
/* step three: the goal fills */
.pk-dgoal { position: absolute; left: 0; right: 0; top: 38cqw; display: flex; justify-content: center; gap: 4cqw; }
.pk-dgoal i { width: 13cqw; height: 13cqw; border-radius: 3.6cqw; background: rgba(241, 239, 233, 0.08); box-shadow: inset 0 0 0 1px rgba(241, 239, 233, 0.12); }
.pk-dgoal-t { position: absolute; left: 0; right: 0; top: 60cqw; text-align: center; font-size: 11cqw; color: var(--muted); }
.pk-fold { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 4px; }
.pk-fold summary { min-height: 44px; display: flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  .pk-dblock.d1 { animation: pk-d1 3.6s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .pk-hand.is-d1 { animation: pk-d1-hand 3.6s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .pk-dblock.d2 { animation: pk-d2 3.6s cubic-bezier(0.25, 1, 0.5, 1) infinite; }
  .pk-dgrid.d2 .pk-dwell:nth-child(n + 5):nth-child(-n + 8) > .pk-tile { animation: pk-d2-row 3.6s ease-out infinite; }
  .pk-dgoal i { animation: pk-d3 3.6s ease-out infinite; animation-delay: calc(var(--i) * 0.22s); }
}
@media (prefers-reduced-motion: reduce) {
  .pk-howdemo .pk-hand { display: none; }
  .pk-dblock.d2 { opacity: 0; }
  .pk-dgrid.d2 .pk-dwell:nth-child(n + 5):nth-child(-n + 8) > .pk-tile { opacity: 0; }
  .pk-dgoal i { background: var(--pk-fit); box-shadow: none; }
}
@keyframes pk-d1 { 0%, 8% { transform: translate(14cqw, 70cqw) scale(0.7); opacity: 0; } 16% { opacity: 1; transform: translate(14cqw, 60cqw) scale(0.8); } 46% { transform: translate(0, -4cqw) scale(1.02); opacity: 1; } 54%, 88% { transform: translate(0, 0) scale(1); opacity: 1; } 96%, 100% { transform: translate(0, 0) scale(1); opacity: 0; } }
@keyframes pk-d1-hand { 0%, 8% { transform: translate(-6cqw, 52cqw); opacity: 0; } 16% { opacity: 0.95; transform: translate(-6cqw, 48cqw); } 46% { transform: translate(-14cqw, -8cqw); opacity: 0.95; } 58%, 100% { transform: translate(-14cqw, -8cqw); opacity: 0; } }
@keyframes pk-d2 { 0%, 10% { transform: translateY(-34cqw); opacity: 0; } 18% { opacity: 1; } 34% { transform: translateY(0); opacity: 1; } 46% { transform: scale(1.08); opacity: 1; filter: brightness(1.4); } 58%, 100% { transform: scale(0.2); opacity: 0; } }
@keyframes pk-d2-row { 0%, 38% { transform: scale(1); opacity: 1; filter: none; } 46% { transform: scale(1.08); opacity: 1; filter: sepia(1) saturate(2.4) brightness(1.25); } 58% { transform: scale(0.2); opacity: 0; } 84% { transform: scale(0.8); opacity: 0; } 94%, 100% { transform: scale(1); opacity: 1; filter: none; } }
@keyframes pk-d3 { 0%, 8% { background: rgba(241, 239, 233, 0.08); transform: scale(1); } 14%, 70% { background: var(--pk-fit); box-shadow: none; transform: scale(1); } 78% { background: var(--gold); transform: scale(1.12); } 88%, 100% { background: rgba(241, 239, 233, 0.08); transform: scale(1); } }

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

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

/* A phone on its side (844 by 390): the grid takes the left half at full height, the lines, the
   tray and the tools stack in the right half. Without this the grid had no height left at all. */
@media (orientation: landscape) and (max-height: 500px) {
  .pk { max-width: 800px; }
  .pk-play { flex-flow: column wrap; justify-content: center; align-content: center; column-gap: 28px; --pk-m: 20px; --pk-mg: 3px; }
  .pk-play::before, .pk-play::after, .pk-play > .pk-gap { display: none; }
  .pk-play > .pk-stage { order: -1; flex: 0 0 100%; width: calc(50% - 14px); align-items: center; }
  .pk-play > :not(.pk-stage, .pk-hand, .sr) { width: calc(50% - 14px); }
  .pk-board, .is-replay .pk-board { width: min(calc(100cqh - 16px), calc(50cqw - 14px), var(--gm-board, 520px)); }
  .pk-status { padding-top: 0; }
  .pk-msg { margin: 4px 0 6px; }
  .pk-tools { padding-top: 4px; }
  .pk-tool { min-height: 48px; }
}
