/* Hi-Lo Card - Main Styles */

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

:root {
    /* Background - Casino felt */
    --bg-dark: #001201;
    --bg-felt: #00420c;
    --bg-light: #00420c;

    /* Cards */
    --card-white: #ffffff;
    --card-red: #dc2626;
    --card-black: #1f2937;
    --card-back: #1e3a5f;
    --card-back-pattern: #2d4a6f;

    /* Buttons */
    --higher-color: #22c55e;
    --higher-dark: #16a34a;
    --lower-color: #ef4444;
    --lower-dark: #dc2626;
    --cashout-gold: #ffd700;
    --cashout-dark: #b8860b;

    /* UI */
    --gold: #ffd700;
    --gold-dark: #b8860b;
    --text-white: #ffffff;
    --text-muted: #a0a0a0;
    --surface: #00420c;
}

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

body {
    background: transparent;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100dvh - 3.5rem);
}

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

.screen.hidden {
    display: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--bg-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: 20px;
    color: var(--gold);
    font-size: 18px;
}

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

.login-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

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

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

/* ============ GAME CONTAINER ============ */
#game-container {
    width: 100%;
    max-width: 500px;
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    position: relative;
}

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

/* ============ HEADER ============ */
#game-header {
    width: 100%;
    padding: 8px 15px;
    display: flex;
    justify-content: center;
}

.balance-display {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.2) 0%, rgba(184, 134, 11, 0.1) 100%);
    border: 2px solid var(--gold-dark);
    border-radius: 20px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

#balance-value {
    color: var(--gold);
    font-size: 18px;
    font-weight: bold;
    min-width: 70px;
    text-align: right;
}

.balance-currency {
    color: var(--gold-dark);
    font-size: 10px;
}

/* ============ MULTIPLIER DISPLAY ============ */
#multiplier-display {
    display: flex;
    gap: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 1px solid var(--gold-dark);
    margin: 5px 0;
}

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

.multiplier-row, .potential-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mult-label, .pot-label {
    color: var(--text-muted);
    font-size: 12px;
}

#current-multiplier {
    color: var(--higher-color);
    font-size: 20px;
    font-weight: bold;
}

#potential-win {
    color: var(--gold);
    font-size: 18px;
    font-weight: bold;
}

/* ============ CARDS SECTION ============ */
#cards-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 10px;
}

.cards-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.card-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
}

/* Card styling */
.card {
    width: 100px;
    height: 140px;
    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;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
}

.card-front {
    background: var(--card-white);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.card-back {
    background: linear-gradient(135deg, var(--card-back) 0%, var(--card-back-pattern) 50%, var(--card-back) 100%);
    transform: rotateY(180deg);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 3px solid var(--gold-dark);
}

.card-back::after {
    content: '🎴';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0.5;
}

.card-rank-top {
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
}

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

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

.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);
}

/* Card animations */
.card.correct {
    animation: cardCorrect 0.5s ease;
}

@keyframes cardCorrect {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px var(--higher-color); }
}

.card.wrong {
    animation: cardWrong 0.5s ease;
}

@keyframes cardWrong {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* VS indicator */
.vs-indicator {
    color: var(--gold);
    font-size: 24px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

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

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

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

.result-text {
    display: block;
    font-size: 36px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.result-text.win {
    color: var(--higher-color);
}

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

.result-amount {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: var(--gold);
    margin-top: 5px;
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 220px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 10px 25px;
    border-radius: 10px;
    border: 2px solid var(--gold);
    z-index: 100;
}

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

#message-text {
    color: var(--text-white);
    font-size: 14px;
}

/* ============ GUESS BUTTONS ============ */
#guess-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    padding: 10px;
}

#guess-buttons.hidden {
    display: none;
}

.guess-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guess-btn.higher {
    background: linear-gradient(180deg, var(--higher-color) 0%, var(--higher-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.guess-btn.lower {
    background: linear-gradient(180deg, var(--lower-color) 0%, var(--lower-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.guess-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.guess-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.guess-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.guess-icon {
    font-size: 20px;
}

/* ============ CASHOUT BUTTON ============ */
#cashout-btn {
    width: 100%;
    max-width: 280px;
    padding: 15px 20px;
    background: linear-gradient(180deg, var(--cashout-gold) 0%, var(--cashout-dark) 100%);
    border: 3px solid #fff8dc;
    border-radius: 15px;
    color: #1a1a2e;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
    transition: all 0.2s ease;
    margin: 10px 0;
    animation: cashoutPulse 1.5s ease-in-out infinite;
}

#cashout-btn.hidden {
    display: none;
}

@keyframes cashoutPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 4px 35px rgba(255, 215, 0, 0.8); }
}

#cashout-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

#cashout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

/* ============ CARD HISTORY ============ */
#card-history {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin: 5px 0;
}

.history-label {
    color: var(--text-muted);
    font-size: 12px;
}

#history-cards {
    display: flex;
    gap: 5px;
}

.history-card {
    width: 30px;
    height: 42px;
    background: var(--card-white);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.history-card.red {
    color: var(--card-red);
}

.history-card.black {
    color: var(--card-black);
}

/* ============ BETTING CONTROLS ============ */
#betting-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

#betting-controls.hidden {
    display: none;
}

.bet-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bet-label {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: bold;
}

.bet-buttons {
    display: flex;
    gap: 8px;
}

.bet-btn {
    width: 50px;
    height: 36px;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-dark) 100%);
    border: 2px solid var(--gold-dark);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.bet-btn.active {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    color: var(--bg-dark);
}

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

#start-btn {
    width: 200px;
    height: 50px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: 3px solid #fff8dc;
    border-radius: 25px;
    color: var(--bg-dark);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: all 0.2s ease;
}

#start-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6);
}

#start-btn:disabled {
    background: linear-gradient(180deg, #666 0%, #444 100%);
    border-color: #888;
    box-shadow: none;
    cursor: not-allowed;
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
}

.title-icon {
    font-size: 20px;
}

.title-text {
    color: var(--text-white);
    font-size: 16px;
    font-weight: bold;
}

/* ============ PARTICLES ============ */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    font-size: 24px;
    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: 400px) {
    .card {
        width: 85px;
        height: 120px;
    }

    .card-rank-top, .card-rank-bottom {
        font-size: 16px;
    }

    .card-suit-center {
        font-size: 32px;
    }

    .guess-btn {
        padding: 12px 20px;
        font-size: 16px;
    }

    .bet-btn {
        width: 42px;
        height: 32px;
        font-size: 12px;
    }

    #start-btn {
        width: 170px;
        height: 45px;
        font-size: 14px;
    }
}

@media (max-height: 700px) {
    #cards-section {
        padding: 5px;
    }

    .card {
        width: 80px;
        height: 112px;
    }

    #card-history {
        display: none;
    }
}
