/* ==========================================================================
   COLOUR & SORT
   The conveyor of things to sort, the bins they go into, and the drag ghost.
   Shared chrome is in kids-common.css.
   ========================================================================= */

#scr-play {
  align-items: stretch;
  /* The items are dragged, and without this the browser treats a slow drag as
     a page scroll and steals the pointer half way through. */
  touch-action: none;
}

/* ===================== The things to sort ===================== */

/* Sentence case and small: this is an aside for whoever is helping, not the
   instruction the child is following — they are following the pictures. */
.tray-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #a49ec9;
  margin-bottom: 6px;
}

/* Sits in the empty space the pictures are dragged across, rather than tight
   under the tray where it competes with the items themselves. */
#feedback {
  margin: auto 0;
}

.item-tray {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 92px;
  padding: 10px;
  border-radius: 20px;
  background: var(--kids-card);
  border: 3px solid #efe9e0;
  margin-bottom: 14px;
}

.sort-item {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 3px solid var(--kids-border);
  background: #fdfcff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Picked up by tapping rather than dragging. Has to be unmistakable: the child
   now has to tap a bin, and nothing else on screen has changed. */
.sort-item.chosen {
  border-color: var(--kids-lilac);
  background: #eeecff;
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(127, 119, 221, 0.4);
}

.sort-item.dragging {
  opacity: 0.25;
}

.sort-item.landed {
  animation: kids-shrink-away 0.32s forwards;
}

@keyframes kids-shrink-away {
  to {
    transform: scale(0.2);
    opacity: 0;
  }
}

/* The piece that follows the finger. Fixed, so it is positioned against the
   viewport and not against whatever happens to be scrolled. */
#drag-ghost {
  position: fixed;
  z-index: 900;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: #eeecff;
  border: 3px solid var(--kids-lilac);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -50%) scale(1.1);
}

/* ===================== The bins ===================== */

.bins {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.bin {
  border-radius: 22px;
  border: 4px dashed #cfc9e8;
  background: var(--kids-card);
  padding: 10px 6px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, background-color 0.12s;
}

.bin-face {
  font-size: 2.2rem;
  line-height: 1.1;
}

.bin-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--kids-muted);
  text-align: center;
  margin-top: 2px;
  min-height: 1.9em;
}

/* What has already been dropped in. Kept visible so a child can see the sorting
   they have done, which is most of the satisfaction of the game. */
.bin-contents {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 3px;
  font-size: 1.25rem;
  margin-top: 4px;
}

.bin.over {
  border-style: solid;
  border-color: var(--kids-lilac);
  background: #f4f2ff;
  transform: scale(1.03);
}

.bin.correct {
  border-style: solid;
  border-color: var(--kids-green);
  background: #e4f6ef;
  animation: kids-pop 0.35s;
}

.bin.wrong {
  border-style: solid;
  border-color: var(--kids-red);
  background: #fdecea;
  animation: kids-shake 0.4s;
}

/* ===================== Menu ===================== */

.game-btn.set-btn {
  background: #1d9e75;
}

.set-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

@media (max-width: 380px) {
  .sort-item,
  #drag-ghost {
    width: 56px;
    height: 56px;
    font-size: 1.85rem;
  }

  .bin {
    min-height: 116px;
  }

  .bin-face {
    font-size: 1.9rem;
  }
}
