/* =========================================================
   Jekpoti — blackjack
   ========================================================= */
body[data-theme="blackjack"] {
  background: radial-gradient(ellipse 80% 60% at 50% 25%, #1b6f78 0%, #0c434b 55%, #04232a 100%);
}
.bj-table {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 18px 16px 22px;
  border-radius: 0 0 50% 50% / 0 0 18% 18%;
  background: radial-gradient(ellipse at 50% 0%, #1d8a6a, #0d5a45 70%);
  border: 8px solid #6b3f1d;
  border-top-width: 4px;
  box-shadow: inset 0 0 40px rgba(0,0,0,.5), 0 18px 40px rgba(0,0,0,.55);
  min-height: clamp(330px, 46vh, 460px);
}
.bj-shoe {
  position: absolute;
  right: 18px;
  top: 14px;
  width: 54px;
  height: 74px;
}
.bj-shoe i {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  border: 2px solid #fff;
  background: var(--back);
}
.bj-shoe i:nth-child(2) {
  transform: translate(-3px,3px);
}
.bj-shoe i:nth-child(3) {
  transform: translate(-6px,6px);
}
.bj-row {
  text-align: center;
}
.bj-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  color: #e2fff2;
  background: rgba(0,0,0,.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.bj-label b,
.bj-hinfo b {
  font-family: 'Bungee','Noto Sans Georgian',sans-serif;
  font-weight: 400;
  color: var(--gold);
  min-width: 1.5em;
}
.bj-arc {
  margin: 14px auto;
  text-align: center;
  font-family: 'Bungee','Noto Sans Georgian',sans-serif;
  font-size: clamp(10px,1.6vw,13px);
  color: rgba(255,230,150,.55);
  letter-spacing: 1px;
}
.bj-cards {
  display: flex;
  justify-content: center;
  min-height: var(--ch);
  padding: 0 6px;
}
.bj-hands {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.bj-hand {
  position: relative;
  text-align: center;
  padding: 8px 10px 10px;
  border-radius: 16px;
  border: 2px solid transparent;
  transition: border-color .2s, background .2s, opacity .3s;
}
.bj-hand.active {
  border-color: var(--gold);
  background: rgba(255,209,102,.1);
  box-shadow: 0 0 18px rgba(255,209,102,.35);
}
.bj-hand.won {
  border-color: #7df59a;
  background: rgba(91,227,125,.12);
}
.bj-hand.lost {
  opacity: .6;
  filter: saturate(.6);
}
.bj-hinfo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 13px;
  color: #e2fff2;
  margin-bottom: 6px;
}
.bj-hinfo .nm {
  opacity: .75;
}
.bj-hinfo .bt {
  background: rgba(0,0,0,.35);
  padding: 2px 8px;
  border-radius: 999px;
}
.bj-res {
  min-height: 26px;
  margin-top: 6px;
}
.bj-res span {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 14px;
  animation: in .25s ease;
}
.bj-res .win,
.bj-res .blackjack {
  background: linear-gradient(180deg,#7df59a,#2fbf5a);
  color: #06240f;
}
.bj-res .blackjack {
  background: linear-gradient(180deg,#ffe08a,#ffb703);
  color: #2b1500;
}
.bj-res .push {
  background: #e2d9ff;
  color: #2a1856;
}
.bj-res .loss,
.bj-res .bust {
  background: #5c1a2a;
  color: #ffb3bd;
}

/* playing cards: original design, the back is the casino's clown pattern */
:root {
  --cw: clamp(58px, 9vw, 86px);
  --ch: calc(var(--cw) * 1.42);
  --back: repeating-linear-gradient(45deg, #7b2ff7 0 6px, #5a1fc0 6px 12px);
}
.pc {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  margin-left: calc(var(--cw) * -0.38);
  perspective: 600px;
  flex: 0 0 auto;
}
.pc:first-child {
  margin-left: 0;
}
.pc .in {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.3,.7,.3,1);
}
.pc.down .in {
  transform: rotateY(180deg);
}
.pc .f,
.pc .b {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * .1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,.45);
}
.pc .f {
  background: linear-gradient(160deg,#fff,#f1ece2);
  color: #151515;
  border: 1px solid #cfc6b4;
  font-family: 'Bungee','Noto Sans Georgian',sans-serif;
}
.pc.red .f {
  color: #c8102e;
}
.pc .b {
  transform: rotateY(180deg);
  background: var(--back);
  border: 3px solid #fff;
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * .42);
}
.pc .b::after {
  content: '🤡';
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.4));
}
.pc .ix {
  position: absolute;
  left: 8%;
  top: 5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-size: calc(var(--cw) * .24);
}
.pc .ix i {
  font-style: normal;
  font-size: .8em;
  margin-top: 2px;
}
.pc .ix.rb {
  left: auto;
  top: auto;
  right: 8%;
  bottom: 5%;
  transform: rotate(180deg);
}
.pc .pip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * .5);
}
.pc .pip b {
  font-weight: 400;
  font-size: .9em;
  padding: 6% 10%;
  border: 2px solid currentColor;
  border-radius: 10%;
  background: rgba(0,0,0,.04);
}
.pc.deal {
  animation: bjdeal .38s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes bjdeal {
  from {
    transform: translate(var(--fx,200px), var(--fy,-150px)) rotate(-14deg) scale(.85);
    opacity: .3;
  }
}
.bj-hand.won .pc .f {
  box-shadow: 0 0 14px rgba(125,245,154,.8);
}

.bj-bar {
  max-width: 900px;
  margin: 12px auto 0;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg,rgba(24,14,46,.95),rgba(4,2,10,.96));
  border: 1px solid rgba(255,215,94,.4);
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.bj-betting {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) minmax(160px,240px);
  gap: 10px 14px;
  align-items: center;
}
.bj-betting .chips {
  margin-top: 0;
  justify-content: flex-start;
}
.bj-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}
.bj-btn {
  padding: 14px 6px;
  border-radius: 14px;
  border: 0;
  font-family: 'Bungee','Noto Sans Georgian',sans-serif;
  font-size: clamp(14px,2.2vw,18px);
  line-height: 1.15;
  color: #fff;
  transition: transform .08s;
}
.bj-btn small {
  display: block;
  font-family: 'Nunito','Noto Sans Georgian',sans-serif;
  font-weight: 900;
  font-size: 11px;
  opacity: .8;
}
.bj-btn.hit {
  background: linear-gradient(180deg,#7df59a,#2fbf5a);
  color: #06240f;
  box-shadow: 0 5px 0 #146b2c;
}
.bj-btn.stand {
  background: linear-gradient(180deg,#ff8a95,#c9303f);
  box-shadow: 0 5px 0 #7a1020;
}
.bj-btn.dbl {
  background: linear-gradient(180deg,#ffe08a,#ffb703);
  color: #2b1500;
  box-shadow: 0 5px 0 #a35c00;
}
.bj-btn.split {
  background: linear-gradient(180deg,#8fc2ff,#1d6fd8);
  box-shadow: 0 5px 0 #0d3d7a;
}
.bj-btn:active:not(:disabled) {
  transform: translateY(3px);
}
.bj-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  box-shadow: none;
}
.bj-hist {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  max-width: 900px;
  margin: 12px auto 0;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.bj-hist span {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  background: rgba(6,3,14,.75);
  border: 1px solid var(--line);
}
.bj-hist .win {
  color: var(--green);
}
.bj-hist .blackjack {
  color: var(--gold);
  border-color: #ffd16688;
}
.bj-hist .push {
  color: #e2d9ff;
}
.bj-hist .loss,
.bj-hist .bust {
  color: #ff9aa6;
}
.bj-stats {
  text-align: center;
  margin-top: 6px;
}
@media (max-width: 700px), (max-height: 500px) and (orientation: landscape) {
  body[data-theme="blackjack"] {
    padding-bottom: calc(150px + env(safe-area-inset-bottom));
  }
  :root {
    --cw: clamp(50px, 15vw, 66px);
  }
  .bj-table {
    padding: 12px 8px 16px;
    border-width: 5px;
    border-top-width: 3px;
    min-height: 0;
  }
  .bj-shoe {
    width: 40px;
    height: 56px;
    right: 10px;
    top: 8px;
  }
  .bj-arc {
    margin: 8px auto;
  }
  .bj-hands {
    gap: 6px;
  }
  .bj-hand {
    padding: 6px 4px 8px;
  }
  .bj-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    margin: 0;
    border-radius: 18px 18px 0 0;
    border-width: 1px 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg,#1d1139,#06030e);
  }
  .bj-betting {
    grid-template-columns: auto minmax(0,1fr);
    gap: 6px 8px;
  }
  .bj-betting .chips {
    grid-column: 1 / -1;
    order: 3;
  }
  .bj-betting .cr-act {
    grid-column: 2;
    grid-row: 1;
    padding: 10px 6px;
  }
  .bj-actions {
    gap: 6px;
  }
  .bj-btn {
    padding: 14px 2px;
    font-size: 13px;
  }
  .bj-btn small {
    font-size: 9px;
  }
  #bjMsg {
    font-size: 13px;
  }
}
#bjMsg {
  height: 70px;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}
@media (max-width: 380px) {
  .bj-hands .pc {
    margin-left: calc(var(--cw) * -0.5);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pc.deal {
    animation: none;
  }
  .pc .in {
    transition: none;
  }
}
