body {
    background-image: radial-gradient(circle at center, #2b6e2b 0%, #144214 80%), radial-gradient(circle at center, rgba(255,255,255,0.03) 1px, transparent 1px), radial-gradient(circle at center, rgba(0,0,0,0.05) 1px, transparent 1px), radial-gradient(circle at center, rgba(255, 255,255,0.02) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 20px 20px, 10px 10px;
    background-repeat: no-repeat, repeat, repeat, repeat;
    box-shadow: inset 0 0 100px 60px rgba(0,0,0,0.5);
    margin: 0;
    color: white;
    font-family: Helvetica, sans-serif;
    text-align: center;
    overflow-x: hidden;
    position: relative;
}
html, body {
    height: 100%;
}
.header-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    height: clamp(200px, 25vh, 300px);
}
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 5vw;
    width: 100%;
    height: clamp(100px, 12vw, 150px);
    box-sizing: border-box;
    position: relative;
    pointer-events: none;
}

.main-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#results {
    font-family: 'Neonderthaw', cursive;
    font-size: 1rem;
    font-weight: normal;
    color: white;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    user-select: none;
    text-shadow: 0 0 10px #d4af37, 0 0 20px #ffd700, 0 0 30px #ffcc00, 0 0 40px #d4af37, 0 0 50px #ffd700, 0 0 60px #ffcc00, 0 0 70px #d4af37;
    animation: glow 3s ease-in-out infinite;
    margin-top: 20px;
    pointer-events: none;
    text-align: center;
    width: 100%;
}
/*result at the bottom of the screen */
#win_or_lose {
    font-family: 'Neonderthaw', cursive;
    font-size: 1rem;
    font-weight: bold;
    color: #ffd700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    user-select: none;
    text-shadow: 0 0 10px #d4af37, 0 0 20px #ffd700, 0 0 30px #ffcc00, 0 0 40px #d4af37, 0 0 50px #ffd700, 0 0 60px #ffcc00, 0 0 70px #d4af37;
    animation: glow 3s ease-in-out infinite;
    margin-top: 20px;
    pointer-events: none;
    text-align: center;
    width: 100%;
}

.your_cards_container, .dealer_cards_container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.dealer_score, .current_score {
    font-size: 2rem;
    font-weight: bold;
    color: #ffd700;
    min-width: 70px;
    user-select: none;
}
.cards-and-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}
body::before{
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.01) 0px, transparent 3px, transparent 20px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,0.01) 0px, transparent 3px, transparent 20px);
    opacity: 0.3;
    pointer-events: none;
}

/*casino style BLACKJACK title */
.black-title, .jack-title {
    animation: glow 3s ease-in-out infinite;
    font-family: 'Neonderthaw', cursive;
    text-shadow: 0 0 10px #d4af37, 0 0 20px #ffd700, 0 0 30px #ffcc00, 0 0 40px #d4af37, 0 0 50px #ffd700, 0 0 60px #ffcc00, 0 0 70px #d4af37;
    color: #ffd700;
    font-weight: normal;
    /*position: absolute;
    top: 10px;
    transform: none;
    color: #ffd700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    user-select: none;
    pointer-events: none;
    text-shadow: 0 0 10px #d4af37, 0 0 20px #ffd700, 0 0 30px #ffcc00, 0 0 40px #d4af37, 0 0 50px #ffd700, 0 0 60px #ffcc00, 0 0 70px #d4af37;
    z-index: 5;
    opacity: 0.5;
    pointer-events: none;*/
}
.turn-and-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: auto;
    z-index: 10;
}

#turn {
    font-family: 'Neonderthaw', cursive;
    font-size: clamp(2.5rem, 5vw, 3rem);
    color: #fff;
    text-shadow: 0 0 5px #ffd700, 0 0 10px #ffcc00;
    pointer-events: none;
    user-select: none;
    text-align: center;
    animation: turnGlow 2s ease-in-out infinite;
}
.black-title, .jack-title {
    position: absolute;
    top: 0;
    font-size: clamp(2rem, 8vw, 5rem);
    opacity: 0.5;
    z-index: 5;
    pointer-events: none;
}
.black-title { left: 4vw; }
.jack-title { right: 5vw; } /* 55 of the viewport width to look good on all screen sizes */

/*decorations */

.table-trim.bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, gold, #b8860b);
    box-shadow: 0 -2px 6px rgba(0,0,0,0.5);
    z-index: 10;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex; 
    justify-content: center;
    align-items: center;
    z-index: 999;
}

/*dashed border arcs */
.arc-decoration {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50vw;
    height: 20vh;
    border: 4px dashed rgba(255,215, 0, 0.25);
    border-radius: 50% / 25%;
    /*transform: translate(-50%, -50%);*/
    transform: translateX(-50%);
    z-index: 0;
    pointer-events: none;
}

.countdown-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10rem;
    color: white;
    opacity: 0.6;
    pointer-events: none;
    z-index: 9999;
    text-shadow: 0 0 10px black;
    font-weight: bold;
    user-select: none;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

/* unhide the game information slowly */
#game_information {
    margin-top: 30px;
    transition: visibility 0.3s ease-in-out;
}

.score-row {
    font-family: 'Neonderthaw', cursive;
    font-size: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-layout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 50px;
    flex-wrap: nowrap;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 30px;
}

#turn {
    font-family: 'Neonderthaw', cursive;
    font-size: 2rem;
}
#result-box {
    animation: glow 3s ease-in-out infinite;
    top: 80%;
    right: 0;
    margin-top: 10px;
    background-color: rgba(255,215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 10px 20px;
    min-width: 200px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 0 10px #ffd70099;
}

/*glowing box that displays the score */
#score-box {
    animation: glow 3s ease-in-out infinite;
    background-color: rgba(255,215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    min-width: 200px;
    margin-left: auto;
    display: flex;
    justify-content: center;
    flex-direction: column;
    box-shadow: 0 0 10px #ffd70099;
}
/*column positioning for score and result boxes */

#score-box, #result-box {
    width: 100%;
    max-width: 350px;
    box-sizing: border-box;
}
.score-and-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.current_score, .dealer_score {
    font-size: 1.5rem;
    color: white;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/*animations */

@keyframes swipeIn {
    0% {
        transform: translateX(-100vw) rotate(-15deg);
        opacity: 0;
    }
    60% {
        transform: translateX(10%) rotate(2deg);
        opacity: 1;
    }
    100% {
        transform: translateX(0) rotate(0);
        opacity: 1;
    }
}
.swipe-in {
    animation: swipeIn 0.6s ease-out;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
.spin {
    animation: spin 0.5s ease-in-out;
}

@keyframes glow {
    0% { text-shadow: 0 0 5px #ffd700, 0 0 10px #ffcc00; }
    50% { text-shadow: 0 0 20px #ffaa00, 0 0 30px #ff6600; }
    100% { text-shadow: 0 0 5px #ffd700, 0 0 10px #ffcc00; }
}

@keyframes turnGlow {
    0% {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff;
        color: #fff;
    }
    50% {
        text-shadow: 0 0 15px #fff, 0 0 25px #fff;
        color: #fff;
    }
    100% {
        text-shadow: 0 0 5px #fff, 0 0 10px #fff;
        color: #fff;
    }
}

/*support dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0a0a0a;
    }
}

/*Tablet resizing */
@media(max-width: 768px) {
    .black-title,
    .jack-title {
        font-size: clamp(1.8rem, 6vw, 3rem);
        top: 5px;
    }
    .turn-and-buttons {
        gap: 15px;
        margin-top: 30px;
    }
    #turn {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }
    .button-container {
        gap: 25px;
    }

    .game-layout {
        flex-wrap: wrap;
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    #score-box, #result-box {
        max-width: 100%;
        width: 90%;
    }

    .your_cards_container,
    .dealer_cards_container {
        width: 100%;
        justify-content: center;
    }

    #login-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    #login-container input,
    #login-container button {
        flex: 1 1 45%;
        min-width: 120px;
    }

    .arc-decoration {
        width: 60vw;
        height: 15vh;
    }
}

/*Mobile resizing */
@media(max-width: 480px) {
    .black-title,
    .jack-title {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
        top: 2px;
    }

    .button-container {
        flex-wrap: wrap;
        gap: 15px;
    }
    .card-row {
        flex-direction: column;
        align-items: center;
    }

    .turn-and-buttons {
        gap: 10px;
        margin-top: 20px;
    }

    #turn {
        font-size: clamp(1rem, 6vw, 1.5rem);
    }
    #results,
    #win_or_lose {
        font-size: 0.9rem;
    }

    #user-menu {
        min-width: 260px;
        max-width: 90%;
        padding: 20px;
    }

    .user-menu-footer {
        flex-direction: column;
        gap: 10px;
    }

    #logout-button,
    #close-user-menu {
        max-width: 100%;
    }
    #deal, #stay {
        width: clamp(60px, 30vw, 100px);
        height: clamp(60px, 30vw, 100px);
    }
}