.fx-carpet { --fx-laid: 0; display: grid; gap: 16px; }
.fx-carpet:has(#fx-carpet-lay:checked) { --fx-laid: 1; }
.fx-carpet .fx-carpet-how ol { margin: 0; padding: 0; list-style: none; }
.fx-carpet .fx-carpet-how li + li { margin-top: 6px; }
.fx-carpet .fx-carpet-goal { margin: 0; color: var(--fx-ink); }
.fx-carpet .fx-carpet-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.fx-carpet .fx-carpet-control { min-width: 0; margin: 0; padding: 0; border: 0; }
.fx-carpet .fx-carpet-control legend { padding: 0; margin-bottom: 8px; font-size: 16px; font-weight: 700; }
.fx-carpet .fx-btn { box-sizing: border-box; display: flex; align-items: center; min-height: 44px; padding: 10px 12px; font-size: 16px; color: var(--fx-ink); background: var(--fx-paper); border: 2px solid var(--fx-ink); }
.fx-carpet .fx-btn:has(input:checked) { color: var(--fx-ink); background: var(--fx-coral-pale); }
.fx-carpet .fx-btn:has(input:focus-visible) { outline: 3px solid var(--fx-grape); outline-offset: 3px; }
.fx-carpet .fx-carpet-says { display: grid; }
.fx-carpet .fx-carpet-state { grid-area: 1 / 1; visibility: hidden; box-sizing: border-box; margin: 0; padding: 12px; font-size: 16px; line-height: 1.45; color: var(--fx-ink); }
.fx-carpet .fx-carpet-description { display: block; margin-top: 8px; font-size: 12px; line-height: 1.4; }
.fx-carpet:not(:has(#fx-carpet-lay:checked)):not(:has(#fx-carpet-lift:checked)) .fx-carpet-start, .fx-carpet:has(#fx-carpet-lay:checked):not(:has(#fx-carpet-lift:checked)) .fx-carpet-covered, .fx-carpet:not(:has(#fx-carpet-lay:checked)):has(#fx-carpet-lift:checked) .fx-carpet-early, .fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-done { visibility: visible; }
.fx-carpet .fx-carpet-stage { box-sizing: border-box; height: 700px; padding: 12px; color: var(--fx-ink); background: var(--fx-sky-pale); }
.fx-carpet .fx-carpet-scene { position: relative; height: 100%; min-width: 0; }
.fx-carpet .fx-carpet-head { box-sizing: border-box; height: 96px; display: grid; gap: 4px; align-content: start; text-align: center; }
.fx-carpet .fx-carpet-head p { margin: 0; font-size: 12px; line-height: 1.4; }
.fx-carpet .fx-carpet-head .fx-carpet-sam { justify-self: center; padding: 4px 8px; border: 1px solid var(--fx-ink); border-radius: 12px; font-size: 14px; background: var(--fx-paper); }
.fx-carpet .fx-carpet-cross { visibility: hidden; font-size: 16px; font-weight: 800; }
.fx-carpet .fx-carpet-board { position: relative; width: min(76%, 196px); aspect-ratio: 7 / 12.5; margin: 24px auto 0; perspective: 800px; }
.fx-carpet .fx-carpet-width, .fx-carpet .fx-carpet-length { position: absolute; font-size: 12px; line-height: 16px; white-space: nowrap; }
.fx-carpet .fx-carpet-width { top: -23px; left: 0; width: 100%; text-align: center; }
.fx-carpet .fx-carpet-length { top: 50%; left: -18px; transform: translate(-50%, -50%) rotate(-90deg); }
.fx-carpet .fx-carpet-layers { position: absolute; inset: 0; transform-style: preserve-3d; }
.fx-carpet .fx-carpet-floor, .fx-carpet .fx-carpet-sheet { position: absolute; inset: 0; clip-path: polygon(0 0, 28.5714% 0, 28.5714% 80%, 100% 80%, 100% 100%, 0 100%); }
.fx-carpet .fx-carpet-floor { background: var(--fx-sun-pale); }
.fx-carpet .fx-carpet-cutout, .fx-carpet .fx-carpet-outline, .fx-carpet .fx-carpet-corner { position: absolute; top: 0; right: 0; width: 71.4286%; height: 80%; box-sizing: border-box; }
.fx-carpet .fx-carpet-cutout { background: var(--fx-paper); }
.fx-carpet .fx-carpet-cutout svg { display: block; width: 100%; height: 100%; }
.fx-carpet .fx-carpet-cutout path { fill: none; stroke: var(--fx-muted); stroke-width: 1; opacity: 0.5; }
.fx-carpet .fx-carpet-outline { border: 1px solid var(--fx-ink); }
.fx-carpet .fx-carpet-sheet, .fx-carpet .fx-carpet-corner { background: var(--fx-coral); opacity: var(--fx-laid); transform: scaleY(var(--fx-laid)); transform-origin: 0 0; transition: transform 0.9s, opacity 0.4s; }
.fx-carpet .fx-carpet-sheet { z-index: 1; }
.fx-carpet .fx-carpet-corner { z-index: 4; border: 1px solid var(--fx-ink); transform-style: preserve-3d; }
.fx-carpet .fx-carpet-under-label { position: absolute; top: 26%; left: 31%; right: 3%; z-index: 3; margin: 0; padding: 4px; font-size: 12px; line-height: 1.4; text-align: center; background: var(--fx-paper); }
.fx-carpet .fx-carpet-word { position: absolute; left: 7%; top: 24%; z-index: 3; visibility: hidden; writing-mode: vertical-rl; font-size: 12px; font-weight: 700; }
.fx-carpet .fx-carpet-floor-label { position: absolute; left: 3%; right: 3%; bottom: 2%; z-index: 5; text-align: center; font-size: 12px; line-height: 1.3; }
.fx-carpet .fx-carpet-formula, .fx-carpet .fx-carpet-piece-readout { display: grid; }
.fx-carpet .fx-carpet-formula span, .fx-carpet .fx-carpet-piece-readout span { grid-area: 1 / 1; }
.fx-carpet .fx-carpet-formula span { visibility: hidden; }
.fx-carpet .fx-carpet-boundary { position: absolute; inset: -2px; border: 2px dashed var(--fx-ink); pointer-events: none; }
.fx-carpet .fx-carpet-roll-station { position: absolute; bottom: 32px; right: 3%; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12px; }
.fx-carpet .fx-carpet-roll { position: relative; box-sizing: border-box; width: 54px; height: 30px; border: 2px solid var(--fx-ink); border-radius: 15px; background: var(--fx-coral); }
.fx-carpet .fx-carpet-roll::after { content: ""; position: absolute; box-sizing: border-box; right: -2px; top: -2px; width: 22px; height: 30px; border: 2px solid var(--fx-ink); border-radius: 50%; background: var(--fx-coral-pale); }
.fx-carpet .fx-carpet-piece-caption { position: absolute; left: 0; bottom: 18px; width: 60%; text-align: center; font-size: 12px; line-height: 1.4; }
.fx-carpet .fx-carpet-piece-area { visibility: hidden; }
.fx-carpet:not(:has(#fx-carpet-lay:checked)) .fx-carpet-no-area { visibility: visible; }
.fx-carpet:has(#fx-carpet-lay:checked) .fx-carpet-under-label, .fx-carpet:has(#fx-carpet-lay:checked) .fx-carpet-roll-station { visibility: hidden; }
.fx-carpet:has(#fx-carpet-lay:checked) .fx-carpet-word { visibility: visible; }
.fx-carpet:has(#fx-carpet-lay:checked):not(:has(#fx-carpet-lift:checked)) .fx-carpet-whole-area { visibility: visible; }
.fx-carpet:not(:has(#fx-carpet-lay:checked)):has(#fx-carpet-lift:checked) .fx-carpet-outline { animation: fx-carpet-wobble 0.3s 2; }
.fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-corner { transform: translate(-40%, 140%) rotateX(38deg) translateZ(14px) scale(0.45); }
.fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-under-label, .fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-floor-area, .fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-piece-area, .fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-cross { visibility: visible; }
.fx-carpet:has(#fx-carpet-lay:checked):has(#fx-carpet-lift:checked) .fx-carpet-dock-note { visibility: hidden; }
@keyframes fx-carpet-wobble { 0% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } 100% { transform: translateX(0); } }
@container (max-width: 480px) { .fx-carpet .fx-carpet-controls { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .fx-carpet .fx-carpet-sheet, .fx-carpet .fx-carpet-corner { transition: none; } .fx-carpet .fx-carpet-outline { animation: none; } }