/* Ludo — the board, the player strip and the dice panel. Shared table chrome
   (seats, banners, buttons, activity rail) lives in the shell's style.css.
   The board keeps the four colours a ludo board has always had, on a white
   track, rather than the shell's team palette: a seat is the same colour in the
   lobby, on the board, in the middle and in the activity rail. */

.lu-rules { margin: 0; padding-left: 20px; font-size: 12.5px; line-height: 1.7; color: var(--muted, #9DB3A6); }
.lu-rules li { margin: 2px 0; }
.lu-rules b { color: var(--ink, #E8F0EA); }

/* One colour per quadrant: --c paints tokens and edges, --cd the flat ground
   behind them (a token has to stay readable on its own colour). */
/* Quadrant 0 is top-left and the rest run clockwise, so the four colours land
   where a board puts them. Each carries three tones — `--cl` catches the light,
   `--c` is the colour, `--cs` is the shaded edge — which is what gives the cells
   and the yards their moulding. `--on-c` is what stays legible printed on `--c`. */
.lu-c0 { --c: #29A84E; --cl: #56CB72; --cs: #177533; --on-c: #FFF; }   /* top-left     */
.lu-c1 { --c: #FFC31C; --cl: #FFDA63; --cs: #C78C00; --on-c: #4A3A03; }/* top-right    */
.lu-c2 { --c: #2A8BE8; --cl: #64B2F7; --cs: #175FA6; --on-c: #FFF; }   /* bottom-right */
.lu-c3 { --c: #E23B31; --cl: #F56E60; --cs: #A1201B; --on-c: #FFF; }   /* bottom-left  */
.lu-q0 { --c: #29A84E; } .lu-q1 { --c: #FFC31C; } .lu-q2 { --c: #2A8BE8; } .lu-q3 { --c: #E23B31; }
.logrow.lu-q0 .dot, .logrow.lu-q1 .dot, .logrow.lu-q2 .dot, .logrow.lu-q3 .dot { background: var(--c); }
.lu-c0 .pav, .pav.lu-c0, .lu-c1 .pav, .pav.lu-c1,
.lu-c2 .pav, .pav.lu-c2, .lu-c3 .pav, .pav.lu-c3 { background: var(--c); color: var(--on-c); }
.lu-c0 .tteam, .lu-c1 .tteam, .lu-c2 .tteam, .lu-c3 .tteam { color: var(--c); }

/* ---- the board ---- */
/* 15×15 is the board itself: every cell knows its own square, so nothing here
   has to care how many seats are in play or how far anyone has walked. */
.lu-board {
  display: grid; grid-template-columns: repeat(15, 1fr); grid-template-rows: repeat(15, 1fr);
  aspect-ratio: 1; gap: 0; margin: 6px 0 10px; padding: 5px; border-radius: 16px;
  /* two backgrounds: the board face inside the padding box, a moulded frame in
     the border box — cheaper than a wrapper element and it bevels on its own */
  background:
    linear-gradient(#FDFCF8, #F2F0E8) padding-box,
    linear-gradient(155deg, #4A5B51 0%, #22322A 45%, #101A15 100%) border-box;
  border: 6px solid transparent;
  box-shadow: 0 14px 30px rgba(0,0,0,.55), 0 2px 0 rgba(255,255,255,.08) inset;
}
.lu-cell {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #FFF 0%, #F0EEE5 100%);
  border: 1px solid #C9CEC5; box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.lu-cell.safe::after {
  content: '★'; position: absolute; font-size: 10px; line-height: 1; color: #A9B2A6;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}
/* A seat's own start cell and its lane are painted in its colour, lit from the
   top — the way the board marks where you come in and where you finish. */
.lu-cell.start, .lu-cell.lane {
  background: linear-gradient(180deg, var(--cl) 0%, var(--c) 58%, var(--cs) 100%);
  border-color: rgba(0,0,0,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -1px 0 rgba(0,0,0,.18);
}
.lu-cell.start::after { color: var(--on-c); text-shadow: 0 1px 1px rgba(0,0,0,.28); }

/* ---- tokens: pawns ---- */
.lu-token {
  width: 100%; aspect-ratio: 24/32; padding: 0; cursor: default; display: block;
  background: none; border: none; line-height: 0;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.38));
}
.lu-pawn { width: 100%; height: 100%; display: block; overflow: visible; }
/* The ball and the cone are filled by their gradients, so CSS only draws the
   outline that keeps a pawn off its own lane, which is painted the same colour. */
.lu-pawn .body, .lu-pawn .head {
  stroke: rgba(0,0,0,.45); stroke-width: .9; stroke-linejoin: round; paint-order: stroke;
}
.lu-pawn .gloss { fill: #FFF; opacity: .6; }
.lu-pawn .sheen { fill: #FFF; opacity: .2; }
.lu-pawn .cast { fill: rgba(0,0,0,.24); }
.lu-token.hot { cursor: pointer; animation: lu-pulse 1.2s ease-in-out infinite; }
.lu-token.hot .lu-pawn .body, .lu-token.hot .lu-pawn .head { stroke: #6B4704; stroke-width: 1.5; }

/* ---- what a cell holds ---- */
/* One pile per colour, side by side; within a pile the pieces sit on each other.
   More piles means smaller pieces, so four colours on a safe square still fit
   and stay countable. */
.lu-cell { gap: 2%; padding: 3%; }
.lu-stack { position: relative; flex: 0 1 auto; width: 94%; aspect-ratio: 24/32; }
.lu-cell[data-piles="2"] .lu-stack { width: 48%; }
.lu-cell[data-piles="3"] .lu-stack { width: 33%; }
.lu-cell[data-piles="4"] .lu-stack { width: 25%; }
.lu-slot { position: absolute; inset: 0; bottom: calc(var(--i) * 26%); }
/* a pile reads as a pile: each piece behind is a touch smaller and dimmer */
.lu-slot:not(:first-child) .lu-token { filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)) brightness(.94); }
@keyframes lu-pulse {
  0%, 100% { filter: drop-shadow(0 2px 2px rgba(0,0,0,.38)) drop-shadow(0 0 2px rgba(191,132,20,.85)); }
  50% { filter: drop-shadow(0 2px 2px rgba(0,0,0,.38)) drop-shadow(0 0 7px rgba(191,132,20,1)); transform: translateY(-7%); }
}

/* ---- being taken ---- */
/* The piece that landed swallows the one standing there: it swells, the victim
   shrinks into it, and a moment later the victim pops back into its own yard. */
@keyframes lu-swallow {
  0% { transform: scale(1); opacity: 1; }
  55% { transform: scale(.38) translateY(6%); opacity: .9; }
  100% { transform: scale(.04) translateY(10%); opacity: 0; }
}
@keyframes lu-gulp { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.34) translateY(-6%); } }
@keyframes lu-drop {
  0% { transform: scale(.15); opacity: 0; }
  65% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(1); }
}
.lu-token.swallowed .lu-pawn { animation: lu-swallow .38s ease-in forwards; }
.lu-token.gulping .lu-pawn { animation: lu-gulp .38s ease-out; }
.lu-token.dropped .lu-pawn { animation: lu-drop .3s cubic-bezier(.2,1.5,.5,1); }
.lu-token.gulping, .lu-token.swallowed { z-index: 6; }

@media (prefers-reduced-motion: reduce) {
  .lu-token.hot, .lu-token.swallowed .lu-pawn, .lu-token.gulping .lu-pawn,
  .lu-token.dropped .lu-pawn, .lu-wedge.celebrate, .lu-burst { animation: none; }
}

/* ---- yards and the middle ---- */
/* A yard is a block of the seat's colour with a pen sunk into it. All four are
   drawn whoever turned up; an empty one simply has no pawns in it. */
.lu-yard {
  background: linear-gradient(155deg, var(--cl) 0%, var(--c) 52%, var(--cs) 100%);
  border: 1px solid rgba(0,0,0,.22);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.3), inset 0 -6px 14px rgba(0,0,0,.22);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.lu-yard-pen {
  width: 62%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8%; place-items: center; padding: 5%; border-radius: 10px;
  background: linear-gradient(180deg, #F2F0E7 0%, #FFF 55%);
  box-shadow: inset 0 3px 7px rgba(0,0,0,.3), 0 1px 0 rgba(255,255,255,.45);
}
.lu-yard-pen .lu-token { width: 74%; }
.lu-yard-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .04em; color: var(--on-c);
  max-width: 86%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* The middle is four triangles, each pointing back down the lane that feeds it;
   a seat's tally sits in the fat end of its own wedge. */
.lu-home {
  position: relative; background: #FCFBF7; border: 1px solid #C9CEC5;
  box-shadow: inset 0 0 10px rgba(0,0,0,.22);
}
.lu-wedge {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--cl) 0%, var(--c) 60%, var(--cs) 100%);
  display: flex; align-items: center; justify-content: center;
  font: 800 11px 'Bricolage Grotesque'; color: var(--on-c);
}
.lu-wedge b { text-shadow: 0 1px 1px rgba(0,0,0,.32); }
/* ---- a pawn getting home ---- */
@keyframes lu-party { 0%, 100% { filter: none; } 40% { filter: brightness(1.45) saturate(1.3); } }
.lu-wedge.celebrate { animation: lu-party .45s ease-in-out 2; }
.lu-burst { position: absolute; inset: 0; pointer-events: none; }
.lu-burst i {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px;
  border-radius: 50%; background: var(--c); box-shadow: 0 0 5px var(--cl);
  animation: lu-spark .85s ease-out forwards;
}
@keyframes lu-spark {
  0% { transform: translate(0, 0) scale(.5); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; }
}
.lu-burst i:nth-child(1) { --dx: 0; --dy: -34px; }
.lu-burst i:nth-child(2) { --dx: 22px; --dy: -26px; animation-delay: .04s; }
.lu-burst i:nth-child(3) { --dx: 32px; --dy: -6px; animation-delay: .08s; }
.lu-burst i:nth-child(4) { --dx: 26px; --dy: 20px; animation-delay: .02s; }
.lu-burst i:nth-child(5) { --dx: 4px; --dy: 32px; animation-delay: .1s; }
.lu-burst i:nth-child(6) { --dx: -20px; --dy: 26px; animation-delay: .06s; }
.lu-burst i:nth-child(7) { --dx: -32px; --dy: 4px; animation-delay: .12s; }
.lu-burst i:nth-child(8) { --dx: -24px; --dy: -22px; animation-delay: 0s; }
.lu-burst i:nth-child(9) { --dx: 14px; --dy: -14px; animation-delay: .16s; }
.lu-burst i:nth-child(10) { --dx: -12px; --dy: 14px; animation-delay: .14s; }
.w-left   { clip-path: polygon(0 0, 50% 50%, 0 100%); justify-content: flex-start; padding-left: 10%; }
.w-top    { clip-path: polygon(0 0, 100% 0, 50% 50%); align-items: flex-start; padding-top: 6%; }
.w-right  { clip-path: polygon(100% 0, 100% 100%, 50% 50%); justify-content: flex-end; padding-right: 10%; }
.w-bottom { clip-path: polygon(0 100%, 100% 100%, 50% 50%); align-items: flex-end; padding-bottom: 6%; }

/* ---- the player strip ---- */
.lu-players { display: flex; flex-direction: column; gap: 6px; }
.lu-p {
  display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 8px 11px;
  background: linear-gradient(180deg, #1A2E23 0%, #132218 100%);
  border: 1px solid var(--felt-line); border-left: 5px solid var(--c);
  border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
.lu-p.on { box-shadow: 0 0 0 1.5px var(--brass); }
.lu-p.open { border-style: dashed; opacity: .6; }
.lu-p.done .lu-phome { color: #6FD3A3; }
.lu-pav { color: var(--c); font-size: 13px; }
.lu-pname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-pteam { font-size: 10px; font-weight: 700; letter-spacing: .08em; color: #8FA898; }
.lu-phome { font: 800 12px 'Bricolage Grotesque'; color: var(--brass); }

/* ---- the dice panel ---- */
.lu-panel {
  display: flex; align-items: center; gap: 12px; min-height: 86px; padding: 10px 12px;
  background: var(--felt-700); border: 1px solid var(--felt-line); border-radius: 16px;
}
.lu-panel.hint { justify-content: center; font-size: 13px; }
/* A drawn die: a 3×3 pip grid the script fills by value. The big one tumbles
   through a few faces when a roll lands — the value is the server's either way. */
.lu-die-slot {
  flex: none; width: 70px; height: 70px; display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none;
}
.lu-die-slot.rollable { cursor: pointer; animation: lu-offer 1.6s ease-in-out infinite; }
.lu-die-slot.rollable:active { transform: scale(.94); }
@keyframes lu-offer { 0%, 100% { transform: none; } 50% { transform: translateY(-4px) rotate(-4deg); } }
@media (prefers-reduced-motion: reduce) { .lu-die-slot.rollable { animation: none; } }
.lu-die.blank { opacity: .3; }
.lu-die.blank i { opacity: .35; }
.lu-die {
  display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); flex: none;
  width: 44px; height: 44px; padding: 6px; gap: 2px; border-radius: 10px;
  background: linear-gradient(160deg, #FFF 0%, #F3F0E4 55%, #DFDACA 100%);
  box-shadow: 0 3px 0 #B9B3A0, 0 7px 14px rgba(0,0,0,.5), inset 0 1px 0 #FFF;
}
.lu-die i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); align-self: center; justify-self: center; }
.lu-die.sm { width: 16px; height: 16px; padding: 2.5px; gap: 1px; border-radius: 4px; vertical-align: -3px; }
.lu-die.sm i { width: 3.5px; height: 3.5px; }
.lu-die.big { width: 62px; height: 62px; padding: 9px; gap: 3px; border-radius: 14px; }
.lu-die.big i { width: 11px; height: 11px; }
.lu-die.spin { animation: lu-tumble .07s linear; }
.lu-die.landed { animation: lu-settle .26s cubic-bezier(.2,1.4,.5,1); }
@keyframes lu-tumble { from { transform: rotate(-13deg) scale(.9); } to { transform: rotate(11deg) scale(1.05); } }
@keyframes lu-settle { from { transform: scale(1.2) rotate(6deg); } 60% { transform: scale(.96) rotate(-2deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .lu-die.spin, .lu-die.landed { animation: none; } }

/* ---- the result: a leaderboard, not just a winner ---- */
.lu-leaderboard { display: flex; flex-direction: column; }
.lu-board-head, .lu-srow {
  display: grid; grid-template-columns: 26px 1fr 42px 46px 36px; align-items: center; gap: 6px;
}
.lu-board-head {
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #7E9787;
  font-weight: 700; padding: 0 2px 6px;
}
.lu-board-head span:not(:nth-child(2)) { text-align: center; }
.lu-srow { font-size: 13.5px; padding: 9px 2px; border-top: 1px solid var(--felt-line); }
.lu-srow.won { background: linear-gradient(90deg, rgba(217,164,65,.16), transparent 70%); border-radius: 10px; }
.lu-rank { text-align: center; font: 800 13px 'Bricolage Grotesque'; color: var(--brass); }
.lu-who { display: flex; align-items: center; gap: 8px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-who .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.lu-num { text-align: center; font: 800 13px 'Bricolage Grotesque'; color: var(--cream); }
.lu-num i { font: 600 10px 'Instrument Sans'; color: #7E9787; font-style: normal; }
