/* Baccarat Mini - Main Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Royal blue velvet table */
    --bg-deep:        #061a30;
    --bg-felt:        #0a2540;
    --bg-felt-light:  #0e3160;
    --bg-felt-edge:   #062043;

    /* Gold */
    --gold:           #c9a04a;
    --gold-light:     #e9c97a;
    --gold-dark:      #8a6a23;

    /* Hand colors */
    --player-color:   #1e88e5;
    --player-dark:    #0d47a1;
    --banker-color:   #c62828;
    --banker-dark:    #7f1212;
    --tie-color:      #1b8f4a;
    --tie-dark:       #0f5d2d;

    /* Cards */
    --card-cream:     #f8f3e7;
    --card-red:       #b3261e;
    --card-black:     #1a1a1a;

    /* Text */
    --text-cream:     #f0e6d2;
    --text-muted:     #b8a988;

    /* Sizes */
    --radius-sm:      0.5rem;
    --radius-md:      0.75rem;
    --radius-lg:      1.25rem;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
}

body {
    background:
        radial-gradient(circle at 50% 30%, var(--bg-felt-light) 0%, var(--bg-felt) 55%, var(--bg-deep) 100%);
    color: var(--text-cream);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
}

/* Subtle velvet texture overlay via repeating gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 0.0625rem, transparent 0.0625rem 0.1875rem),
        repeating-linear-gradient(90deg, rgba(0,0,0,0.04) 0 0.0625rem, transparent 0.0625rem 0.1875rem);
    pointer-events: none;
    z-index: 0;
}

/* ============ SCREENS ============ */
.screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-deep);
    color: var(--text-cream);
    z-index: 1000;
}

.screen.hidden,
.hidden {
    display: none !important;
}

.loading-spinner {
    width: 3.75rem;
    height: 3.75rem;
    border: 0.25rem solid var(--bg-felt-light);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-screen p {
    margin-top: 1.25rem;
    color: var(--gold);
    font-size: 1.125rem;
}

.login-content {
    text-align: center;
}

.login-icon {
    font-size: 4rem;
    margin-bottom: 1.25rem;
}

.login-content h2 {
    color: var(--gold);
    margin-bottom: 0.625rem;
}

.login-content p {
    color: var(--text-muted);
}

/* ============ GAME CONTAINER ============ */
#game-container {
    position: relative;
    width: 100%;
    max-width: 32rem;
    height: 100%;
    max-height: 56rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    z-index: 1;
}

/* ============ HEADER ============ */
#game-header {
    width: 100%;
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(201,160,74,0.22) 0%, rgba(138,106,35,0.12) 100%);
    border: 0.125rem solid var(--gold-dark);
    border-radius: 1.25rem;
    padding: 0.375rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 0 0.75rem rgba(201,160,74,0.25) inset;
}

.balance-label {
    color: var(--text-muted);
    font-size: 0.75rem;
}

#balance-value {
    color: var(--gold-light);
    font-size: 1.125rem;
    font-weight: bold;
    min-width: 4.5rem;
    text-align: right;
}

.balance-currency {
    color: var(--gold);
    font-size: 0.625rem;
}

/* ============ BACCARAT TABLE ============ */
#baccarat-table {
    width: 100%;
    flex: 1;
    background:
        radial-gradient(ellipse at 50% 40%, var(--bg-felt-light) 0%, var(--bg-felt) 75%);
    border: 0.1875rem solid var(--gold-dark);
    border-radius: var(--radius-lg);
    box-shadow:
        0 0 0 0.125rem rgba(0,0,0,0.4) inset,
        0 0 1.5rem rgba(201,160,74,0.25),
        0 0 2rem rgba(0,0,0,0.55);
    padding: 0.75rem;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============ HANDS ============ */
.hands-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    flex: 1;
    min-height: 12rem;
}

.hand-area {
    flex: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0.25), rgba(0,0,0,0.05));
    border: 0.125rem solid transparent;
    border-radius: var(--radius-md);
    padding: 0.625rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.hand-area.hand-player {
    border-color: var(--player-color);
    box-shadow: 0 0 0.875rem rgba(30,136,229,0.25) inset;
}

.hand-area.hand-banker {
    border-color: var(--banker-color);
    box-shadow: 0 0 0.875rem rgba(198,40,40,0.25) inset;
}

.hand-area.winner {
    box-shadow:
        0 0 0 0.125rem var(--gold) inset,
        0 0 1.25rem rgba(201,160,74,0.6);
    animation: winnerPulse 1.4s ease-in-out infinite;
}

@keyframes winnerPulse {
    0%, 100% { box-shadow: 0 0 0 0.125rem var(--gold) inset, 0 0 1rem rgba(201,160,74,0.55); }
    50%      { box-shadow: 0 0 0 0.125rem var(--gold-light) inset, 0 0 1.75rem rgba(201,160,74,0.95); }
}

.hand-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.25rem;
    border-bottom: 0.0625rem dashed rgba(201,160,74,0.4);
}

.hand-label {
    font-size: 0.8125rem;
    font-weight: bold;
    letter-spacing: 0.125rem;
    color: var(--gold-light);
}

.hand-total {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--card-cream);
    background: rgba(0,0,0,0.35);
    border-radius: 0.5rem;
    padding: 0.0625rem 0.625rem;
    min-width: 2.25rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.hand-total.flash {
    animation: totalFlash 0.45s ease;
}

@keyframes totalFlash {
    0%, 100% { transform: scale(1); color: var(--card-cream); }
    50%      { transform: scale(1.25); color: var(--gold-light); text-shadow: 0 0 0.5rem var(--gold); }
}

.hand-cards {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 6.25rem;
}

/* ============ CENTER DIVIDER ============ */
.table-divider {
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 0.0625rem;
    text-shadow: 0 0 0.625rem rgba(201,160,74,0.7);
}

.divider-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    background: linear-gradient(180deg, var(--gold-light), var(--gold-dark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: 0.875rem;
    padding: 0.25rem 0;
}

/* ============ CARDS ============ */
.bcard {
    width: 2.75rem;
    height: 3.875rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--card-cream) 100%);
    border: 0.0625rem solid rgba(0,0,0,0.2);
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.625rem rgba(0,0,0,0.4);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.25rem;
    font-family: 'Georgia', serif;
    opacity: 0;
    transform: translateY(-1.5rem) rotate(-8deg) scale(0.9);
    transition: transform 0.28s ease, opacity 0.28s ease;
}

.bcard.dealt {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
}

.bcard.red .bcard-rank-top,
.bcard.red .bcard-rank-bottom,
.bcard.red .bcard-suit-center {
    color: var(--card-red);
}

.bcard.black .bcard-rank-top,
.bcard.black .bcard-rank-bottom,
.bcard.black .bcard-suit-center {
    color: var(--card-black);
}

.bcard-rank-top {
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
}

.bcard-suit-center {
    font-size: 1.5rem;
    text-align: center;
    line-height: 1;
}

.bcard-rank-bottom {
    font-size: 0.75rem;
    font-weight: bold;
    text-align: right;
    line-height: 1;
    transform: rotate(180deg);
}

/* ============ SIDE BETS ============ */
.sidebets-row {
    display: flex;
    gap: 0.5rem;
}

.sidebet-box {
    flex: 1;
    background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.15) 100%);
    border: 0.125rem solid var(--gold-dark);
    border-radius: var(--radius-md);
    color: var(--text-cream);
    padding: 0.5rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.sidebet-box .sidebet-name {
    font-size: 0.8125rem;
    font-weight: bold;
    letter-spacing: 0.0625rem;
}

.sidebet-box .sidebet-mult {
    font-size: 0.75rem;
    color: var(--gold-light);
    font-weight: bold;
}

.sidebet-box.sidebet-player {
    border-color: var(--player-color);
}
.sidebet-box.sidebet-banker {
    border-color: var(--banker-color);
}
.sidebet-box.sidebet-tie {
    border-color: var(--tie-color);
}

.sidebet-box:hover:not(:disabled) {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.25rem 0.875rem rgba(201,160,74,0.35);
}

.sidebet-box.active {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-deep);
    border-color: var(--gold-light);
    box-shadow: 0 0 1rem rgba(201,160,74,0.7);
}

.sidebet-box.active .sidebet-mult {
    color: var(--bg-deep);
}

.sidebet-box:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* ============ RESULT DISPLAY ============ */
#result-display {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    animation: resultPopup 0.4s ease;
    pointer-events: none;
}

@keyframes resultPopup {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.result-text {
    display: block;
    font-size: 1.875rem;
    font-weight: bold;
    text-shadow: 0 0.125rem 0.5rem rgba(0,0,0,0.6);
    letter-spacing: 0.125rem;
}

.result-text.win {
    color: var(--gold-light);
    text-shadow: 0 0 1rem rgba(201,160,74,0.8);
}

.result-text.lose {
    color: var(--banker-color);
}

.result-text.push {
    color: var(--tie-color);
}

.result-amount {
    display: block;
    font-size: 1.375rem;
    font-weight: bold;
    color: var(--gold);
    margin-top: 0.25rem;
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 11rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 0.5rem 1.25rem;
    border-radius: 0.625rem;
    border: 0.125rem solid var(--gold);
    z-index: 100;
}

#message-text {
    color: var(--text-cream);
    font-size: 0.875rem;
}

/* ============ BET CONTROLS ============ */
#bet-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    flex-wrap: wrap;
}

.bet-label {
    color: var(--gold-light);
    font-size: 0.875rem;
    font-weight: bold;
    letter-spacing: 0.0625rem;
}

.bet-buttons {
    display: flex;
    gap: 0.375rem;
}

.bet-btn {
    width: 3rem;
    height: 2.25rem;
    background: linear-gradient(180deg, var(--bg-felt-light) 0%, var(--bg-felt) 100%);
    border: 0.125rem solid var(--gold-dark);
    border-radius: 0.5rem;
    color: var(--text-cream);
    font-size: 0.875rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.bet-btn:hover:not(:disabled) {
    border-color: var(--gold);
}

.bet-btn.active {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-deep);
    box-shadow: 0 0 0.625rem rgba(201,160,74,0.6);
}

.bet-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.current-bet {
    color: var(--gold-light);
    font-size: 0.9375rem;
    font-weight: bold;
    background: rgba(0,0,0,0.3);
    border-radius: 0.5rem;
    padding: 0.25rem 0.625rem;
    border: 0.0625rem solid var(--gold-dark);
}

/* ============ DEAL BUTTON ============ */
#deal-button {
    width: 14rem;
    height: 3.25rem;
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
    border: 0.1875rem solid #fff8dc;
    border-radius: 1.625rem;
    color: var(--bg-deep);
    font-size: 1.125rem;
    font-weight: bold;
    letter-spacing: 0.125rem;
    cursor: pointer;
    box-shadow:
        0 0.25rem 1rem rgba(201,160,74,0.55),
        0 0 0 0.0625rem rgba(0,0,0,0.25) inset;
    transition: all 0.2s ease;
    margin: 0.5rem 0;
    font-family: inherit;
}

#deal-button:hover:not(:disabled) {
    transform: scale(1.04);
    box-shadow: 0 0.375rem 1.5rem rgba(201,160,74,0.8);
}

#deal-button:active:not(:disabled) {
    transform: scale(0.98);
}

#deal-button:disabled {
    background: linear-gradient(180deg, #6a6a6a 0%, #4a4a4a 100%);
    border-color: #8a8a8a;
    color: #2a2a2a;
    box-shadow: none;
    cursor: not-allowed;
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.title-icon {
    font-size: 1.25rem;
}

.title-text {
    color: var(--gold-light);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.125rem;
}

/* ============ PARTICLES ============ */
#particles-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1500;
}

.particle {
    position: absolute;
    font-size: 1.5rem;
    animation: particleFall 2s ease-out forwards;
}

@keyframes particleFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.5); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 25rem) {
    .bcard {
        width: 2.25rem;
        height: 3.25rem;
    }
    .bcard-rank-top, .bcard-rank-bottom {
        font-size: 0.625rem;
    }
    .bcard-suit-center {
        font-size: 1.25rem;
    }
    .bet-btn {
        width: 2.5rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    #deal-button {
        width: 11rem;
        height: 2.75rem;
        font-size: 1rem;
    }
    .sidebet-box .sidebet-name {
        font-size: 0.6875rem;
    }
    .sidebet-box .sidebet-mult {
        font-size: 0.625rem;
    }
}

@media (max-height: 44rem) {
    .hands-row {
        min-height: 9rem;
    }
    .bcard {
        width: 2.25rem;
        height: 3.25rem;
    }
}
