.game-baccarat-grid {
  --board-height: 586px;
  --board-width: 910px;

  display: grid;
  grid-template-columns: 380px 1fr 450px;
  grid-template-rows: minmax(auto, 1fr) 1fr;
  gap: 24px;
}

@media screen and (max-width: 1779px) {
  .game-baccarat-grid {
    --board-width: 750px;
    ;
  }
}

@media screen and (min-width: 1098px) and (max-width: 1599px) {
  .game-baccarat-grid {
    --board-width: 850px;
    ;
  }
}



@media screen and (max-width: 575px) {
  .game-baccarat-grid {
    --board-height: 503px;
  }
}

@media screen and (max-width: 575px) {
  .game-baccarat-grid {
    --board-height: 460px;
  }
}

.game-baccarat-grid__column.betting-board {
  grid-row-start: 1;
  grid-row: span 1 / span 1;
  grid-column-start: 2;
}

.game-baccarat-grid__column.betting-actions {
  grid-column-start: 3;
  grid-row: span 1 / span 1;
  grid-row-start: 1;
}

.game-baccarat-grid__column.betting-players {
  grid-row: span 2 / span 2;
  grid-column-start: 1;
  grid-row-start: 1;
}

.game-baccarat-grid__column.betting-history {
  grid-column: span 2 / span 3;
  grid-row-start: 2;
}



@media screen and (min-width: 1298px) and (max-width: 1599px) {
  .game-baccarat-grid__column.betting-board {
    min-width: 850px;
  }
}

@media screen and (min-width: 1098px) and (max-width: 1299px) {
  .game-baccarat-grid__column.betting-board {
    min-width: 650px;
  }
}

@media screen and (min-width: 1098px) and (max-width: 1599px) {
  .game-area-chips {
    max-height: 435px;
    overflow-y: auto;
  }

  .game-area-chips::-webkit-scrollbar {
    width: 5px;
  }

  .game-area-chips::-webkit-scrollbar-thumb {
    background-color: hsl(var(--base));
  }

  .game-area-chips::-webkit-scrollbar-track {
    background-color: hsl(var(--base-two));
  }

  .game-baccarat-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: calc(var(--board-height, 0px) + var(--action-height, 0px)) 1fr;
  }

  .game-baccarat-grid__column.betting-board {
    grid-row: span 1;
    grid-column-start: 1;
  }

  .game-baccarat-grid__column.betting-actions {
    grid-column-start: 2;
    grid-row-start: 1;
    grid-row: span 1 / span 1;
  }

  .game-baccarat-grid__column.betting-history {
    grid-row: span 2 / span 2;
    grid-column-start: 1;
    grid-column-end: 1;
  }

  .game-baccarat-grid__column.betting-players {
    grid-column: span 1 / span 1;
    grid-row: span 1 / span 1;
    grid-row-start: 2;
    grid-column-start: 2;
  }

}

@media screen and (max-width: 1099px) {
  .game-baccarat-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;

  }

  .game-baccarat-grid__column.betting-actions {
    margin-top: -16px;
  }

  .game-area-chips {
    display: none !important;
  }
}

.game-area-chips {
  margin-bottom: 25px !important;
}

@media screen and (max-width:768px) {
  .game-area-chips {
    gap: 12px !important;
  }
}

@media screen and (max-width: 575px) {
  .game-area-chips {
    margin-bottom: 0px !important;
  }
}

@media screen and (min-width: 992px) and (max-width: 1099px) {
  .game-baccarat-grid__column.betting-board {
    min-width: 550px;
  }

}


.card-thumb,
.preview-card {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  height: var(--result-height);
  width: var(--result-width);

  img {
    height: var(--result-height);
    width: var(--result-width);
    max-width: unset
  }
}

.card-thumb {
  height: inherit;
  backface-visibility: hidden;
  position: absolute;
  inset: 0;
}

/* Style the back side */
.preview-card {
  transform: rotateY(180deg);
}

.game-area-card__table {
  min-width: max-content;
}


.baccarat-game {
  --card-width: 78px;
  --card-height: 120px;
  --shifted: 24px;
  --preview-gap: 140px;
  --card-gap: 41px;
  height: var(--board-height);
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.50);
  padding-top: 130px;
  position: relative;
  z-index: 1;
  overflow: hidden;

  @media screen and (max-width: 575px) {
    padding-top: 100px;
  }
}

.baccarat-game .game-overlay {
  position: absolute;
  z-index: 10;
  top: 0px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0 0 12px 12px;
  padding: 12px 16px 8px;
  border-bottom: 2px solid hsl(var(--base));
  min-width: 350px;
  background-color: hsl(var(--base)/0.2);
  backdrop-filter: blur(5px);

  @media screen and (max-width: 575px) {
    min-width: 293px;
  }

  .game-overlay__count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
}

.baccarat-game .used-card {
  left: var(--shifted);
}

.baccarat-game .game-lines {
  position: absolute;
  width: 100%;
  height: 55%;
  overflow: hidden;
  left: 0;
  bottom: 0;
  z-index: -1;

  .line-round {
    position: absolute;
    width: 100%;
    left: 0;
    bottom: 85px;

    @media screen and (max-width: 575px) {
      bottom: 65px;
    }

  }

  .line-round__one,
  .line-round__two {
    position: absolute;
    transform: translateX(-50%);
    left: 50%;
    bottom: 0;
    height: 416px;
    width: 1008px;
    border-radius: 100%;
    outline: 2px solid hsl(var(--base));

    @media screen and (max-width: 1099px) and (min-width: 992px) {
      width: 1152px;
    }
  }

  .line-round__two {
    bottom: 84px;
    height: 507px;

    @media screen and (max-width: 575px) {
      bottom: 63px;
    }
  }
}


.baccarat-game__stored {
  --shifted: 24px;

  @media screen and (max-width: 1199px) {
    --shifted: 10px;
  }

  .stored-card {
    position: absolute;
    top: 40px;
    right: var(--shifted);

    @media screen and (max-width: 1699px) {
      top: 20px;
      width: 90px;
    }

    @media screen and (max-width: 575px) {
      opacity: 00.0001;
      top: -34px;
      transform: translateX(72px);
    }

    &.used-card {
      @media screen and (max-width: 1199px) {
        top: 10px;
      }

      svg {
        @media screen and (max-width: 1699px) {
          width: 80px;
        }
      }
    }

    &.fresh-card {
      @media screen and (max-width: 1199px) {
        top: 10px;
        transform: translateX(11px);

      }

      svg {
        @media screen and (max-width: 1699px) {
          width: 80px;
        }
      }
    }
  }

  .card-back {
    --result-width: var(--card-width);
    --result-height: var(--card-height);
  }

}


.baccarat-game__control {
  --control-size: 84px;
  clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
  width: 420px;
  height: calc(var(--control-size) * 3);
  margin-inline: auto;
  margin-top: 24px;
  text-align: center;
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);

  @media screen and (min-width: 991px) and (max-width: 1599px) {
    width: 320px;
  }

  @media screen and (max-width: 667px) {
    width: 320px;
  }

  @media screen and (max-width: 575px) {
    --control-size: 65px;
    width: 225px;
  }

  @media screen and (max-width: 424px) {
    width: 180px;
  }

  &::before,
  &::after {
    content: '';
    position: absolute;
    left: 0px;
    bottom: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, rgba(36, 6, 65, 1) 0%, rgba(124, 77, 255, 1) 50%, rgba(36, 6, 65, 1) 100%);
    border-radius: 12px;
    z-index: -1;
    transform: rotate(18.5deg);
    transform-origin: left bottom;
  }

  &::after {
    left: auto;
    right: 0px;
    transform: rotate(-18.5deg);

    @media screen and (max-width: 1599px) {
      left: auto;
      right: 47px;
      transform: rotate(-8.5deg);
    }

    @media screen and (max-width: 991px) {
      right: 4px;
      transform: rotate(-17.5deg);
    }

    @media screen and (max-width: 667px) {
      right: 61px;
      transform: rotate(-7deg);
    }

    @media screen and (max-width: 575px) {
      right: 44px;
    }

    @media screen and (max-width: 424px) {
      right: 31px;
    }
  }

  &::before {
    @media screen and (max-width: 1599px) {
      left: 52px;
      transform: rotate(5.5deg);
    }

    @media screen and (max-width: 991px) {
      left: 16px;
      transform: rotate(14.5deg);
    }

    @media screen and (max-width: 667px) {
      left: 51px;
      transform: rotate(5.5deg);
    }

    @media screen and (max-width: 575px) {
      left: 40px;
    }

    @media screen and (max-width: 424px) {
      left: 34px;
      transform: rotate(3deg);
    }

  }


  .baccarat-game__control-item {
    --size: 1900px;
    --control-btn-height: var(--control-size);
    position: absolute;
    width: 100%;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    height: 100px;
    width: var(--size);
    height: var(--size);
    border-radius: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;

    &:first-child {
      bottom: calc(var(--control-size) * 2);
      z-index: 3;

      --control-btn-width: 300px;
    }

    &:nth-child(2) {
      bottom: var(--control-size);
      z-index: 2;
      --control-btn-width: 355px;
      --control-btn-height: calc(var(--control-size) + 8px);

      @media screen and (max-width: 1599px) {
        --control-btn-height: var(--control-size);
      }
    }

    &:last-child {
      bottom: 0px;
      z-index: 1;
      border-radius: 0;
      --control-btn-width: 409px;
      --control-btn-height: calc(var(--control-size) + 5px);

      @media screen and (max-width: 1599px) {
        --control-btn-height: var(--control-size);
      }
    }

  }


  .baccarat-game__control-inner {
    font-family: var(--heading-font);
    color: hsl(var(--base));
    width: 100%;
    font-size: clamp(1.25rem, 1.1308rem + 0.5961vw, 1.5rem);
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-color: transparent !important;

    &.bg--primary {
      color: hsl(var(--base-two));
    }

    .baccarat-game__control-btn {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      bottom: 0;
      height: var(--control-btn-height);
      width: var(--control-btn-width);
      transform: rotate(180deg) translateX(-50%);
      transform-origin: left;
      clip-path: ellipse(101% 100% at 50% 100%);

      &.bg--primary {
        background-color: transparent !important;

        .text {
          color: hsl(var(--base-two)) !important;
        }
      }

      .text {
        transform: scale(-1);
        color: hsl(var(--base));
      }

    }

    &:hover .text {
      color: hsl(var(--base-d-200));
    }
  }

  &.control-left,
  &.control-right {
    --control-size: 89px;
    width: 300px;
    height: calc(var(--control-size) * 3);
    left: calc(50% - 247px);
    transform: translateX(-50%) rotate(15deg);
    clip-path: polygon(30% 0%, 79% 0%, 72% 100%, 0% 101%);


    @media screen and (min-width: 991px) and (max-width: 1599px) {
      width: 293px;
      left: calc(50% - 189px);
      transform: translateX(-50%) rotate(11deg);
      clip-path: polygon(26% 0%, 72% 0%, 68% 128%, 18% 100%);
      bottom: -13px;
    }

    @media screen and (max-width: 667px) {
      width: 293px;
      left: calc(50% - 189px);
      transform: translateX(-50%) rotate(11deg);
      clip-path: polygon(26% 0%, 72% 0%, 68% 128%, 18% 100%);
      bottom: -13px;
    }

    @media screen and (max-width: 575px) {
      width: 240px;
      left: calc(50% - 139px);
      transform: translateX(-50%) rotate(8deg);
      clip-path: polygon(26% 0%, 72% 2%, 62% 132%, 18% 100%);
      bottom: -62px
    }

    @media screen and (max-width: 424px) {
      width: 173px;
      left: calc(50% - 110px);
      transform: translateX(-50%) rotate(7deg);
      clip-path: polygon(26% 0%, 72% 0%, 68% 128%, 18% 100%);
      bottom: -67px;
    }

    .baccarat-game__control-item {
      border-radius: 100%;
      transform: translateX(-50%);

      &:first-child {
        bottom: 200px;
      }

      .baccarat-game__control-inner {
        .baccarat-game__control-btn {
          left: calc(50% + -4px);
          line-height: 1;

          @media screen and (max-width: 575px) {
            font-size: 16px;
          }
        }
      }
    }
  }

  &.control-right {

    left: calc(50% + 247px);
    transform: translateX(-50%) rotate(-15deg);
    clip-path: polygon(22% 0%, 70% 0, 101% 99%, 24% 100%);

    @media screen and (min-width: 991px) and (max-width: 1599px) {
      left: calc(50% + 188px);
      border: 32px;
      transform: translateX(-48%) rotate(-12deg);
      clip-path: polygon(27% 0%, 70% 0, 101% 183%, 28% 114%);
      bottom: -12px !important;
    }

    @media screen and (max-width: 667px) {
      left: calc(50% + 186px);
      border: 32px;
      transform: translateX(-48%) rotate(-11deg);
      clip-path: polygon(27% 0%, 69% 0%, 84% 160%, 28% 38%);
      bottom: -14px !important;
    }

    @media screen and (max-width: 575px) {
      left: calc(50% + 141px);
      border: 32px;
      transform: translateX(-48%) rotate(-9deg);
      clip-path: polygon(26% 1%, 68% 0%, 103% 263%, 30% 61%);
      bottom: -62px !important;
    }

    @media screen and (max-width: 424px) {
      left: calc(50% + 112px);
      border: 32px;
      transform: translateX(-48%) rotate(-7deg);
      clip-path: polygon(26% 1%, 68% 0%, 103% 263%, 28% 61%);
      bottom: -66px !important;
      width: 188px;
    }

    &::before {
      display: none;
    }

    .baccarat-game__control-item {
      right: 0;

      &:last-child {
        --control-btn-width: 165px !important;
        --control-btn-height: 66px !important;
        clip-path: ellipse(114% 100% at 50% 100%);
      }
    }
  }

  &.control-left {
    &::after {
      display: none;
    }

    .baccarat-game__control-item {
      right: 0;

      &:last-child {
        --control-btn-width: 165px !important;
        --control-btn-height: 66px !important;
      }
    }
  }

}

.baccarat-game__board {
  --preview-gap: 140px;
  display: flex;
  justify-content: space-between;
  gap: var(--preview-gap);
  max-width: fit-content;
  margin-inline: auto;

  @media screen and (max-width: 575px) {
    --preview-gap: 50px;
  }

  @media screen and (max-width: 575px) {
    --preview-gap: 28px;
  }
}


.baccarat-game__slot {
  flex: 1;
  --card-gap: 41px;

  @media screen and (max-width: 424px) {
    --card-gap: 25px;
  }

  &.banker {
    text-align: right;

    .baccarat-game__slot-item {
      left: 0px;
      right: auto;
    }

    .baccarat-game__slot-cards {
      justify-content: flex-start;
    }
  }
}

.baccarat-game__slot-name {
  margin-bottom: 24px;
  white-space: nowrap;

  @media screen and (max-width: 1399px) {
    margin-bottom: 9px;
  }
}

.baccarat-game__slot-cards {
  --card-width: 78px;
  --card-height: 120px;
  --slop: var(--card-gap);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  position: relative;
  width: calc((var(--card-width) * 3) - calc((var(--card-width) - var(--card-gap)) * 2));
  height: var(--card-height);

  @media screen and (max-width: 575px) {
    --card-width: 70px;
    --card-height: 108px;
  }

  &.banker {

    &::before {
      content: "";
      top: -67px;
      left: calc(((var(--preview-gap) / 2) - 1px) * -1);
      position: absolute;
      width: 2px;
      height: 200px;
      background: linear-gradient(180deg, #240641 0%, hsl(var(--base)) 48.56%, #240641 100%);

    }

  }

}


.baccarat-game__slot-item {
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 2px;

  &:nth-child(2) {
    transform: translateX(var(--slop));
  }

  &:last-child {
    transform: translateX(calc(var(--slop) * 2));
  }


  &:not(.flip):has(img) {
    box-shadow: 0px 0px 10px 4px hsl(0deg 0% 0% / 12%);
  }

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
  }


}

.baccarat-game__slot-item .flip-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.baccarat-game__slot-item .flip-card__inner {
  position: absolute;

  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(180deg);

  .card-thumb {
    display: none;
  }

  &:has(.preview-card .card-preview__item-thumb) .card-thumb {
    display: block;
  }
}

.baccarat-game__slot-item .card-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.baccarat-game__slot-item .preview-card {
  position: absolute;
  inset: 0;
}

.baccarat-game__slot-item.flip .flip-card__inner,
.card-preview__item.flip .flip-card__inner {
  animation: flip-card-reverse 1s ease-in-out forwards;
}

.baccarat-game__slot-item.flip .flip-card {
  --end-top-adjust: 92px;
  --end-left-adjust: 60px;
  --end-width: 57px;
  --end-height: 87px;

  animation: back-to-slot 1s ease-in-out forwards;
  animation-delay: 1s;

  @media screen and (max-width: 1699px) {
    --end-top-adjust: 59px;
    --end-left-adjust: 60px;
    --end-width: 44px;
    --end-height: 75px;
  }

  @media screen and (max-width: 1199px) {
    --end-top-adjust: 39px;
    --end-left-adjust: 32px;
    --end-width: 46px;
    --end-height: 75px;
  }

  @media screen and (max-width: 575px) {
    --end-top-adjust: 39px;
    --end-left-adjust: 33px;
    --end-width: 0px;
    --end-height: 0px;
  }

}

.card-preview__item.flip .flip-card {
  --end-top-adjust: 5px;
  --end-left-adjust: 36px;
  --end-width: 58px;
  --end-height: 90px;

  animation: back-to-slot 1s ease-in-out forwards;
  animation-delay: 1s;


}



.betting-actions {
  position: relative;
  z-index: 3;

  @media screen and (min-width: 1699px) {
    min-height: 190px;
    height: 100%;
  }
}

.game-area-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 0;
  padding-top: 24px;
  padding-bottom: 24px;
  padding-inline: 10px;
  border-radius: 12px;
  border: 1px solid rgba(51, 65, 85, 0.50);
  background: rgba(15, 23, 42, 0.50);
  backdrop-filter: blur(5px);
  height: 100%;

  @media screen and (max-width: 1599px) {
    margin-top: 0 !important;
  }
}

.game-baccarat-grid__column.betting-history .game-area-card {
  max-height: 550px;

}

.game-baccarat-grid__column.betting-players .game-area-card {
  max-height: 1160px;
}


@media screen and (max-width: 1599px) {

  .game-baccarat-grid__column.betting-history .game-area-card,
  .game-baccarat-grid__column.betting-players .game-area-card {
    max-height: 500px;
  }
}



@media screen and (max-width: 575px) {

  .game-baccarat-grid__column.betting-history .game-area-card,
  .game-baccarat-grid__column.betting-players .game-area-card {
    max-height: 400px;
  }
}


.card-back {
  --animation-time: 0.6s;
  position: absolute;
  perspective: 500px;
  right: var(--result-right);
  top: var(--result-top);
  height: var(--result-height);
  width: var(--result-width);
  z-index: 2;
  display: none;
  overflow: hidden;
}

.card-back.animate {
  display: block;
  animation: card-animation var(--animation-time) ease forwards;

  .card-back__inner {
    height: inherit;
    animation: flip-card;
    animation-duration: 0.5s;
    animation-delay: var(--animation-time);
    animation-fill-mode: forwards;
  }
}


.card-back.animate {
  .card-back__inner {
    height: inherit;
    animation: flip-card;
    animation-duration: 0.5s;
    animation-delay: var(--animation-time);
    animation-fill-mode: forwards;
  }
}


.card-back.animate {
  .card-back__inner {
    height: inherit;
    animation: flip-card;
    animation-duration: 0.5s;
    animation-delay: var(--animation-time);
    animation-fill-mode: forwards;
  }
}


.card-back.flip {
  animation: card-animation-backwards var(--animation-time) ease forwards;
  animation-duration: 0.6s;
  animation-delay: 0.5s;

  .card-back__inner {
    animation: flip-card-reverse;
    animation-duration: 0.5s;
    animation-delay: 0s;
    height: inherit;
    animation-fill-mode: forwards;
    transform-style: preserve-3d;
    transform: rotateY(180deg);
  }

  .card-back__inner {
    height: inherit;
    animation: flip-card;
    animation-duration: 0.5s;
    animation-delay: var(--animation-time);
    animation-fill-mode: forwards;
  }
}





@keyframes card-animation {
  0% {
    right: 31px;
    top: 54px;
    height: 55px;
    transform: rotate(118deg);
  }

  30% {
    right: 80px;
    top: 4px;
    height: 130px;
    transform: rotate(0deg) skew(-19deg, 1deg);
  }

  100% {
    right: var(--result-right);
    top: var(--result-top);
    height: var(--result-height);
    transform: rotate(0deg) skew(0deg);
  }
}

@keyframes card-animation-backwards {

  0% {
    left: calc(100% - var(--result-right) - var(--card-width));
    top: var(--result-top);
    height: var(--result-height);
    transform: rotate(0deg) skew(0deg);
  }

  100% {
    top: 52px;
    left: calc(var(--shifted) + 3px);
    height: 87px;
    transform: rotate(0deg) skew(0deg);
  }
}

@keyframes flip-card {
  0% {
    transform-style: preserve-3d;
    transform: rotateY(0);
  }

  100% {
    transform-style: preserve-3d;
    transform: rotateY(180deg);
  }
}

@keyframes flip-card-reverse {
  0% {
    transform-style: preserve-3d;
    transform: rotateY(180deg);
  }

  100% {
    transform: rotateY(0);
    transform-style: preserve-3d;
  }
}




@keyframes back-to-slot {
  5% {
    transform: skew(10deg) translateY(-10px);
  }

  100% {
    transform: skew(0deg) translateY(0px);
    left: calc(var(--left) + var(--end-left-adjust));
    top: calc(var(--top) + var(--end-top-adjust));
    width: var(--end-width);
    height: var(--end-height, auto);
  }
}


/* Main css Reset */
@media screen and (min-width: 991px) and (max-width: 1599px) {

  .game-area-card__table th,
  .game-area-card__table td {
    padding-inline: 5px !important;
  }
}