.fx-stack { display: grid; }
.fx-stack .fx-stack-shell { display: grid; gap: 16px; min-width: 0; color: var(--fx-ink); font-size: 16px; line-height: 1.45; }
.fx-stack p { margin: 0; }
.fx-stack .fx-stack-instructions ol { margin: 0; padding-left: 24px; }
.fx-stack .fx-stack-instructions li + li { margin-top: 4px; }
.fx-stack .fx-stack-controls { border: 0; padding: 0; margin: 0; min-width: 0; }
.fx-stack .fx-stack-controls legend { padding: 0; margin-bottom: 12px; font-weight: 700; }
.fx-stack .fx-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fx-stack .fx-btn { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 8px 12px; border: 2px solid var(--fx-ink); background: var(--fx-paper); color: var(--fx-ink); font-size: 16px; font-weight: 700; }
.fx-stack .fx-btn:has(input:checked) { background: var(--fx-sky); color: var(--fx-ink); font-weight: 700; }
.fx-stack .fx-btn:has(input:focus-visible) { outline: 3px solid var(--fx-grape); outline-offset: 3px; }
.fx-stack .fx-stack-stage { box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: 16px; height: 280px; padding: 12px; color: var(--fx-ink); }
.fx-stack .fx-stack-scene { min-width: 0; }
.fx-stack .fx-stack-caption { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.fx-stack .fx-stack-view { position: relative; height: 195px; perspective: 700px; }
.fx-stack .fx-stack-world { --fx-stack-count: 0; position: absolute; left: 50%; top: 70px; width: 160px; height: 80px; margin-left: -80px; transform: rotateX(58deg) rotateZ(-22deg); transform-style: preserve-3d; }
.fx-stack:has(#fx-stack-n1:checked) .fx-stack-world { --fx-stack-count: 1; }
.fx-stack:has(#fx-stack-n2:checked) .fx-stack-world { --fx-stack-count: 2; }
.fx-stack:has(#fx-stack-n3:checked) .fx-stack-world { --fx-stack-count: 3; }
.fx-stack:has(#fx-stack-n4:checked) .fx-stack-world { --fx-stack-count: 4; }
.fx-stack:has(#fx-stack-n5:checked) .fx-stack-world { --fx-stack-count: 5; }
.fx-stack:has(#fx-stack-n6:checked) .fx-stack-world { --fx-stack-count: 6; }
.fx-stack .fx-stack-world svg { position: absolute; overflow: visible; transform-origin: 0 0; }
.fx-stack .fx-stack-world .fx-stack-defs { width: 0; height: 0; overflow: hidden; }
.fx-stack .fx-stack-floor { left: 0; top: 0; width: 160px; height: 80px; }
.fx-stack .fx-stack-floor rect { fill: var(--fx-paper); stroke: var(--fx-ink); stroke-width: 1.5; }
.fx-stack .fx-stack-world use { fill: none; stroke: var(--fx-ink); stroke-width: 0.65; }
.fx-stack .fx-stack-wall rect { fill: var(--fx-sky-pale); fill-opacity: 0.18; stroke: var(--fx-ink); stroke-width: 1.5; }
.fx-stack .fx-stack-wall path { fill: none; stroke: var(--fx-muted); stroke-opacity: 0.5; stroke-width: 0.7; stroke-dasharray: 3 3; }
.fx-stack .fx-stack-back, .fx-stack .fx-stack-frontwall { left: 0; width: 160px; height: 48px; transform: translateZ(48px) rotateX(-90deg); }
.fx-stack .fx-stack-back { top: 0; }
.fx-stack .fx-stack-frontwall { top: 80px; }
.fx-stack .fx-stack-leftwall, .fx-stack .fx-stack-rightwall { top: 0; width: 80px; height: 48px; transform: translateZ(48px) rotateY(-90deg) rotateZ(90deg); }
.fx-stack .fx-stack-leftwall { left: 0; }
.fx-stack .fx-stack-rightwall { left: 160px; }
.fx-stack .fx-stack-ghost { left: 0; top: 0; width: 160px; height: 80px; transform: translateZ(8px); visibility: hidden; }
.fx-stack .fx-stack-ghost use { stroke: var(--fx-muted); stroke-dasharray: 2 2; }
.fx-stack:has(#fx-stack-n0:checked) .fx-stack-ghost { visibility: visible; }
.fx-stack .fx-stack-layer { --fx-stack-on: clamp(0, calc(var(--fx-stack-count) - var(--fx-stack-level) + 1), 1); position: absolute; left: 0; top: 0; width: 160px; height: 80px; transform-style: preserve-3d; transform: translateZ(calc(var(--fx-stack-level) * 8px + (1 - var(--fx-stack-on)) * 96px)) scale(var(--fx-stack-on)); transition: transform 0.65s cubic-bezier(0.2, 0.7, 0.3, 1); }
.fx-stack .fx-stack-top { left: 0; top: 0; width: 160px; height: 80px; }
.fx-stack .fx-stack-front { left: 0; top: 80px; width: 160px; height: 8px; transform: rotateX(-90deg); }
.fx-stack .fx-stack-side { left: 0; top: 0; width: 80px; height: 8px; transform: rotateY(-90deg) rotateZ(90deg); }
.fx-stack .fx-stack-top rect { fill: var(--fx-sun-pale); }
.fx-stack .fx-stack-front rect { fill: var(--fx-sun); }
.fx-stack .fx-stack-side rect { fill: var(--fx-coral-pale); }
.fx-stack:has(#fx-stack-n6:checked) .fx-stack-wall rect { stroke: var(--fx-mint); stroke-width: 2.5; }
.fx-stack .fx-stack-width, .fx-stack .fx-stack-length { position: absolute; bottom: 0; font-size: 12px; font-weight: 700; }
.fx-stack .fx-stack-width { left: 0; }
.fx-stack .fx-stack-length { right: 0; }
.fx-stack .fx-stack-guide { display: grid; align-content: center; justify-items: center; gap: 16px; min-width: 0; text-align: center; }
.fx-stack .fx-stack-unit { display: flex; align-items: center; justify-content: center; gap: 10px; }
.fx-stack .fx-stack-unit svg { width: 56px; height: 64px; flex: 0 0 56px; }
.fx-stack .fx-stack-unit polygon { stroke: var(--fx-ink); stroke-width: 1.5; stroke-linejoin: round; }
.fx-stack .fx-stack-unit-top { fill: var(--fx-sun-pale); }
.fx-stack .fx-stack-unit-front { fill: var(--fx-sun); }
.fx-stack .fx-stack-unit-side { fill: var(--fx-coral-pale); }
.fx-stack .fx-stack-unit small { font-size: 12px; }
.fx-stack .fx-stack-equations, .fx-stack .fx-stack-status { display: grid; min-width: 0; }
.fx-stack .fx-stack-equations > p, .fx-stack .fx-stack-status > p { display: block; grid-area: 1 / 1; visibility: hidden; box-sizing: border-box; margin: 0; }
.fx-stack .fx-stack-equations > p { font-size: 22px; font-weight: 800; }
.fx-stack .fx-stack-status > p { padding: 12px; font-size: 16px; line-height: 1.45; color: var(--fx-ink); }
.fx-stack:has(#fx-stack-n0:checked) .fx-stack-s0, .fx-stack:has(#fx-stack-n1:checked) .fx-stack-s1, .fx-stack:has(#fx-stack-n2:checked) .fx-stack-s2, .fx-stack:has(#fx-stack-n3:checked) .fx-stack-s3, .fx-stack:has(#fx-stack-n4:checked) .fx-stack-s4, .fx-stack:has(#fx-stack-n5:checked) .fx-stack-s5, .fx-stack:has(#fx-stack-n6:checked) .fx-stack-s6, .fx-stack:has(#fx-stack-n6:checked) .fx-stack-full { visibility: visible; }
@container (max-width: 480px) { .fx-stack .fx-stack-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: 222px minmax(0, 1fr); height: 440px; gap: 12px; } .fx-stack .fx-stack-guide { gap: 12px; } }
@media (prefers-reduced-motion: reduce) { .fx-stack .fx-stack-layer { transition: none; } }