@import url("https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

.blackjack-page-wrapper {
    max-width: 1160px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.blackjack-page-wrapper .history-container {
    margin-top: 0;
}

.blackjack-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-areas: "controls table";
    background: #1f3a4b;
    border: 1px solid #2e5163;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
}

.blackjack-controls {
    grid-area: controls;
    align-self: start;
    background: #243f4f;
    border-right: 1px solid #2f576b;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blackjack-controls label {
    color: #d5e7f2;
    font: 600 14px "Space Grotesk", sans-serif;
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.02em;
}

.bet-row {
    min-height: 44px;
    display: flex;
    align-items: center;
    border: 1px solid #496b7f;
    border-radius: 8px;
    background: #143041;
    overflow: hidden;
    transition: border-color 0.16s, box-shadow 0.16s;
}

.bet-row:focus-within {
    border-color: #6f98af;
    box-shadow: 0 0 0 2px rgba(92, 139, 165, 0.25);
}

#bjBetAmount {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #f2f9ff;
    font: 700 18px "Space Grotesk", sans-serif;
    padding: 9px 10px;
}

#bjBetAmount::-webkit-outer-spin-button,
#bjBetAmount::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bet-currency {
    width: 28px;
    height: 28px;
    margin-right: 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #83eb00;
    color: #0e2217;
    font: 800 14px "Space Grotesk", sans-serif;
}

.bet-chips-inline {
    display: flex;
    align-items: center;
    height: 100%;
    padding-right: 4px;
    border-left: 1px solid #3f6073;
    margin-left: 6px;
}

.chip-btn {
    min-width: 46px;
    height: 100%;
    border: none;
    background: transparent;
    color: #b9d0dd;
    font: 600 15px "Barlow Condensed", sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s;
}

.chip-btn + .chip-btn {
    border-left: 1px solid #3f6073;
}

.chip-btn:hover:not(:disabled) {
    color: #ffffff;
    background: rgba(80, 110, 128, 0.35);
}

.chip-btn:disabled {
    color: #7f9aa9;
    cursor: not-allowed;
}

.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bj-btn {
    min-height: 42px;
    border: 1px solid #47687a;
    border-radius: 9px;
    background: linear-gradient(180deg, #3f6276 0%, #355466 100%);
    color: #eff7fc;
    font: 600 14px "Barlow Condensed", sans-serif;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: border-color 0.15s, filter 0.15s, transform 0.1s;
}

.bj-btn:hover:not(:disabled) {
    border-color: #66889f;
    filter: brightness(1.08);
}

.bj-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.bj-btn.primary {
    margin-top: 2px;
    background: linear-gradient(180deg, #2f90ec 0%, #2a7bd3 100%);
    border-color: #64aaef;
}

.bj-btn.full {
    width: 100%;
}

.bj-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: saturate(0.75);
}

.round-summary {
    display: grid;
    gap: 6px;
    border-top: 1px solid #3a5a6c;
    padding-top: 10px;
}

.round-summary > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    color: #ecf7ff;
    font: 700 15px "Space Grotesk", sans-serif;
}

.meta-label {
    color: #a9bfce;
    font: 600 11px "Barlow Condensed", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.blackjack-table {
    grid-area: table;
    position: relative;
    min-height: 540px;
    padding: 16px 20px 20px;
    background:
        radial-gradient(130% 95% at 50% 12%, #133b52 0%, #0e3044 55%, #0a2638 100%),
        repeating-radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 7px);
    overflow: hidden;
    perspective: 900px;
}

.blackjack-table::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 44%, transparent 36%, rgba(4, 12, 18, 0.38) 100%);
}

.blackjack-header {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.blackjack-header .header-title {
    color: #d5e9f5;
    font: 700 14px "Barlow Condensed", sans-serif;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.blackjack-header .header-subtitle {
    color: #d0e3ef;
    font: 600 13px "Barlow Condensed", sans-serif;
}

.hand-panel {
    position: relative;
    z-index: 2;
    min-height: 190px;
    padding: 6px 0;
}

.dealer-panel {
    margin-bottom: 8px;
}

.player-panel {
    margin-top: 8px;
}

.hand-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ddebf4;
    font: 600 41px "Space Grotesk", sans-serif;
    margin-bottom: 8px;
}

.hand-score {
    min-width: 40px;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid #5e859d;
    background: rgba(54, 86, 106, 0.72);
    color: #d8f2ff;
    text-align: center;
    font: 700 27px "Barlow Condensed", sans-serif;
    line-height: 1.15;
}

.cards-row {
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
}

.cards-row .card {
    margin-right: -10px;
}

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

.card {
    width: 94px;
    height: 134px;
    border-radius: 10px;
    border: 1px solid #c3d2dc;
    background: linear-gradient(180deg, #fbfdff 0%, #edf2f6 100%);
    color: #12273a;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 8px 16px rgba(5, 16, 24, 0.45);
    transform-origin: 50% 60%;
    backface-visibility: hidden;
}

.card-rank {
    font: 700 16px "Space Grotesk", sans-serif;
    line-height: 1;
}

.card-suit {
    font-size: 40px;
    line-height: 1;
    text-align: center;
}

.card.red {
    color: #cb3434;
}

.card.back {
    border-color: #7fb2f0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
        repeating-linear-gradient(45deg, #2174e7, #2174e7 8px, #1b63c7 8px, #1b63c7 16px);
    color: transparent;
}

.card.dealing {
    will-change: transform, opacity;
    animation-duration: 680ms;
    animation-fill-mode: both;
    animation-timing-function: cubic-bezier(0.18, 0.82, 0.24, 1);
    animation-delay: var(--deal-delay, 0ms);
}

.card.dealing.card--dealer {
    animation-name: dealerDealIn;
}

.card.dealing.card--player {
    animation-name: playerDealIn;
}

@keyframes dealerDealIn {
    0% {
        opacity: 0;
        transform: translate3d(290px, -180px, 0) rotate(calc(var(--deal-rot, 0deg) - 12deg)) scale(0.88);
    }
    72% {
        opacity: 1;
        transform: translate3d(-4px, 3px, 0) rotate(calc(var(--deal-rot, 0deg) + 1deg)) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(var(--deal-rot, 0deg)) scale(1);
    }
}

@keyframes playerDealIn {
    0% {
        opacity: 0;
        transform: translate3d(280px, 190px, 0) rotate(calc(var(--deal-rot, 0deg) + 10deg)) scale(0.88);
    }
    72% {
        opacity: 1;
        transform: translate3d(-5px, 4px, 0) rotate(calc(var(--deal-rot, 0deg) - 1deg)) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) rotate(var(--deal-rot, 0deg)) scale(1);
    }
}

.table-center-meta {
    position: relative;
    z-index: 2;
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
}

.payout-plaque {
    min-width: 270px;
    padding: 8px 16px;
    border: 1px solid #2b4e63;
    border-radius: 4px;
    background: #16374b;
    color: #9eb8c9;
    text-align: center;
    font: 700 30px "Barlow Condensed", sans-serif;
    letter-spacing: 0.04em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 8px 14px rgba(0, 0, 0, 0.24);
    position: relative;
}

.payout-plaque::before,
.payout-plaque::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30px;
    height: 18px;
    margin-top: -9px;
    background: #16374b;
    border: 1px solid #2b4e63;
}

.payout-plaque::before {
    left: -24px;
    clip-path: polygon(100% 0, 100% 100%, 0 50%);
}

.payout-plaque::after {
    right: -24px;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.insurance-line {
    margin-top: 6px;
    color: #8ea6b7;
    font: 700 30px "Barlow Condensed", sans-serif;
    letter-spacing: 0.04em;
}

.shoe-stack {
    position: absolute;
    top: -8px;
    right: 18px;
    width: 82px;
    height: 58px;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
        repeating-linear-gradient(45deg, #2174e7, #2174e7 8px, #1b63c7 8px, #1b63c7 16px);
    border: 1px solid #7fb2f0;
    box-shadow: 0 8px 14px rgba(0, 0, 0, 0.3);
}

.shoe-stack::before,
.shoe-stack::after {
    content: "";
    position: absolute;
    left: 3px;
    right: 3px;
    height: 6px;
    border-radius: 4px;
    background: rgba(228, 238, 247, 0.85);
}

.shoe-stack::before {
    bottom: -5px;
}

.shoe-stack::after {
    bottom: -10px;
}

.hand-score.score-pop {
    animation: scorePop 260ms cubic-bezier(0.25, 0.9, 0.2, 1);
}

@keyframes scorePop {
    0% {
        transform: scale(0.92);
        filter: brightness(1.2);
    }
    100% {
        transform: scale(1);
        filter: brightness(1);
    }
}

@media (max-width: 980px) {
    .blackjack-page {
        grid-template-columns: 1fr;
        grid-template-areas:
            "table"
            "controls";
    }

    .blackjack-controls {
        border-right: none;
        border-top: 1px solid #35596b;
    }

    .blackjack-table {
        min-height: 470px;
    }

    .hand-top {
        font-size: 34px;
    }

    .hand-score {
        font-size: 22px;
    }

    .payout-plaque,
    .insurance-line {
        font-size: 24px;
    }
}
