.fx-stack { --fx-n: 0; display: grid; gap: 16px; }
.fx-stack:has(#fx-stack-n1:checked) { --fx-n: 1; }
.fx-stack:has(#fx-stack-n2:checked) { --fx-n: 2; }
.fx-stack:has(#fx-stack-n3:checked) { --fx-n: 3; }
.fx-stack:has(#fx-stack-n4:checked) { --fx-n: 4; }
.fx-stack:has(#fx-stack-n5:checked) { --fx-n: 5; }
.fx-stack:has(#fx-stack-n6:checked) { --fx-n: 6; }
.fx-stack:has(#fx-stack-n7:checked) { --fx-n: 7; }
.fx-stack:has(#fx-stack-n8:checked) { --fx-n: 8; }
.fx-stack:has(#fx-stack-n9:checked) { --fx-n: 9; }
.fx-stack:has(#fx-stack-n10:checked) { --fx-n: 10; }
.fx-stack .fx-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fx-stack .fx-goal, .fx-stack .fx-prompt { margin: 0; }
.fx-stack .fx-controls { min-width: 0; padding: 0; margin: 0; border: 0; }
.fx-stack .fx-controls legend { padding: 0; margin-bottom: 8px; font-weight: 800; }
.fx-stack .fx-choices { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px 6px; max-width: 330px; padding-top: 44px; }
.fx-stack .fx-choice { position: relative; display: grid; justify-items: center; min-width: 0; }
.fx-stack .fx-btn { display: grid; place-items: center; width: 100%; max-width: 36px; min-width: 24px; min-height: 24px; height: auto; aspect-ratio: 1; box-sizing: border-box; padding: 0; border: 2px solid var(--fx-ink); border-radius: 50%; font-size: 14px; color: var(--fx-ink); background: var(--fx-paper); cursor: pointer; }
.fx-stack .fx-btn:has(input:checked) { color: var(--fx-ink); background: var(--fx-sun); }
.fx-stack .fx-btn:has(input:focus-visible) { outline: 3px solid var(--fx-ink); outline-offset: 3px; }
.fx-stack .fx-try { position: absolute; bottom: calc(100% + 4px); left: 50%; width: 88px; height: 36px; transform: translateX(-10px); font-size: 12px; line-height: 18px; color: var(--fx-ink); pointer-events: none; }
.fx-stack .fx-try span { display: block; }
.fx-stack .fx-try span:last-child { padding-left: 4px; }
.fx-stack .fx-display { box-sizing: border-box; height: 400px; padding: 12px; display: grid; grid-template-rows: auto 1fr; gap: 8px; color: var(--fx-ink); }
.fx-stack .fx-part { margin: 0; font-size: 14px; line-height: 1.4; }
.fx-stack .fx-scene { display: grid; grid-template-columns: minmax(0, 1fr) minmax(92px, 0.65fr); gap: 12px; align-items: center; min-width: 0; }
.fx-stack .fx-view { position: relative; height: 320px; min-width: 0; overflow: hidden; perspective: 700px; }
.fx-stack .fx-tower { position: absolute; bottom: 32px; left: 50%; width: 160px; height: 280px; transform-origin: 50% 100%; transform: translateX(-50%) rotateX(-10deg) rotateY(-18deg); transform-style: preserve-3d; }
.fx-stack .fx-boxes { position: absolute; bottom: 10px; left: 8px; width: 132px; height: 240px; transform-style: preserve-3d; }
.fx-stack .fx-piece { --fx-on: clamp(0, calc(var(--fx-n) - var(--fx-i)), 1); position: absolute; bottom: calc(var(--fx-i) * 24px); left: 0; width: 132px; height: 24px; transform-style: preserve-3d; opacity: var(--fx-on); transform: translate3d(0, calc((1 - var(--fx-on)) * -36px), 0) scale(var(--fx-on)); transition: transform 0.4s, opacity 0.4s; }
.fx-stack .fx-front, .fx-stack .fx-top, .fx-stack .fx-side { position: absolute; box-sizing: border-box; border: 1px solid var(--fx-ink); backface-visibility: hidden; }
.fx-stack .fx-front { width: 132px; height: 24px; transform: translateZ(24px); background: var(--fx-coral); display: flex; align-items: center; padding: 0 6px; }
.fx-stack .fx-front svg { display: block; width: 64px; height: 20px; }
.fx-stack .fx-front path { fill: var(--fx-ink); }
.fx-stack .fx-tag { margin-left: auto; min-width: 26px; height: 18px; line-height: 18px; font-size: 14px; text-align: center; background: var(--fx-paper); color: var(--fx-ink); border-radius: 2px; }
.fx-stack .fx-top { top: -24px; left: 0; width: 132px; height: 48px; transform: rotateX(90deg); background: var(--fx-sun-pale); }
.fx-stack .fx-side { top: 0; left: 108px; width: 48px; height: 24px; transform: rotateY(90deg); background: var(--fx-sun); }
.fx-stack .fx-shelf-front { position: absolute; bottom: 0; left: -14px; width: 176px; height: 10px; transform: translateZ(34px); box-sizing: border-box; border: 1px solid var(--fx-ink); background: var(--fx-sky); }
.fx-stack .fx-shelf-top { position: absolute; bottom: -24px; left: -14px; width: 176px; height: 68px; transform: rotateX(90deg); box-sizing: border-box; border: 1px solid var(--fx-ink); background: var(--fx-sky-pale); }
.fx-stack .fx-shelf-word { position: absolute; bottom: 0; left: 0; width: 100%; text-align: center; font-size: 14px; font-weight: 700; }
.fx-stack .fx-counter { box-sizing: border-box; min-width: 0; min-height: 112px; padding: 10px; display: grid; align-content: center; gap: 4px; text-align: center; background: var(--fx-sun-pale); color: var(--fx-ink); border: 2px solid var(--fx-ink); border-radius: 12px; }
.fx-stack .fx-counter p { margin: 0; font-size: 14px; }
.fx-stack .fx-totals { display: grid; margin: 0; font-size: 36px; line-height: 1.2; }
.fx-stack .fx-says, .fx-stack .fx-feedback { display: grid; min-width: 0; }
.fx-stack .fx-state { visibility: hidden; grid-area: 1 / 1; }
.fx-stack .fx-says p, .fx-stack .fx-feedback p { margin: 0; }
.fx-stack:has(#fx-stack-n0:checked) .fx-s0, .fx-stack:has(#fx-stack-n1:checked) .fx-s1, .fx-stack:has(#fx-stack-n2:checked) .fx-s2, .fx-stack:has(#fx-stack-n3:checked) .fx-s3, .fx-stack:has(#fx-stack-n4:checked) .fx-s4, .fx-stack:has(#fx-stack-n5:checked) .fx-s5, .fx-stack:has(#fx-stack-n6:checked) .fx-s6, .fx-stack:has(#fx-stack-n7:checked) .fx-s7, .fx-stack:has(#fx-stack-n8:checked) .fx-s8, .fx-stack:has(#fx-stack-n9:checked) .fx-s9, .fx-stack:has(#fx-stack-n10:checked) .fx-s10 { visibility: visible; }
.fx-stack:has(#fx-stack-n10:checked) .fx-counter { background: var(--fx-mint); }
.fx-stack:has(#fx-stack-n10:checked) .fx-boxes { box-shadow: 0 0 16px var(--fx-mint); outline: 3px solid var(--fx-mint); }
@container (max-width: 480px) { .fx-stack .fx-scene { grid-template-columns: minmax(0, 1fr); grid-template-rows: 320px 92px; align-content: start; } .fx-stack .fx-display { height: 510px; } .fx-stack .fx-counter { height: 92px; min-height: 92px; } }
@media (prefers-reduced-motion: reduce) { .fx-stack .fx-piece { transition: none; } }