/* Ludo — the embroidered cloth is drawn on the canvas; here are the layout, the status line and the die. */
.ld-col { padding: 4px 8px 8px; gap: 8px; }
.ld-wrap { direction: ltr; flex: 0 1 auto; aspect-ratio: 1 / 1; max-width: 620px; }
.ld-wrap canvas { cursor: pointer; touch-action: manipulation; }

.ld-tray { flex: none; display: flex; align-items: center; justify-content: center; gap: 14px; width: 100%; max-width: 620px; min-height: 68px; }
.ld-status { justify-content: flex-start; gap: 8px; min-height: 0; min-width: 0; padding: 0; font-size: 1rem; line-height: 1.25; text-align: start; }
.ld-pip { flex: none; display: inline-block; width: 15px; height: 15px; border-radius: 50%; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(244, 236, 214, 0.8); }

/* the die: seven pips on a 3 x 3 grid, shown by value */
.ld-die {
  flex: none; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); direction: ltr;
  width: 64px; height: 64px; padding: 9px; margin: 0; cursor: pointer;
  border: 3px solid var(--w-vermilion); border-radius: 16px;
  background: linear-gradient(145deg, #FFFDF4 0%, var(--w-bone) 55%, #D9CBA6 100%);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.35), 0 10px 18px rgba(0, 0, 0, 0.3), inset 0 2px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.2s linear;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.ld-die i { place-self: center; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #3A5A52, var(--w-ink) 70%); visibility: hidden; }
.ld-die .a { grid-area: 1 / 1; } .ld-die .b { grid-area: 1 / 3; }
.ld-die .c { grid-area: 2 / 1; } .ld-die .d { grid-area: 2 / 3; }
.ld-die .e { grid-area: 3 / 1; } .ld-die .f { grid-area: 3 / 3; }
.ld-die .g { grid-area: 2 / 2; }
.ld-die[data-v="1"] .g, .ld-die[data-v="3"] .g, .ld-die[data-v="5"] .g,
.ld-die[data-v="2"] .b, .ld-die[data-v="2"] .e, .ld-die[data-v="3"] .b, .ld-die[data-v="3"] .e,
.ld-die[data-v="4"] i:not(.c):not(.d):not(.g), .ld-die[data-v="5"] i:not(.c):not(.d),
.ld-die[data-v="6"] i:not(.g) { visibility: visible; }
.ld-die[data-v="1"] .g { width: 14px; height: 14px; background: radial-gradient(circle at 35% 30%, #F58A72, var(--w-vermilion) 70%); }
.ld-die:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.ld-die.is-go { animation: ld-go 1.1s ease-in-out infinite; }
.ld-die.is-roll { animation: ld-roll 0.3s linear infinite; }
@keyframes ld-go { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-5px) scale(1.06); } }
@keyframes ld-roll {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(180deg) scale(1.08); }
  100% { transform: translateY(0) rotate(360deg); }
}

@media (max-width: 360px) {
  .ld-col { gap: 6px; padding: 2px 6px 6px; }
  .ld-tray { min-height: 60px; gap: 10px; }
  .ld-die { width: 56px; height: 56px; padding: 8px; border-radius: 14px; }
  .ld-die i { width: 9px; height: 9px; }
  .ld-status { font-size: 0.92rem; }
}
/* a phone on its side: the die and status sit beside the cloth so it keeps the full height */
@media (orientation: landscape) and (max-height: 500px) {
  .ld-col { flex-direction: row; gap: 16px; padding: 4px 12px; }
  .ld-wrap { flex: 0 0 auto; width: auto; height: 100%; }
  .ld-tray { flex: 0 1 200px; width: auto; flex-direction: column; }
  .ld-status { justify-content: center; text-align: center; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .ld-die.is-go, .ld-die.is-roll { animation: none; } }
