/* Checkers page only (games/checkers/index.php): move animation, legal-move dots, capture hints, tips.
   Base board / piece look stays in boards.css (.ck-sq / .ck-piece). */
#checkers-board { touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#checkers-board .ck-piece { position: relative; pointer-events: none; }
#checkers-board .ck-piece.ck-anim { will-change: transform; z-index: 2; }
#checkers-board .ck-sq.ck-top { z-index: 3; }

/* legal destinations of the selected piece: a dot (no full-square fill) */
#checkers-board .ck-sq.dest { box-shadow: none; }
#checkers-board .ck-sq.dest::after {
    content: ""; width: 30%; aspect-ratio: 1; border-radius: 50%;
    background: rgba(212,255,58,.9); box-shadow: 0 0 0 3px rgba(20,24,54,.35), 0 0 14px rgba(212,255,58,.6);
}
#checkers-board.ck-ping .ck-sq.dest::after { animation: ckDot .55s ease-out 1; }
@keyframes ckDot { 0% { transform: scale(1); } 35% { transform: scale(1.55); } 100% { transform: scale(1); } }

/* the opponent's last move: origin + destination, subtle */
#checkers-board .ck-sq.lastf, #checkers-board .ck-sq.lastt { box-shadow: inset 0 0 0 999px rgba(255,200,61,.16); }
#checkers-board .ck-sq.lastt { box-shadow: inset 0 0 0 999px rgba(255,200,61,.16), inset 0 0 0 2px rgba(255,200,61,.7); }
#checkers-board .ck-sq.lastf:not(.dest)::after { content: ""; width: 18%; aspect-ratio: 1; border-radius: 50%; background: rgba(255,200,61,.45); }
#checkers-board .ck-sq.sel { box-shadow: inset 0 0 0 999px rgba(255,200,61,.4); }

/* pieces that can (must) capture: glowing pulse ring */
#checkers-board .ck-piece.must::after {
    content: ""; position: absolute; inset: -9%; border-radius: 50%; border: 3px solid #d4ff3a;
    box-shadow: 0 0 12px rgba(212,255,58,.75); animation: ckMust 1.1s ease-in-out infinite; pointer-events: none;
}
#checkers-board.ck-ping-must .ck-piece.must::after { animation: ckMustBig .6s ease-out 2; }
@keyframes ckMust { 0%, 100% { transform: scale(.94); opacity: .55; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes ckMustBig { 0% { transform: scale(.9); opacity: .6; } 50% { transform: scale(1.22); opacity: 1; } 100% { transform: scale(.94); opacity: .7; } }

/* tapped a piece that cannot move: brief red ring (the wiggle is a Web Animation) */
#checkers-board .ck-piece.bad::before {
    content: ""; position: absolute; inset: -8%; border-radius: 50%; border: 3px solid #ff4d5e;
    box-shadow: 0 0 10px rgba(255,77,94,.7); animation: ckBad .7s ease-out 1 forwards; pointer-events: none;
}
@keyframes ckBad { 0% { opacity: 0; transform: scale(.9); } 20% { opacity: 1; transform: scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }

/* captured piece fading out (temporary element in the emptied square) */
#checkers-board .ck-piece.ck-dying { position: absolute !important; left: 11%; top: 11%; z-index: 1; }

/* hint / tip line between the scoreboard and the board (never covers the board) */
.ck-tip {
    min-height: 34px; margin: 0 auto 8px; max-width: min(100%, 520px); padding: 5px 14px; box-sizing: border-box;
    display: flex; align-items: center; justify-content: center; text-align: center;
    font: 700 16px/1.25 var(--font-display, inherit); color: var(--text-dim, #667); border-radius: 999px;
    opacity: 0; transition: opacity .15s, background-color .15s, color .15s; pointer-events: none;
}
.ck-tip.on { opacity: 1; }
.ck-tip.must { color: #1f7a2e; }
:root[data-theme="dark"] .ck-tip.must { color: #d4ff3a; }
.ck-tip.is-tip { background: var(--ink, #141836); color: #fff; box-shadow: 0 4px 14px rgba(10,14,30,.25); }
:root[data-theme="dark"] .ck-tip.is-tip { background: #d4ff3a; color: #141836; }
.ck-tip.is-tip.is-bad { background: #b3263a; color: #fff; }

#ck-sfx { min-width: 38px; padding: 0 8px; font-size: 17px; line-height: 1; }
@media (max-width: 760px) { .toolbar-actions #ck-sfx { flex: 0 0 40px; } }

@media (prefers-reduced-motion: reduce) {
    #checkers-board .ck-piece.must::after, #checkers-board.ck-ping .ck-sq.dest::after { animation: none; }
}

/* scoreboard above the board: pieces left per side (main, big digits), whose turn, series / today tally (secondary) */
.ck-score {
    width: min(100cqw, 520px); max-width: 100%; box-sizing: border-box; margin: 0 auto 4px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px;
}
.ck-side { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 5px 9px; border-radius: 14px; border: 2px solid transparent; transition: background-color .2s, border-color .2s; }
.ck-side.op { flex-direction: row-reverse; text-align: right; }
.ck-side.is-turn { background: rgba(212,255,58,.18); border-color: rgba(140,180,20,.6); }
:root[data-theme="dark"] .ck-side.is-turn { background: rgba(212,255,58,.12); border-color: rgba(212,255,58,.55); }
.ck-av { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; font-size: 15px; color: #fff; background: #64748b; }
.ck-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ck-who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; line-height: 1.15; }
.ck-who b { font-size: 15px; font-weight: 800; color: var(--text, #141836); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ck-who small { font-size: 12px; font-weight: 600; color: var(--text-dim, #667); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.15em; }
.ck-cnt { flex: 0 0 auto; display: flex; align-items: center; gap: 3px; }
.ck-side.op .ck-cnt { flex-direction: row-reverse; }
.ck-cnt i { font-style: normal; font-weight: 700; font-size: 15px; color: var(--text-dim, #667); }
.ck-num { display: inline-block; min-width: 1.1ch; font: 800 32px/1 var(--font-display, inherit); color: var(--text, #141836); font-variant-numeric: tabular-nums; text-align: center; }
.ck-num.bump { animation: ckBump .5s ease-out 1; }
@keyframes ckBump { 0% { transform: scale(1); color: inherit; } 30% { transform: scale(1.45); color: #e23d4b; } 100% { transform: scale(1); } }
.ck-disc { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.18); }
.ck-disc.red { background: radial-gradient(circle at 35% 30%, #ff8a8f, #d22a3a 58%, #9e1a28); }
.ck-disc.black { background: radial-gradient(circle at 35% 30%, #5a6080, #1d2033 58%, #0b0d18); }
.ck-mid { display: flex; flex-direction: column; align-items: center; line-height: 1; padding: 0 2px; }
.ck-lbl { font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-dim, #667); white-space: nowrap; margin-bottom: 3px; }
.ck-tally { font: 800 17px/1 var(--font-display, inherit); color: var(--text-dim, #556); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* "You're ahead by 2 pieces" / "Even" (shown in the hint line when there is no tip) */
.ck-tip.adv { font-size: 15px; }
.ck-tip.adv.up { color: #1f7a2e; }
.ck-tip.adv.down { color: #b3263a; }
:root[data-theme="dark"] .ck-tip.adv.up { color: #9be15d; }
:root[data-theme="dark"] .ck-tip.adv.down { color: #ff8a8f; }
@media (max-width: 760px) {
    .ck-score { gap: 3px; }
    .ck-side { gap: 4px; padding: 4px 5px; border-radius: 12px; }
    .ck-av { display: none; }
    .ck-who b { font-size: 14px; }
    .ck-who small { font-size: 11px; }
    .ck-num { font-size: 27px; }
    .ck-disc { flex-basis: 20px; width: 20px; height: 20px; }
    .ck-cnt i { font-size: 13px; }
    .ck-lbl { font-size: 9px; }
    .ck-tally { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .ck-num.bump { animation: none; } }

/* small phones: keep the toolbar on one row (extra sound button) and the tip line one line high (no board jump) */
.ck-lvl { white-space: nowrap; }
@media (max-width: 760px) {
    .ck-tip { height: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 24px; }
}
@media (max-width: 420px) {
    .ck-lvl { display: none; }
    .ck-tip { font-size: 14px; padding: 5px 10px; }
    .ck-tip.adv { font-size: 14px; }
    .ck-num { font-size: 25px; }
    .ck-disc { flex-basis: 18px; width: 18px; height: 18px; }
    .ck-who b { font-size: 13.5px; }
    .toolbar-actions:has(#ck-sfx) { gap: 4px; }
    .toolbar-actions:has(#ck-sfx) .btn { padding: 0 8px; }
    .toolbar-actions:has(#ck-sfx) #ck-diff { padding: 0 4px 0 10px; min-width: 98px; flex: 1 1 auto; }
    .toolbar-actions:has(#ck-sfx) .btn-primary { flex: 1 1 auto; min-width: 0; padding: 0 10px; }
    .toolbar-actions #ck-sfx, .toolbar-actions:has(#ck-sfx) .btn-icon { flex: 0 0 36px; min-width: 36px; padding: 0; }
}
@media (max-width: 380px) {
    .ck-cnt i { display: none; }
    .ck-side { padding: 3px 4px; gap: 3px; }
    .ck-who b { font-size: 13px; }
    .ck-score { gap: 2px; }
}
