/* Sort Stack — game-specific styles */
.ss-wrap {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
}
/* in fullscreen the stage has a fixed height: let the board scroll rather than get cut */
.is-fs .ss-wrap, .is-pseudo-fs .ss-wrap { max-height: 100dvh; overflow-y: auto; }
.ss-info {
  display: flex;
  justify-content: space-between;
  width: min(100%, 520px);
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--muted);
}
.ss-info .is-low { color: #ff5c7a; }
.ss-field {
  --cols: 5;
  /* ball size follows the space available per tube, so a full tube (4 balls) always fits inside it */
  --ball: clamp(24px, calc((min(100cqw - 24px, 520px) - (var(--cols) - 1) * 10px) / var(--cols) - 14px), 46px);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 14px 10px;
  width: min(100%, 520px);
  justify-items: center;
}
.ss-tube {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  width: calc(var(--ball) + 14px);
  height: calc(var(--ball) * 4 + 4px * 3 + 12px + 4px);
  padding: 6px 5px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px 8px 26px 26px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease-out, border-color 120ms;
}
.ss-tube:hover { border-color: rgba(255, 255, 255, 0.4); }
.ss-tube.is-sel { transform: translateY(-10px); border-color: #c6ff3d; box-shadow: 0 0 14px rgba(198, 255, 61, 0.3); }
.ss-tube.is-done { border-color: rgba(198, 255, 61, 0.55); }
.ss-tube:focus-visible { outline: 3px solid #c6ff3d; outline-offset: 3px; }
.ss-ball {
  flex: none;
  width: var(--ball);
  height: var(--ball);
  border-radius: 50%;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2), inset 0 3px 0 rgba(255, 255, 255, 0.3);
}
.ss-tools { display: flex; gap: 10px; }
.ss-hint { margin: 0; max-width: 520px; font-size: 0.85rem; color: var(--muted); text-align: center; }
@media (prefers-reduced-motion: reduce) { .ss-tube { transition: none; } }
