/* The panel, rival picker, speech bubble and scoreboard live in cat-board-game.css. */
.game-picker { max-width: 480px; margin: 0 auto 14px; }
.game-picker-head { display: flex; justify-content: space-between; align-items: center; margin: 0 0 5px; }
.game-picker-head .pick-head { margin: 0; }
#game-position { color: var(--muted); font: 13px/1 "Dos", monospace; }
.game-carousel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px; align-items: center; }
.game-carousel .game-arrow {
    width: 34px; height: 38px; padding: 0; border-radius: 9px;
    font: bold 24px/1 var(--head-font);
}
.game-track {
    position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: clamp(108px, 32vw, 148px);
    gap: 8px; overflow-x: auto; overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity; scrollbar-width: thin; padding: 3px 3px 5px;
}
.game-track .game-card {
    display: grid; grid-template-rows: auto 1fr; min-width: 0;
    padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
    background: var(--well); color: var(--navy); text-shadow: none;
    font: bold 12px/1.3 var(--head-font); scroll-snap-align: center;
}
.game-card img { display: block; width: 100%; height: auto; }
.game-card span { padding: 5px 3px; }
.game-track .game-card:hover { border-color: #5c7ed0; background: var(--hover); }
.game-track .game-card[aria-pressed="true"] {
    border-color: var(--rival); box-shadow: 0 0 0 1px var(--rival);
    color: #ffbc80; background: #1f2a58;
}
.game-track .game-card:focus-visible { outline: 2px solid var(--paper); outline-offset: 1px; }
.game-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabletop .side.active .mark { text-shadow: 0 0 8px currentColor; }
.tabletop .tally > span { text-align: center; }
.tabletop .pick-rec { color: var(--legal); }
.tabletop .status > strong { margin-right: .45em; }
.tabletop .status > span { color: var(--muted); }
.tabletop .result { z-index: 5; }
.tabletop .result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }

.tabletop-board {
    --tile-line: #2a3d7a;
    display: grid; width: 100%;
    background: #050d2e; border: 1px solid #000; border-radius: 12px;
    box-shadow: 0 0 0 1px var(--line), inset 0 2px 8px rgba(0,0,0,.6);
}
.tabletop-board button {
    min-width: 0; padding: 0; border: 0; border-radius: 0; background: none;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.tabletop-board button[aria-disabled="true"] { cursor: default; }
.tabletop-board button:focus-visible { outline: 2px solid var(--paper); outline-offset: -2px; z-index: 3; }

/* Connect Four */
.tabletop-board.four {
    grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px;
    padding: clamp(5px, 1.5vw, 10px);
}
.tabletop-board .column {
    display: grid; justify-items: center; gap: clamp(3px, 1vw, 6px);
    padding: 3px clamp(2px, .7vw, 4px) 4px; border-radius: 6px;
}
.column:not([aria-disabled="true"]):is(:hover, :focus-visible) { background: #243c31; }
.column-marker { color: var(--muted); font: 14px/1 "Dos", monospace; }
.column:not([aria-disabled="true"]) .column-marker { color: var(--legal); }
.disc, .piece { display: grid; place-items: center; border-radius: 50%; aspect-ratio: 1; }
.disc {
    width: 100%; background: var(--well); border: 1px solid var(--tile-line);
    box-shadow: inset 0 2px 5px #030c28;
}
.disc.you, .piece.you { --piece: var(--you); --rim: #3565ae; --shine: #aacbff; }
.disc.cat, .piece.cat { --piece: var(--rival); --rim: #a34e0c; --shine: #ffbd7c; }
.disc.you, .disc.cat, .piece.you, .piece.cat {
    border: 2px solid var(--rim); background: var(--piece);
    box-shadow: inset 0 0 0 2px var(--shine), inset 0 -3px 0 2px var(--rim);
    color: #081436;
}
.disc.cat { background: repeating-linear-gradient(135deg, #fff2c540 0 3px, transparent 3px 7px), var(--piece); }
.disc.last { outline: 2px dashed var(--paper); outline-offset: 1px; }
.disc.winning { outline: 2px solid var(--paper); outline-offset: 1px; }

/* Checkers */
.tabletop-board.checkers { grid-template-columns: repeat(8, minmax(0, 1fr)); overflow: hidden; }
.tabletop-board .square { position: relative; display: grid; place-items: center; aspect-ratio: 1; }
.square.light { background: #4d6399; }
.square.dark { background: var(--well); }
.square.last { box-shadow: inset 0 0 0 2px var(--paper); }
.square.movable .piece { outline: 1px solid var(--legal); outline-offset: 1px; }
.square.movable:hover, .square.target:hover, .square.selected { background: #263c43; }
.square.selected .piece { outline: 2px solid var(--legal); outline-offset: 2px; }
.square.target::after {
    content: ''; position: absolute; width: 27%; aspect-ratio: 1; border-radius: 50%;
    background: var(--legal); pointer-events: none;
}
.piece { width: 76%; font: bold clamp(13px, 3vw, 23px)/1 Georgia, serif; }

/* Dots and Boxes: give every edge a 24 px hit area around its line. */
.tabletop-board.dots {
    grid-template-columns: repeat(4, 24px minmax(0, 1fr)) 24px;
    grid-template-rows: repeat(4, 24px minmax(0, 1fr)) 24px;
    aspect-ratio: 1; padding: 6px;
}
.tabletop-board .edge { position: relative; border-radius: 6px; }
.edge::after { position: absolute; content: ''; border-radius: 3px; background: #465880; pointer-events: none; }
.edge.horizontal::after { inset: 50% -12px auto; height: 4px; transform: translateY(-50%); }
.edge.vertical::after { inset: -12px auto -12px 50%; width: 4px; transform: translateX(-50%); }
.edge:not([aria-disabled="true"]):is(:hover, :focus-visible)::after { background: var(--legal); }
.edge.you::after { background: var(--you); }
.edge.cat::after { background: var(--rival); }
.edge.last::after { box-shadow: 0 0 0 2px var(--paper); }
.dot { z-index: 2; pointer-events: none; place-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); }
.box { display: grid; place-items: center; border-radius: 4px; font: 18px/1 "Arcade", sans-serif; }
.box.you { background: #172d5d; color: var(--you); }
.box.cat { background: #482d2d; color: var(--rival); }

/* Disc and stone placement games */
.tabletop-board:is(.reversi, .gomoku) {
    grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
    overflow: hidden;
}
.tabletop-board .placement { position: relative; display: grid; place-items: center; aspect-ratio: 1; }
.reversi .placement { background: #112856; box-shadow: inset 0 0 0 .5px #4e6695; }
.gomoku .placement {
    background: linear-gradient(#536992, #536992) center / 100% 1px no-repeat,
                linear-gradient(#536992, #536992) center / 1px 100% no-repeat, #14244f;
}
.reversi .placement:not([aria-disabled="true"])::after {
    content: ''; width: 23%; aspect-ratio: 1; position: absolute;
    background: var(--legal); border-radius: 50%; opacity: .75;
}
.tabletop-board :is(.placement, .morris-point) .piece { width: 76%; z-index: 1; }
.tabletop-board .placement:not([aria-disabled="true"]):hover { background-color: #2c463c; }
.tabletop-board :is(.placement.last, .morris-point.last) .piece { outline: 2px dashed var(--paper); }
.tabletop-board .placement.winning .piece { outline: 2px solid var(--paper); }

.tabletop-board.hex { position: relative; aspect-ratio: 1.575; width: 96%; }
.tabletop-board.hex .placement {
    position: absolute; width: 10%; aspect-ratio: .866; transform: translate(-50%, -50%);
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
    background: #526b9b;
}
.hex .placement::before {
    content: ''; position: absolute; inset: 1px; clip-path: inherit; background: #182e5e;
}
.hex .placement.goal-you::before { background: #244d88; }
.hex .placement.goal-cat::before { background: #5b3c43; }
.hex .placement.goal-you.goal-cat::before { background: linear-gradient(#244d88 50%, #5b3c43 50%); }
.hex .placement:not([aria-disabled="true"]):hover::before { background: #2c463c; }
.tabletop-board.hex .placement:focus-visible { background: var(--paper); }
.hex .placement .piece { width: 68%; }

/* Kalah pits follow sowing order across the bottom and back along the top. */
.tabletop-board.kalah {
    position: relative;
    grid-template-columns: minmax(0, 1.35fr) repeat(6, minmax(0, 1fr)) minmax(0, 1.35fr);
    grid-template-rows: auto 15px auto;
    gap: 3px clamp(2px, 1vw, 6px); padding: clamp(5px, 2vw, 12px);
    background: linear-gradient(155deg, #354c7e, #172854 58%, #233665);
}
.tabletop-board .kalah-pit, .kalah-store {
    position: relative; display: grid; justify-items: center;
    background: radial-gradient(ellipse at 50% 75%, #213461, #0b1537 78%);
    color: var(--you); border: 1px solid #6486bb;
    box-shadow: inset 0 3px 5px #050b24, 0 1px 2px #060f2d;
    text-shadow: none;
}
.tabletop-board .kalah-pit {
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 53px; aspect-ratio: .76; border-radius: 46%;
    padding: 5px 2px 4px;
}
.tabletop-board .kalah-pit.cat, .kalah-store.cat { color: var(--rival); }
.tabletop-board .kalah-pit:not([aria-disabled="true"]):hover {
    background: radial-gradient(ellipse at 50% 75%, #2c463c, #0b1537 85%); border-color: var(--legal);
}
.tabletop-board .kalah-pit.last, .kalah-store.last {
    border-color: var(--paper); box-shadow: inset 0 3px 5px #050b24, 0 0 5px #8cbdff90;
}
.kalah-store {
    grid-template-rows: auto minmax(0, 1fr) auto; gap: 3px;
    padding: 6px 3px 5px; border-radius: 17px;
}
.kalah-store > span:first-child { font: 10px var(--head-font); overflow-wrap: anywhere; text-align: center; }
.kalah-count { font: bold clamp(11px, 3vw, 16px)/1 "Dos", monospace; }
.kalah-stones {
    display: grid; grid-template-columns: repeat(var(--seed-cols, 2), minmax(0, 1fr));
    grid-auto-rows: minmax(0, 9px); align-content: center; place-items: center;
    width: 100%; min-height: 0; gap: 0 1px; pointer-events: none;
}
.kalah-stone {
    --seed-light: #ffedbb; --seed-mid: #dda25e; --seed-dark: #8d5637;
    display: block; width: 100%; height: 100%; max-width: 9px; max-height: 8px;
    border-radius: 62% 42% 57% 40%; transform: rotate(-18deg);
    background: radial-gradient(circle at 34% 26%, var(--seed-light), var(--seed-mid) 50%, var(--seed-dark) 85%);
    box-shadow: 0 1px 1px #030a24;
}
.kalah-stone:nth-child(3n + 2) {
    --seed-light: #e0fff0; --seed-mid: #6fb5a5; --seed-dark: #34726b; transform: rotate(24deg);
}
.kalah-stone:nth-child(3n) {
    --seed-light: #ffe1dc; --seed-mid: #d48788; --seed-dark: #9b4e62; transform: rotate(-38deg);
}
.kalah-hand {
    grid-area: 2 / 2 / 3 / 8; display: grid; place-items: center;
    color: var(--paper); font: 12px/1 "Dos", monospace; pointer-events: none;
}
.kalah-flight {
    position: absolute; z-index: 4; display: flex; gap: 1px; pointer-events: none;
    filter: drop-shadow(0 2px 2px #050b22);
}
.kalah-flight .kalah-stone { width: 10px; height: 9px; }

/* Morris uses the same graph for its move rules and drawn lines. */
.tabletop-board.morris { position: relative; aspect-ratio: 1; }
.morris-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.morris-lines line { stroke: #5879b8; stroke-width: .035; }
.tabletop-board .morris-point {
    position: absolute; display: grid; place-items: center;
    width: 11%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
}
.morris-point::before {
    content: ''; position: absolute; width: 29%; aspect-ratio: 1; border-radius: 50%;
    background: #687fb0; border: 1px solid #9fb5dc;
}
.morris-point.target::before { background: var(--legal); }
.morris-point.target .piece.cat, .morris-point.selected .piece.you { outline: 2px solid var(--legal); }
.tabletop-board .morris-point:not([aria-disabled="true"]):hover { background: #2c463c; }

/* Pig: two race tracks, the die, and the two choices. */
.tabletop-board.pig { grid-template-columns: 1fr 1fr; gap: 10px; padding: clamp(10px, 3vw, 18px); }
.pig-track {
    grid-column: 1 / -1; display: grid; grid-template-columns: 4.6em minmax(0, 1fr) 2.2em;
    align-items: center; gap: 8px; color: var(--you); font: 15px/1 "Dos", monospace;
}
.pig-track.cat { color: var(--rival); }
.pig-track b { text-align: right; font-weight: normal; }
.pig-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pig-track.active .pig-name::before { content: '> '; }
.pig-bar {
    display: flex; height: 14px; overflow: hidden; border-radius: 7px;
    background: var(--well); border: 1px solid var(--tile-line);
}
.pig-bar i { background: currentColor; transition: width .25s; }
.pig-bar .pending { background: repeating-linear-gradient(135deg, currentColor 0 3px, transparent 3px 6px); opacity: .75; }
.pig-table {
    grid-column: 1 / -1; display: flex; align-items: center; justify-content: center;
    gap: clamp(14px, 6vw, 34px); padding: clamp(8px, 3vw, 18px) 0;
}
.die {
    display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); flex: none;
    box-sizing: border-box; width: clamp(76px, 24vw, 104px); aspect-ratio: 1; padding: clamp(9px, 3vw, 13px); border-radius: 18%;
    background: var(--paper); border: 3px solid #9fb5dc;
    box-shadow: inset 0 -5px 0 #c3d0ee, 0 4px 0 #030a24;
}
.die[data-by="you"] { border-color: var(--you); }
.die[data-by="cat"] { border-color: var(--rival); }
.die.rest { opacity: .55; }
.die i { margin: 11%; border-radius: 50%; }
.die[data-face="1"] i:nth-child(5),
.die[data-face="2"] i:is(:nth-child(1), :nth-child(9)),
.die[data-face="3"] i:is(:nth-child(1), :nth-child(5), :nth-child(9)),
.die[data-face="4"] i:is(:nth-child(1), :nth-child(3), :nth-child(7), :nth-child(9)),
.die[data-face="5"] i:is(:nth-child(1), :nth-child(3), :nth-child(5), :nth-child(7), :nth-child(9)),
.die[data-face="6"] i:is(:nth-child(1), :nth-child(3), :nth-child(4), :nth-child(6), :nth-child(7), :nth-child(9)) {
    background: var(--paper-ink);
}
.die[data-face="1"]:not(.rest) i:nth-child(5) { background: #d8342c; }
.pig-turn { display: grid; justify-items: center; gap: 4px; margin: 0; min-width: 6.5em; color: var(--muted); font: 14px/1 "Dos", monospace; }
.pig-turn strong { color: var(--paper); font: 44px/1 "Arcade", sans-serif; }
.pig-turn em { min-height: 1em; color: var(--legal); font-style: normal; }
.pig-turn em.bust { color: #ff6b5e; }
.tabletop-board .pig-action {
    display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 54px;
    border: 2px solid var(--legal); border-radius: 10px; background: #173022;
    color: var(--paper); text-shadow: none; font: bold 17px/1 var(--head-font);
}
.pig-action small { min-height: 1em; color: var(--legal); font: 12px/1 "Dos", monospace; }
.tabletop-board .pig-action:not([aria-disabled="true"]):hover { background: #2c463c; }
.tabletop-board .pig-action[aria-disabled="true"] { border-color: var(--tile-line); background: var(--well); color: var(--muted); }

/* Memory match */
.tabletop-board.memory {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(4px, 1.4vw, 8px); padding: clamp(6px, 2vw, 12px);
}
.tabletop-board .memory-card {
    display: grid; place-items: center; aspect-ratio: 3 / 4;
    border: 2px solid #5879b8; border-radius: 8px;
    background: repeating-linear-gradient(45deg, #1d3270 0 6px, #152553 6px 12px);
    font-size: clamp(20px, 6.4vw, 30px); line-height: 1; text-shadow: none;
}
.tabletop-board .memory-card.up { background: var(--paper); border-color: var(--paper); }
.tabletop-board .memory-card.miss { border-color: #8b97b8; background: #c9d2e8; }
.tabletop-board .memory-card.you { border-color: var(--you); background: #172d5d; }
.tabletop-board .memory-card.cat { border-color: var(--rival); background: #482d2d; }
.memory-card:is(.you, .cat) span { opacity: .8; }
.memory-card.last { outline: 2px dashed var(--paper); outline-offset: 1px; }
.tabletop-board .memory-card:not([aria-disabled="true"]):hover { border-color: var(--legal); }

/* Go Fish: the cat's hand, the pool and what was said, then your hand grouped by rank. */
.tabletop-board.fish { gap: 10px; padding: clamp(8px, 2.5vw, 14px); }
.fish-side { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 30px; font: 14px/1 "Dos", monospace; }
.fish-side.cat { color: var(--rival); }
.fish-side.you { color: var(--you); }
.fish-backs { display: flex; padding-left: 13px; }
.fish-backs i, .fish-pool {
    border: 1px solid #9fb5dc; border-radius: 4px;
    background: repeating-linear-gradient(45deg, #1d3270 0 4px, #2b468f 4px 8px);
}
.fish-backs i { width: 20px; aspect-ratio: 5 / 7; margin-left: -13px; box-shadow: -1px 0 2px #030a24; }
.fish-books { display: flex; flex-wrap: wrap; gap: 3px; margin-left: auto; }
.fish-books b {
    min-width: 1.6em; padding: 3px 4px; border: 1px solid currentColor; border-radius: 4px;
    background: var(--well); text-align: center; font: bold 12px/1 Georgia, serif;
}
.fish-table { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.fish-pool {
    display: grid; place-items: center; width: 46px; aspect-ratio: 5 / 7; border-radius: 6px;
    color: var(--paper); font: 20px/1 "Arcade", sans-serif; text-shadow: 0 1px 2px #000;
    box-shadow: 2px 2px 0 #0b1537, 3px 3px 0 #9fb5dc55;
}
.fish-pool.empty { background: none; border-style: dashed; box-shadow: none; color: var(--muted); }
.fish-log { display: grid; gap: 4px; margin: 0; padding: 0; min-height: 5.6em; align-content: end; list-style: none; color: var(--muted); font: 14px/1.2 "Dos", monospace; }
.fish-log li:last-child { color: var(--paper); }
.fish-hand { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 8px; min-height: 68px; padding: 2px 4px 5px 0; }
.tabletop-board .fish-rank {
    position: relative; display: grid; grid-template-rows: 1fr auto; justify-items: center; align-items: center;
    width: clamp(42px, 11.6vw, 50px); aspect-ratio: 5 / 7; padding: 3px 0 4px;
    border: 1px solid #7f8fb5; border-radius: 6px; background: var(--paper);
    color: var(--paper-ink); text-shadow: none; font: bold 20px/1 Georgia, serif;
}
.tabletop-board .fish-rank[hidden] { display: none; }
.fish-rank[data-count="2"] { box-shadow: 3px 3px 0 #b9c5e2; }
.fish-rank[data-count="3"] { box-shadow: 3px 3px 0 #b9c5e2, 6px 6px 0 #8f9dc2; }
.fish-suits { display: flex; gap: 1px; font: 12px/1 Georgia, "Times New Roman", serif; }
.fish-suits i { font-style: normal; }
.fish-suits .red { color: #c22b2b; }
.fish-count {
    position: absolute; top: -7px; right: -7px; padding: 2px 4px; border-radius: 8px;
    background: var(--paper-ink); color: var(--paper); font: bold 11px/1 Georgia, serif;
}
.fish-count:empty { display: none; }
.tabletop-board .fish-rank:not([aria-disabled="true"]):hover { background: #d9f3c9; border-color: var(--legal); transform: translateY(-3px); }
.tabletop-board .fish-rank[aria-disabled="true"] { filter: brightness(.78); }
