*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --casino-bg: #0c0608;
  --casino-dark: #150a0e;
  --felt: #6b1224;
  --felt-mid: #8b1a30;
  --felt-light: #a8223c;
  --felt-edge: #4a0a18;
  --rail: #2a1810;
  --rail-light: #5c3d20;
  --gold: #d4af37;
  --gold-light: #f0d060;
  --gold-dark: #9a7b1a;
  --red: #c0392b;
  --red-light: #e74c3c;
  --card-white: #fafafa;
  --card-shadow: rgba(0,0,0,0.5);
  --text: #f5ece8;
  --text-muted: #c4a8a8;
  --radius: 12px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --perspective: 1100px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--casino-bg);
}

/* ── Casino Room Ambience ── */
.casino-room {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 0%, #2a1018 0%, var(--casino-bg) 55%),
    linear-gradient(180deg, #1a0a10 0%, #0c0608 100%);
}

.ambient-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
}
.glow-left { top: 10%; left: -5%; background: #8b1a30; }
.glow-right { top: 15%; right: -5%; background: #d4af37; opacity: 0.2; }

.ceiling-lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 180px,
    rgba(212,175,55,0.06) 180px,
    rgba(212,175,55,0.06) 200px
  );
  mask-image: linear-gradient(to bottom, black, transparent);
}

.hidden { display: none !important; }

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-card {
  background: linear-gradient(145deg, #2a1218, #150a0e);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 20px;
  padding: 2.5rem;
  width: min(440px, 92vw);
  box-shadow:
    0 24px 80px rgba(0,0,0,0.6),
    0 0 40px rgba(139,26,48,0.15),
    inset 0 1px 0 rgba(212,175,55,0.1);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header { text-align: center; margin-bottom: 2rem; }
.modal-header h1, .modal-header h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold-light);
  margin: 0.5rem 0 0.25rem;
}
.modal-header h2 { font-size: 1.6rem; }
.modal-header p { color: var(--text-muted); font-size: 0.9rem; }

.chip-icon {
  display: inline-block;
  font-size: 2.5rem;
  color: var(--red-light);
  text-shadow: 0 2px 12px rgba(231,76,60,0.5);
}
.chip-icon.small { font-size: 1.2rem; }

.modal-card label {
  display: block;
  margin-bottom: 1.25rem;
}
.modal-card label span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}
.input-wrap:focus-within { border-color: var(--gold); }

.input-wrap .currency {
  padding: 0 0.75rem;
  color: var(--gold);
  font-weight: 600;
}

.input-wrap input,
.bet-adjuster input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.75rem 0.5rem;
  outline: none;
  width: 100%;
  font-family: var(--font-body);
}

.quick-bets {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.quick-bet {
  flex: 1;
  padding: 0.5rem;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 8px;
  color: var(--gold-light);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.quick-bet:hover { background: rgba(212,175,55,0.22); }

/* Deck selector */
.deck-selector {
  display: flex;
  gap: 0.5rem;
}

.deck-option {
  flex: 1;
  padding: 0.65rem 0;
  background: rgba(0,0,0,0.35);
  border: 2px solid rgba(212,175,55,0.2);
  border-radius: 10px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.deck-option:hover {
  border-color: rgba(212,175,55,0.45);
  color: var(--gold-light);
}
.deck-option.active {
  background: linear-gradient(135deg, rgba(212,175,55,0.25), rgba(139,26,48,0.3));
  border-color: var(--gold);
  color: var(--gold-light);
  box-shadow: 0 0 16px rgba(212,175,55,0.2);
}

.session-summary {
  background: rgba(0,0,0,0.35);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(212,175,55,0.15);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.summary-row:last-child { border-bottom: none; }
.summary-row strong { color: var(--text); font-size: 1rem; }
.summary-row.highlight strong { color: var(--gold-light); font-size: 1.15rem; }
.summary-row.highlight.profit strong { color: #2ecc71; }
.summary-row.highlight.loss strong { color: var(--red-light); }

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.modal-actions .btn-primary { width: 100%; padding: 0.85rem; }

.rules-summary {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.rules-summary summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 600;
}
.rules-summary ul {
  margin-top: 0.75rem;
  padding-left: 1.25rem;
  line-height: 1.7;
}
.rules-summary strong { color: var(--gold-light); }

/* ── Buttons ── */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a0a0e;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 20px rgba(212,175,55,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(212,175,55,0.45); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-lg { padding: 1rem 2rem; font-size: 1.05rem; }

.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

.btn-leave {
  background: rgba(139,26,48,0.4);
  color: var(--text);
  padding: 0.5rem 1rem;
  border: 1px solid rgba(212,175,55,0.25);
  font-size: 0.85rem;
}
.btn-leave:hover:not(:disabled) {
  background: rgba(139,26,48,0.65);
  border-color: var(--gold);
}
.btn-leave:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-chip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212,175,55,0.12);
  color: var(--gold-light);
  border: 2px solid rgba(212,175,55,0.35);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-chip:hover { background: rgba(212,175,55,0.28); }

.btn-action {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  border-radius: 50px;
  min-width: 110px;
  transform-style: preserve-3d;
  box-shadow: 0 6px 0 rgba(0,0,0,0.3), 0 8px 16px rgba(0,0,0,0.25);
}
.btn-action:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.btn-action.hit {
  background: linear-gradient(180deg, #3ddc84, #1e8449);
  color: #fff;
}
.btn-action.stand {
  background: linear-gradient(180deg, #ff6b5b, #922b21);
  color: #fff;
}
.btn-action.double {
  background: linear-gradient(180deg, #5dade2, #1a5276);
  color: #fff;
}
.btn-action.split {
  background: linear-gradient(180deg, #bb8fce, #6c3483);
  color: #fff;
}
.btn-action:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-2px); }
.btn-action:disabled { opacity: 0.35; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }

/* ── Game Layout ── */
.game {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212,175,55,0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-light);
  font-size: 1.1rem;
}

.stats { display: flex; gap: 1.75rem; }
.top-actions { display: flex; gap: 0.5rem; align-items: center; }

.stat { text-align: center; }
.stat-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-light);
}

/* ── 3D Scene & Table ── */
.scene-3d {
  flex: 1;
  perspective: var(--perspective);
  perspective-origin: 50% 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 1rem;
}

.table-3d {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(18deg) scale(0.95);
  transition: transform 0.6s ease;
  width: min(960px, 96vw);
}

.table-rail {
  position: absolute;
  inset: -14px -20px;
  background: linear-gradient(180deg, var(--rail-light) 0%, var(--rail) 40%, #1a0e08 100%);
  border-radius: 50% / 30%;
  transform: translateZ(-20px);
  box-shadow:
    0 20px 40px rgba(0,0,0,0.6),
    inset 0 2px 4px rgba(212,175,55,0.2),
    inset 0 -4px 8px rgba(0,0,0,0.4);
  border: 3px solid rgba(212,175,55,0.25);
}

.table-surface {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 30%, var(--felt-light) 0%, var(--felt-mid) 35%, var(--felt) 70%, var(--felt-edge) 100%);
  border-radius: 50% / 38%;
  min-height: 420px;
  padding: 2rem 2.5rem 3rem;
  transform-style: preserve-3d;
  box-shadow:
    inset 0 4px 20px rgba(255,255,255,0.06),
    inset 0 -8px 30px rgba(0,0,0,0.35),
    0 10px 30px rgba(0,0,0,0.4);
  border: 2px solid rgba(212,175,55,0.15);
}

.table-surface::before {
  content: '';
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(212,175,55,0.2);
  border-radius: 50% / 40%;
  pointer-events: none;
}

.table-surface::after {
  content: 'BLACKJACK PAYS 3 TO 2  •  DEALER STANDS ON SOFT 17';
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(212,175,55,0.45);
  white-space: nowrap;
  pointer-events: none;
}

.table-shadow {
  position: absolute;
  bottom: -40px;
  left: 10%;
  right: 10%;
  height: 40px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.5) 0%, transparent 70%);
  transform: translateZ(-40px) rotateX(90deg);
  filter: blur(8px);
}

.table {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 360px;
  transform-style: preserve-3d;
}

/* ── 3D Dealer ── */
.dealer-area {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  width: 100%;
  justify-content: center;
  transform: translateZ(30px);
}

.dealer-character {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  transform-style: preserve-3d;
}

.dealer-3d {
  position: relative;
  transform-style: preserve-3d;
  animation: dealerIdle 4s ease-in-out infinite;
}

@keyframes dealerIdle {
  0%, 100% { transform: translateY(0) rotateY(-5deg); }
  50% { transform: translateY(-4px) rotateY(5deg); }
}

.dealer-character.dealing .dealer-3d {
  animation: dealerDeal3d 0.55s ease;
}

@keyframes dealerDeal3d {
  0% { transform: translateY(0) rotateY(-5deg); }
  35% { transform: translateY(12px) rotateY(-15deg) translateZ(20px); }
  65% { transform: translateY(-6px) rotateY(8deg) translateZ(10px); }
  100% { transform: translateY(0) rotateY(-5deg); }
}

.dealer-character.dealing .dealer-arm.right {
  animation: armDeal 0.55s ease;
}

@keyframes armDeal {
  0% { transform: rotateX(0) rotateZ(10deg); }
  40% { transform: rotateX(-30deg) rotateZ(-20deg) translateZ(15px); }
  100% { transform: rotateX(0) rotateZ(10deg); }
}

.dealer-figure {
  position: relative;
  width: 100px;
  height: 130px;
  transform-style: preserve-3d;
  transform: rotateX(-8deg);
}

.dealer-head {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateZ(10px);
  width: 52px;
  height: 58px;
  transform-style: preserve-3d;
}

.dealer-hair-back {
  position: absolute;
  top: -4px;
  left: -8px;
  width: 68px;
  height: 64px;
  background: linear-gradient(180deg, #4a2818, #2a1810);
  border-radius: 50% 50% 40% 40%;
  transform: translateZ(-4px);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,0.3);
}

.dealer-hair-top {
  position: absolute;
  top: -6px;
  left: -4px;
  width: 60px;
  height: 36px;
  background: linear-gradient(180deg, #5c3420, #3d2314);
  border-radius: 50% 50% 0 0;
  transform: translateZ(2px);
}

.dealer-face {
  position: absolute;
  top: 10px;
  left: 4px;
  width: 44px;
  height: 48px;
  background: linear-gradient(160deg, #f5d0b8, #e8b896);
  border-radius: 45% 45% 50% 50%;
  transform: translateZ(6px);
  box-shadow:
    inset -3px -3px 8px rgba(0,0,0,0.1),
    0 4px 8px rgba(0,0,0,0.2);
}

.dealer-brow {
  position: absolute;
  top: 14px;
  width: 10px;
  height: 3px;
  background: #3d2314;
  border-radius: 2px;
}
.dealer-brow.left { left: 8px; transform: rotate(-5deg); }
.dealer-brow.right { right: 8px; transform: rotate(5deg); }

.dealer-eye {
  position: absolute;
  top: 18px;
  width: 8px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}
.dealer-eye.left { left: 9px; }
.dealer-eye.right { right: 9px; }
.dealer-eye .pupil {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 6px;
  background: #2c1810;
  border-radius: 50%;
}

.dealer-nose {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 8px;
  background: rgba(0,0,0,0.08);
  border-radius: 50%;
}

.dealer-lips {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 5px;
  background: #c47a6a;
  border-radius: 0 0 8px 8px;
}

.dealer-blush {
  position: absolute;
  top: 28px;
  width: 8px;
  height: 5px;
  background: rgba(240,120,120,0.35);
  border-radius: 50%;
}
.dealer-blush.left { left: 4px; }
.dealer-blush.right { right: 4px; }

.dealer-neck {
  position: absolute;
  top: 54px;
  left: 50%;
  transform: translateX(-50%) translateZ(4px);
  width: 18px;
  height: 14px;
  background: linear-gradient(180deg, #e8b896, #d4a080);
  border-radius: 4px;
}

.dealer-torso {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%) translateZ(8px);
  width: 72px;
  height: 58px;
  transform-style: preserve-3d;
}

.dealer-blouse {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #fff, #e8e8e8);
  border-radius: 8px 8px 4px 4px;
  transform: translateZ(2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.dealer-vest.left-panel,
.dealer-vest.right-panel {
  position: absolute;
  top: 0;
  width: 36px;
  height: 58px;
  background: linear-gradient(180deg, #1a1a2e, #0f0f1a);
  transform: translateZ(4px);
}
.dealer-vest.left-panel {
  left: 0;
  border-radius: 8px 0 0 4px;
  clip-path: polygon(0 0, 100% 0, 60% 100%, 0 100%);
}
.dealer-vest.right-panel {
  right: 0;
  border-radius: 0 8px 4px 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 40% 100%);
}

.dealer-bowtie {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%) translateZ(8px);
  width: 16px;
  height: 10px;
  background: var(--red);
  clip-path: polygon(50% 100%, 0 30%, 20% 0, 50% 20%, 80% 0, 100% 30%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dealer-nametag {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%) translateZ(10px);
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a0a0e;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dealer-arm {
  position: absolute;
  top: 68px;
  width: 14px;
  height: 36px;
  background: linear-gradient(180deg, #1a1a2e, #0f0f1a);
  border-radius: 6px;
  transform-style: preserve-3d;
}
.dealer-arm.left {
  left: 4px;
  transform: rotateZ(15deg) translateZ(6px);
}
.dealer-arm.right {
  right: 4px;
  transform: rotateZ(-10deg) translateZ(6px);
}

.dealer-hand {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 10px;
  background: linear-gradient(180deg, #e8b896, #d4a080);
  border-radius: 50% 50% 40% 40%;
}

.dealer-podium {
  width: 80px;
  height: 20px;
  margin: -4px auto 0;
  background: linear-gradient(180deg, var(--rail-light), var(--rail));
  border-radius: 4px;
  transform: translateZ(0) rotateX(60deg);
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  border: 1px solid rgba(212,175,55,0.2);
}

.dealer-speech {
  margin-top: 0.75rem;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 12px;
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 150px;
  text-align: center;
  line-height: 1.4;
  transition: all 0.3s;
  transform: translateZ(20px);
}

.dealer-speech.active {
  color: var(--gold-light);
  border-color: rgba(212,175,55,0.5);
  box-shadow: 0 0 12px rgba(212,175,55,0.15);
}

.hand-area { flex: 1; min-width: 0; transform: translateZ(15px); }

.hand-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.6);
}

.score-badge {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 20px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  color: var(--gold-light);
  font-weight: 700;
}

.card-row {
  display: flex;
  min-height: 130px;
  position: relative;
  transform-style: preserve-3d;
  transform: translateZ(20px);
}

/* ── 3D Cards ── */
.card {
  width: 80px;
  height: 116px;
  position: relative;
  flex-shrink: 0;
  margin-right: -28px;
  transform-style: preserve-3d;
  transition: margin-right 0.4s ease;
  transform: rotateX(8deg);
}

.card-row .card:last-child { margin-right: 0; }

.card.dealing {
  animation: dealCard3d 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes dealCard3d {
  0% {
    opacity: 0;
    transform: translate3d(-100px, -200px, 80px) rotateX(40deg) rotateY(-30deg) rotateZ(-12deg) scale(0.5);
  }
  55% {
    opacity: 1;
    transform: translate3d(8px, 6px, 30px) rotateX(15deg) rotateY(8deg) rotateZ(4deg) scale(1.04);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 20px) rotateX(8deg) rotateY(0) rotateZ(0) scale(1);
  }
}

.card-inner {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: var(--card-white);
  position: relative;
  transform-style: preserve-3d;
  box-shadow:
    0 8px 20px var(--card-shadow),
    0 2px 4px rgba(0,0,0,0.2);
}

.card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  right: -3px;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #e8e8e8, #ccc);
  transform: rotateY(90deg) translateZ(1px);
  transform-origin: left center;
  border-radius: 0 2px 2px 0;
}

.card-inner::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #ddd, #bbb);
  transform: rotateX(-90deg) translateZ(1px);
  transform-origin: top center;
}

.card.face-down .card-inner {
  background: linear-gradient(135deg, #8b1a30, #4a0a18);
  border: 2px solid rgba(212,175,55,0.4);
}

.card.face-down .card-inner::before {
  background: linear-gradient(180deg, #6b1224, #4a0a18);
}

.card.face-down .card-pattern {
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(212,175,55,0.35);
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 4px, rgba(212,175,55,0.1) 4px, rgba(212,175,55,0.1) 8px),
    radial-gradient(circle at center, rgba(212,175,55,0.2) 0%, transparent 60%);
}

.card.face-down .card-front { display: none; }

.card-front {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 8px;
  backface-visibility: hidden;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-weight: 700;
  font-size: 0.85rem;
}

.card-corner.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card-suit { font-size: 0.75rem; }
.card-suit.large {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.15;
}

.card.red .card-corner,
.card.red .card-suit { color: var(--red); }
.card.black .card-corner,
.card.black .card-suit { color: #1a1a2e; }

.card.flipping {
  animation: flipCard3d 0.55s ease forwards;
}

@keyframes flipCard3d {
  0% { transform: rotateX(8deg) rotateY(0); }
  50% { transform: rotateX(8deg) rotateY(90deg) translateZ(10px); }
  100% { transform: rotateX(8deg) rotateY(0) translateZ(20px); }
}

/* ── Player Hands ── */
.player-area {
  width: 100%;
  display: flex;
  justify-content: center;
  transform: translateZ(25px);
}

.player-hands {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.player-hand {
  background: rgba(0,0,0,0.25);
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 0.75rem 1rem 1rem;
  transition: all 0.3s;
  min-width: 200px;
  transform: translateZ(10px);
  backdrop-filter: blur(4px);
}

.player-hand.active {
  border-color: rgba(212,175,55,0.55);
  background: rgba(212,175,55,0.1);
  box-shadow: 0 0 28px rgba(212,175,55,0.2), 0 8px 24px rgba(0,0,0,0.3);
  transform: translateZ(25px);
}

.player-hand.win { border-color: rgba(46,204,113,0.55); }
.player-hand.lose { border-color: rgba(231,76,60,0.45); opacity: 0.85; }
.player-hand.push { border-color: rgba(255,255,255,0.2); }

.player-hand .hand-label { justify-content: center; }

.player-hand .card-row {
  justify-content: center;
  min-height: 120px;
}

.bet-chip {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a0a0e;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  margin-left: 0.25rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* ── Message Banner ── */
.message-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(60px);
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212,175,55,0.35);
  border-radius: 16px;
  padding: 1rem 2rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold-light);
  text-align: center;
  z-index: 10;
  animation: bannerIn 0.4s ease;
  pointer-events: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.message-banner.win { border-color: rgba(46,204,113,0.5); color: #2ecc71; }
.message-banner.lose { border-color: rgba(231,76,60,0.5); color: #e74c3c; }
.message-banner.push { border-color: rgba(255,255,255,0.3); }

@keyframes bannerIn {
  from { opacity: 0; transform: translate(-50%, -50%) translateZ(60px) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) translateZ(60px) scale(1); }
}

/* ── Timer ── */
.timer-container {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%) translateZ(50px);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timer-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.timer-bg {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 4;
}

.timer-progress {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 163.36;
  stroke-dashoffset: 0;
  transition: stroke 0.3s;
}

.timer-progress.warning { stroke: #f39c12; }
.timer-progress.danger { stroke: var(--red-light); }

.timer-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
  z-index: 1;
}

.timer-text.warning { color: #f39c12; }
.timer-text.danger { color: var(--red-light); animation: pulse 0.5s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* ── Controls ── */
.controls {
  padding: 1rem 1.5rem 1.5rem;
  display: flex;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(212,175,55,0.15);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.bet-adjuster {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0,0,0,0.4);
  border-radius: 50px;
  padding: 0.25rem 0.5rem;
  border: 1px solid rgba(212,175,55,0.25);
}

.bet-adjuster input {
  width: 80px;
  text-align: center;
  font-size: 1rem;
  padding: 0.5rem;
}

#betting-controls .btn-lg {
  width: auto;
  min-width: 140px;
}

.insurance-prompt {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .table-3d { transform: rotateX(14deg) scale(0.88); }
  .table-surface { min-height: 340px; padding: 1.5rem 1rem 2.5rem; }
  .dealer-area { flex-direction: column; align-items: center; }
  .dealer-figure { transform: rotateX(-8deg) scale(0.85); }
  .card { width: 64px; height: 93px; margin-right: -22px; }
  .card-row { min-height: 100px; }
  .stats { gap: 0.75rem; }
  .stat-value { font-size: 0.95rem; }
  .stat-label { font-size: 0.6rem; }
  .btn-action { padding: 0.7rem 1.2rem; min-width: 90px; font-size: 0.9rem; }
  .timer-container { width: 52px; height: 52px; }
  .timer-text { font-size: 0.9rem; }
  .top-actions { flex-direction: column; gap: 0.25rem; }
  .btn-leave { font-size: 0.75rem; padding: 0.4rem 0.6rem; }
}
