/* Serpientes y Escaleras: the board is one canvas; the dock holds three player badges and the big die. */
.sp-canvas {
  direction: ltr;
  border-radius: 14px;
  box-shadow: 0 0 0 3px #FF3D8B, 0 0 0 6px #FFB627, 0 0 0 9px #19C9B6, 0 16px 34px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
body[data-game="serpientes"] .fa-title { font-size: clamp(14px, 4.3vw, 22px); }
.sp-row { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 4px 0 2px; }
.sp-badge {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--lapis-raise);
  box-shadow: 0 0 0 2px rgba(255, 243, 224, 0.16);
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}
.sp-badge canvas { display: block; width: 48px; height: 48px; margin: 2px; }
.sp-badge.is-on { opacity: 1; transform: scale(1.16); box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(255, 182, 39, 0.6); }
.sp-me {
  position: absolute; left: 50%; bottom: -5px;
  width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--lapis);
}
.sp-die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 78px; height: 78px;
  margin: 0 4px;
  padding: 10px;
  border: 5px solid var(--gold);
  border-radius: 20px;
  background: linear-gradient(160deg, #FFFFFF, #FFE9C4);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35), inset 0 -5px 0 rgba(42, 15, 61, 0.12);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.2s ease, transform 0.12s ease;
}
.sp-die:active { transform: translateY(3px); }
.sp-die:focus-visible { outline: 3px solid var(--w-turquoise); outline-offset: 3px; }
.sp-die i {
  place-self: center;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #2A0F3D;
  opacity: 0;
}
.sp-die[data-f="1"] i:nth-child(5),
.sp-die[data-f="2"] i:nth-child(1), .sp-die[data-f="2"] i:nth-child(9),
.sp-die[data-f="3"] i:nth-child(1), .sp-die[data-f="3"] i:nth-child(5), .sp-die[data-f="3"] i:nth-child(9),
.sp-die[data-f="4"] i:nth-child(1), .sp-die[data-f="4"] i:nth-child(3), .sp-die[data-f="4"] i:nth-child(7), .sp-die[data-f="4"] i:nth-child(9),
.sp-die[data-f="5"] i:nth-child(1), .sp-die[data-f="5"] i:nth-child(3), .sp-die[data-f="5"] i:nth-child(5), .sp-die[data-f="5"] i:nth-child(7), .sp-die[data-f="5"] i:nth-child(9),
.sp-die[data-f="6"] i:nth-child(1), .sp-die[data-f="6"] i:nth-child(3), .sp-die[data-f="6"] i:nth-child(4), .sp-die[data-f="6"] i:nth-child(6), .sp-die[data-f="6"] i:nth-child(7), .sp-die[data-f="6"] i:nth-child(9) { opacity: 1; }
.sp-die[data-f="1"] i:nth-child(5) { background: #E8452C; transform: scale(1.5); }
.sp-die.is-ready { animation: sp-wiggle 1.1s ease-in-out infinite; }
.sp-die.is-rolling { animation: sp-tumble 0.3s linear infinite; }
@keyframes sp-wiggle {
  0%, 60%, 100% { transform: rotate(0) scale(1); }
  70% { transform: rotate(-9deg) scale(1.08); }
  80% { transform: rotate(8deg) scale(1.08); }
  90% { transform: rotate(-4deg) scale(1.04); }
}
@keyframes sp-tumble {
  0% { transform: rotate(0) translateY(0); }
  50% { transform: rotate(180deg) translateY(-8px); }
  100% { transform: rotate(360deg) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .sp-die.is-ready { animation: none; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(255, 182, 39, 0.5); }
  .sp-die.is-rolling { animation: none; }
}
@media (max-height: 600px) and (orientation: portrait) {
  .sp-die { width: 66px; height: 66px; padding: 8px; border-width: 4px; border-radius: 17px; }
  .sp-die i { width: 11px; height: 11px; }
  .sp-badge { width: 46px; height: 46px; }
  .sp-badge canvas { width: 42px; height: 42px; }
}
/* Short landscape screens: the dock moves beside the board so the board keeps its size. */
@media (orientation: landscape) and (max-height: 520px) {
  body[data-game="serpientes"] .fa-app { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto minmax(0, 1fr); }
  body[data-game="serpientes"] .fa-bar { grid-column: 1 / 3; }
  body[data-game="serpientes"] .fa-dock { padding: 6px 22px; }
  .sp-row { flex-direction: column; gap: 12px; }
}
