/* blackjack.css */
/* v1.0.24 */

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

#blackjack-screen {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.blackjack-table {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: calc(120px + env(safe-area-inset-top)) 15px calc(40px + env(safe-area-inset-bottom)) 15px;
    font-family: 'Graduate', serif;
}

#blackjack-back-button {
    position: absolute;
    top: calc(85px + env(safe-area-inset-top));
    right: 15px;
    width: 30px;
    height: 29px;
    background-size: contain;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 10;
}

.blackjack-info {
    text-align: center;
    font-size: 1.2em;
    color: #fff;
    text-shadow: 1px 1px 2px #000;
    min-height: 50px;
    margin-bottom: 10px;
}

.blackjack-hand-container {
    margin: 5px 0;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.blackjack-hand-container h2 {
    font-family: 'Rye', cursive;
    font-size: 1.5em;
    color: #ffd55c;
    margin: 0 0 10px 0;
    text-align: center;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

.hand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    gap: 10px;
}

.card {
    width: 66px;
    height: 93px;
    background-color: #fff;
    border: 1px solid #aaa;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    position: relative;
    font-family: 'Arvo', serif;
    font-weight: bold;
    font-size: 1.8em;
    box-sizing: border-box;
    transition: transform 0.4s ease-out, opacity 0.3s ease-out;
}

.card .rank {
    position: absolute;
    top: 1px;
    left: 6px;
}

.card .suit {
    position: absolute;
    bottom: 1px;
    right: 10px;
    font-size: 1.7em;
}

.card-spades,
.card-clubs {
    color: #000;
}

.card-hearts,
.card-diamonds {
    color: #D90000;
}

.card.hidden-card {
    background-size: cover;
    background-position: center;
    border: 0px solid #aaa;
    color: transparent;
    padding: 0;
    background-color: transparent;
}

.blackjack-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.blackjack-button {
    padding: 12px 10px;
    font-family: 'Graduate', serif;
    font-size: 1em;
    font-weight: bold;
    color: #fff;
    background-color: #a00000;
    border: 2px solid #ffc107;
    border-radius: 10px;
    text-shadow: 1px 1px 2px #000;
    box-shadow: 0 4px 0 #600;
    cursor: pointer;
    transition: all 0.1s ease;
}

.blackjack-button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #600;
}

.blackjack-button:disabled {
    background-color: #555;
    border-color: #777;
    box-shadow: 0 4px 0 #333;
    cursor: not-allowed;
    opacity: 0.7;
}

#blackjack-status-bar {
    position: absolute;
    top: calc(80px + env(safe-area-inset-top));
    left: 15px;
    right: 15px;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
    padding-right: 40px;
}

#blackjack-dust-counter {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    padding: 5px 12px 5px 5px;
    font-family: 'Lilita One', cursive;
    color: #fff;
    font-size: 1.1em;
    text-shadow: 1px 1px 1px #000;
}

#blackjack-dust-counter img {
    width: 28px;
    height: 28px;
    margin-right: 6px;
}

#blackjack-level-container {
    display: flex;
    align-items: center;
    font-family: 'Lilita One', cursive;
    color: #fff;
    font-size: 1.1em;
}

#blackjack-level-text {
    margin-right: 8px;
}

.level-bar-outer {
    width: 100px;
    height: 18px;
    background-color: #333;
    border: 2px solid #000;
    border-radius: 9px;
    padding: 2px;
    box-sizing: border-box;
}

#level-bar-inner {
    width: 0%;
    height: 100%;
    background-color: #3498db;
    border-radius: 5px;
    transition: width 0.5s ease;
}

#chip-betting-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.chip-button {
    width: 100%;
    max-width: 60px;
    height: auto;
    margin: 0 auto;
    display: block;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.2s ease;
}

.chip-button:active {
    transform: translateY(2px) scale(0.98);
}

.chip-button.disabled {
    filter: grayscale(100%) opacity(0.5);
    cursor: not-allowed;
    transform: none;
}

#action-button-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

#btn-deal {
    grid-column: 1 / -1;
}

#btn-clear-bet {
    grid-column: 1 / 3;
}

#btn-deal {
    grid-column: 3 / 5;
}

#action-button-row.playing-phase #btn-clear-bet,
#action-button-row.playing-phase #btn-deal {
    grid-column: auto;
}

#player-hand.hand {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

.split-hand {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 1px;
    border: 2px solid transparent;
    border-radius: 10px;
    min-width: 150px;
    gap: 10px;
}

.active-hand {
    border-color: #ffc107;
    box-shadow: 0 0 15px #ffc107;
}

#insurance-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    --insurance-no-bg: #8c1a1a;
    --insurance-no-shadow: #5a0000;
}

#insurance-text {
    font-family: 'Lilita One', cursive;
    font-size: 1.1em;
    color: #ffd55c;
    text-shadow: 1px 1px 2px #000;
}

#btn-insurance-yes {
    background-color: #0c6b0c;
    box-shadow: 0 4px 0 #003e00;
    min-width: 80px;
}

#btn-insurance-no {
    background-color: var(--insurance-no-bg);
    box-shadow: 0 4px 0 var(--insurance-no-shadow);
    min-width: 80px;
}

#btn-insurance-yes:active {
    box-shadow: 0 2px 0 #003e00;
}

#btn-insurance-no:active {
    background-color: var(--insurance-no-bg);
    box-shadow: 0 2px 0 var(--insurance-no-shadow);
}

.card.dealing {
    opacity: 0;
    transform: translateY(-80px) scale(0.8);
}

.card.is-fading-out {
    animation: fade-out-fast 0.3s ease-out forwards;
}

.card.is-fading-in {
    opacity: 0;
    animation: fade-in-fast 0.3s ease-in 0.3s forwards;
}

@keyframes fade-out-fast {
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

@keyframes fade-in-fast {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#blackjack-animation-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.flying-chip {
    position: absolute;
    width: 60px;
    height: 60px;
    z-index: 101;
    transition: transform 0.4s cubic-bezier(0.5, 0, 0.75, 0);
}

#bet-stack-area {
    width: 100%;
    height: 50px;
    margin-bottom: 10px;
    position: relative;
}

@keyframes fade-out-slow {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.clearing-table {
    animation: fade-out-slow 0.5s ease-out forwards;
    pointer-events: none;
}