/* Board games: checkers, reversi, five in a row, dots and boxes (js/games/board.js). */
.bd-wrap { display: grid; gap: 10px; justify-items: center; }
.bd-badge { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; flex: none; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.bd-badge.ck0, .bd-badge.go1, .bd-badge.rv1 { background: #fbf6ef; border: 1px solid #c9b8a6; }
.bd-badge.ck1, .bd-badge.go0, .bd-badge.rv0 { background: #3a2a24; }
.bd-badge.ck0 { background: radial-gradient(circle at 35% 30%, #fff, var(--you, #f4a3b5)); border: 0; }
.bd-badge.ck1 { background: radial-gradient(circle at 35% 30%, #a77a65, var(--mocha, #6b4a3a)); }
.bd-badge.db0 { background: var(--me); border-radius: 4px; }
.bd-badge.db1 { background: var(--mocha, #6b4a3a); border-radius: 4px; }

/* checkers */
.ck-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(100%, 400px); aspect-ratio: 1; border-radius: 14px; overflow: hidden; border: 4px solid color-mix(in srgb, var(--mocha, #6b4a3a) 70%, var(--rule)); box-shadow: 0 10px 24px var(--glow, rgba(0, 0, 0, .12)); }
.ck-sq { display: grid; place-items: center; border: 0; padding: 0; margin: 0; position: relative; aspect-ratio: 1; }
.ck-sq.light { background: color-mix(in srgb, var(--paper) 80%, #f3dfc8); }
.ck-sq.dark { background: color-mix(in srgb, var(--mocha, #6b4a3a) 55%, var(--paper)); cursor: pointer; }
.ck-sq.dark.last { background: color-mix(in srgb, var(--mocha, #6b4a3a) 40%, #e9c46a); }
.ck-sq.can .ck-pc { box-shadow: 0 0 0 3px color-mix(in srgb, var(--good, #3bb273) 70%, transparent), inset 0 -4px 0 rgba(0, 0, 0, .2); }
.ck-sq.sel { background: color-mix(in srgb, var(--me) 55%, var(--mocha, #6b4a3a)); }
.ck-sq.target::after { content: ""; width: 34%; height: 34%; border-radius: 50%; background: var(--me); opacity: .75; animation: bd-pulse 1s ease-in-out infinite; }
.ck-pc { width: 78%; height: 78%; border-radius: 50%; display: grid; place-items: center; font-size: clamp(.9rem, 4vw, 1.4rem); line-height: 1; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2), 0 2px 4px rgba(0, 0, 0, .25); transition: transform .2s; animation: bd-pop .25s ease-out; }
.ck-pc.ck0 { background: radial-gradient(circle at 35% 30%, #fff, var(--you, #f4a3b5)); color: #a8324f; }
.ck-pc.ck1 { background: radial-gradient(circle at 35% 30%, #a77a65, var(--mocha, #6b4a3a)); color: #ffd36b; }
.ck-sq.sel .ck-pc { transform: scale(1.08) translateY(-2px); }

/* reversi */
.rv-board { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; width: min(100%, 400px); aspect-ratio: 1; padding: 6px; border-radius: 16px; background: color-mix(in srgb, #2f8f5b 80%, var(--ink) 5%); box-shadow: 0 10px 24px var(--glow, rgba(0, 0, 0, .12)); }
.rv-sq { border: 0; padding: 0; border-radius: 6px; background: color-mix(in srgb, #3fa86c 85%, #fff 10%); display: grid; place-items: center; position: relative; perspective: 300px; }
.rv-sq:disabled { cursor: default; opacity: 1; }
.rv-sq.hint { cursor: pointer; }
.rv-sq.hint::after { content: ""; width: 26%; height: 26%; border-radius: 50%; background: rgba(255, 255, 255, .55); }
.rv-sq.last { box-shadow: inset 0 0 0 2px #ffd36b; }
.rv-disc { width: 82%; height: 82%; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25), 0 2px 3px rgba(0, 0, 0, .3); }
.rv-disc.rv0 { background: radial-gradient(circle at 35% 30%, #6a5a55, #1f1715); }
.rv-disc.rv1 { background: radial-gradient(circle at 35% 30%, #fff, #e6ddd2); }
.rv-disc.flip { animation: rv-flip .45s ease-in-out; }
.rv-disc.place { animation: bd-pop .25s ease-out; }
.rv-count { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; color: var(--ink-soft); }
.rv-count > span { display: inline-flex; align-items: center; gap: 6px; }
.rv-count b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* five in a row: scrolls sideways on narrow phones, points never smaller than 22px */
.go-scroll { overflow: auto; max-width: 100%; margin: 0 auto; padding: 4px; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y pinch-zoom; }
.go-board { --pt: max(22px, min(calc((100vw - 48px) / 15), 30px)); display: grid; grid-template-columns: repeat(15, var(--pt)); grid-auto-rows: var(--pt); width: max-content; margin: 0 auto; padding: 6px; border-radius: 12px;
  background: linear-gradient(160deg, #f1d39a, #ddb36e); box-shadow: 0 8px 20px var(--glow, rgba(0, 0, 0, .12)); }
.go-pt { border: 0; padding: 0; margin: 0; background: none; position: relative; display: grid; place-items: center; cursor: pointer; }
.go-pt::before, .go-pt::after { content: ""; position: absolute; background: rgba(90, 60, 30, .55); pointer-events: none; }
.go-pt::before { left: 0; right: 0; top: 50%; height: 1px; }
.go-pt::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.go-pt:disabled { cursor: default; }
.go-pt:not(.taken):not(:disabled):hover .go-st, .go-pt:not(.taken):not(:disabled):active { background: rgba(255, 255, 255, .25); }
.go-st { position: relative; z-index: 1; width: 86%; height: 86%; border-radius: 50%; box-shadow: 0 2px 3px rgba(0, 0, 0, .35); animation: bd-pop .2s ease-out; }
.go-st.go0 { background: radial-gradient(circle at 35% 30%, #6a5a55, #15100e); }
.go-st.go1 { background: radial-gradient(circle at 35% 30%, #fff, #ddd3c6); }
.go-pt.last .go-st::after { content: ""; position: absolute; inset: 34%; border-radius: 50%; background: var(--me); }
.go-pt.win .go-st { box-shadow: 0 0 0 3px var(--me), 0 0 12px var(--me); animation: bd-pulse 1s ease-in-out infinite; }

/* dots and boxes */
.db-board { --dot: 22px; display: grid; grid-template-columns: repeat(4, var(--dot) 1fr) var(--dot); grid-template-rows: repeat(4, var(--dot) 1fr) var(--dot); width: min(100%, 360px); aspect-ratio: 1; padding: 6px; border-radius: 18px; background: var(--raised); border: 1px solid var(--rule); }
.db-dot { width: 12px; height: 12px; margin: auto; border-radius: 50%; background: var(--ink); z-index: 1; }
.db-e { border: 0; padding: 0; margin: 0; background: none; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.db-e > span { display: block; border-radius: 99px; background: var(--rule); opacity: .55; transition: background .2s, opacity .2s; }
.db-e.h > span { width: 100%; height: 6px; }
.db-e.v > span { height: 100%; width: 6px; }
.db-e:not(:disabled):hover > span, .db-e:not(:disabled):active > span { background: var(--me); opacity: .45; }
.db-e:disabled { cursor: default; }
.db-e.on > span { opacity: 1; animation: bd-pop .2s ease-out; }
.db-e.on.o0 > span { background: var(--me); }
.db-e.on.o1 > span { background: var(--mocha, #6b4a3a); }
.db-e.last > span { box-shadow: 0 0 0 3px color-mix(in srgb, #ffd36b 70%, transparent); }
.db-box { display: grid; place-items: center; margin: 3px; border-radius: 8px; font-weight: 800; color: #fff; font-size: clamp(.8rem, 4vw, 1.2rem); }
.db-box.o0 { background: color-mix(in srgb, var(--me) 75%, transparent); animation: bd-pop .3s ease-out; }
.db-box.o1 { background: color-mix(in srgb, var(--mocha, #6b4a3a) 75%, transparent); animation: bd-pop .3s ease-out; }

@keyframes bd-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bd-pulse { 0%, 100% { opacity: .85; } 50% { opacity: .45; } }
@keyframes rv-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(1.1); } 100% { transform: rotateY(0); } }
@media (prefers-reduced-motion: reduce) { .ck-pc, .rv-disc, .go-st, .db-e > span, .db-box, .ck-sq.target::after { animation: none !important; } }
