.dice-tray__row {
  display: flex;
  justify-content: center;
  gap: var(--sp-3);
  min-height: 60px;
}

.die {
  --size: 54px;
  width: var(--size);
  height: var(--size);
  padding: calc(var(--size) * 0.14);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  place-items: center;
  border-radius: calc(var(--size) * 0.2);
  background: linear-gradient(145deg, #ffffff, #e9e4d6);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), var(--shadow-sm);
  transition: transform 200ms var(--ease-out), box-shadow 200ms;
}

.die--logo { --size: 64px; }

.die__pip {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  background: var(--c-ink);
  visibility: hidden;
}

/* Pip layout: cells numbered 1–9, left to right, top to bottom */
.die[data-face="1"] .die__pip:nth-child(5),
.die[data-face="2"] .die__pip:is(:nth-child(1), :nth-child(9)),
.die[data-face="3"] .die__pip:is(:nth-child(1), :nth-child(5), :nth-child(9)),
.die[data-face="4"] .die__pip:is(:nth-child(1), :nth-child(3), :nth-child(7), :nth-child(9)),
.die[data-face="5"] .die__pip:is(:nth-child(1), :nth-child(3), :nth-child(5), :nth-child(7), :nth-child(9)),
.die[data-face="6"] .die__pip:is(:nth-child(1), :nth-child(3), :nth-child(4), :nth-child(6), :nth-child(7), :nth-child(9)) {
  visibility: visible;
}

.die[data-face="1"] .die__pip:nth-child(5) { background: var(--c-flag); }

.die[data-face="0"] {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.die--rolling {
  animation: die-tumble 650ms var(--ease-out) both;
}

.die--match {
  transform: translateY(-6px);
  box-shadow: 0 0 0 3px var(--c-primary), 0 8px 16px rgba(0, 0, 0, 0.35);
}

@keyframes die-tumble {
  0% { transform: translateY(-30px) rotate(-200deg) scale(0.8); }
  45% { transform: translateY(6px) rotate(40deg) scale(1.05); }
  70% { transform: translateY(-4px) rotate(-12deg); }
  100% { transform: translateY(0) rotate(0); }
}

@media (max-width: 360px) {
  .die { --size: 48px; }
  .dice-tray__row { gap: var(--sp-2); }
}
