/* Canasta (js/games/canasta.js). The table and cards are Solitaire's
 * (css/games/solitaire.css, loaded with this file). */

.ca-room .sc-slot[data-pile] { cursor: pointer; }
.ca-room .sc-sj { color: #4B3A8C; }

/* wild cards (2s and jokers) carry a small butter star at the left, where it shows when cards overlap */
.ca-room .sc-card.ca-wild:not(.sc-sj)::before {
  content: ''; position: absolute; z-index: 1; left: 6%; top: 34%; width: 24%; aspect-ratio: 1; pointer-events: none;
  background: #F2C879; border: 1.5px solid #16181D; box-sizing: border-box;
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* canastas: the top card framed red (natural) or black (mixed) */
.ca-room .sc-card.ca-nat { box-shadow: 0 0 0 calc(var(--cw, 80px) * .045) #C62828, 0 2px 6px rgba(0, 0, 0, .35); }
.ca-room .sc-card.ca-mix { box-shadow: 0 0 0 calc(var(--cw, 80px) * .045) #16181D, 0 0 0 calc(var(--cw, 80px) * .07) rgba(255, 255, 255, .7), 0 2px 6px rgba(0, 0, 0, .35); }
.ca-badge, .ca-count {
  position: absolute; z-index: 60; pointer-events: none; box-sizing: border-box;
  font-weight: 600; line-height: 1; text-align: center; font-variant-numeric: tabular-nums;
}
.ca-badge { padding: .22em 0; white-space: nowrap; border-radius: 99px; color: #fff; }
.ca-badge span { font-weight: 400; opacity: .85; }
.ca-badge-nat { background: #C62828; }
.ca-badge-mix { background: #16181D; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .7); }
.ca-count { min-width: 1.7em; padding: .22em .3em; border-radius: 99px; background: var(--surface-100, #181818); color: var(--ink); box-shadow: 0 0 0 1.5px var(--sc-slot-line); }

/* melds laid out before the first meld goes down: dashed and a little faded */
.ca-room .sc-card.ca-staged { opacity: .82; box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, .3); }
/* the cards you just took */
.ca-room .sc-card.ca-new:not(.sc-picked):not(.sc-hint) { box-shadow: 0 0 0 3px var(--toy-butter), 0 6px 16px rgba(0, 0, 0, .3); }
.ca-room .sc-anim .sc-card { transition: transform .26s cubic-bezier(.2, .8, .3, 1), opacity .2s ease; }

/* texts on the table */
.ca-who, .ca-note, .ca-status, .ca-empty { position: absolute; margin: 0; z-index: 0; pointer-events: none; line-height: 1.35; max-width: none; }
.ca-who { font-size: .85rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 3rem; }
.ca-who b { color: var(--ink); font-weight: 600; }
.ca-you { padding-right: 0; text-align: center; }
.ca-who[hidden], .ca-info[hidden], .ca-over[hidden] { display: none; }
.ca-note { font-size: .85rem; color: var(--ink-muted); text-align: center; white-space: nowrap; }
.ca-note b { font-weight: 600; }
.ca-note .ca-frozen { color: var(--ink); }
.ca-note .ca-blocked { color: var(--ink); }
.ca-status { font-size: 1rem; color: var(--ink); }
.ca-empty { font-size: .85rem; color: var(--sc-slot-ink); text-align: center; }

/* Meld and Discard */
.ca-info { position: absolute; z-index: 900; display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.ca-act { white-space: nowrap; min-width: 7.5rem; }
.ca-act[aria-disabled="true"] { opacity: .5; }
.ca-act.ca-ready { border-color: var(--ink); }
.ca-act.ca-hinted { box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent); }

/* the end of a hand: a score table */
.ca-over {
  position: absolute; z-index: 950; left: 50%; transform: translateX(-50%); width: min(30rem, calc(100% - 24px)); overflow: auto;
  background: var(--surface-200, #1F1F1F); color: var(--ink); border-radius: var(--radius-lg, 20px); box-shadow: var(--shadow-float);
  padding: var(--space-4) var(--space-4) var(--space-4); box-sizing: border-box; display: flex; flex-direction: column; gap: var(--space-3);
}
.ca-over-title { margin: 0; font-size: 1.25rem; font-weight: 600; text-align: center; }
.ca-over-note { margin: 0; font-size: .85rem; color: var(--ink-muted); text-align: center; }
.ca-score { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ca-score th, .ca-score td { padding: .32rem .4rem; text-align: right; border-bottom: 1px solid var(--line, rgba(255, 255, 255, .12)); }
.ca-score th[scope="row"] { text-align: left; font-weight: 400; color: var(--ink-muted); }
.ca-score thead th { font-weight: 600; color: var(--ink); }
.ca-score small { font-size: .85rem; color: var(--ink-muted); white-space: nowrap; }
.ca-score .ca-total th, .ca-score .ca-total td { font-weight: 600; color: var(--ink); border-bottom: 0; }
.ca-over .btn { align-self: center; }

@media (prefers-reduced-motion: reduce) { .ca-room .sc-anim .sc-card { transition: none; } }

/* keyboard: a button over each meld column (pointers pass through to the cards); the stock and
   the pile show the ring above their cards; a focused card comes to the front */
.ca-meldkey { position: absolute; z-index: 850; pointer-events: none; border-radius: 8px; }
.ca-meldkey:focus { outline: none; }
.ca-meldkey:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.ca-room .sc-slot:focus { outline: none; }
.ca-room .sc-slot:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; z-index: 600; background: transparent; border-color: transparent; }
.ca-room .sc-card:focus { outline: none; }
.ca-room .sc-card:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; z-index: 8000 !important; }
