/* games/ludo.html: Ludo (Fia med knuff). The page around it is css/games/board-game.css, the die css/dice.css. */
.wrap.wide{max-width:1080px}
.dot{display:inline-block;width:14px;height:14px;border-radius:50%;background:var(--c);box-shadow:inset 0 -2px 3px rgba(0,0,0,.3);flex:none}

/* New game: the colour choice */
.colour-pick{display:flex;flex-wrap:wrap;gap:6px 16px}
.colour-opt{display:inline-flex!important;align-items:center!important;gap:6px!important}
.colour-opt[hidden]{display:none!important}

/* Lobby */
.lobby-seats{list-style:none;display:flex;flex-direction:column;gap:8px;margin:16px 0 10px}
.lobby-seats li{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:8px 12px;border:1px solid var(--border);border-radius:10px;background:var(--bg2)}
.lobby-seats .ok{color:var(--green)}

/* Players, board and die */
.ludo-players{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.lplayer{display:flex;align-items:center;gap:8px;background:var(--card);border:1px solid var(--border);border-radius:10px;padding:6px 12px;font-weight:700;min-width:0}
.lplayer .pname{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:16em}
.lplayer b{font-weight:600;color:var(--muted);font-size:13px}
.lplayer.active{border-color:var(--green);box-shadow:0 0 0 1px var(--green)}
.lplayer.won{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.ludo-play{display:grid;grid-template-columns:minmax(0,1fr) 310px;gap:18px;align-items:start}
.ludo-side{display:flex;flex-direction:column;gap:10px;min-width:0}
.ludo-status{font-weight:800;font-size:16px;min-height:2.8em}
.ludo-dice-actions{display:flex;justify-content:center;gap:8px}
.ludo-dice-actions .btn[hidden]{display:none}
.ludo-hint{text-align:center;min-height:1.3em}
#takeover{white-space:normal;text-align:left}
@media (max-width:820px){
  .ludo-play{grid-template-columns:1fr}
  .ludo-status{min-height:0}
}

/* The board: a picture (js/games/ludo-viking.js) with numbered pieces on it, turned so the player's nest is at the
   bottom left: the royal board of 15 × 15 squares (classic Ludo without crowns and feathers, FR-LUDO-02), or six arms. */
.ludo-board-wrap{width:100%;max-width:640px;margin:0 auto}
.ludo-board{--rot:0deg;position:relative;width:100%;aspect-ratio:1;border-radius:18px;transform:rotate(var(--rot));
  background:#f3e7cf;border:clamp(5px,1.4vw,9px) solid #6b4423;
  box-shadow:0 10px 26px rgba(0,0,0,.4),inset 0 0 0 2px rgba(255,255,255,.25);box-sizing:border-box}

/* Pieces: they stay upright while the board turns, and hop square by square (--step). */
.piece{position:absolute;z-index:2;width:calc(100% / var(--n,11) * .64);aspect-ratio:1;padding:0;border:0;border-radius:50%;cursor:default;
  transform:translate(-50%,-50%) rotate(calc(-1 * var(--rot)));
  background:radial-gradient(circle at 34% 28%,#fff 0 7%,color-mix(in srgb,var(--c) 70%,#fff) 16%,var(--c) 42%,color-mix(in srgb,var(--c) 55%,#000) 100%);
  box-shadow:0 3px 4px rgba(0,0,0,.45),inset 0 -3px 5px rgba(0,0,0,.3);
  transition:left var(--step,0ms) ease-out,top var(--step,0ms) ease-out,width .2s}
.piece::after{content:'';position:absolute;inset:27%;border-radius:50%;border:2px solid rgba(255,255,255,.55);box-shadow:inset 0 1px 2px rgba(0,0,0,.25)}
.piece.in-goal{width:calc(100% / var(--n,11) * .36)}
.piece.moving{z-index:5;transform:translate(-50%,-62%) rotate(calc(-1 * var(--rot))) scale(1.12);box-shadow:0 8px 8px rgba(0,0,0,.35),inset 0 -3px 5px rgba(0,0,0,.3)}
.piece.knocked{z-index:5;transition:left .45s cubic-bezier(.3,.7,.4,1),top .45s cubic-bezier(.3,.7,.4,1)}
.piece.can{z-index:4;cursor:pointer;animation:ludo-glow 1s ease-in-out infinite alternate}
.piece:focus-visible{outline:3px solid var(--blue);outline-offset:2px}
@keyframes ludo-glow{from{box-shadow:0 0 0 2px #fff,0 0 0 4px var(--green),0 3px 4px rgba(0,0,0,.45)}to{box-shadow:0 0 0 3px #fff,0 0 12px 6px var(--green),0 3px 4px rgba(0,0,0,.45)}}
@media (prefers-reduced-motion:reduce){.piece.can{animation:none;box-shadow:0 0 0 3px #fff,0 0 0 6px var(--green)}}

/* Fia med hutt: the SKÅL! splash over the whole page */
.hutt{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:16px;
  background:radial-gradient(circle at 50% 45%,rgba(240,165,0,.35),rgba(0,0,0,.72) 70%)}
.hutt[hidden]{display:none}
.hutt-card{max-width:420px;width:100%;text-align:center;background:var(--card);border:2px solid var(--accent);border-radius:20px;
  padding:22px 20px 18px;box-shadow:0 20px 60px rgba(0,0,0,.6)}
.hutt-glass{font-size:clamp(64px,18vw,104px);line-height:1;display:inline-block;transform-origin:50% 90%}
.hutt-title{font-size:clamp(40px,11vw,64px);font-weight:900;letter-spacing:2px;color:var(--accent);margin:4px 0 6px;
  text-shadow:0 3px 0 rgba(0,0,0,.35)}
.hutt-text{font-size:18px;font-weight:700;margin-bottom:14px}
.hutt-btn{font-size:18px;padding:12px 22px}
.hutt-btn[hidden]{display:none}
.hutt-wait{margin-top:8px;min-height:1.2em}
.hutt.pop .hutt-card{animation:hutt-in .45s cubic-bezier(.2,1.6,.4,1)}
.hutt.pop .hutt-glass{animation:hutt-cheers 1.2s ease-in-out .2s 2}
@keyframes hutt-in{from{transform:scale(.4);opacity:0}to{transform:scale(1);opacity:1}}
@keyframes hutt-cheers{0%,100%{transform:rotate(0)}25%{transform:rotate(-14deg)}50%{transform:rotate(10deg) translateY(-6px)}75%{transform:rotate(-6deg)}}
@media (prefers-reduced-motion:reduce){.hutt.pop .hutt-card,.hutt.pop .hutt-glass{animation:none}}

/* Settings dialog */
#settings .set-group{margin-bottom:14px}
#settings input[type=range]{width:100%;accent-color:var(--green)}
#settings output{font-weight:700;margin-left:6px}
.remember{display:flex;gap:8px;align-items:baseline;cursor:pointer;margin-top:4px}
.remember[hidden]{display:none}

/* The pieces on the picture board; Kunglig Vikingludo (FR-LUDO-19..22) adds a button per piece that may move, and a
   crown on 3 and a feather on 5 of the die. */
.ludo-board.six{border-radius:50%;background:transparent;border:0;box-shadow:none}
.ludo-board .viking-board{position:absolute;inset:0;width:100%;height:100%;display:block}
.ludo-board .piece{width:calc(100% / var(--n) * .86)}
.ludo-board .piece.in-goal{width:calc(100% / var(--n) * .5)}
.ludo-board .piece::after{inset:22%}
.piece .num{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;z-index:1;
  font:900 clamp(8px,1.5vw,13px)/1 system-ui,sans-serif;color:#fff;text-shadow:0 0 2px #000,0 1px 2px #000}
.piece.in-goal .num{display:none}
/* Pieces of one colour on one square: one bigger piece with their numbers ("12"); the others are hidden under it. */
.ludo-board .piece.stack{width:calc(100% / var(--n) * 1.06);z-index:3}
.piece.stack .num{font-size:clamp(7px,1.2vw,11px);letter-spacing:-.5px}
.piece.stacked{visibility:hidden}
.piece.hl{z-index:6;outline:3px solid var(--blue);outline-offset:2px}
.ludo-pick{display:flex;flex-direction:column;gap:6px}
.ludo-pick[hidden]{display:none}
.ludo-pick .pick{display:flex;align-items:center;gap:10px;text-align:left;white-space:normal}
.ludo-pick .num{flex:none;display:inline-flex;align-items:center;justify-content:center;width:1.8em;height:1.8em;border-radius:50%;
  background:var(--c);color:#fff;text-shadow:0 1px 2px #000;box-shadow:inset 0 -2px 3px rgba(0,0,0,.3)}
#tray.viking .die-face[data-value="3"] .pip,#tray.viking .die-face[data-value="5"] .pip{display:none}
#tray.viking .die-face[data-value="3"]{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -13 28 26'%3E%3Cpath d='M-11 6 L-12 -7 L-6 -1 L0 -10 L6 -1 L12 -7 L11 6Z' fill='%23e2a70f' stroke='%233a2a18' stroke-width='1.6' stroke-linejoin='round'/%3E%3Crect x='-11' y='4' width='22' height='5' rx='1' fill='%23e2a70f' stroke='%233a2a18' stroke-width='1.6'/%3E%3Ccircle cx='-6' cy='6.5' r='1.5' fill='%23b3262e'/%3E%3Ccircle cx='0' cy='6.5' r='1.5' fill='%23b3262e'/%3E%3Ccircle cx='6' cy='6.5' r='1.5' fill='%23b3262e'/%3E%3C/svg%3E") center/72% no-repeat,radial-gradient(circle at 35% 30%,#fffdf7,#f4efe3 60%,#e6dfcf)}
#tray.viking .die-face[data-value="5"]{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-14 -16 28 34'%3E%3Cg transform='rotate(-35)'%3E%3Cpath d='M0 -13 C8 -8 8 6 0 12 C-8 6 -8 -8 0 -13Z' fill='%237a3fc0' stroke='%233a2a18' stroke-width='1.4'/%3E%3Cpath d='M0 -11 L0 17' stroke='%233a2a18' stroke-width='1.6' stroke-linecap='round'/%3E%3C/g%3E%3C/svg%3E") center/72% no-repeat,radial-gradient(circle at 35% 30%,#fffdf7,#f4efe3 60%,#e6dfcf)}
