/* Remix pack for the ages-4–5 set: the boards js/remix-little.js draws.
   ------------------------------------------------------------------------
   House rules, kept from css/style.css: every size is a clamp() or a
   min() of the viewport so a phone on its side and an iPad both fit without
   scrolling; targets are big (44px at the very least); animations are short,
   run once as a thing lands, and are switched off under
   prefers-reduced-motion at the foot of the file. Every class is `lil-`.
   Colours lean on the theme variables (--gold, --gold-deep, --ink,
   --parchment, --green, --red) so the boards wear whichever game they are in. */

/* ================================================================ shared */
@keyframes lil-pop {
  0% { transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(1); }
  45% { transform: translate(-50%, -50%) rotate(0deg) scale(1.22); }
  100% { transform: translate(-50%, -50%) rotate(0deg) scale(1.06); }
}
@keyframes lil-shake-abs {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--r, 0deg)); }
  25% { transform: translate(calc(-50% - 7px), -50%) rotate(var(--r, 0deg)); }
  75% { transform: translate(calc(-50% + 7px), -50%) rotate(var(--r, 0deg)); }
}
@keyframes lil-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
@keyframes lil-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 201, 74, 0.95); }
  50% { box-shadow: 0 0 0 12px rgba(255, 201, 74, 0); }
}
@keyframes lil-in {
  from { opacity: 0; transform: scale(0.6); }
}
@keyframes lil-bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-14px); }
}

.stage-board .stimulus > .lil-board {
  flex: 1 1 auto;
}

/* The stage panel shrink-wraps its content (its percentage width is cyclic
   inside the play screen's auto grid column), so a board says how wide it
   wants to be rather than asking for 100%. */
.lil-board {
  width: min(700px, 86vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(4px, 1.2vh, 12px);
  min-height: 0;
}

.lil-board button {
  font-family: inherit;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.lil-shake {
  animation: lil-shake 0.42s ease;
}

.lil-glow {
  animation: lil-glow 1s ease-in-out infinite !important;
  border-color: var(--gold-deep) !important;
}

/* The thing being looked for, shown at the top of a hunt. */
.lil-head {
  display: flex;
  justify-content: center;
}

.lil-card-letter,
.lil-card-word,
.lil-card-pic {
  display: inline-block;
  background: #fff;
  border: 4px solid var(--gold-deep);
  border-radius: 18px;
  padding: 0.05em 0.55em;
  line-height: 1.1;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.14);
}

.lil-card-letter {
  font-size: clamp(1.6rem, min(7vw, 7.5vh), 3rem);
  letter-spacing: 0.12em;
  color: var(--gold-deep);
}

.lil-card-word {
  font-size: clamp(1.5rem, min(6.5vw, 7vh), 2.8rem);
  letter-spacing: 0.06em;
}

.lil-card-pic {
  font-size: clamp(1.6rem, min(7vw, 7.5vh), 3rem);
}

/* ================================================================ fields */
/* A scene to hunt through: things placed on a jittered grid by the script,
   which also sets --s, the size each thing should be. */
.lil-field {
  position: relative;
  width: 100%;
  height: clamp(118px, 40vh, 330px);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.75), transparent 38%),
    linear-gradient(180deg, #e3f6ff 0%, #f6fbe9 62%, #dff3c8 100%);
  border: 4px solid var(--parchment-edge);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  --s: 64px;
}

.lil-hw .lil-field {
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 255, 255, 0.28) 46px 50px),
    linear-gradient(180deg, #eef1f5 0%, #dfe4ea 100%);
}

.lil-spot {
  position: absolute;
  width: var(--s);
  height: var(--s);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: calc(var(--s) * 0.66);
  line-height: 1;
  background: rgba(255, 255, 255, 0.82);
  border: 3px solid rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: opacity 0.25s ease, border-color 0.2s ease, background 0.2s ease;
}

.lil-spot:active:not(:disabled) {
  transform: translate(-50%, calc(-50% + 3px)) rotate(var(--r, 0deg));
}

.lil-spot:disabled {
  cursor: default;
}

.lil-spot.lil-found {
  border-color: var(--green);
  background: #dcf8e6;
  animation: lil-pop 0.42s ease forwards;
}

.lil-spot.lil-found::after {
  content: '✓';
  position: absolute;
  right: -6%;
  top: -6%;
  width: 36%;
  height: 36%;
  min-width: 18px;
  min-height: 18px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: max(12px, calc(var(--s) * 0.22));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.lil-spot.lil-nope {
  animation: lil-shake-abs 0.4s ease;
  opacity: 0.3;
  filter: grayscale(0.9);
}

.lil-spot.lil-glow {
  animation: lil-glow 1s ease-in-out infinite;
}

/* One star for each thing still to find. */
.lil-pips {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.lil-pip {
  width: clamp(18px, 3.6vh, 28px);
  height: clamp(18px, 3.6vh, 28px);
  border-radius: 50%;
  border: 3px dashed var(--parchment-edge);
  background: rgba(255, 255, 255, 0.6);
}

.lil-pip.on {
  border: 3px solid var(--gold-deep);
  background: radial-gradient(circle at 35% 35%, #fff4b8, var(--gold));
  animation: lil-in 0.3s ease;
}

/* ---------------------------------------------------------------- bubbles */
.lil-bubbles .lil-field {
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(180deg, #bfe9ff 0%, #8fd3f5 100%);
}

.lil-bubbles .lil-spot {
  background: radial-gradient(circle at 32% 28%, #ffffff 0 14%, rgba(255, 255, 255, 0.55) 15% 40%, rgba(185, 232, 255, 0.55) 70%, rgba(255, 255, 255, 0.9) 100%);
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 10px rgba(24, 90, 140, 0.25);
}

.lil-bub {
  font-size: calc(var(--s) * 0.56);
  font-weight: bold;
  color: #1d3f6e;
  font-family: "Andika", "Century Gothic", "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
}

.lil-bubbles .lil-spot.lil-found {
  background: radial-gradient(circle at 32% 28%, #fff 0 14%, #d6ffe4 40%, #9fe8b9 100%);
}

/* ------------------------------------------------------------- tap count */
.lil-tapcount .lil-spot {
  background: rgba(255, 255, 255, 0.9);
}

.lil-lined {
  height: clamp(100px, 26vh, 190px);
}

.lil-spot.lil-counted {
  border-color: var(--gold-deep);
  background: #fff6d8;
}

.lil-badge {
  position: absolute;
  right: -10%;
  top: -12%;
  min-width: max(22px, calc(var(--s) * 0.42));
  height: max(22px, calc(var(--s) * 0.42));
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold-deep);
  color: #fff;
  font-size: max(13px, calc(var(--s) * 0.28));
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
  animation: lil-in 0.25s ease;
  transform: rotate(calc(var(--r, 0deg) * -1));
}

/* ================================================================== feed */
.lil-feed {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(8px, 3vw, 28px);
}

.lil-feed-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lil-hero {
  font-size: clamp(2.2rem, min(10vw, 11vh), 4.4rem);
  line-height: 1;
}

.lil-happy .lil-hero {
  animation: lil-bounce 0.5s ease 2;
}

.lil-bowl {
  position: relative;
  width: clamp(120px, min(32vw, 34vh), 220px);
  height: clamp(66px, min(17vw, 18vh), 118px);
  border-radius: 12px 12px 50% 50% / 12px 12px 100% 100%;
  background: linear-gradient(180deg, #e2574c, #b83a31);
  border: 4px solid #8f2a23;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.lil-hw .lil-bowl {
  border-radius: 12px;
  background: repeating-linear-gradient(135deg, #2b2f36 0 12px, #ffc93c 12px 24px);
  border-color: #1d2026;
}

.lil-bowl-num {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  min-width: 1.4em;
  padding: 0 0.2em;
  font-size: clamp(1.6rem, min(7vw, 7.5vh), 2.8rem);
  font-weight: bold;
  line-height: 1.1;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border-radius: 14px;
  border: 3px solid var(--gold-deep);
}

/* What is in the bowl sits on top of it, in a heap. */
.lil-bowl-items {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 72%;
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: center;
  gap: 0 2px;
}

.lil-treat {
  width: clamp(44px, min(10vw, 10.5vh), 64px);
  height: clamp(44px, min(10vw, 10.5vh), 64px);
  font-size: clamp(1.5rem, min(6.4vw, 6.8vh), 2.4rem);
  line-height: 1;
  padding: 0;
  border-radius: 16px;
  border: 3px solid var(--parchment-edge);
  background: #fffdf6;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.14);
  cursor: pointer;
  animation: lil-in 0.2s ease;
}

.lil-bowl-items .lil-treat {
  width: auto;
  height: auto;
  border: 0;
  background: none;
  box-shadow: none;
  font-size: clamp(1.1rem, min(4.8vw, 5vh), 1.8rem);
  margin: 0 -1px;
}

.lil-bowl-items.lil-many .lil-treat {
  font-size: clamp(0.95rem, min(3.8vw, 4vh), 1.4rem);
}

.lil-pantry {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: clamp(4px, 1.2vw, 10px);
  padding: clamp(6px, 1.4vw, 12px);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
  border: 3px dashed var(--parchment-edge);
}

.lil-tally {
  font-size: clamp(1rem, 3.2vh, 1.4rem);
  font-weight: bold;
  min-width: 2em;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 0 0.6em;
}

.lil-done[disabled] {
  opacity: 0.5;
}

/* =================================================================== park */
.lil-lot {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  width: min(100%, 560px);
  padding: clamp(6px, 1.4vw, 12px);
  border-radius: 18px;
  background: linear-gradient(180deg, #5c6470, #474e58);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
}

.lil-bay {
  height: clamp(62px, min(18vw, 22vh), 120px);
  padding: 0;
  border: 0;
  border-left: 4px solid #f5f5f5;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.lil-bay:nth-child(5n) {
  border-right: 4px solid #f5f5f5;
}

.lil-ten .lil-bay {
  height: clamp(50px, min(13vw, 14vh), 92px);
}

.lil-ten .lil-bay:nth-child(-n + 5) {
  border-bottom: 4px dashed rgba(255, 255, 255, 0.5);
}

/* An empty space says so with a big P painted on the ground. */
.lil-bay:empty::before {
  content: 'P';
  font-size: clamp(1.4rem, min(5vw, 6vh), 2.4rem);
  font-weight: bold;
  color: rgba(255, 255, 255, 0.28);
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  width: 1.4em;
  height: 1.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lil-car {
  font-size: clamp(1.8rem, min(8vw, 9vh), 3.4rem);
  line-height: 1;
}

.lil-ten .lil-car {
  font-size: clamp(1.4rem, min(6vw, 7vh), 2.6rem);
}

.lil-car.lil-was {
  opacity: 0.72;
  filter: saturate(0.6);
}

.lil-car.lil-new {
  border-radius: 14px;
  padding: 2px 4px;
  background: rgba(255, 201, 74, 0.35);
  box-shadow: 0 0 0 3px var(--gold);
  animation: lil-drive 0.35s ease-out;
}

@keyframes lil-drive {
  from { transform: translateY(40%); opacity: 0; }
}

.lil-lot.lil-full {
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2), 0 0 0 5px var(--green);
}

/* ================================================================ seesaw */
.lil-seesaw {
  position: relative;
  width: min(100%, 580px);
  height: clamp(118px, 36vh, 250px);
}

.lil-beam {
  --tilt: 0deg;
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 34%;
  height: clamp(10px, 2vh, 16px);
  border-radius: 999px;
  background: linear-gradient(180deg, #c98b4f, #8b5a2b);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  transform: rotate(var(--tilt));
  transform-origin: 50% 50%;
  transition: transform 0.55s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.lil-pan {
  position: absolute;
  bottom: 100%;
  width: 44%;
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: center;
  align-content: flex-start;
  gap: 1px 2px;
  padding-bottom: 2px;
}

.lil-pan-l {
  left: 0;
}

.lil-pan-r {
  right: 0;
}

.lil-weight {
  font-size: clamp(1.3rem, min(5.4vw, 6.4vh), 2.3rem);
  line-height: 1;
  padding: 0;
  border: 0;
  background: none;
  animation: lil-in 0.2s ease;
}

button.lil-weight {
  cursor: pointer;
  border-radius: 12px;
  outline: 3px dashed rgba(226, 87, 76, 0.45);
  outline-offset: -2px;
  min-width: 44px;
  min-height: 44px;
}

.lil-weight.lil-gone {
  transform: translateY(-30px) scale(0.4);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.lil-fulcrum {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: clamp(54px, 12vw, 90px);
  height: 34%;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}

.lil-pan-num {
  position: absolute;
  bottom: 2%;
  font-size: clamp(1.1rem, 4vh, 1.8rem);
  font-weight: bold;
  min-width: 1.8em;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  border: 3px solid var(--parchment-edge);
}

.lil-num-l {
  left: 10%;
}

.lil-num-r {
  right: 10%;
}

.lil-seesaw.lil-level .lil-pan-num {
  border-color: var(--green);
  background: #dcf8e6;
}

.lil-seesaw.lil-level .lil-beam {
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(46, 168, 106, 0.6);
}

.lil-seesaw.lil-glow {
  border-radius: 20px;
}

.lil-add-btn {
  font-size: clamp(1.2rem, 4vw, 1.7rem);
}

/* ================================================================ stones */
.lil-pond {
  background:
    radial-gradient(ellipse at 30% 30%, rgba(255, 255, 255, 0.35), transparent 40%),
    linear-gradient(90deg, #9fd67a 0 9%, #5bb6e8 9% 91%, #9fd67a 91% 100%);
}

.lil-hw .lil-pond {
  background: linear-gradient(90deg, #d8dde3 0 9%, #3b414b 9% 91%, #d8dde3 91% 100%);
}

.lil-stone {
  position: absolute;
  width: var(--s);
  height: calc(var(--s) * 0.82);
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  padding: 0;
  border-radius: 46% 54% 50% 50% / 55% 50% 50% 45%;
  border: 3px solid #6f7680;
  background: radial-gradient(circle at 35% 30%, #f2f3f5, #b7bdc6);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.lil-hw .lil-stone {
  border-radius: 14px;
  background: radial-gradient(circle at 35% 30%, #fff, #ffd98a);
  border-color: var(--gold-deep);
}

.lil-stone b {
  display: inline-block;
  font-size: calc(var(--s) * 0.46);
  transform: rotate(calc(var(--r, 0deg) * -1));
}

.lil-stone.lil-shake {
  animation: lil-shake-abs 0.42s ease;
}

.lil-stone.lil-stepped {
  background: radial-gradient(circle at 35% 30%, #fff, #bdf0cf);
  border-color: var(--green);
}

.lil-hopper,
.lil-goal {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: calc(var(--s) * 0.62);
  line-height: 1;
  pointer-events: none;
}

.lil-hopper {
  z-index: 2;
  transition: left 0.34s ease, top 0.34s cubic-bezier(0.3, -0.9, 0.6, 1);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.25));
}

/* ================================================================ memory */
.lil-grid {
  --cols: 3;
  display: grid;
  grid-template-columns: repeat(var(--cols), auto);
  gap: clamp(6px, 1.6vw, 14px);
  justify-content: center;
}

.lil-mcard {
  --c: clamp(58px, min(17vw, 19vh), 124px);
  width: var(--c);
  height: calc(var(--c) * 1.08);
  padding: 0;
  border: 0;
  background: none;
  perspective: 600px;
  cursor: pointer;
  border-radius: 18px;
}

.lil-in {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.34s ease;
}

.lil-mcard.lil-up .lil-in {
  transform: rotateY(180deg);
}

.lil-back,
.lil-front {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
}

.lil-back {
  font-size: calc(var(--c) * 0.42);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.25) 0 20%, transparent 21%) 0 0 / 22px 22px,
    linear-gradient(160deg, #3a8fe0, #1d5fae);
  border: 4px solid #174f93;
}

.lil-hw .lil-back {
  background:
    conic-gradient(#222 25%, #fff 0 50%, #222 0 75%, #fff 0) 0 0 / 22px 22px;
  border-color: #111;
}

.lil-front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, #fffdf6, var(--parchment));
  border: 4px solid var(--parchment-edge);
  padding: 4px;
  gap: 2px;
  overflow: hidden;
}

.lil-mcard.lil-got .lil-front {
  border-color: var(--green);
  background: linear-gradient(180deg, #eaffef, #c7f5d8);
}

.lil-mcard.lil-glow {
  animation: lil-glow 1s ease-in-out infinite;
}

.lil-num {
  font-size: calc(var(--c) * 0.55);
  line-height: 1;
}

.lil-pic {
  font-size: calc(var(--c) * 0.46);
  line-height: 1;
}

.lil-cap {
  font-size: calc(var(--c) * 0.16);
  opacity: 0.85;
}

.lil-word {
  font-size: calc(var(--c) * 0.24);
  font-weight: bold;
  letter-spacing: 0.04em;
}

/* Dots in the shape a child would lay them out: up to six, never a line. */
.lil-dots {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 1px 3px;
  justify-content: center;
  align-content: center;
  line-height: 1;
  font-size: calc(var(--c) * 0.24);
}

.lil-dots i {
  font-style: normal;
}

.lil-d1,
.lil-d2,
.lil-d4 {
  grid-template-columns: repeat(2, auto);
  font-size: calc(var(--c) * 0.3);
}

.lil-d1 {
  font-size: calc(var(--c) * 0.36);
}

/* =============================================================== corners */
.lil-shapebox {
  position: relative;
  width: clamp(140px, min(46vw, 44vh), 290px);
  aspect-ratio: 1;
  margin: clamp(8px, 2vh, 16px);
}

.lil-shapebox svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.lil-shapebox polygon {
  fill: #7fc4f2;
  stroke: #1d5fae;
  stroke-width: 3;
  stroke-linejoin: round;
}

.lil-hw .lil-shapebox polygon {
  fill: #ffb347;
  stroke: #c05a00;
}

.lil-shapebox.lil-done polygon {
  fill: #9fe8b9;
  stroke: var(--green);
}

.lil-corner {
  position: absolute;
  width: clamp(44px, 9vh, 58px);
  height: clamp(44px, 9vh, 58px);
  transform: translate(-50%, -50%);
  padding: 0;
  border-radius: 50%;
  border: 4px dashed var(--gold-deep);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: clamp(1.1rem, 4vh, 1.6rem);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lil-corner.lil-counted {
  border: 4px solid var(--gold-deep);
  background: var(--gold);
  animation: lil-in 0.25s ease;
}

/* ======================================================= tap-tile pictures */
/* A silhouette: the picture itself, filled black. */
.lil-shadow {
  display: inline-block;
  font-size: 2.3em;
  line-height: 1;
  filter: brightness(0);
  opacity: 0.82;
}

.lil-paint {
  font-size: 1.15em;
}

.lil-op {
  font-weight: bold;
  color: var(--ink);
  opacity: 0.75;
}

/* A row of dots inside a word tile, for "same pattern". */
.lil-beads {
  display: inline-block;
  font-size: clamp(0.95rem, min(3.6vw, 4.2vh), 1.6rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
  line-height: 1.2;
}

/* =============================================================== mistake */
.lil-beadrow {
  --n: 8;
  --b: clamp(34px, min(calc((min(100vw, 700px) - 60px) / var(--n)), 13vh), 74px);
  display: flex;
  flex-wrap: nowrap;
  gap: clamp(3px, 0.8vw, 8px);
  justify-content: center;
  padding: clamp(8px, 2vh, 16px) clamp(4px, 1vw, 10px);
  border-radius: 999px;
  background:
    linear-gradient(180deg, transparent calc(50% - 2px), var(--parchment-edge) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px));
}

.lil-bead {
  width: var(--b);
  height: var(--b);
  padding: 0;
  font-size: calc(var(--b) * 0.62);
  line-height: 1;
  border-radius: 50%;
  border: 3px solid var(--parchment-edge);
  background: #fffdf6;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transition: transform 0.26s ease;
}

.lil-bead.lil-flip {
  transform: rotateY(90deg);
}

.lil-bead.lil-fixed {
  transform: none;
  border-color: var(--green);
  background: #dcf8e6;
}

.lil-beadrow.lil-done .lil-bead {
  border-color: var(--green);
}

/* ================================================================= story */
.lil-strip {
  display: flex;
  gap: clamp(6px, 1.6vw, 14px);
  justify-content: center;
}

.lil-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lil-slot {
  --f: clamp(58px, min(16vw, 17vh), 112px);
  width: var(--f);
  height: var(--f);
  border-radius: 18px;
  border: 4px dashed var(--parchment-edge);
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lil-frame.lil-filled .lil-slot {
  border-style: solid;
  border-color: var(--green);
  background: #eaffef;
}

.lil-lab {
  font-size: clamp(0.85rem, 2.8vh, 1.15rem);
  font-weight: bold;
  background: var(--gold);
  border-radius: 999px;
  padding: 0 0.7em;
}

.lil-deck {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(6px, 1.6vw, 14px);
  justify-content: center;
  min-height: clamp(52px, min(14vw, 15vh), 100px);
}

.lil-scard {
  width: clamp(52px, min(14vw, 15vh), 100px);
  height: clamp(52px, min(14vw, 15vh), 100px);
  font-size: clamp(1.8rem, min(8vw, 8.5vh), 3.4rem);
  line-height: 1;
  padding: 0;
  border-radius: 18px;
  border: 4px solid var(--parchment-edge);
  background: linear-gradient(180deg, #fffdf6, var(--parchment));
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.16);
  cursor: pointer;
}

.lil-scard.lil-placed {
  width: 100%;
  height: 100%;
  border: 0;
  background: none;
  box-shadow: none;
  animation: lil-in 0.28s ease;
}

/* ================================================================= tower */
.lil-tower {
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(10px, 4vw, 40px);
  --u: clamp(70px, min(24vw, 24vh), 170px);
}

.lil-blocks {
  flex: 0 1 auto;
  max-width: 60%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 1.4vw, 12px);
  min-height: calc(var(--u) * 0.3);
}

.lil-block {
  width: calc(var(--u) * var(--f));
  height: max(44px, calc(var(--u) * 0.26));
  padding: 0;
  border-radius: 10px;
  border: 3px solid rgba(0, 0, 0, 0.25);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), transparent 45%),
    var(--c);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.lil-stack {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  width: calc(var(--u) + 24px);
  min-height: calc(var(--u) * 1.2);
  gap: 0;
}

.lil-stack .lil-block {
  cursor: default;
  box-shadow: none;
  animation: lil-drop 0.3s ease-out;
}

@keyframes lil-drop {
  from { transform: translateY(-30px); opacity: 0.4; }
}

.lil-base {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #8b5a2b;
}

.lil-stack.lil-done .lil-block {
  border-color: var(--green);
}

/* =========================================================== drag boards */
/* Big-or-small sort: the same picture at two very different sizes. */
.drag-item.lil-sz-big .face {
  font-size: calc(var(--w) * 0.74);
}

.drag-item.lil-sz-small .face {
  font-size: calc(var(--w) * 0.28);
}

/* ======================================================== short screens */
@media (max-height: 480px) {
  .lil-field {
    height: clamp(96px, 38vh, 200px);
  }
  .lil-lined {
    height: clamp(80px, 24vh, 140px);
  }
  .lil-seesaw {
    height: clamp(100px, 36vh, 160px);
  }
  .lil-pips {
    display: none;
  }
  .lil-card-letter,
  .lil-card-word,
  .lil-card-pic {
    font-size: clamp(1rem, 6vh, 1.6rem);
    border-width: 3px;
  }
  .lil-hero {
    font-size: clamp(1.6rem, 9vh, 2.6rem);
  }
  .lil-strip,
  .lil-deck {
    gap: 6px;
  }
}

/* A narrow phone held upright: boards stack rather than sitting side by side. */
@media (max-width: 520px) {
  .lil-tower {
    --u: clamp(64px, 30vw, 120px);
  }
  .lil-pantry {
    grid-template-columns: repeat(5, auto);
  }
}

/* ======================================================== reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lil-board *,
  .lil-board *::before,
  .lil-board *::after {
    animation: none !important;
    transition: none !important;
  }
  .lil-mcard.lil-up .lil-in {
    transform: rotateY(180deg);
  }
}
