/* AnomicFlip — Blackjack (/blackjack). Shares the page shell (.cf, .cf-side, .cf-bar…) with coinflip.css. */
.bj { --cw: 124px; --ch: 174px; --sx: 52px; --sy: 16px; }
.bj-spacer { flex: 1; }

/* left panel */
.bj-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bj-acts button, .bj-ins button {
  height: 64px; border: 0; border-radius: 8px; background: #2a2d33; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px; font: 700 18px 'Archivo', system-ui, sans-serif; transition: background .12s, opacity .12s;
}
.bj-acts button:hover:not(:disabled), .bj-ins button:hover:not(:disabled) { background: #33373e; }
.bj-acts button:disabled, .bj-ins button:disabled { opacity: .4; cursor: not-allowed; }
.bj-acts svg { color: #c9ccd1; }
.bj-acts .x2 { font-size: 22px; font-weight: 500; color: #c9ccd1; }
.bj-count { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bj-count button { height: 58px; border: 0; border-radius: 8px; background: #2a2d33; color: #fff; font: 800 19px 'Archivo', system-ui, sans-serif; cursor: pointer; }
.bj-count button:hover:not(:disabled) { background: #33373e; }
.bj-count button.on { background: #3fbf7f; color: #0d1f16; }
.bj-count button:disabled { cursor: not-allowed; }
.bj-count button:disabled:not(.on) { opacity: .5; }
.bj-rows { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid #2a2d33; }
.bj-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; color: #a7abb2; }
.bj-row b { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-size: 17px; font-variant-numeric: tabular-nums; }
.bj-row[hidden], .bj-ins[hidden] { display: none; }
.bj-ins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bj-ins button svg { color: #3fd68f; }
.bj-ins button:last-child svg { color: #c9ccd1; }

/* table */
.bj-table {
  position: relative; min-height: 840px; padding: 36px 24px 40px; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto 1fr; justify-items: center; align-items: center; gap: 20px;
}
.bj-zone { display: flex; justify-content: center; align-items: flex-start; gap: 44px; flex-wrap: wrap; min-height: calc(var(--ch) + 60px); }
.bj-dealer { align-self: start; }
.bj-player { align-self: end; }
.bj-player.many { --cw: 96px; --ch: 134px; --sx: 40px; --sy: 12px; gap: 26px; }

.bj-hand { position: relative; display: grid; justify-items: center; gap: 16px; padding-top: 6px; }
.bj-cards {
  position: relative;
  width: calc(var(--cw) + (var(--n, 1) - 1) * var(--sx));
  height: calc(var(--ch) + (var(--n, 1) - 1) * var(--sy));
  transition: width .2s ease, height .2s ease;
}
.bj-total {
  position: absolute; top: -12px; right: -18px; z-index: 30; min-width: 48px; height: 38px; padding: 0 12px; border-radius: 99px;
  display: grid; place-items: center; background: #3a3f46; color: #fff; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.bj-total[hidden] { display: none; }
.bj-hand.active .bj-total { background: #3fbf7f; color: #0d1f16; }
.bj-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 99px;
  background: #2a2d33; color: #fff; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; transition: background .2s;
}

/* cards */
.bj-card {
  position: absolute; left: calc(var(--i, 0) * var(--sx)); top: calc(var(--i, 0) * var(--sy)); z-index: calc(var(--i, 0) + 1);
  width: var(--cw); height: var(--ch); border-radius: 12px; box-sizing: border-box;
  box-shadow: -4px 6px 16px rgba(0,0,0,.35); user-select: none; transition: border-color .2s, box-shadow .2s;
}
.bj-card.face { background: #f4f4f4; color: #151515; padding: 12px 14px; display: flex; flex-direction: column; align-items: flex-start; border: 4px solid transparent; }
.bj-card.face.red { color: #ff3b3b; }
.bj-card.face b { font-size: calc(var(--cw) * .36); line-height: 1; font-weight: 800; letter-spacing: -1px; }
.bj-card.face i { font-style: normal; font-size: calc(var(--cw) * .32); line-height: 1.15; }
.bj-card.back { background: #17473a; border: 3px solid #3fd68f; overflow: hidden; }
.bj-card.back svg { display: block; width: 100%; height: 100%; }
/* logo in the middle of the card back (swap public/card-logo.webp to change it) */
.bj-card.back::after { content: ''; position: absolute; left: 31%; right: 31%; top: 38%; bottom: 38%; background: url('/card-logo.webp') center / contain no-repeat; pointer-events: none; }

.bj-card.deal { animation: bj-deal .38s cubic-bezier(.2,.8,.25,1) both; }
.bj-card.deal.slow { animation-duration: .7s; } /* hit / double / split cards */
@keyframes bj-deal {
  from { transform: translate(var(--fx, 400px), var(--fy, -300px)) rotate(-12deg) scale(.9); opacity: .4; }
  to { transform: none; opacity: 1; }
}
.bj-card.flip { animation: bj-flip .32s ease-out both; }
@keyframes bj-flip { from { transform: rotateY(90deg); } to { transform: none; } }

/* results: green win, red loss, orange tie */
.bj-hand.win .bj-card.face { border-color: #22c55e; }
.bj-hand.win .bj-chip { background: #15803d; }
.bj-hand.lose .bj-card.face { border-color: #d33a3a; }
.bj-hand.lose .bj-chip { background: #b7282f; }
.bj-hand.push .bj-card.face { border-color: #f07a1a; }
.bj-hand.push .bj-chip { background: #b8530c; }
.bj-hand.active .bj-cards { filter: drop-shadow(0 0 14px rgba(63,214,143,.35)); }

/* shoe */
.bj-shoe { position: absolute; top: 30px; right: 30px; width: 150px; height: 214px; pointer-events: none; }
.bj-shoe .bj-card { --cw: 140px; --ch: 200px; left: auto; right: calc(var(--k, 0) * 5px); top: calc(var(--k, 0) * 5px); box-shadow: 0 6px 14px rgba(0,0,0,.4); }
.bj-shoe .bj-card:nth-child(1) { --k: 2; } .bj-shoe .bj-card:nth-child(2) { --k: 1; } .bj-shoe .bj-card:nth-child(3) { --k: 0; }

/* ribbon */
.bj-ribbon { position: relative; display: grid; justify-items: center; gap: 10px; pointer-events: none; }
.bj-rib { position: relative; padding: 0 56px; }
.bj-rib::before, .bj-rib::after {
  content: ''; position: absolute; top: 18px; width: 70px; height: 42px; background: #24563f; z-index: 0;
}
.bj-rib::before { left: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 18% 50%); }
.bj-rib::after { right: 0; clip-path: polygon(0 0, 100% 0, 82% 50%, 100% 100%, 0 100%); }
.bj-rib span {
  position: relative; z-index: 1; display: block; padding: 14px 52px; background: #2f6b4f; color: #e9fff3;
  font-size: 18px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; box-shadow: 0 4px 0 #214a37;
}
.bj-ribbon small { font-size: 17px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: #e6e8eb; }

.bj-win { top: 50%; margin-top: -86px; }

@media (prefers-reduced-motion: reduce) { .bj-card.deal, .bj-card.flip { animation-duration: .01s; } }
@media (max-width: 1100px) { .bj-table { min-height: 640px; } }
@media (max-width: 600px) {
  .bj { --cw: 76px; --ch: 106px; --sx: 32px; --sy: 10px; }
  .bj-player.many { --cw: 60px; --ch: 84px; --sx: 24px; --sy: 8px; gap: 16px; }
  .bj-table { min-height: 0; grid-template-rows: auto auto auto; gap: 28px; padding: 24px 10px 28px; }
  .bj-zone { min-height: calc(var(--ch) + 50px); }
  .bj-zone { gap: 20px; }
  .bj-shoe { transform: scale(.5); transform-origin: top right; top: 12px; right: 12px; }
  .bj-rib { padding: 0 34px; }
  .bj-rib::before, .bj-rib::after { width: 44px; height: 32px; top: 12px; }
  .bj-rib span { padding: 10px 22px; font-size: 13px; }
  .bj-ribbon small { font-size: 13px; }
  .bj-acts button, .bj-ins button { height: 56px; font-size: 16px; }
  .bj-total { height: 32px; min-width: 40px; font-size: 16px; right: -12px; }
  .bj-chip { height: 34px; font-size: 15px; }
}
