/* ============================================
   DICE OVERLAY
   ============================================ */
.dice-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

.dice-container {
  display: flex;
  align-items: center;
  gap: 16px;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.12s ease, transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: blur(4px);
}

.dice-container.show,
.dice-container.visible {
  opacity: 1;
  transform: scale(1);
  filter: blur(0);
}

.dice-container.rolling {
  animation: containerShake 0.08s linear infinite;
  will-change: transform;
}

@keyframes containerShake {
  0% { transform: translate(0, 0) scale(1.05); }
  25% { transform: translate(-3px, 2px) scale(1.05); }
  50% { transform: translate(2px, -2px) scale(1.05); }
  75% { transform: translate(-2px, -1px) scale(1.05); }
  100% { transform: translate(3px, 1px) scale(1.05); }
}

.roll-total {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.75);
  padding: 3px 14px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  border: 1px solid rgba(255,255,255,0.15);
}

@keyframes totalSlam {
  0% { transform: translateX(-50%) scale(2.5); opacity: 0; }
  50% { transform: translateX(-50%) scale(0.85); opacity: 1; }
  75% { transform: translateX(-50%) scale(1.1); }
  100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

.roll-total.visible {
  animation: totalSlam 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ============================================
   DICE
   ============================================ */
.die {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #e53935, #b71c1c);
  border-radius: 11px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.2);
  position: relative;
  transition: transform 0.04s linear, box-shadow 0.08s ease;
  will-change: transform;
}

.pip {
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
  display: none;
}

/* Pip layouts for each die value */
/* value 1: center pip only */
.die[data-v="1"] .pip:nth-child(5) { display: block; }

/* value 2: top-right, bottom-left */
.die[data-v="2"] .pip:nth-child(3) { display: block; }
.die[data-v="2"] .pip:nth-child(7) { display: block; }

/* value 3: top-right, center, bottom-left */
.die[data-v="3"] .pip:nth-child(3) { display: block; }
.die[data-v="3"] .pip:nth-child(5) { display: block; }
.die[data-v="3"] .pip:nth-child(7) { display: block; }

/* value 4: four corners */
.die[data-v="4"] .pip:nth-child(1) { display: block; }
.die[data-v="4"] .pip:nth-child(3) { display: block; }
.die[data-v="4"] .pip:nth-child(7) { display: block; }
.die[data-v="4"] .pip:nth-child(9) { display: block; }

/* value 5: four corners + center */
.die[data-v="5"] .pip:nth-child(1) { display: block; }
.die[data-v="5"] .pip:nth-child(3) { display: block; }
.die[data-v="5"] .pip:nth-child(5) { display: block; }
.die[data-v="5"] .pip:nth-child(7) { display: block; }
.die[data-v="5"] .pip:nth-child(9) { display: block; }

/* value 6: three left, three right */
.die[data-v="6"] .pip:nth-child(1) { display: block; }
.die[data-v="6"] .pip:nth-child(3) { display: block; }
.die[data-v="6"] .pip:nth-child(4) { display: block; }
.die[data-v="6"] .pip:nth-child(6) { display: block; }
.die[data-v="6"] .pip:nth-child(7) { display: block; }
.die[data-v="6"] .pip:nth-child(9) { display: block; }
