/* A quiet, physical puzzle. Keep the 3D tree free of filters and clipping. */
.hero-visual { position: relative; width: min(100%, 435px); animation: none; }
.cube-mode-bar { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.cube-mode, .cube-view-reset { min-height: 34px; padding: 6px 11px; border: 1px solid #d0d0cb; color: #5d5d59; background: transparent; font: inherit; font-size: 10px; font-weight: 550; cursor: pointer; }
.cube-mode:hover, .cube-mode:focus-visible, .cube-view-reset:hover, .cube-view-reset:focus-visible { color: #171717; border-color: #72726e; }
.cube-mode.is-active, .cube-mode.is-active:hover, .cube-mode.is-active:focus-visible { color: #f8f8f5; border-color: #242424; background: #242424; }
.cube-view-reset { margin-left: auto; border-color: transparent; }
.cube-stage { position: relative; width: 100%; aspect-ratio: 1.12; perspective: 1100px; perspective-origin: 50% 46%; overflow: visible; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.cube-stage.is-view-mode { cursor: move; }
.cube-stage.is-dragging { cursor: grabbing; }
/* Keep keyboard focus visible through the caption without framing the puzzle. */
.cube-stage:focus, .cube-stage:focus-visible { outline: none; border-radius: 0; }
.cube-stage:focus-visible + .cube-caption span:first-child { color: #262626; text-decoration: underline; text-underline-offset: 4px; }
.cube-stage::before { content: none; }
.cube-stage::after { content: ""; position: absolute; top: auto; bottom: 4%; left: 22%; width: 56%; height: 8%; border: 0; background: radial-gradient(ellipse, #15151520, #15151500 70%); transform: none; pointer-events: none; }
.cube-halo { display: none; }
.twist-cube { --cube-size: clamp(200px, 20vw, 256px); --cubelet-size: calc(var(--cube-size) / 3); --view-x: -25deg; --view-y: -35deg; position: absolute; top: 47%; left: 50%; width: var(--cube-size); height: var(--cube-size); transform: translate(-50%, -50%) rotateX(var(--view-x)) rotateY(var(--view-y)); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.cubelet { position: absolute; top: 50%; left: 50%; width: var(--cubelet-size); height: var(--cubelet-size); margin-top: calc(var(--cubelet-size) * -.5); margin-left: calc(var(--cubelet-size) * -.5); transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.cube-face { position: absolute; inset: 0; padding: 2px; border: 1.5px solid #242424; border-radius: 2px; background: #242424; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cube-face span { display: block; width: 100%; height: 100%; border-radius: 2px; background: var(--sticker, #252524); box-shadow: inset 0 1px 0 #ffffff38, inset 0 -2px 3px #00000012; }
.cube-face span.is-internal { box-shadow: none; }
.cube-face-front { transform: translateZ(calc(var(--cubelet-size) * .495)); }
.cube-face-back { transform: rotateY(180deg) translateZ(calc(var(--cubelet-size) * .495)); }
.cube-face-right { transform: rotateY(90deg) translateZ(calc(var(--cubelet-size) * .495)); }
.cube-face-left { transform: rotateY(-90deg) translateZ(calc(var(--cubelet-size) * .495)); }
.cube-face-top { transform: rotateX(90deg) translateZ(calc(var(--cubelet-size) * .495)); }
.cube-face-bottom { transform: rotateX(-90deg) translateZ(calc(var(--cubelet-size) * .495)); }
.cube-restore { position: absolute; z-index: 2; top: 45px; right: 0; min-height: 32px; padding: 5px 9px; border: 1px solid #bcbcb7; color: #40403d; background: #f5f5f1ed; font: inherit; font-size: 10px; cursor: pointer; }
.cube-restore:hover, .cube-restore:focus-visible { color: #fff; border-color: #242424; background: #242424; }
.cube-restore:disabled { opacity: .55; cursor: default; }
.cube-restore[hidden] { display: none; }
.cube-caption { display: flex; justify-content: space-between; gap: 8px; max-width: none; margin: 0 0 16px; color: #6a6a65; font-size: 10px; font-weight: 400; letter-spacing: 0; line-height: 1.6; }
.cube-pattern { margin: 12px 0 8px; color: #777771; font-size: 10px; line-height: 1.7; text-align: left; }
.cube-moves { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cube-move { min-height: 44px; padding: 5px 2px; border: 1px solid #d0d0cb; color: #33332f; background: transparent; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.cube-move span { display: block; margin-top: 2px; color: #777771; font-size: 9px; font-weight: 400; }
.cube-move:hover, .cube-move:focus-visible { border-color: #7d7d76; background: #e9e9e3; }
.cube-layer-panel { margin-top: 12px; padding: 12px; border: 1px solid #d0d0cb; background: transparent; }
.cube-layer-panel > p { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: #555550; font-size: 9px; font-weight: 600; letter-spacing: .07em; }
.cube-layer-panel > p span { color: #777771; font-weight: 400; letter-spacing: 0; }
.cube-layer-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px 44px; align-items: end; gap: 6px; }
.cube-layer-row label { display: grid; gap: 4px; min-width: 0; color: #777771; font-size: 9px; }
.cube-layer-row select { width: 100%; min-height: 34px; padding: 0 5px; border: 1px solid #c5c5bf; border-radius: 0; color: #3c3c37; background: #f5f5f1; font: inherit; font-size: 10px; color-scheme: light; }
.cube-layer-row select:focus-visible { outline: 1px solid #33332f; outline-offset: 2px; }
.cube-layer-turn { min-height: 34px; padding: 0; border: 1px solid #b7b7b1; color: #33332f; background: transparent; font: inherit; font-size: 10px; font-weight: 600; cursor: pointer; }
.cube-layer-turn:hover, .cube-layer-turn:focus-visible { color: #fff; background: #242424; }
@media (max-width: 680px) {
  .hero-visual { width: min(100%, 390px); }
  .twist-cube { --cube-size: clamp(180px, 60vw, 238px); }
  .cube-caption { font-size: 9px; }
  .cube-layer-panel > p { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .cubelet, .cube-move { transition: none !important; }
}

.cube-mode-bar .cube-restore { position: static; margin-left: 1px; padding-inline: 8px; min-height: 34px; }

/* One canvas owns all visible cube faces, avoiding CSS 3D layer reordering. */
.cube-stage.has-canvas-renderer .twist-cube { visibility: hidden; pointer-events: none; }
.cube-stage .cube-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
