/* Solitaire (js/games/solitaire.js). Kit styles: css/game.css. Card art: js/games/solitaire-cards.js. */

/* the table: a calm green-grey, a little lighter than the page in dark, softer in light */
.sc-room {
  --sc-table: #1C2622; --sc-slot-line: rgba(255, 255, 255, .17); --sc-slot-fill: rgba(255, 255, 255, .035); --sc-slot-ink: rgba(255, 255, 255, .3);
  --sc-black: #16181D; --sc-red: #C62828; --sc-green: #1B7A3A; --sc-blue: #1D4ED8;
  position: absolute; inset: 0; overflow: hidden; background: var(--sc-table);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
:root[data-theme="light"] .sc-room { --sc-table: #DCE5DF; --sc-slot-line: rgba(17, 17, 17, .16); --sc-slot-fill: rgba(255, 255, 255, .4); --sc-slot-ink: rgba(17, 17, 17, .28); }
/* cards live in their own layer so the toolbar, host and result card always sit above them */
.sc-table { position: absolute; inset: 0; isolation: isolate; z-index: 0; }

.sc-card, .sc-slot { position: absolute; left: 0; top: 0; width: var(--cw, 80px); height: var(--ch, 112px); border-radius: calc(var(--cw, 80px) * .08); }
.sc-card { will-change: transform; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.sc-anim .sc-card { transition: transform .22s cubic-bezier(.2, .8, .3, 1); }
.sc-card.sc-drag { transition: none !important; cursor: grabbing; box-shadow: 0 10px 24px rgba(0, 0, 0, .4); }
.sc-face, .sc-back { position: absolute; inset: 0; }
.sc-svg { display: block; width: 100%; height: 100%; font-family: var(--font-sans); }
.sc-card .sc-back, .sc-card.is-down .sc-face { display: none; }
.sc-card.is-down .sc-back { display: block; }

/* suit colours on white (all pass 4.5:1); four colours: clubs green, diamonds blue */
.sc-s0, .sc-s3 { color: var(--sc-black); }
.sc-s1, .sc-s2 { color: var(--sc-red); }
.sc-four .sc-s0 { color: var(--sc-green); }
.sc-four .sc-s1 { color: var(--sc-blue); }

/* empty places */
.sc-slot { display: grid; place-items: center; border: 2px solid var(--sc-slot-line); background: var(--sc-slot-fill); color: var(--sc-slot-ink); box-sizing: border-box; }
.sc-slot-plain { border-color: transparent; background: none; }
.sc-slot-suit { width: 48%; height: 48%; }
.sc-slot-k { font: 600 calc(var(--cw, 80px) * .42) / 1 var(--font-sans); }
.sc-slot .sc-slot-again { width: 44%; height: 44%; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.sc-slot-recycle .sc-slot-again { opacity: 1; }
.sc-fam-klondike .sc-slot[data-pile="s"] { cursor: pointer; }

/* picked up (tap, then tap where it goes) and hints */
.sc-card.sc-picked { translate: 0 calc(var(--ch, 112px) * -.05); box-shadow: 0 0 0 3px var(--accent), 0 10px 22px rgba(0, 0, 0, .35); }
.sc-card.sc-hint, .sc-slot.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; }
.sc-card.sc-hint-target, .sc-slot.sc-hint-target { box-shadow: 0 0 0 3px var(--positive), 0 0 0 8px color-mix(in srgb, var(--positive) 30%, transparent); animation: sc-pulse 1.1s ease-in-out 3; }
@keyframes sc-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.08); } }
.sc-nope { animation: sc-shake .38s ease; }
@keyframes sc-shake { 0%, 100% { translate: 0 0; } 20% { translate: -6px 0; } 40% { translate: 6px 0; } 60% { translate: -4px 0; } 80% { translate: 3px 0; } }

/* keyboard focus (js/games/keynav.js): one ring drawn above the cards, round the card or the run
   it would lift (an outline on the card itself would hide under the cards that overlap it) */
.kn-root .sc-card:focus, .kn-root .sc-slot:focus { outline: none; }
.kn-frame {
  position: absolute; z-index: 9500; pointer-events: none; box-sizing: border-box;
  border-radius: calc(var(--cw, 80px) * .08 + 3px);
  outline: 3px solid var(--focus-ring); outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .28);
}
:root[data-theme="light"] .kn-frame { box-shadow: 0 0 0 3px rgba(255, 255, 255, .6); }

/* finished: the foundations glow softly */
.sc-done .sc-card { transition: box-shadow .6s ease; }
.sc-done .sc-card:not(.is-down) { box-shadow: 0 0 0 2px var(--positive), 0 8px 24px rgba(0, 0, 0, .3); }

.sc-label { position: absolute; margin: 0; z-index: 0; pointer-events: none; font-size: .85rem; line-height: 1.35; color: var(--ink-muted); }
.sc-shuffling { min-height: inherit; height: 100%; }
.sc-shuffling p { margin: 0; }

/* the kit's toolbar is centred with left: 50%, which can squeeze it and clip the move count: let it
   take its natural width (still capped by the kit's max-width; phones keep the kit's full-width bar) */


/* the small sheets: new deal, no more moves */
.sc-confirm { display: flex; flex-direction: column; gap: var(--space-4); }
.sc-confirm-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

@media (prefers-reduced-motion: reduce) {
  .sc-anim .sc-card, .sc-done .sc-card { transition: none; }
  .sc-card.sc-hint, .sc-slot.sc-hint, .sc-card.sc-hint-target, .sc-slot.sc-hint-target, .sc-nope { animation: none; }
}
