/* The panel paints the scene and the stage stays see-through; the script sets --ss-horizon to the crates' top edge. */
.game-root[data-game="sort-shift"] {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #e3f0ec 0, #d6ebe4 var(--ss-horizon, 76%), #ead5b2 calc(var(--ss-horizon, 76%) + 1px), #dcc39c 100%);
}
.ss { container-type: inline-size; position: relative; display: flex; flex-direction: column; gap: 10px; width: 100%; }
.ss-hud { display: flex; justify-content: center; }
.ss-bar { width: min(100%, 320px); height: 8px; border-radius: 4px; background: rgba(60, 90, 110, .15); overflow: hidden; }
.ss-bar-fill { display: block; width: 0; height: 100%; border-radius: 4px; background: #5fb870; transition: width .3s; }
/* min-height: 0, or the aspect-ratio box grows by the stage's rounding and the fit loops. */
.ss-fit { display: grid; place-items: center; width: 100%; max-width: 520px; min-height: 0; margin: 0 auto; aspect-ratio: 560 / 720; }
.ss-stage { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ss-world { position: absolute; left: 0; top: 0; width: 560px; height: 720px; transform-origin: 0 0; }
.ss-world > * { position: absolute; }
.ss-toys, .ss-fx { inset: 0; pointer-events: none; }
.ss-clock { left: 0; top: 0; width: 0; height: 0; }

.ss-snd { position: absolute; top: 8px; right: 8px; z-index: 3; display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); box-shadow: 0 2px 6px rgba(60, 80, 100, .15); color: #3f6b5e; font-size: 19px; line-height: 1; cursor: pointer; }
.ss-snd[hidden] { display: none; }
.ss-snd.is-off { color: #a9a39a; }
.ss-snd.is-off::after { content: ""; position: absolute; width: 22px; height: 2px; border-radius: 1px; background: #a9a39a; transform: rotate(-45deg); }

/* --- the sign --- */
.ss-sign { left: 170px; top: 18px; width: 220px; height: 92px; display: grid; grid-template-rows: auto 1fr; justify-items: center; align-items: center; padding: 6px 10px 8px; border-radius: 14px; background: linear-gradient(#f7e3bf, #eccf9d); box-shadow: inset 0 -4px 0 rgba(120, 80, 30, .18), 0 5px 0 rgba(96, 64, 30, .2); transform-origin: 50% 0; }
.ss-sign::before, .ss-sign::after { content: ""; position: absolute; top: -18px; width: 3px; height: 18px; background: #8a6a45; }
.ss-sign::before { left: 40px; }
.ss-sign::after { right: 40px; }
.ss-sign-label { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #8a6a45; }
.ss-sign-face { display: flex; align-items: center; gap: 12px; }
.ss-sign-word { font-size: 32px; font-weight: 800; color: #4a3520; }
.ss-sign-icon { position: relative; display: block; width: 44px; height: 30px; }
.ss-sign-icon::before, .ss-sign-icon::after { content: ""; position: absolute; top: 50%; }
.ss-sign-icon.is-colour::before { left: 0; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: #ef6a5b; }
.ss-sign-icon.is-colour::after { right: 0; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: #4a8fe0; }
.ss-sign-icon.is-shape::before { left: 0; width: 18px; height: 18px; margin-top: -9px; border: 3px solid #4a3520; border-radius: 50%; }
.ss-sign-icon.is-shape::after { right: 0; width: 18px; height: 18px; margin-top: -9px; border: 3px solid #4a3520; border-radius: 3px; }
.ss-sign-icon.is-size::before { left: 0; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; background: #4a3520; }
.ss-sign-icon.is-size::after { right: 0; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: #4a3520; }

/* --- the belt --- */
.ss-belt { left: 220px; top: 124px; width: 120px; height: 366px; border-radius: 18px; background: repeating-linear-gradient(180deg, #5d6775 0 14px, #505966 14px 28px); box-shadow: inset 0 0 0 6px #3d444e, 0 6px 0 rgba(0, 0, 0, .12); animation: ss-roll .55s linear infinite; }
.ss-belt.is-still { animation-play-state: paused; }
@keyframes ss-roll { to { background-position: 0 28px; } }

/* --- crates --- */
.ss-crate { width: 200px; height: 128px; border-radius: 12px; background: repeating-linear-gradient(180deg, #c98f52 0 38px, #b87f45 38px 42px); box-shadow: inset 0 0 0 6px #a26e3a, 0 6px 0 rgba(80, 50, 20, .25); }
.ss-crate::before { content: ""; position: absolute; left: 6px; right: 6px; top: 0; height: 18px; border-radius: 10px 10px 0 0; background: rgba(60, 35, 10, .35); }
.ss-chips { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 10px; }
.ss-chip { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 248, 236, .55); opacity: .45; transition: opacity .2s, transform .2s, background .2s; }
.ss-chip[hidden] { display: none; }
.ss-chip.is-on { opacity: 1; background: #fffaf0; transform: scale(1.12); box-shadow: 0 0 0 3px #fff, 0 3px 0 rgba(80, 50, 20, .25); }
.ss-chip::before { content: ""; display: block; }
.ss-chip-colour[data-side="0"]::before { width: 24px; height: 24px; border-radius: 50%; background: #ef6a5b; }
.ss-chip-colour[data-side="1"]::before { width: 24px; height: 24px; border-radius: 50%; background: #4a8fe0; }
.ss-chip-shape[data-side="0"]::before { width: 20px; height: 20px; border: 3px solid #4a3520; border-radius: 50%; }
.ss-chip-shape[data-side="1"]::before { width: 20px; height: 20px; border: 3px solid #4a3520; border-radius: 3px; }
.ss-chip-size[data-side="0"]::before { width: 28px; height: 28px; border-radius: 50%; background: #4a3520; }
.ss-chip-size[data-side="1"]::before { width: 12px; height: 12px; border-radius: 50%; background: #4a3520; }
.ss-halo { position: absolute; inset: -9px; border: 4px solid #5fb870; border-radius: 18px; opacity: 0; pointer-events: none; }
.ss-crate.is-cue .ss-halo { animation: ss-breathe 1.6s ease-in-out infinite; }
@keyframes ss-breathe { 0%, 100% { transform: scale(.98); opacity: .3; } 50% { transform: scale(1.04); opacity: .95; } }

/* --- toys --- */
.ss-toy { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.ss-toy-body { position: absolute; left: calc(var(--s) / -2); top: calc(var(--s) / -2); width: var(--s); height: var(--s); background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55) 0 12%, transparent 13%), var(--tc); box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .14), 0 5px 0 rgba(0, 0, 0, .16); }
.ss-toy-body::after { content: ""; position: absolute; left: 22%; right: 22%; top: 40%; height: 20%; background: radial-gradient(circle at 25% 50%, #2d2a32 0 calc(var(--s) * .05), transparent calc(var(--s) * .05 + .5px)), radial-gradient(circle at 75% 50%, #2d2a32 0 calc(var(--s) * .05), transparent calc(var(--s) * .05 + .5px)); }
.ss-toy.is-round .ss-toy-body { border-radius: 50%; }
.ss-toy.is-square .ss-toy-body { border-radius: 16%; }
.ss-toy.is-mid { --s: 72px; }
.ss-toy.is-big { --s: 90px; }
.ss-toy.is-small { --s: 50px; }
.ss-spark { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--tc); }

.ss-foot { display: grid; justify-items: center; }
.ss-cap { min-height: 1.5em; margin: 0; font-weight: 700; color: var(--c-text); text-align: center; }
@container (max-width: 480px) {
  .ss-cap { min-height: 3em; }
}
.ss-go { background: #3fae5a; color: #fff; box-shadow: var(--shadow); }
.ss-go:hover { background: #36994e; }
.ss-end { position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 12px; background: rgba(34, 52, 72, .22); }
.ss-end:empty { display: none; }
.ss-end .result-card { width: min(100%, 340px); padding: 18px 20px 20px; border-radius: 20px; background: #fff; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); animation: ss-pop .34s cubic-bezier(.3, 1.4, .5, 1); }
.ss-end .result-card .result-done { font-size: 1.8rem; margin: 0 0 6px; }
.ss-end .result-card .btn { margin-top: 12px; }
@keyframes ss-pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

html.fills-window .game-root[data-game="sort-shift"] .ss { height: 100%; }
html.fills-window .game-root[data-game="sort-shift"] .ss-fit { flex: 1 1 0; max-width: none; aspect-ratio: auto; }
html.fills-window .game-root[data-game="sort-shift"] .ss-hud,
html.fills-window .game-root[data-game="sort-shift"] .ss-foot { flex: none; }
