/* Plinko Drop - Main Styles */

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

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

    /* Pegs */
    --peg-color: #00420c;
    --peg-glow: #fad900;

    /* Ball */
    --ball-color: #ffd700;
    --ball-glow: #ffeb3b;

    /* Prize pockets by multiplier */
    --slot-loss: #ef4444;
    --slot-low: #f59e0b;
    --slot-medium: #22c55e;
    --slot-high: #3b82f6;
    --slot-jackpot: #a855f7;

    /* Pocket label text — lighter tints of the tier colours, readable on the
       tinted pocket fill the tier colour itself is too dark for. */
    --slot-loss-text: #fca5a5;
    --slot-low-text: #fcd34d;
    --slot-medium-text: #86efac;
    --slot-high-text: #93c5fd;
    --slot-jackpot-text: #d8b4fe;

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

    --plinko-bg: #001201;
}

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: 5px;
    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;
}

/* ============ RISK SELECTOR ============ */
#risk-selector {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 5px;
}

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

.risk-buttons {
    display: flex;
    gap: 5px;
}

.risk-btn {
    padding: 6px 14px;
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: 15px;
    color: var(--text-white);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.risk-btn:hover {
    background: var(--bg-light);
}

.risk-btn.active {
    border-color: var(--gold);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.05) 100%);
}

.risk-btn[data-risk="low"].active {
    border-color: var(--slot-medium);
}

.risk-btn[data-risk="medium"].active {
    border-color: var(--gold);
}

.risk-btn[data-risk="high"].active {
    border-color: var(--slot-jackpot);
}

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

/* ============ PLINKO BOARD ============ */
#plinko-board {
    flex: 1;
    width: 100%;
    max-width: 420px;
    position: relative;
    background: var(--plinko-bg);
    border-radius: 15px;
    border: 3px solid var(--bg-light);
    overflow: hidden;
    margin: 5px 0;
}

/* Drop zone */
#drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

/* Ball */
.ball {
    width: 18px;
    height: 18px;
    background: radial-gradient(circle at 30% 30%, var(--ball-glow), var(--ball-color), #b8860b);
    border-radius: 50%;
    position: absolute;
    z-index: 100;
    box-shadow:
        0 0 10px var(--ball-glow),
        0 0 20px rgba(255, 215, 0, 0.5),
        inset 0 -3px 6px rgba(0, 0, 0, 0.3);
    transition: none;
}

.ball.hidden {
    display: none;
}

/* Pegs container */
#pegs-container {
    position: absolute;
    top: 25px;
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    z-index: 10;
}

/* Individual peg */
.peg {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle at 30% 30%, var(--peg-glow), var(--peg-color));
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.15s ease;
}

.peg.hit {
    background: radial-gradient(circle at 30% 30%, #fff, var(--peg-glow));
    box-shadow: 0 0 15px var(--peg-glow);
    transform: translate(-50%, -50%) scale(1.3);
}

/* Prize pockets container */
#slots-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 0 5px;
    gap: 2px;
    z-index: 5;
}

/* Individual pocket */
.slot {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
    border-radius: 5px 5px 0 0;
    border: 1px solid var(--bg-light);
    border-bottom: none;
    transition: all 0.2s ease;
    min-width: 0;
}

.slot-multiplier {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

/* Pocket colors by multiplier tier */
.slot[data-tier="loss"] {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.3) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-color: var(--slot-loss);
}
.slot[data-tier="loss"] .slot-multiplier { color: var(--slot-loss-text); }

.slot[data-tier="low"] {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.3) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-color: var(--slot-low);
}
.slot[data-tier="low"] .slot-multiplier { color: var(--slot-low-text); }

.slot[data-tier="medium"] {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0.1) 100%);
    border-color: var(--slot-medium);
}
.slot[data-tier="medium"] .slot-multiplier { color: var(--slot-medium-text); }

.slot[data-tier="high"] {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: var(--slot-high);
}
.slot[data-tier="high"] .slot-multiplier { color: var(--slot-high-text); }

.slot[data-tier="jackpot"] {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.4) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-color: var(--slot-jackpot);
}
.slot[data-tier="jackpot"] .slot-multiplier {
    color: var(--slot-jackpot-text);
    font-size: 11px;
}

.slot.winner {
    animation: slotWin 0.5s ease infinite;
}

@keyframes slotWin {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============ WIN DISPLAY ============ */
#win-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.95) 0%, rgba(184, 134, 11, 0.95) 100%);
    padding: 15px 30px;
    border-radius: 15px;
    border: 3px solid #fff8dc;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.8);
    z-index: 200;
    text-align: center;
    animation: winPopup 0.4s ease;
}

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

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

.win-label {
    display: block;
    color: #8b0000;
    font-size: 24px;
    font-weight: bold;
}

#win-amount {
    display: block;
    color: var(--bg-dark);
    font-size: 28px;
    font-weight: bold;
}

#win-multiplier {
    display: block;
    color: #8b0000;
    font-size: 16px;
    font-weight: bold;
}

/* ============ MESSAGE DISPLAY ============ */
#message-display {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(220, 20, 60, 0.9);
    padding: 8px 20px;
    border-radius: 8px;
    border: 2px solid var(--gold);
    z-index: 200;
}

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

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

/* ============ BET CONTROLS ============ */
#bet-controls {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 5px;
}

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

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

.bet-btn {
    width: 45px;
    height: 32px;
    background: linear-gradient(180deg, #003a0a 0%, #001201 100%);
    border: 2px solid var(--gold-dark);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 12px;
    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;
}

/* ============ DROP BUTTON ============ */
#drop-button {
    width: 180px;
    height: 48px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
    border: 3px solid #fff8dc;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    transition: all 0.2s ease;
    margin: 5px 0;
}

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

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

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

.drop-text {
    color: var(--bg-dark);
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
}

#drop-button:disabled .drop-text {
    color: #888;
}

#drop-button.pulse {
    animation: buttonPulse 2s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 4px 35px rgba(255, 215, 0, 0.9); }
}

/* ============ GAME TITLE ============ */
.game-title {
    display: flex;
    align-items: center;
    gap: 6px;
    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: 20px;
    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) {
    #plinko-board {
        max-width: 340px;
    }

    .peg {
        width: 8px;
        height: 8px;
    }

    .ball {
        width: 14px;
        height: 14px;
    }

    .slot-multiplier {
        font-size: 10px;
    }

    .bet-btn {
        width: 40px;
        height: 28px;
        font-size: 11px;
    }

    #drop-button {
        width: 150px;
        height: 42px;
    }

    .drop-text {
        font-size: 16px;
    }
}

@media (max-height: 750px) {
    #plinko-board {
        max-height: 400px;
    }

    #slots-container {
        height: 38px;
    }

    .slot-multiplier {
        font-size: 10px;
    }
}

.risk-btn.active, .risk-btn.active:hover { background: oklch(0.88 0.12 90); color: oklch(0.24 0.04 150); }
.risk-label, .bet-label { color: oklch(0.35 0.04 150); }

#bet-controls .bet-label { color: oklch(0.35 0.04 150) !important; text-shadow: none !important; }
