/* Tavolo di blackjack gratis (/gratis/). Caricato solo su quella pagina, dopo style.css. */
.bjg { --card-w: 74px; --card-h: 104px; --card-fs: 1.05rem; background: var(--surface); border: 1px solid rgba(56, 228, 145, 0.25); border-radius: var(--r-l); box-shadow: var(--shadow); margin: 1.4rem 0 1.8rem; overflow: hidden; }
.bjg-top { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; align-items: center; justify-content: space-between; padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line); font-size: 0.86rem; color: var(--ink-3); }
.bjg-top b { color: #fff; font-size: 1.08rem; margin-left: 0.4rem; font-variant-numeric: tabular-nums; }
.bjg-stats { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.bjg-shoe { color: var(--ink-3); }
.bjg-shoe.is-low { color: var(--amber); }

.bjg-felt {
  position: relative; display: flex; flex-direction: column; gap: 0.5rem; min-height: 400px; padding: 1.1rem 1rem 1.4rem;
  background: radial-gradient(ellipse at 50% 15%, #1d7a4b 0%, var(--felt-2) 45%, var(--felt) 100%);
  box-shadow: inset 0 0 0 8px #3d2415, inset 0 0 0 10px #7a512a, inset 0 0 70px rgba(0, 0, 0, 0.45);
  border-radius: 0 0 170px 170px / 0 0 90px 90px;
}
.bjg-felt::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 0 0 160px 160px / 0 0 80px 80px; pointer-events: none; }
.bjg-label { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin: 0; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.bjg-total { display: inline-block; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); color: #fff; font-weight: 700; font-size: 0.8rem; letter-spacing: 0; text-transform: none; min-height: 22px; }
.bjg-total:empty { display: none; }
.bjg-cards { display: flex; justify-content: center; min-height: var(--card-h); }
.bjg-cards .card + .card { margin-left: calc(var(--card-w) * -0.42); }
.bjg-arc { margin: 0.2rem 0 0; text-align: center; font-size: 0.72rem; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.45); font-weight: 600; }
.bjg-message { text-align: center; min-height: 1.6em; margin: 0; font-weight: 700; font-size: 1.15rem; color: #fff; }
.bjg-message.win { color: var(--green); }
.bjg-message.lose { color: #ffb4b4; }
.bjg-message.push { color: #d7e5dc; }
.bjg-message.warn { color: var(--amber); }
.bjg-hands { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem 1.2rem; min-height: calc(var(--card-h) + 70px); }
.bjg-hand { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; padding: 0.6rem 0.7rem 0.7rem; border-radius: 14px; border: 2px solid transparent; transition: border-color 0.2s, background 0.2s; }
.bjg-hand.is-active { border-color: rgba(246, 193, 78, 0.85); background: rgba(0, 0, 0, 0.18); }
.bjg-hand-meta { display: flex; gap: 0.5rem; align-items: center; min-height: 22px; }
.bjg-status { font-weight: 700; font-size: 0.85rem; color: #fff; }
.bjg-status.win { color: var(--green); }
.bjg-status.lose { color: #ffb4b4; }
.bjg-status.push { color: #d7e5dc; }
.bjg-stack { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 30px; }
.bjg-stack b { color: #fff; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.bjg-coin { --coin: #e9e4d8; --coin-in: #f7f3ea; position: relative; display: inline-block; width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; background: radial-gradient(circle, var(--coin-in) 0 56%, var(--coin) 57% 100%); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.bjg-coin::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 255, 255, 0.9) 0 14deg, transparent 14deg 60deg); -webkit-mask: radial-gradient(circle, transparent 0 58%, #000 59% 88%, transparent 89%); mask: radial-gradient(circle, transparent 0 58%, #000 59% 88%, transparent 89%); }
.bjg-stack .bjg-coin + .bjg-coin { margin-left: -22px; }
.bjg-coin.c1 { --coin: #d9d3c4; --coin-in: #f7f3ea; }
.bjg-coin.c5 { --coin: #b42f33; --coin-in: #de4f54; }
.bjg-coin.c25 { --coin: #1f7a4b; --coin-in: #2fb874; }
.bjg-coin.c100 { --coin: #141414; --coin-in: #3d3d3d; }
.bjg-coin.c500 { --coin: #5c35a6; --coin-in: #8b5ed9; }
.bjg-ins { font-size: 0.74rem; color: rgba(255, 255, 255, 0.7); }

.bjg-controls { padding: 0.9rem 1.1rem 1.1rem; display: grid; gap: 0.8rem; }
.bjg-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.bjg-chips > span { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-right: 0.3rem; }
.bjg-chip { width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; position: relative; font-family: inherit; font-weight: 800; font-size: 0.9rem; color: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45); transition: transform 0.12s, opacity 0.2s; }
.bjg-chip span { position: relative; z-index: 1; }
.bjg-chip.c1 { color: #2a2a2a; }
.bjg-chip:hover:not(:disabled) { transform: translateY(-3px); }
.bjg-chip:disabled { opacity: 0.35; cursor: not-allowed; }
.bjg-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bjg-actions .btn { min-width: 112px; }
.bjg-actions .btn kbd { margin-left: 0.5rem; font-size: 0.66rem; opacity: 0.75; padding: 0 0.3rem; border-color: currentColor; background: transparent; color: inherit; }
.bjg-actions [hidden] { display: none !important; }
.bjg-actions .btn.is-hint { box-shadow: 0 0 0 3px var(--amber); }
.bjg-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.7rem 1.1rem; border-top: 1px solid var(--line); font-size: 0.82rem; color: var(--ink-3); }
.bjg-foot button { background: none; border: 0; color: var(--link); font: inherit; cursor: pointer; padding: 0; }
.bjg-nojs { margin: 0; padding: 1rem 1.1rem; color: var(--ink-2); }

/* Carte */
.card { position: relative; width: var(--card-w); height: var(--card-h); flex: 0 0 auto; perspective: 700px; transition: transform 0.38s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease; }
.card.is-new { transform: translate(200px, -160px) rotate(12deg); opacity: 0; }
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.5s ease; }
.card.is-down .card-inner { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.card-front { background: linear-gradient(160deg, #fffdf7 0%, #f3eee2 100%); color: #1a211d; }
.card.red .card-front { color: #c8242a; }
.card-back { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, rgba(56, 228, 145, 0.35) 0 2px, transparent 2px 9px), repeating-linear-gradient(-45deg, rgba(56, 228, 145, 0.35) 0 2px, transparent 2px 9px) #0c1a14; box-shadow: inset 0 0 0 4px #fffdf7, inset 0 0 0 5px var(--green-3), 0 4px 10px rgba(0, 0, 0, 0.4); }
.card-idx { position: absolute; top: 5px; left: 6px; display: flex; flex-direction: column; align-items: center; font-weight: 700; font-size: var(--card-fs); line-height: 1; }
.card-idx i { font-style: normal; font-size: 0.85em; margin-top: 1px; }
.card-idx.b { top: auto; left: auto; right: 6px; bottom: 5px; transform: rotate(180deg); }
.card-pips { position: absolute; inset: 15px 17px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(7, 1fr); font-size: calc(var(--card-h) / 8.5); line-height: 1; }
.card-pips i { font-style: normal; display: flex; align-items: center; justify-content: center; }
.p-11 { grid-area: 1 / 1; } .p-21 { grid-area: 1 / 2; } .p-31 { grid-area: 1 / 3; }
.p-22 { grid-area: 2 / 2; } .p-13 { grid-area: 3 / 1; } .p-33 { grid-area: 3 / 3; }
.p-14 { grid-area: 4 / 1; } .p-24 { grid-area: 4 / 2; } .p-34 { grid-area: 4 / 3; }
.p-15 { grid-area: 5 / 1; } .p-35 { grid-area: 5 / 3; } .p-26 { grid-area: 6 / 2; }
.p-17 { grid-area: 7 / 1; } .p-27 { grid-area: 7 / 2; } .p-37 { grid-area: 7 / 3; }
.p-15, .p-35, .p-26, .p-17, .p-27, .p-37 { transform: rotate(180deg); }
.card-ace { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--card-h) / 2.3); line-height: 1; }
.card-court { position: absolute; inset: 18px 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid currentColor; border-radius: 4px; }
.card-court svg { width: 42%; fill: var(--amber); }
.card-court b { font-size: calc(var(--card-h) / 3.1); line-height: 1; }
.card-court i { font-style: normal; font-size: calc(var(--card-h) / 7); line-height: 1; }

@media (max-width: 600px) {
  .bjg { --card-w: 58px; --card-h: 82px; --card-fs: 0.9rem; }
  .bjg-felt { min-height: 340px; padding: 0.9rem 0.6rem 1.2rem; border-radius: 0 0 90px 90px / 0 0 50px 50px; }
  .bjg-felt::before { border-radius: 0 0 80px 80px / 0 0 40px 40px; }
  .bjg-chip { width: 46px; height: 46px; font-size: 0.8rem; }
  .bjg-actions .btn { min-width: 0; flex: 1 1 45%; }
  .bjg-actions .btn kbd { display: none; }
  .bjg-message { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card-inner { transition: none; }
  .card.is-new { transform: none; opacity: 1; }
}
