.bj-title-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

#bj-sound {
  min-width: 86px;
  padding: 8px 11px;
  border-color: #3a4c58;
  background: #20282e;
  color: #a9c7da;
  font-size: 11px;
  letter-spacing: .25px;
}

#bj-sound[aria-pressed="true"] {
  border-color: #47799a;
  color: #8fd0fb;
  box-shadow: inset 0 0 0 1px #479feb22;
}

.blackjack-layout {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  max-width: 1340px;
  min-height: 630px;
  margin: 18px auto;
  overflow: hidden;
  border: 1px solid #35414a;
  border-radius: 12px;
  background: #202529;
  box-shadow: 0 20px 55px #080b0d45;
}

.blackjack-panel {
  position: relative;
  z-index: 10;
  padding: 28px 24px;
  border-right: 1px solid #35414a;
  background: linear-gradient(180deg, #22292e, #1c2226);
}

.blackjack-panel::after {
  content: '';
  position: absolute;
  top: 0;
  right: -1px;
  width: 2px;
  height: 86px;
  background: var(--blue);
  box-shadow: 0 0 22px #479feb77;
}

.blackjack-panel label {
  display: block;
  margin: 20px 0 9px;
  color: #dbe5ec;
  font-size: 13px;
  font-weight: 750;
}

.bj-money-input {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #3a4852;
  border-radius: 7px;
  background: #161b1f;
}

.bj-money-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px #479feb25; }
.bj-money-input > span { padding: 0 13px; color: #75b9ec; font-size: 18px; }
.blackjack-panel input { width: 100%; margin: 0; border: 0; border-left: 1px solid #303a42; border-radius: 0; background: transparent; font-size: 18px; }

.deal-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 11px 0 18px; }
.deal-presets button { padding: 8px 2px; border-color: #35414a; background: #272e33; color: #aeb9c1; font-size: 11px; }
.deal-presets button:hover { border-color: #526776; color: #fff; }
.bj-new-hand { width: 100%; height: 47px; }

.blackjack-history {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 72px;
  margin-top: 14px;
  padding: 13px 14px;
  border-left: 2px solid #479feb;
  border-radius: 3px 7px 7px 3px;
  background: #171d21;
  color: #8fa0ab;
  font-size: 12px;
}

.blackjack-history b { color: #fff; }
.blackjack-history strong { color: #79c9ff; font-size: 17px; }
.blackjack-paytable { display: grid; gap: 0; margin: 18px 0; }
.blackjack-paytable div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #303940; color: #778994; font-size: 10px; letter-spacing: .7px; }
.blackjack-paytable b { color: #b6c7d2; }
.blackjack-rules { color: #71838e; font-size: 11px; line-height: 1.6; }

.blackjack-table {
  position: relative;
  min-width: 0;
  height: 630px;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49.9%, #3a465020 50%, transparent 50.1%),
    radial-gradient(circle at 50% 42%, #2e3c4626 0, transparent 42%),
    linear-gradient(145deg, #1d2429, #171d21 74%);
  text-align: center;
  isolation: isolate;
}

.blackjack-table::before {
  content: 'PACKSBRO  /  LIVE TABLE';
  position: absolute;
  top: 17px;
  left: 22px;
  z-index: 3;
  color: #60727e;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1.8px;
}

.blackjack-table::after {
  content: 'PL';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  color: #d6e8f0;
  font-size: 180px;
  font-weight: 950;
  letter-spacing: -22px;
  opacity: .018;
  transform: translate(-52%, -55%) rotate(-8deg);
}

.blackjack-oval {
  position: absolute;
  inset: 44px 25px 90px;
  z-index: -1;
  border: 1px solid #34424b;
  border-radius: 9px;
  background:
    linear-gradient(135deg, #479feb0b, transparent 30%),
    repeating-linear-gradient(135deg, transparent 0 22px, #ffffff08 22px 23px);
  box-shadow: inset 0 0 70px #0b101455;
}

.blackjack-oval::before,
.blackjack-oval::after {
  content: '';
  position: absolute;
  width: 54px;
  height: 3px;
  background: var(--blue);
  box-shadow: 0 0 15px #479feb66;
}

.blackjack-oval::before { top: -2px; left: 18px; }
.blackjack-oval::after { right: 18px; bottom: -2px; }

.blackjack-hand { position: absolute; left: 50%; z-index: 2; transform: translateX(-50%); }
.dealer-hand { top: 25px; }
.player-hand { bottom: 110px; }

.hand-label {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin: 5px;
  color: #81939e;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.hand-label i { padding: 2px 5px; border-radius: 3px; background: #2c3941; color: #6d8797; font-size: 7px; font-style: normal; letter-spacing: .8px; }
.playing-cards { display: flex; justify-content: center; gap: 8px; min-width: 92px; min-height: 112px; contain: layout style; }

.playing-card {
  position: relative;
  width: 76px;
  height: 108px;
  padding: 7px;
  border: 1px solid #d4d9dd;
  border-radius: 6px;
  background: linear-gradient(145deg, #fff, #edf0f1);
  box-shadow: 0 9px 18px #02040580;
  color: #20262a;
  text-align: left;
  transform: translateZ(0);
  backface-visibility: hidden;
  animation: cardSettle .24s cubic-bezier(.18, .78, .25, 1);
}

.playing-card.red { color: #c02035; }
.card-corner { position: absolute; top: 6px; left: 8px; font: 700 20px Georgia, serif; line-height: .75; }
.card-corner small { display: block; margin-top: 6px; font-size: 13px; text-align: center; }
.card-corner.bottom { right: 8px; bottom: 6px; left: auto; top: auto; transform: rotate(180deg); }
.card-suit { display: grid; height: 100%; place-items: center; font: 400 36px Georgia, serif; }

.playing-card.back,
.flying-card.flying-back {
  display: grid;
  place-items: center;
  border: 3px double #9bd5f2;
  background: repeating-linear-gradient(45deg, #317ca4 0 5px, #246789 5px 10px);
  color: #fff;
}

.card-back-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #d3edf888; border-radius: 5px; font-size: 12px; font-weight: 900; letter-spacing: 1px; transform: rotate(-8deg); }

.hand-total {
  position: absolute;
  left: 50%;
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid #4b6373;
  border-radius: 5px;
  background: #26343d;
  box-shadow: 0 5px 12px #0005;
  color: #d7ebf8;
  font-size: 12px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.dealer-hand > .hand-total { bottom: -29px; }
.player-hand > .hand-total { top: -31px; }

.bj-deck {
  position: absolute;
  top: 44%;
  right: 4%;
  z-index: 4;
  display: grid;
  width: 69px;
  height: 99px;
  place-items: center;
  border: 3px double #9bd5f2;
  border-radius: 6px;
  background: repeating-linear-gradient(45deg, #317ca4 0 5px, #246789 5px 10px);
  box-shadow: 4px 3px 0 #1e5874, 8px 6px 0 #163e52, 12px 11px 23px #0008;
  color: #e5f7ff;
  transform: translateY(-50%) translateZ(0);
}

.bj-deck::after { content: 'DECK'; position: absolute; bottom: -24px; color: #687c88; font-size: 8px; font-weight: 800; letter-spacing: 1.5px; }
.bj-deck i { position: absolute; inset: 6px; border: 1px solid #d8f2fb77; border-radius: 3px; }
.bj-deck i:nth-child(2) { inset: 10px; }
.bj-deck span { font-size: 15px; font-weight: 900; letter-spacing: 1px; transform: rotate(-8deg); }

.blackjack-center { position: absolute; top: 44%; left: 50%; width: 260px; color: #60727e; font-size: 9px; font-weight: 850; letter-spacing: 1px; transform: translate(-50%, -50%); }
.blackjack-center div { padding: 7px; border: 1px solid #35444e; background: #1d272d; clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%); }
.blackjack-center div + div { width: 84%; margin: 5px auto 0; color: #536975; }

.blackjack-actions { position: absolute; right: 0; bottom: 18px; left: 0; z-index: 5; display: flex; justify-content: center; gap: 8px; }
.blackjack-actions button { min-width: 112px; height: 46px; border-color: #394a54; border-radius: 7px; background: #252e34; box-shadow: inset 0 -2px #151a1d; color: #b9c7cf; font-weight: 750; transition: transform .16s, border-color .16s, background .16s; }
.blackjack-actions button span { margin-right: 7px; color: #67b6e8; font-size: 16px; }
.blackjack-actions button#bj-double span { color: #54c995; }
.blackjack-actions button#bj-stand span { color: #bf83d4; }
.blackjack-actions button#bj-split span { color: #d08a58; }
.blackjack-actions button:hover:not(:disabled) { border-color: #638093; background: #303c43; transform: translateY(-2px); }
.blackjack-actions button:disabled { opacity: .3; }

.blackjack-result { position: absolute; bottom: 76px; left: 50%; z-index: 6; padding: 8px 17px; border: 1px solid #3e5260; border-radius: 6px; background: #202b32ed; color: #dcecf6; font-weight: 800; opacity: 0; transform: translateX(-50%) translateY(5px); transition: opacity .2s, transform .2s; }
.blackjack-result.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.flying-card {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 76px;
  height: 108px;
  border: 1px solid #fff;
  border-radius: 6px;
  background: linear-gradient(145deg, #fff, #edf0f1);
  box-shadow: 0 15px 30px #000a;
  color: #20262a;
  pointer-events: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
  contain: strict;
}

.flying-card.red { color: #c02035; }
.flying-card > span { position: absolute; top: 8px; left: 9px; font: 700 20px Georgia, serif; }
.flying-card > span small { display: block; }
.flying-card > b { display: grid; height: 100%; place-items: center; font: 400 36px Georgia, serif; }

@keyframes cardSettle {
  from { opacity: .55; transform: translate3d(0, -6px, 0) rotate(2deg); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@media (max-width: 950px) {
  .blackjack-layout { grid-template-columns: 1fr; }
  .blackjack-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 18px; border-right: 0; border-bottom: 1px solid #35414a; }
  .blackjack-panel::after { right: auto; bottom: -1px; left: 0; top: auto; width: 86px; height: 2px; }
  .blackjack-panel > .eyebrow, .blackjack-panel label, .blackjack-paytable, .blackjack-rules { grid-column: 1 / -1; }
  .blackjack-history { margin: 0; }
  .blackjack-table { height: 610px; }
}

@media (max-width: 650px) {
  .bj-title-tools .muted { display: none; }
  .blackjack-panel { display: block; padding: 22px 20px; }
  .blackjack-table { height: 565px; }
  .blackjack-oval { inset: 40px 10px 84px; }
  .playing-card, .flying-card { width: 64px; height: 92px; }
  .playing-cards { min-height: 95px; gap: 5px; }
  .dealer-hand { top: 25px; }
  .player-hand { bottom: 105px; }
  .blackjack-actions { gap: 4px; padding: 0 7px; }
  .blackjack-actions button { min-width: 0; flex: 1; padding: 7px 2px; font-size: 10px; }
  .bj-deck { right: 7px; transform: translateY(-50%) scale(.72); }
  .blackjack-center { width: 220px; }
}
