/* Skip-Bo table. Seats sit around the building piles: you along the bottom,
   the next player on the left, the third on the right, anyone else across the top.
   Five pile columns line up: four piles, then stock or the draw pile. */


#view-skipbo:not([hidden]) { display: block; }

html:has(body.skipbo-play),
body.skipbo-play { overflow: hidden; }
body.skipbo-play .shell {
  max-width: none; height: 100vh; height: 100dvh; padding: 8px 12px; overflow: hidden;
}
body.skipbo-play .top { padding: 0 2px 6px; margin-bottom: 8px; }
body.skipbo-play #view-skipbo:not([hidden]) {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
}
body.skipbo-play #skipbo-root { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
body.skipbo-play .sb-play { flex: 1; min-height: 0; min-width: 0; }
body.skipbo-play .sb-play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 270px);
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
body.skipbo-play .sb-felt {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 8px 10px;
}
body.skipbo-play .sb-felt > .panel-head { flex: 0 0 auto; margin-bottom: 6px; }
body.skipbo-play .sb-side {
  width: auto; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; padding: 14px;
}
body.skipbo-play .sb-side > .fold { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.skipbo-play .sb-side > .fold.open > .fold-body { flex: 1; min-height: 0; overflow: auto; }
body.skipbo-play .sb-prompt { flex: 0 0 auto; min-height: 0; margin: 0 0 6px; }
body.skipbo-play .sb-log { flex: 1; min-height: 0; max-height: none; margin: 4px 0 0; overflow: auto; }

.sb-around {
  flex: 1; min-height: 0; min-width: 0; width: 100%; height: 100%;
  container-type: size;
  --sb-gap: 6px;
  --sb-across: 7;
  /* The side players run the full height, beside both the middle and your row, so the
     card size comes from their column: five piles stacked (seven card heights) plus the
     names, captions and the card edges of stacked discard piles. Across the top (four or
     more players) adds a row of cards above that. */
  --sb-tall: 7;
  --sb-fixed: 11rem;
  --sb-card: max(32px, min(
    calc((100cqi - 8rem) / var(--sb-across)),
    calc((100cqb - var(--sb-fixed)) / var(--sb-tall)),
    7.5rem
  ));
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "left main right" "left you right";
  /* On wide windows the outer edges give up some width, so the side players sit a
     little nearer the middle instead of far out in the free space. */
  column-gap: clamp(40px, 6vw, 96px);
  padding-inline: clamp(0px, 8vw - 80px, 120px);
  box-sizing: border-box;
  row-gap: 14px;
  justify-items: center; align-items: center;
}
.sb-around.n2 {
  --sb-across: 6;
  grid-template-areas: "left main ." "left you .";
}
.sb-around.n3 { --sb-across: 7; }
.sb-around.n4, .sb-around.n5, .sb-around.n6 {
  --sb-tall: 8.4; --sb-fixed: 16rem;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top top" "left main right" "left you right";
}
.sb-around.n4 { --sb-across: 7; }
.sb-around.n5 { --sb-across: 10; }
.sb-around.n6 { --sb-across: 15; }
.sb-at { min-width: 0; min-height: 0; height: max-content; }
.sb-at-top { grid-area: top; display: flex; gap: 10px; justify-content: center; align-self: end; }
.sb-at-left, .sb-at-right, .sb-at-main { align-self: center; height: max-content; }
.sb-you {
  grid-area: you; justify-self: center; align-self: end;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: max-content; max-width: 100%;
}
.sb-at-left { grid-area: left; justify-self: center; }
.sb-at-left .sb-who, .sb-at-right .sb-who {
  flex-wrap: wrap; justify-content: center; max-width: calc(var(--sb-card) + 10px); row-gap: 2px;
}
.sb-at-main {
  grid-area: main; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0;
}
.sb-at-right { grid-area: right; }

.sb-felt, .sb-side, .sb-room { min-width: 0; }
.sb-line {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 0; min-height: 0; height: auto; margin: 0;
}
.sb-line.turn .sb-who { box-shadow: inset 3px 0 0 var(--you, var(--orange)); border-radius: 4px; }
.sb-mid {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255,255,255,0.16), transparent 55%),
    #1a7344;
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.22),
    inset 0 12px 24px rgba(0,0,0,0.22);
}
.sb-mid .sb-cap { color: rgba(255,255,255,0.82); }
.sb-piles.sb-split {
  display: flex; align-items: flex-end; gap: 28px;
  grid-template-columns: none;
}
.sb-group {
  display: grid; grid-template-columns: repeat(4, var(--sb-card)); gap: var(--sb-gap);
}
.sb-who {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  min-width: 0; line-height: 1.2;
}
.sb-who .sb-name { flex: 0 1 auto; }
.sb-seat { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sb-name, .sb-seat b {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.sb-meta { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.sb-piles {
  flex: 0 0 auto; min-height: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(5, var(--sb-card)); gap: var(--sb-gap);
  width: max-content;
}
.sb-at-left .sb-piles, .sb-at-right .sb-piles {
  display: flex; flex-direction: column; align-items: center;
  width: var(--sb-card); height: auto; gap: var(--sb-gap);
}
.sb-slot {
  min-width: 0; min-height: 0; height: auto;
  display: grid; grid-template-rows: 1.05em auto; justify-items: center;
}
.sb-at-left .sb-cap:empty, .sb-at-right .sb-cap:empty { display: none; }
.sb-at-left .sb-slot, .sb-at-right .sb-slot { grid-template-rows: auto auto; }
.sb-cap {
  height: 1.1em; line-height: 1.1; font-size: 0.62rem; text-transform: uppercase;
  color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 100%;
}
.sb-face {
  width: var(--sb-card); height: calc(var(--sb-card) * 7 / 5); min-width: 0; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
/* A discard pile always keeps room for the card peeking out under the top one, so a
   second card does not make the pile (and everything below it) grow. */
.sb-face:has(.sb-stack), .sb-discard > .sb-face { height: calc(var(--sb-card) * 7 / 5 + 22px); align-items: flex-end; }
/* An empty discard pile outlines that whole space, so a stacked pile fills the same box. */
#view-skipbo .sb-discard > .sb-face > .sb-card.sb-empty { height: calc(var(--sb-card) * 7 / 5 + 22px); }
/* A single card sits at the top of the pile's box, where the first card of a stack lies,
   so the next card lands lower down, as it does on the table. */
.sb-discard > .sb-face:not(:has(.sb-stack)) { align-items: flex-start; }
/* With cards on it, the same well shows behind them: one card at its top, a stack fills it. */
.sb-discard > .sb-face { position: relative; }
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"]) .sb-discard > .sb-face:not(:has(.sb-empty))::before {
  content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  background: rgba(255, 255, 255, 0.04); border: 1px dashed var(--border);
}
.sb-stack { position: relative; width: var(--sb-card); height: 100%; }
.sb-under { position: absolute; top: 0; left: 0; width: var(--sb-card); height: calc(var(--sb-card) * 7 / 5); }
#view-skipbo .sb-stack > .sb-card {
  position: absolute; left: 0; bottom: 0;
  width: var(--sb-card); height: calc(var(--sb-card) * 7 / 5);
}
#view-skipbo .sb-face > .sb-card,
#view-skipbo .sb-face > .sb-back,
#view-skipbo .sb-ghost,
.fold.floated[data-fold^="skipbo-"] .sb-face > .sb-card,
.fold.floated[data-fold^="skipbo-"] .sb-face > .sb-back,
.deck-face .sb-face > .sb-card,
.deck-face .sb-face > .sb-back {
  width: var(--sb-card); height: calc(var(--sb-card) * 7 / 5);
  max-width: none; max-height: none; aspect-ratio: auto;
}
/* Cards look like the printed deck: white card stock inside a coloured frame, the
   number big in the middle and small in two corners. 1-4 blue, 5-8 green, 9-12 red,
   the Skip-Bo wild orange. The back is navy with the logo.
   A slight 3D look: a bevelled edge, a gloss from the top left, the card's thickness
   below it (a pile shows a few edges), and a tilt towards you on hover or drag. */
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) :is(button.sb-card, .sb-card, .sb-under) {
  --tone: #2a2320;
  --sb-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.95), inset 0 -2px 3px rgba(0, 0, 0, 0.12);
  --sb-frame: inset 0 0 0 3px #fff, inset 0 0 0 5px var(--tone);
  --sb-edges: 0 1px 0 #ddd5c7, 0 2px 0 #b8ad9a;
  --sb-drop: 0 3px 4px rgba(0, 0, 0, 0.3), 0 8px 16px rgba(0, 0, 0, 0.22);
  position: relative; box-sizing: border-box; container-type: inline-size; overflow: hidden;
  border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.3);
  background:
    radial-gradient(ellipse 50% 32% at 50% 50%, color-mix(in srgb, var(--tone) 13%, transparent) 0 97%, transparent 100%),
    linear-gradient(160deg, #ffffff 0%, #f4efe6 100%);
  color: var(--tone);
  box-shadow: var(--sb-bevel), var(--sb-frame), var(--sb-edges), var(--sb-drop);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) .sb-under { position: absolute; }
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) .sb-card:not(.sb-empty)::after,
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) .sb-under::after,
.sb-back::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.1) 32%,
    rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.06) 100%);
}
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) .sb-card:has(> .sb-count) {
  --sb-edges: 0 1px 0 #ddd5c7, 0 2px 0 #b8ad9a, 0 3px 0 #ddd5c7, 0 4px 0 #b8ad9a, 0 5px 0 #ddd5c7, 0 6px 0 #a89c88;
}
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) :is(.sb-card, .sb-under).low { --tone: #1b5fc1; }
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) :is(.sb-card, .sb-under).mid { --tone: #1d8a3b; }
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) :is(.sb-card, .sb-under).high { --tone: #d22d26; }
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) :is(.sb-card, .sb-under).wild {
  --tone: #e8590c;
  background:
    radial-gradient(ellipse 62% 40% at 50% 50%, #ffd43b 0 97%, transparent 100%),
    linear-gradient(160deg, #ffffff 0%, #f4efe6 100%);
}
:where(#view-skipbo) button.sb-card,
:where(.fold.floated[data-fold^="skipbo-"]) button.sb-card {
  margin: 0; padding: 0; font: inherit; font-weight: 800; cursor: pointer;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}
:where(#view-skipbo) button.sb-card:not(.sb-empty):hover {
  transform: perspective(500px) translateY(-4px) rotateX(10deg);
  --sb-drop: 0 6px 6px rgba(0, 0, 0, 0.28), 0 14px 22px rgba(0, 0, 0, 0.3);
}
:where(#view-skipbo, .fold.floated[data-fold^="skipbo-"], .deck-face) .sb-card .sb-logo,
.sb-back::before {
  padding: 0.18em 0.4em; border-radius: 999px; transform: rotate(-24deg);
  background: linear-gradient(180deg, #f76707, #d9480f); color: #fff;
  font-size: clamp(0.55rem, 24cqi, 1.3rem); font-weight: 900; line-height: 1;
  letter-spacing: 0.02em; white-space: nowrap; font-style: italic;
  box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
:where(#view-skipbo) .sb-card.sb-empty,
:where(.fold.floated[data-fold^="skipbo-"]) .sb-card.sb-empty {
  background: rgba(255, 255, 255, 0.04); color: var(--muted); box-shadow: none;
  border: 1px dashed var(--border);
}
:where(#view-skipbo) .sb-mid .sb-card.sb-empty { border-color: rgba(255, 255, 255, 0.45); color: rgba(255, 255, 255, 0.7); }
:where(#view-skipbo) button.sb-card.sb-empty:hover { background: var(--accent-faint); color: var(--text); }
#view-skipbo .sb-card.on { outline: 2px solid var(--orange); outline-offset: 2px; }
#view-skipbo .sb-card.hot { outline: 2px solid var(--pending); outline-offset: 2px; }
#view-skipbo button.sb-card[data-sb="card"] { cursor: grab; }
#view-skipbo .sb-card.sb-lifting { opacity: 0.35; }
#view-skipbo .sb-slot.sb-drop > .sb-face > .sb-card { outline: 2px solid var(--pending); outline-offset: 2px; }
#view-skipbo .sb-slot.sb-over > .sb-face > .sb-card { outline: 2px solid var(--found, #3ddc6e); outline-offset: 2px; }
#view-skipbo .sb-card.sb-ghost {
  position: fixed; z-index: 80; margin: 0; pointer-events: none;
  transform: translate(-50%, -50%) perspective(500px) rotateX(12deg) rotate(-5deg) scale(1.06);
  --sb-drop: 0 14px 14px rgba(0, 0, 0, 0.3), 0 24px 36px rgba(0, 0, 0, 0.4);
}
body.sb-dragging, body.sb-dragging * { cursor: grabbing; }
.sb-opp { height: auto; display: flex; flex-direction: column; align-items: center; }
.sb-opp > .fold-head { align-items: center; width: max-content; max-width: none; flex: none; }
.sb-opp .fold-toggle {
  justify-content: flex-start; flex-wrap: nowrap; text-transform: none; letter-spacing: 0;
  font-size: 0.78rem; width: auto; max-width: 100%;
}
.sb-opp .fold-arrow, .sb-opp > .fold-head > .fold-float { flex: 0 0 auto; }
.sb-opp-meta { margin: 0; text-align: center; line-height: 1.2; white-space: nowrap; }
.sb-at-left .sb-opp, .sb-at-right .sb-opp { width: max-content; max-width: none; }
.sb-at-left .sb-opp .fold-body, .sb-at-right .sb-opp .fold-body {
  display: block; height: auto; flex: none; overflow: visible;
}
.sb-opp .fold-title { flex: 0 1 auto; min-width: 0; }
.sb-opp .swatch { flex: 0 0 auto; }
.sb-opp.turn > .fold-head { box-shadow: inset 3px 0 0 var(--you, var(--orange)); }
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) {
  --sb-fit: min(76px, calc((min(520px, 100vw - 56px) - 24px) / 5));
  width: max-content; max-width: calc(100vw - 16px); max-height: none; overflow: visible;
}
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) > .fold-body { overflow: visible; }
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-piles {
  display: grid; grid-template-columns: repeat(5, var(--sb-fit)); width: max-content; height: auto;
}
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-face,
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-face > .sb-card,
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-face > .sb-back {
  width: var(--sb-fit); height: calc(var(--sb-fit) * 7 / 5);
}
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-face:has(.sb-stack),
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-discard > .sb-face {
  height: calc(var(--sb-fit) * 7 / 5 + 22px);
}
.fold.floated[data-fold^="skipbo-"]:not([data-fold="skipbo-log"]) .sb-discard > .sb-face > .sb-card.sb-empty {
  height: calc(var(--sb-fit) * 7 / 5 + 22px);
}
body.skipbo-play .sb-play:not(:has(.sb-side .fold:not(.floated))) { grid-template-columns: minmax(0, 1fr); }
body.skipbo-play .sb-side:not(:has(.fold:not(.floated))) { display: none; }
.sb-rank {
  font-size: clamp(1.55rem, 58cqi, 3.5rem); font-weight: 900; line-height: 0.85;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}
.sb-corner {
  position: absolute; top: 7px; left: 8px; font-size: clamp(0.5rem, 17cqi, 0.8rem);
  font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
}
.sb-corner-b { top: auto; left: auto; bottom: 7px; right: 8px; transform: rotate(180deg); }
@container (max-width: 46px) {
  .sb-corner { top: 5px; left: 6px; }
  .sb-corner-b, .sb-as { display: none; }
}
.sb-as { margin-top: 4px; font-size: clamp(0.45rem, 12cqi, 0.62rem); font-weight: 800; letter-spacing: 0.03em; }
.sb-count {
  position: absolute; right: 5px; top: 5px; font-size: clamp(0.5rem, 14cqi, 0.68rem);
  font-variant-numeric: tabular-nums; line-height: 1.35;
  background: rgba(0, 0, 0, 0.7); color: #fff; border-radius: 999px; padding: 0 5px;
}
.sb-back {
  position: relative; overflow: hidden; container-type: inline-size;
  border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.45);
  background:
    radial-gradient(ellipse 70% 30% at 50% 50%, rgba(255, 255, 255, 0.14) 0 97%, transparent 100%),
    repeating-linear-gradient(45deg, #1c3f8f 0 5px, #16337a 5px 10px);
  box-shadow:
    inset 0 0 0 3px #fff, inset 0 0 0 4px rgba(0, 0, 0, 0.25),
    0 1px 0 #ddd5c7, 0 2px 0 #b8ad9a, 0 3px 0 #ddd5c7, 0 4px 0 #b8ad9a,
    0 5px 0 #ddd5c7, 0 6px 0 #a89c88, 0 3px 4px rgba(0, 0, 0, 0.3), 0 10px 18px rgba(0, 0, 0, 0.25);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-variant-numeric: tabular-nums; font-size: 1rem;
}
.sb-back::before {
  content: "Skip-Bo"; position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-24deg); font-size: clamp(0.5rem, 22cqi, 1.2rem);
}
.sb-back > span {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  font-size: clamp(0.55rem, 16cqi, 0.8rem); line-height: 1.35;
  background: rgba(0, 0, 0, 0.7); border-radius: 999px; padding: 0 6px;
}
.sb-peek {
  position: fixed; z-index: 80; min-width: 148px; max-width: 220px;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
}
.sb-peek b { font-size: 0.78rem; padding: 0 2px; }
.sb-peek ol {
  list-style: none; margin: 0; padding: 0; overflow: auto; max-height: min(60vh, 360px);
  display: flex; flex-direction: column; gap: 4px;
}
.sb-peek-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 26px; margin: 0; padding: 0 8px; border-radius: 6px;
  font-weight: 750; font-variant-numeric: tabular-nums; color: #fff;
}
.sb-peek-card.low { background: #1f78d1; }
.sb-peek-card.mid { background: #2f9e36; }
.sb-peek-card.high { background: #e23b32; }
.sb-peek-card.wild { background: #f5b31a; color: #1a4f9c; }
.sb-peek-top { font-size: 0.62rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; }
.sb-prompt { margin: 0; }
.sb-log {
  list-style: none; margin: 0; padding: 0; font-size: 0.82rem; color: var(--muted);
  max-height: none; overflow: auto;
}
.sb-log li {
  border-left: 3px solid var(--border); padding: 1px 0 1px 8px; margin-bottom: 3px;
  overflow-wrap: anywhere; min-width: 0;
}
.sb-form { max-width: 280px; margin-top: 12px; }
.sb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sb-rules { margin: 0 0 8px; max-width: 62rem; }

@media (max-width: 720px) {
  body.skipbo-play .sb-play {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 4.6rem;
  }
}

/* Your turn: a badge by the prompt, a frame round your hand and piles, and the cards
   you were just dealt slide in. The frame flashes once when the turn begins. */
.sb-your-turn {
  display: inline-block; margin-right: 8px; padding: 1px 10px; border-radius: 999px;
  background: var(--turn-green); color: #fff; font-weight: 750;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}
.sb-you { border-radius: 14px; padding: 6px 10px; transition: box-shadow 0.2s; }
.sb-you.mine {
  box-shadow: 0 0 0 2px var(--turn-green),
    0 0 18px color-mix(in srgb, var(--turn-green) 45%, transparent);
}
.sb-you { position: relative; }
.sb-you::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  opacity: 0; will-change: opacity; box-shadow: inset 0 0 0 4px var(--turn-green), inset 0 0 36px color-mix(in srgb, var(--turn-green) 70%, transparent);
}
.sb-you.mine.start::after { animation: turn-glow 0.9s ease-out 2; }
.sb-your-turn.start { animation: sb-turn-pop 0.5s ease-out; }
.sb-slot.dealt > .sb-face { animation: sb-deal 0.4s ease-out both; animation-delay: var(--d, 0ms); }
@keyframes sb-turn-pop { from { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.12); } }
@keyframes sb-deal { from { transform: translateY(-40px) scale(0.85); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  #view-skipbo button.sb-card { transition: none; }
  #view-skipbo button.sb-card.on { outline-offset: 1px; }
  .sb-you.mine.start::after, .sb-your-turn.start, .sb-slot.dealt > .sb-face { animation: none; }
}

.sb-numbers { grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; }
.sb-numbers b.num { font-size: 1.15rem; }
.stats-sources.sb-meters { grid-template-columns: 7.5rem minmax(0, 1fr) 7.5rem; }

/* Card styles (html[data-deck], see decks.js). Classic is the look above; each style
   below repaints the faces, the wild's banner and the back. The gallery shows every
   style at once: each sample is a .deck-face, and a scope stops there so the page's
   own style doesn't paint over the sample. Empty slots keep the Classic dashes. */

/* Flat graphic: poster print, solid colour, thick black outline, hard shadow. */
@scope (html[data-deck="flat"], .deck-face[data-deck="flat"]) to (.deck-face) {
  :scope :is(.sb-card:not(.sb-empty), .sb-under) {
    background: var(--tone); color: #fff;
    border: 3px solid #141110; border-radius: 6px;
    box-shadow: 3px 3px 0 #141110;
  }
  :scope .sb-card:not(.sb-empty):has(> .sb-count) { box-shadow: 3px 3px 0 #fff8e6, 5px 5px 0 #141110; }
  :scope :is(.sb-card, .sb-under).wild { background: #ffd43b; color: #141110; }
  :scope :is(.sb-card, .sb-under)::after, :scope .sb-back::after { display: none; }
  :scope .sb-rank { text-shadow: 2px 2px 0 #141110; }
  :scope .wild .sb-rank { text-shadow: none; }
  :scope .sb-card .sb-logo, :scope .sb-back::before {
    background: #141110; color: #ffd43b; border-radius: 4px; font-style: normal;
    box-shadow: none; text-shadow: none;
  }
  :scope .sb-card .sb-logo { transform: rotate(-12deg); }
  :scope .sb-back::before { transform: translate(-50%, -50%) rotate(-12deg); }
  :scope .sb-back {
    background: #1b5fc1; border: 3px solid #141110; border-radius: 6px;
    box-shadow: 3px 3px 0 #fff8e6, 5px 5px 0 #141110;
  }
}

/* Neon: dark glass, glowing outlines and numbers. */
@scope (html[data-deck="neon"], .deck-face[data-deck="neon"]) to (.deck-face) {
  :scope :is(.sb-card, .sb-under).low { --tone: #3db4ff; }
  :scope :is(.sb-card, .sb-under).mid { --tone: #3dff8f; }
  :scope :is(.sb-card, .sb-under).high { --tone: #ff3d6e; }
  :scope :is(.sb-card, .sb-under).wild { --tone: #ffd400; }
  :scope :is(.sb-card:not(.sb-empty), .sb-under) {
    background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--tone) 16%, #0b0a14), #07060d 75%);
    color: var(--tone); border: 1px solid var(--tone); border-radius: 8px;
    box-shadow: 0 0 10px color-mix(in srgb, var(--tone) 55%, transparent),
      inset 0 0 12px color-mix(in srgb, var(--tone) 30%, transparent);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  }
  :scope :is(.sb-card, .sb-under)::after, :scope .sb-back::after { display: none; }
  :scope .sb-rank { text-shadow: 0 0 6px var(--tone), 0 0 14px var(--tone); }
  :scope .sb-corner { text-shadow: 0 0 4px var(--tone); }
  :scope .sb-card .sb-logo, :scope .sb-back::before {
    background: transparent; color: #ff4dd8; border: 1px solid #ff4dd8; border-radius: 4px;
    box-shadow: 0 0 8px #ff4dd8, inset 0 0 6px rgba(255, 77, 216, 0.5);
    text-shadow: 0 0 6px #ff4dd8; font-style: normal; font-family: ui-monospace, Consolas, monospace;
  }
  :scope .sb-back {
    border: 1px solid #ff4dd8;
    background:
      repeating-linear-gradient(0deg, rgba(255, 77, 216, 0.22) 0 1px, transparent 1px 8px),
      repeating-linear-gradient(90deg, rgba(61, 180, 255, 0.22) 0 1px, transparent 1px 8px),
      #07060d;
    box-shadow: 0 0 12px rgba(255, 77, 216, 0.55), 2px 3px 0 #2a1840, 4px 6px 0 #1a0f2a;
  }
  :scope .sb-count, :scope .sb-back > span { background: #07060d; border: 1px solid currentColor; }
}

/* Vintage: aged card stock, a double frame and serif numbers in muted inks. */
@scope (html[data-deck="vintage"], .deck-face[data-deck="vintage"]) to (.deck-face) {
  :scope :is(.sb-card, .sb-under).low { --tone: #2d4a7a; }
  :scope :is(.sb-card, .sb-under).mid { --tone: #4f6b2e; }
  :scope :is(.sb-card, .sb-under).high { --tone: #8c2a2a; }
  :scope :is(.sb-card, .sb-under).wild { --tone: #9a6a08; }
  :scope :is(.sb-card:not(.sb-empty), .sb-under) {
    background: radial-gradient(ellipse at 50% 45%, #f8eed4 40%, #e8d6ac 100%);
    color: var(--tone); border: 1px solid #8a6f47; border-radius: 6px;
    box-shadow: inset 0 0 0 3px #f6ebcf, inset 0 0 0 4px var(--tone), inset 0 0 0 6px #f6ebcf,
      inset 0 0 0 7px var(--tone), 0 1px 0 #d9c69c, 0 2px 0 #a88d5e, 0 4px 8px rgba(60, 40, 10, 0.35);
    font-family: Georgia, "Times New Roman", serif;
  }
  :scope :is(.sb-card, .sb-under)::after {
    background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(110, 70, 20, 0.18) 100%);
  }
  :scope .sb-rank { font-weight: 700; text-shadow: none; }
  :scope .sb-corner { font-weight: 700; }
  :scope .sb-card .sb-logo, :scope .sb-back::before {
    background: #8c2a2a; color: #f6ebcf; border-radius: 3px; font-style: normal;
    font-family: Georgia, "Times New Roman", serif; font-variant: small-caps; font-weight: 700;
    box-shadow: 0 0 0 1px #f6ebcf, 0 0 0 2px #8c2a2a; text-shadow: none;
  }
  :scope .sb-card .sb-logo { transform: rotate(-12deg); }
  :scope .sb-back::before { transform: translate(-50%, -50%) rotate(-12deg); }
  :scope .sb-back {
    border: 1px solid #4a1e1e; border-radius: 6px;
    background:
      repeating-linear-gradient(45deg, rgba(246, 235, 207, 0.16) 0 2px, transparent 2px 9px),
      repeating-linear-gradient(-45deg, rgba(246, 235, 207, 0.16) 0 2px, transparent 2px 9px),
      #6e2323;
    box-shadow: inset 0 0 0 3px #f6ebcf, inset 0 0 0 4px #6e2323,
      0 1px 0 #d9c69c, 0 2px 0 #a88d5e, 0 3px 0 #d9c69c, 0 4px 0 #a88d5e, 0 6px 10px rgba(60, 40, 10, 0.35);
  }
  :scope .sb-back::after { display: none; }
}

/* Pixel art: square corners, chunky outline, a stepped bevel and a blocky shadow. */
@scope (html[data-deck="pixel"], .deck-face[data-deck="pixel"]) to (.deck-face) {
  :scope :is(.sb-card, .sb-under).low { --tone: #2b6cff; }
  :scope :is(.sb-card, .sb-under).mid { --tone: #1fa83a; }
  :scope :is(.sb-card, .sb-under).high { --tone: #e8261e; }
  :scope :is(.sb-card, .sb-under).wild { --tone: #ff7a00; }
  :scope :is(.sb-card:not(.sb-empty), .sb-under) {
    background: color-mix(in srgb, var(--tone) 14%, #fff); color: var(--tone);
    border: 3px solid #141110; border-radius: 0;
    box-shadow: inset 4px 4px 0 rgba(255, 255, 255, 0.85), inset -4px -4px 0 rgba(0, 0, 0, 0.16), 4px 4px 0 #141110;
    font-family: "Courier New", ui-monospace, monospace;
  }
  :scope :is(.sb-card, .sb-under).wild { background: #ffe066; }
  :scope :is(.sb-card, .sb-under)::after, :scope .sb-back::after { display: none; }
  :scope .sb-rank { font-weight: 900; text-shadow: 3px 3px 0 #141110; }
  :scope .sb-corner { text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.25); }
  :scope .sb-card .sb-logo, :scope .sb-back::before {
    background: #ff7a00; color: #fff; border: 2px solid #141110; border-radius: 0;
    box-shadow: 2px 2px 0 #141110; text-shadow: 1px 1px 0 #141110; font-style: normal;
    font-family: "Courier New", ui-monospace, monospace;
  }
  :scope .sb-card .sb-logo { transform: none; }
  :scope .sb-back::before { transform: translate(-50%, -50%); }
  :scope .sb-back {
    border: 3px solid #141110; border-radius: 0;
    background: conic-gradient(#1c3f8f 25%, #2b56b8 0 50%, #1c3f8f 0 75%, #2b56b8 0) 0 0 / 10px 10px;
    box-shadow: inset 3px 3px 0 rgba(255, 255, 255, 0.35), 4px 4px 0 #141110;
  }
  :scope .sb-count, :scope .sb-back > span { border-radius: 0; }
}

/* The card styles page: one row of the same cards per style. */
.deck-gallery { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
button.deck-sample {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  min-width: 0; padding: 0 0 14px; text-align: left;
  background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  font-weight: 650; cursor: pointer;
}
button.deck-sample:hover { background: transparent; color: var(--text); border-color: var(--accent-border-medium); }
button.deck-sample.on { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
button.deck-sample .name { padding: 8px 12px; }
.deck-face.sb-piles {
  --sb-card: 62px;
  display: flex; flex-wrap: wrap; gap: 12px; width: auto; padding: 4px 14px 6px;
}
.deck-face .sb-slot { grid-template-rows: auto; }
.deck-face .sb-cap { display: none; }

/* Sort the hand low to high: a small switch beside the Hand label. */
.sb-sort {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
  font-size: 0.85em; color: var(--muted); cursor: pointer; user-select: none;
}
.sb-sort input {
  appearance: none; position: relative; flex: 0 0 auto; margin: 0; cursor: pointer;
  width: 28px; height: 16px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--border); transition: background 0.15s, border-color 0.15s;
}
.sb-sort input::before {
  content: ""; position: absolute; top: 1px; left: 1px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); transition: transform 0.15s, background 0.15s;
}
.sb-sort input:checked { background: var(--orange); border-color: var(--orange); }
.sb-sort input:checked::before { transform: translateX(12px); background: #fff; }
.sb-sort input:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sb-sort input, .sb-sort input::before { transition: none; } }
