/* Cribbage (js/games/cribbage.js). The table and card colours are Solitaire's
 * (css/games/solitaire.css, loaded with this file); here: the board, the rows and the show panel. */

.cb-room { --peg-you: #8EB2F2; --peg-cpu: #E39FD8; }
.cb-main {
  position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  gap: 6px; min-height: 0;
}
.cb-room .kit-tool:disabled { opacity: .4; cursor: default; }
.cb-room .kit-tool:disabled:hover { background: transparent; }

/* scores and board */
.cb-scores { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%; max-width: var(--board-w, 900px); font-size: 1rem; color: var(--ink); }
.cb-who { display: inline-flex; align-items: center; gap: .45em; white-space: nowrap; }
.cb-who b { font: 600 1.45rem/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.cb-dot { width: .8em; height: .8em; border-radius: 50%; border: 2px solid #1B1B22; flex: none; }
.cb-you .cb-dot { background: var(--peg-you); }
.cb-cpu .cb-dot { background: var(--peg-cpu); }
.cb-tag { font-size: .85rem; padding: .1em .55em; border-radius: var(--radius-pill); background: var(--fill-strong); color: var(--ink); }
.cb-target { font-size: .85rem; color: var(--ink-muted); white-space: nowrap; }
.cb-board { width: 100%; max-width: var(--board-w, 900px); flex: none; }
.cb-board-svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.cb-peg { transition: transform .7s cubic-bezier(.3, .8, .3, 1); }

/* cards: the solitaire faces, laid out in rows */
.cb-card { position: relative; flex: none; width: var(--w, 70px); height: calc(var(--w, 70px) * 1.4); border-radius: calc(var(--w, 70px) * .08); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); background: #fff; }
.cb-card.is-down { background: none; }
.cb-card .sc-face, .cb-card > .sc-svg { position: absolute; inset: 0; }
.cb-card.cb-empty { background: none; box-shadow: none; border: 2px solid var(--sc-slot-line); box-sizing: border-box; }
.cb-new { animation: cb-in .32s cubic-bezier(.2, .8, .3, 1); }
@keyframes cb-in { from { opacity: 0; translate: 0 -12%; } to { opacity: 1; } }

.cb-label { font-size: .85rem; color: var(--ink-muted); white-space: nowrap; }
.cb-none { font-size: .85rem; color: var(--ink-muted); }

/* the computer's row */
.cb-opp { display: flex; align-items: center; justify-content: center; gap: var(--space-3); min-height: calc(var(--ow) * 1.4); }
.cb-opp .cb-card { --w: var(--ow); }
.cb-fan { display: flex; }
.cb-fan .cb-card + .cb-card { margin-left: calc(var(--ow) * -.35); }
.cb-showing .cb-fan .cb-card + .cb-card { margin-left: calc(var(--ow) * .08); }

/* middle: starter | the count | crib */
.cb-mid { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3); width: 100%; max-width: 900px; }
.cb-mid .cb-card { --w: var(--mw); }
.cb-pile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cb-stack { position: relative; width: var(--mw); height: calc(var(--mw) * 1.4); }
.cb-stack .cb-card { position: absolute; inset: 0; }
.cb-stack .cb-starter { translate: 0 0; }
.cb-crib-n { position: absolute; right: -6px; bottom: -6px; z-index: 2; min-width: 1.6rem; height: 1.6rem; padding: 0 .3rem; border-radius: var(--radius-pill); display: grid; place-items: center; font: 600 .85rem/1 var(--font-sans); background: var(--surface-200); color: var(--ink); border: 1px solid var(--line); }
.cb-play { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.cb-seq { display: flex; justify-content: center; min-height: calc(var(--mw) * 1.55); align-items: center; }
.cb-seq .cb-card + .cb-card { margin-left: calc(var(--mw) * -.52); }
.cb-seq .cb-by1 { translate: 0 -7%; }
.cb-seq .cb-by0 { translate: 0 7%; }
.cb-seq .cb-by1.cb-new, .cb-seq .cb-by0.cb-new { animation-name: cb-in; }
.cb-count { display: flex; align-items: baseline; gap: .4em; color: var(--ink); }
.cb-count-n { font: 600 1.6rem/1 var(--font-sans); font-variant-numeric: tabular-nums; }
.cb-count-l { font-size: .85rem; color: var(--ink-muted); }

/* status line */
.cb-msg { margin: 0; max-width: 40rem; min-height: 2.7em; text-align: center; font-size: 1rem; line-height: 1.35; color: var(--ink); }

/* your hand */
.cb-hand { display: flex; justify-content: center; align-items: flex-end; padding-top: calc(var(--cw) * .16); min-height: calc(var(--cw) * 1.56); max-width: 100%; }
.cb-hand .cb-card { --w: var(--cw); transition: translate .15s ease, filter .15s ease; }
.cb-cardbtn { appearance: none; border: 0; padding: 0; margin: 0; background: none; cursor: pointer; border-radius: calc(var(--cw) * .08); flex: none; }
.cb-cardbtn + .cb-cardbtn { margin-left: var(--hgap, 8px); }
.cb-cardbtn.cb-still { cursor: default; }
.cb-cardbtn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; position: relative; z-index: 2; }
.cb-hand .cb-sel { translate: 0 -14%; box-shadow: 0 0 0 3px var(--ink), 0 10px 22px rgba(0, 0, 0, .35); }
.cb-card.sc-hint { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); animation: sc-pulse 1.1s ease-in-out 3; }
.cb-hand .cb-dim { filter: brightness(.62); }
:root[data-theme="light"] .cb-card.sc-hint { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); animation: sc-pulse 1.1s ease-in-out 3; }
.cb-hand .cb-dim { filter: brightness(.82) saturate(.7); }
.cb-hand.is-turn .cb-card:not(.cb-dim):hover { translate: 0 -6%; }
.cb-act { min-height: max(52px, 2.9rem); display: flex; align-items: center; justify-content: center; }
.cb-act .btn[disabled] { background: var(--fill-strong); color: var(--ink-muted); cursor: default; opacity: 1; }

/* the show: a panel over the lower half, one hand at a time */
.cb-panel {
  position: absolute; z-index: 4; margin: 0 auto; max-width: 40rem; max-height: min(70%, 34rem);
  display: flex; flex-direction: column; background: var(--surface-200); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-float);
  animation: cb-panel-in .35s ease .15s both; touch-action: pan-y;
}
.cb-panel[hidden] { display: none; }
@keyframes cb-panel-in { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }
.cb-panel-body { overflow-y: auto; padding: var(--space-4) var(--space-4) var(--space-2); }
.cb-panel-foot { padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line); display: flex; justify-content: center; }
.cb-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.cb-panel-title { margin: 0; font-size: 1.2rem; }
.cb-panel-total { margin: 0; font-weight: 600; font-size: 1.2rem; }
.cb-panel-intro { margin: var(--space-2) 0; font-size: 1rem; }
.cb-panel-cards { display: flex; align-items: center; gap: 6px; margin: var(--space-3) 0; }
.cb-panel-cards .cb-card { --w: clamp(40px, 11vw, 64px); }
.cb-plus { font-size: 1.2rem; color: var(--ink-muted); padding: 0 2px; }
.cb-lines { list-style: none; margin: 0; padding: 0; }
.cb-lines li { display: flex; justify-content: space-between; gap: var(--space-3); padding: .45em 0; border-top: 1px solid var(--line); font-size: 1rem; }
.cb-lines li b { font-variant-numeric: tabular-nums; }
.cb-zero { color: var(--ink-muted); }
@media (min-width: 900px) { .cb-lines { column-count: 2; column-gap: var(--space-5); } .cb-lines li { break-inside: avoid; } }
.cb-claim-note, .cb-claim-q { margin: var(--space-2) 0; font-size: 1rem; }
.cb-claim { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3); }
.cb-stepper { display: flex; align-items: center; gap: var(--space-2); }
.cb-step { min-width: var(--control-lg, 52px); padding: 0; font-size: 1.4rem; }
.cb-claim-n { min-width: 2.2em; text-align: center; font: 600 1.6rem/1 var(--font-sans); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .cb-peg, .cb-hand .cb-card { transition: none; }
  .cb-new, .cb-panel, .cb-card.sc-hint { animation: none; }
}
