/* Poker 5-Draw — Vintage Vegas Video Poker */

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

:root {
    /* Burgundy/Vegas palette */
    --burgundy-deep:  #2a0710;
    --burgundy:       #5a0f1f;
    --burgundy-light: #7a1830;

    /* Gold chrome */
    --gold:           #e3b341;
    --gold-bright:    #f5cf68;
    --gold-dark:      #a07814;
    --gold-deep:      #6e520a;

    /* Card colors */
    --card-white:     #f4ead2;
    --card-cream:     #ede0c0;
    --card-red:       #b71c1c;
    --card-black:     #1f1411;
    --card-back:      #3a0a18;

    /* Text */
    --text-cream:     #f4ead2;
    --text-muted:     #a98c6b;
    --text-shadow:    rgba(0, 0, 0, 0.6);

    /* Result colors */
    --win-color:      #5fbf60;
    --lose-color:     #b71c1c;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Georgia', 'Times New Roman', serif;
}

body {
    background: radial-gradient(ellipse at 50% 0%,
        var(--burgundy-light) 0%,
        var(--burgundy) 35%,
        var(--burgundy-deep) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100dvh - 3.5rem);
    color: var(--text-cream);
}

/* Subtle felt vignette */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 0%, rgba(0,0,0,0.5) 100%),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.01) 0 2px, transparent 2px 4px);
    pointer-events: none;
    z-index: 0;
}

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

.screen.hidden { display: none; }

.loading-spinner {
    width: 3.25rem;
    height: 3.25rem;
    border: 0.25rem solid rgba(227, 179, 65, 0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spinAnim 1s linear infinite;
}

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

#loading-screen p {
    margin-top: 1rem;
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 0.0625rem;
}

.login-content { text-align: center; }
.login-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.login-content h2 { color: var(--gold); margin-bottom: 0.5rem; }
.login-content p { color: var(--text-muted); }

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

#game-container.hidden { display: none; }

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

.balance-display {
    background:
        linear-gradient(180deg, rgba(0,0,0,0.45) 0%, rgba(0,0,0,0.3) 100%) padding-box,
        linear-gradient(180deg, var(--gold-bright), var(--gold-dark)) border-box;
    border: 0.125rem solid transparent;
    border-radius: 1.5rem;
    padding: 0.4375rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.4375rem;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4),
        0 0.25rem 0.875rem rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(245,207,104,0.2);
}

.balance-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.03125rem;
    text-transform: uppercase;
}

#balance-value {
    color: var(--gold-bright);
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 4.375rem;
    text-align: right;
    text-shadow: 0 0 0.625rem rgba(227,179,65,0.4);
    font-family: 'Georgia', serif;
}

.balance-currency {
    color: var(--gold-dark);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.0625rem;
}

/* ============ PAYTABLE ============ */
.paytable {
    width: 100%;
    background:
        linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 100%) padding-box,
        linear-gradient(180deg, var(--gold-bright), var(--gold-dark) 50%, var(--gold-bright)) border-box;
    border: 0.125rem solid transparent;
    border-radius: 0.5rem;
    padding: 0.4375rem 0.625rem;
    margin-bottom: 0.375rem;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(245,207,104,0.15);
}

.paytable-title {
    text-align: center;
    color: var(--gold-bright);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.1875rem;
    margin-bottom: 0.25rem;
    padding-bottom: 0.1875rem;
    border-bottom: 1px solid rgba(227,179,65,0.3);
    text-shadow: 0 1px 2px var(--text-shadow);
}

.paytable-rows {
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
}

.paytable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.1875rem 0.5rem;
    border-radius: 0.1875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.pt-name {
    color: var(--text-cream);
    font-size: 0.75rem;
    letter-spacing: 0.03125rem;
    font-family: 'Georgia', serif;
}

.pt-mult {
    color: var(--gold);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.03125rem;
}

.paytable-row.active {
    background: linear-gradient(90deg,
        rgba(227,179,65,0.35) 0%,
        rgba(227,179,65,0.18) 50%,
        rgba(227,179,65,0.35) 100%);
    border-color: var(--gold-bright);
    box-shadow:
        0 0 1rem rgba(245,207,104,0.6),
        inset 0 0 0.5rem rgba(245,207,104,0.25);
    animation: paytablePulse 1s ease-in-out infinite;
}

.paytable-row.active .pt-name {
    color: var(--gold-bright);
    text-shadow: 0 0 0.5rem rgba(245,207,104,0.6);
}

.paytable-row.active .pt-mult {
    color: var(--gold-bright);
    text-shadow: 0 0 0.625rem rgba(245,207,104,0.7);
}

@keyframes paytablePulse {
    0%, 100% { box-shadow: 0 0 1rem rgba(245,207,104,0.55), inset 0 0 0.5rem rgba(245,207,104,0.25); }
    50%       { box-shadow: 0 0 1.5rem rgba(245,207,104,0.85), inset 0 0 0.75rem rgba(245,207,104,0.35); }
}

/* ============ CARDS SECTION ============ */
#cards-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.625rem 0.25rem;
}

.cards-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
}

.card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.25rem;
    border-radius: 0.625rem;
    border: 0.125rem solid transparent;
    transition: all 0.2s ease;
    position: relative;
    flex: 1;
    max-width: 5rem;
}

.card-slot.interactive {
    cursor: pointer;
}

.card-slot.interactive:hover {
    transform: translateY(-0.125rem);
}

.card-slot.held {
    border-color: var(--gold-bright);
    background: linear-gradient(180deg,
        rgba(227,179,65,0.18) 0%,
        rgba(227,179,65,0.08) 100%);
    box-shadow:
        0 0 0.75rem rgba(245,207,104,0.6),
        inset 0 1px 0 rgba(245,207,104,0.25);
}

.card-slot.held .card {
    transform: translateY(-0.25rem);
}

.hold-tag {
    height: 1rem;
    padding: 0.0625rem 0.5rem;
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-dark) 100%);
    color: var(--burgundy-deep);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.0625rem;
    border-radius: 0.625rem;
    border: 1px solid var(--gold-bright);
    box-shadow: 0 1px 0.3125rem rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
    text-shadow: 0 1px 0 rgba(245,207,104,0.4);
}

.card-slot.held .hold-tag {
    opacity: 1;
}

/* ============ CARD ============ */
.card {
    width: 100%;
    aspect-ratio: 5 / 7;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0.4375rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.375rem 0.4375rem;
    box-shadow:
        0 0.25rem 0.625rem rgba(0,0,0,0.5),
        inset 0 0 0 1px rgba(0,0,0,0.15);
}

.card-front {
    background:
        linear-gradient(160deg, var(--card-white) 0%, var(--card-cream) 100%);
    border: 1px solid rgba(0,0,0,0.2);
}

.card-back {
    background:
        repeating-linear-gradient(45deg,
            var(--card-back) 0, var(--card-back) 4px,
            #4a0a1c 4px, #4a0a1c 8px),
        linear-gradient(135deg, var(--card-back) 0%, #5a0a20 100%);
    transform: rotateY(180deg);
    border: 0.1875rem solid var(--gold-dark);
}

.card-back::after {
    content: '♣ ♠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: var(--gold);
    letter-spacing: 0.125rem;
    opacity: 0.7;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.card-rank-top {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1;
    font-family: 'Georgia', serif;
}

.card-suit-center {
    font-size: 2.25rem;
    text-align: center;
    line-height: 1;
    align-self: center;
    margin: -0.5rem 0;
}

.card-rank-bottom {
    font-size: 1.125rem;
    font-weight: 700;
    text-align: right;
    line-height: 1;
    transform: rotate(180deg);
    font-family: 'Georgia', serif;
}

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

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

/* Winning card highlight */
.card.win-highlight {
    animation: cardWinPulse 0.6s ease;
}

@keyframes cardWinPulse {
    0%, 100% { transform: scale(1); filter: none; }
    50%       { transform: scale(1.06); filter: drop-shadow(0 0 0.75rem rgba(245,207,104,0.85)); }
}

/* ============ RESULT DISPLAY ============ */
#result-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background:
        linear-gradient(160deg, rgba(20,5,10,0.96) 0%, rgba(40,10,20,0.96) 100%) padding-box,
        linear-gradient(180deg, var(--gold-bright), var(--gold-dark)) border-box;
    border: 0.1875rem solid transparent;
    padding: 1.125rem 2.5rem;
    border-radius: 1rem;
    text-align: center;
    z-index: 100;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.5),
        0 0 3.125rem rgba(227,179,65,0.45),
        0 1rem 2.5rem rgba(0,0,0,0.7);
    animation: resultPopup 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 14rem;
}

#result-display.hidden { display: none; }

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

.result-text {
    display: block;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: 0.1875rem;
    margin-bottom: 0.375rem;
    text-shadow: 0 0.125rem 0.25rem var(--text-shadow);
    text-transform: uppercase;
    font-family: 'Georgia', serif;
}

.result-text.win {
    color: var(--gold-bright);
    text-shadow: 0 0 1rem rgba(245,207,104,0.7);
}

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

.result-amount {
    display: block;
    color: var(--gold-bright);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 1.25rem rgba(245,207,104,0.65);
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 11.875rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 5, 10, 0.96);
    padding: 0.5rem 1.375rem;
    border-radius: 0.5rem;
    border: 1px solid var(--gold-dark);
    z-index: 100;
    white-space: nowrap;
}

#message-display.hidden { display: none; }
#message-text { color: var(--text-cream); font-size: 0.8125rem; }

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

.bet-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.0625rem;
    text-transform: uppercase;
}

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

.bet-btn {
    width: 3rem;
    height: 2rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.25) 100%);
    border: 1px solid var(--gold-dark);
    border-radius: 0.375rem;
    color: var(--text-cream);
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Georgia', serif;
}

.bet-btn:hover:not(:disabled) {
    border-color: var(--gold-bright);
    color: var(--gold-bright);
    background: rgba(227, 179, 65, 0.1);
}

.bet-btn.active {
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-dark) 100%);
    color: var(--burgundy-deep);
    border-color: var(--gold-bright);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.4),
        0 0.125rem 0.5rem rgba(227, 179, 65, 0.4);
}

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

.current-bet {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.25rem 0.875rem;
    border-radius: 0.375rem;
    border: 1px solid var(--gold-dark);
}

#current-bet-value {
    color: var(--gold-bright);
    font-size: 1rem;
    font-weight: 700;
}

/* ============ ACTION BUTTON ============ */
#action-button {
    width: 11.25rem;
    height: 3.25rem;
    background: linear-gradient(180deg, var(--gold-bright) 0%, var(--gold-dark) 100%);
    border: 0.125rem solid var(--gold-bright);
    border-radius: 1.625rem;
    cursor: pointer;
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.45),
        0 0.25rem 1rem rgba(227, 179, 65, 0.45),
        inset 0 1px 0 rgba(245, 207, 104, 0.3);
    transition: all 0.18s ease;
    margin: 0.5rem 0;
    color: var(--burgundy-deep);
}

#action-button:hover:not(:disabled) {
    transform: translateY(-0.125rem);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.45),
        0 0.5rem 1.5rem rgba(245, 207, 104, 0.6);
}

#action-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.45),
        0 0.125rem 0.5rem rgba(227, 179, 65, 0.4);
}

#action-button:disabled {
    background: linear-gradient(180deg, #4a3a1a 0%, #2e2410 100%);
    border-color: var(--gold-deep);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
    cursor: not-allowed;
    color: var(--text-muted);
}

#action-button.draw-mode {
    background: linear-gradient(180deg, var(--gold-bright) 0%, #c8702a 100%);
    animation: drawPulse 1.6s ease-in-out infinite;
}

@keyframes drawPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,0.45), 0 0.25rem 1rem rgba(227, 179, 65, 0.5); }
    50%       { box-shadow: 0 0 0 1px rgba(0,0,0,0.45), 0 0.25rem 1.75rem rgba(245, 207, 104, 0.9); }
}

.action-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.1875rem;
    font-family: 'Georgia', serif;
    text-shadow: 0 1px 0 rgba(245, 207, 104, 0.4);
}

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

.title-deco {
    color: var(--gold-dark);
    font-size: 0.8125rem;
    letter-spacing: 0.125rem;
}

.title-text {
    color: var(--gold);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.1875rem;
    text-transform: uppercase;
    text-shadow: 0 0 0.625rem rgba(227, 179, 65, 0.4);
    font-family: 'Georgia', serif;
}

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

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

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

/* ============ RESPONSIVE ============ */
@media (max-width: 25rem) {
    .card-slot { max-width: 4.25rem; }
    .card-rank-top, .card-rank-bottom { font-size: 0.9375rem; }
    .card-suit-center { font-size: 1.75rem; }
    .bet-btn { width: 2.625rem; height: 1.875rem; font-size: 0.75rem; }
    #action-button { width: 9.5rem; height: 2.875rem; }
    .action-text { font-size: 1.0625rem; }
    .pt-name { font-size: 0.6875rem; }
    .pt-mult { font-size: 0.75rem; }
    .hold-tag { font-size: 0.625rem; padding: 0.0625rem 0.375rem; }
}

@media (max-height: 44rem) {
    .paytable { padding: 0.3125rem 0.5rem; }
    .paytable-row { padding: 0.0625rem 0.4375rem; }
    .pt-name, .pt-mult { font-size: 0.6875rem; }
    .paytable-title { margin-bottom: 0.125rem; padding-bottom: 0.125rem; }
    #cards-section { padding: 0.375rem 0.25rem; }
    .card-suit-center { font-size: 1.75rem; }
    #action-button { height: 2.875rem; margin: 0.25rem 0; }
}
