/* Shared 3D pip dice (Shut the Box style) — used across dice games */

.pip-dice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 20px;
  margin: 0;
}

.pip-dice-empty,
.pip-dice-waiting {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted, #64748b);
}

.pip-die,
.shutbox-die,
.zilch-die {
  --die-face: linear-gradient(152deg, #fffefb 0%, #f4efe6 42%, #e3dcd0 100%);
  --die-rim: rgba(201, 152, 46, 0.42);
  width: clamp(56px, 15vw, 76px);
  height: clamp(56px, 15vw, 76px);
  border-radius: 16px;
  background: var(--die-face);
  border: 1px solid var(--die-rim);
  box-shadow:
    0 5px 0 #5c554c,
    0 14px 32px rgba(0, 0, 0, 0.42),
    inset 0 2px 3px rgba(255, 255, 255, 0.95),
    inset 0 -10px 22px rgba(100, 90, 78, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  padding: 0;
  font-family: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, outline 0.12s ease;
}

.pip-die--lg,
.zilch-die.pip-die--lg {
  width: clamp(64px, 14vw, 88px);
  height: clamp(64px, 14vw, 88px);
  border-radius: 18px;
  box-shadow:
    0 6px 0 #5c554c,
    0 16px 36px rgba(0, 0, 0, 0.45),
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    inset 0 -10px 22px rgba(100, 90, 78, 0.14);
}

.pip-die--sm {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow:
    0 4px 0 #5c554c,
    0 10px 24px rgba(0, 0, 0, 0.38),
    inset 0 2px 3px rgba(255, 255, 255, 0.92),
    inset 0 -8px 18px rgba(100, 90, 78, 0.12);
}

button.pip-die {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

button.pip-die:hover:not(:disabled):not(.pip-die--dim) {
  transform: translateY(-3px);
}

button.pip-die:active:not(:disabled):not(.pip-die--dim) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #5c554c, 0 8px 20px rgba(0, 0, 0, 0.35);
}

.pip-die--sel,
.zilch-die--sel,
.zilch-die--picked {
  outline: 4px solid var(--accent, #facc15);
  outline-offset: 3px;
  transform: translateY(-5px);
  box-shadow:
    0 6px 0 #5c554c,
    0 0 0 2px rgba(250, 204, 21, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.95);
  background: linear-gradient(152deg, #fffef8 0%, #fef3c7 42%, #fde68a 100%);
}

.zilch-die.pip-die--roll.pip-die--sel,
.zilch-die.pip-die--roll.zilch-die--picked {
  animation: pip-die-roll 0.5s ease-out, zilch-die-pulse 1.2s ease-in-out infinite;
}

@keyframes zilch-die-pulse {
  0%, 100% { outline-color: #facc15; }
  50% { outline-color: #f59e0b; }
}

.pip-die--dim,
.zilch-die--dim {
  opacity: 0.55;
  filter: saturate(0.7);
  cursor: default;
  box-shadow: 0 4px 0 #4a4540, 0 10px 24px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* Zilch: non-scoring dice — dim but must not block clicks on siblings */
button.zilch-die--locked {
  opacity: 0.5;
  filter: saturate(0.55) brightness(0.88);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: 0 4px 0 #4a4540, 0 8px 18px rgba(0, 0, 0, 0.28);
}

button.zilch-die:not(.zilch-die--locked) {
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.pip-die:disabled,
.zilch-die:disabled {
  cursor: default;
}

.pip-die--roll,
.zilch-die--roll {
  animation: pip-die-roll 0.5s ease-out;
}

@keyframes pip-die-roll {
  0% { transform: rotate(-18deg) scale(0.7); opacity: 0.3; }
  55% { transform: rotate(8deg) scale(1.06); }
  100% { transform: rotate(0) scale(1); opacity: 1; }
}

.pip-die-inner,
.shutbox-die-inner,
.zilch-die-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 72%;
  height: 72%;
  gap: 10%;
  padding: 2px;
  box-sizing: border-box;
  pointer-events: none;
}

.pip-pip,
.shutbox-pip,
.zilch-pip {
  place-self: center;
  width: 88%;
  height: 88%;
  border-radius: 50%;
  opacity: 0.08;
  transform: scale(0.92);
  background: #1c1917;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.pip-pip--on,
.shutbox-pip--on,
.zilch-pip--on {
  opacity: 1;
  transform: scale(1);
  background: radial-gradient(circle at 32% 28%, #5c5854 0%, #2a2622 42%, #0f0d0c 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.18),
    inset 0 -3px 5px rgba(0, 0, 0, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

/* Shut the Box dice bar + sum display */
.die-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 96px;
  padding: 10px 12px 6px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.55) 0%, rgba(11, 17, 32, 0.72) 100%);
  border: 1px solid rgba(201, 152, 46, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

.shutbox-dice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 20px;
  margin: 0;
}

.shutbox-die-plus {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-light, #e0b44a);
  text-shadow: 0 0 18px rgba(201, 152, 46, 0.35);
  line-height: 1;
  padding: 0 2px;
}

.shutbox-sum {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text, #e2e8f0);
  letter-spacing: 0.03em;
}

.shutbox-sum-note {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent, #c9982e);
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(201, 152, 46, 0.12);
  border: 1px solid rgba(201, 152, 46, 0.28);
}

.shutbox-sum-eq {
  opacity: 0.75;
  font-weight: 800;
}

.shutbox-sum-num {
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: center;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 100%);
  box-shadow:
    0 2px 0 rgba(180, 83, 9, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.pig-dice-zone,
.ds-dice-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 14px 0 8px;
  min-height: 96px;
  justify-content: center;
}

.pig-dice-label,
.ds-dice-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}

/* Zilch board — large 3D pip dice */
#game.cg-zilch-game #diceRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 18px;
  min-height: 100px !important;
  padding: 12px 8px;
  pointer-events: auto;
}

#game.cg-zilch-game button.zilch-die.pip-die--lg {
  width: clamp(68px, 16vw, 84px);
  height: clamp(68px, 16vw, 84px);
  border-radius: 18px;
}

#game.cg-zilch-game button.zilch-die {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#game.cg-zilch-game button.zilch-die .pip-pip--on {
  width: 92%;
  height: 92%;
  opacity: 1;
  background: radial-gradient(circle at 32% 28%, #5c5854 0%, #2a2622 42%, #0f0d0c 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.18),
    inset 0 -3px 5px rgba(0, 0, 0, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.4);
}

#game.cg-zilch-game .zilch-die-fallback {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  font-size: 1.75rem;
  font-weight: 900;
  border: 2px solid rgba(201, 152, 46, 0.45);
  background: linear-gradient(152deg, #fffefb 0%, #e8e0d4 100%);
  color: #1a1410;
  box-shadow: 0 5px 0 #5c554c;
}

#game.cg-zilch-game .zilch-die-fallback.sel {
  outline: 4px solid #facc15;
  outline-offset: 3px;
  background: linear-gradient(152deg, #fffef8 0%, #fde68a 100%);
}

@media (prefers-reduced-motion: reduce) {
  .pip-die,
  .shutbox-die,
  .zilch-die,
  .pip-pip,
  .shutbox-pip {
    transition: none;
    animation: none !important;
  }
}
