.fx-stack { --fx-wholes: 1; --fx-quarters: 0; display: grid; }
.fx-stack:has(#fx-stack-h2:checked) { --fx-wholes: 2; }
.fx-stack:has(#fx-stack-h3:checked), .fx-stack:has(#fx-stack-h325:checked), .fx-stack:has(#fx-stack-h35:checked), .fx-stack:has(#fx-stack-h375:checked) { --fx-wholes: 3; }
.fx-stack:has(#fx-stack-h325:checked) { --fx-quarters: 1; }
.fx-stack:has(#fx-stack-h35:checked) { --fx-quarters: 2; }
.fx-stack:has(#fx-stack-h375:checked) { --fx-quarters: 3; }
.fx-stack:has(#fx-stack-h4:checked) { --fx-wholes: 4; }
.fx-stack .fx-stack-layout { display: grid; gap: 14px; min-width: 0; color: var(--fx-ink); font-size: 16px; line-height: 1.5; }
.fx-stack .fx-stack-layout * { box-sizing: border-box; }
.fx-stack .fx-stack-layout p { margin: 0; }
.fx-stack .fx-stack-steps { list-style: none; padding: 0; margin: 0; }
.fx-stack .fx-stack-steps li + li { margin-top: 6px; }
.fx-stack .fx-stack-controls { min-width: 0; margin: 0; padding: 0; border: 0; }
.fx-stack .fx-stack-controls legend { max-width: 100%; padding: 0; margin-bottom: 10px; font-weight: 800; }
.fx-stack .fx-stack-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fx-stack .fx-stack-choices .fx-btn { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 44px; padding: 10px 8px; margin: 0; border: 2px solid var(--fx-ink); background: var(--fx-paper); color: var(--fx-ink); font-size: 16px; font-weight: 700; line-height: 1.3; text-align: center; cursor: pointer; transform: none; }
.fx-stack .fx-stack-choices .fx-btn:has(input:checked) { background: var(--fx-sky-pale); color: var(--fx-ink); transform: none; }
.fx-stack .fx-stack-choices .fx-btn:focus-within { outline: 3px solid var(--fx-grape); outline-offset: 2px; }
.fx-stack .fx-stack-scene { position: relative; height: 350px; min-width: 0; overflow: hidden; }
.fx-stack .fx-stack-sign { position: absolute; top: 12px; left: 12px; right: 12px; padding: 8px; border: 2px solid var(--fx-ink); background: var(--fx-sun-pale); color: var(--fx-ink); font-size: 14px; font-weight: 800; line-height: 1.3; text-align: center; }
.fx-stack .fx-stack-perspective { position: absolute; bottom: 30px; left: 0; width: 100%; height: 250px; perspective: 700px; perspective-origin: 50% -80px; }
.fx-stack .fx-stack-tower { position: absolute; bottom: 0; left: 50%; width: min(156px, 68%); height: 208px; transform-style: preserve-3d; transform: translateX(-50%) rotateY(-14deg); transition: transform 0.45s; }
.fx-stack .fx-stack-base { position: absolute; bottom: -20px; left: -10%; width: 120%; height: 20px; border: 1px solid var(--fx-ink); background: var(--fx-sky-pale); color: var(--fx-ink); font-size: 12px; line-height: 18px; text-align: center; transform: translateZ(-1px); }
.fx-stack .fx-stack-brick { --fx-on: clamp(0, calc(var(--fx-wholes) - var(--fx-index) + 1), 1); position: absolute; left: 0; bottom: var(--fx-bottom); width: 100%; height: 52px; transform-style: preserve-3d; transform: translate3d(0, calc((1 - var(--fx-on)) * -28px), 0) scale(var(--fx-on)); opacity: var(--fx-on); transition: transform 0.45s, opacity 0.3s; }
.fx-stack .fx-stack-quarter { --fx-on: clamp(0, calc(var(--fx-quarters) - var(--fx-index) + 1), 1); height: 13px; }
.fx-stack .fx-stack-front { position: absolute; inset: 0; display: grid; place-items: center; border: 1px solid var(--fx-ink); background: var(--fx-sky); color: var(--fx-ink); font-size: 12px; line-height: 12px; white-space: nowrap; transform: translateZ(0px); }
.fx-stack .fx-stack-brick::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 20px; border: 1px solid var(--fx-ink); background: var(--fx-sky-pale); transform-origin: top; transform: rotateX(-90deg); }
.fx-stack .fx-stack-brick::after { content: ""; position: absolute; top: 0; left: 100%; width: 20px; height: 100%; border: 1px solid var(--fx-ink); background: var(--fx-sky); transform-origin: left; transform: rotateY(90deg); }
.fx-stack .fx-stack-quarter .fx-stack-front, .fx-stack .fx-stack-quarter::after { background: var(--fx-coral); }
.fx-stack .fx-stack-quarter::before { background: var(--fx-coral-pale); }
.fx-stack .fx-stack-extra { position: absolute; top: 0; left: 0; right: 0; height: 13px; border: 2px dashed var(--fx-ink); background: var(--fx-coral-pale); color: var(--fx-ink); font-size: 12px; line-height: 12px; text-align: center; }
.fx-stack .fx-stack-end { position: absolute; left: -12px; bottom: 194px; width: calc(100% + 24px); height: 0; border-top: 2px dashed var(--fx-coral); }
.fx-stack .fx-stack-end-label { position: absolute; bottom: 8px; left: -8px; right: -8px; padding: 3px; background: var(--fx-paper); color: var(--fx-ink); font-size: 12px; line-height: 1.3; text-align: center; }
.fx-stack:has(#fx-stack-h375:checked) .fx-stack-end { border-color: var(--fx-mint); }
.fx-stack:has(#fx-stack-h375:checked) .fx-stack-end-label { background: var(--fx-mint-pale); }
.fx-stack .fx-stack-live { display: grid; min-width: 0; }
.fx-stack .fx-stack-message { grid-area: 1 / 1; min-width: 0; visibility: hidden; }
.fx-stack .fx-stack-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.fx-stack .fx-stack-totals b { display: block; font-size: 14px; }
.fx-stack .fx-stack-totals .fx-score { display: block; margin: 0; font-size: 20px; line-height: 1.3; }
.fx-stack .fx-stack-build { display: block; margin-bottom: 10px; }
.fx-stack .fx-stack-sentence { display: block; }
.fx-stack:has(#fx-stack-h1:checked) .fx-stack-s1, .fx-stack:has(#fx-stack-h2:checked) .fx-stack-s2, .fx-stack:has(#fx-stack-h3:checked) .fx-stack-s3, .fx-stack:has(#fx-stack-h325:checked) .fx-stack-s325, .fx-stack:has(#fx-stack-h35:checked) .fx-stack-s35, .fx-stack:has(#fx-stack-h375:checked) .fx-stack-s375, .fx-stack:has(#fx-stack-h4:checked) .fx-stack-s4 { visibility: visible; }
@container (max-width: 480px) { .fx-stack .fx-stack-choices, .fx-stack .fx-stack-totals { grid-template-columns: 1fr; } }