/* ============================================
   GLHF Game - Roulette v2 (Premium redesign)
   ============================================ */

.game-page--roulette {
    --game-accent:     #d4af37;
    --game-accent-rgb: 212, 175, 55;
    --rou-red:         #c0392b;
    --rou-red-dark:    #8b0000;
    --rou-red-glow:    rgba(192, 57, 43, 0.6);
    --rou-black:       #1a1a1a;
    --rou-gold:        #d4af37;
    --rou-gold-light:  #f5d680;
    --rou-gold-dark:   #a07820;
    --rou-gold-metal:  linear-gradient(135deg, #f5d680 0%, #d4af37 35%, #a07820 65%, #d4af37 100%);
    --rou-felt:        #0d3020;
    --rou-felt-dark:   #071a10;
    --rou-wheel-size:  360px;
    --rou-track-size:  calc(var(--rou-wheel-size) + 60px);
    --rou-rim-size:    calc(var(--rou-track-size) + 20px);
}

/* ─── Table felt background ─────────────────── */
.roulette-table {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--rou-rim-size);
    height: var(--rou-rim-size);
    max-width: 100%;
    margin: 0 auto 2.5rem;
    background: radial-gradient(ellipse at center, #0f3d24 0%, var(--rou-felt-dark) 70%);
    border-radius: 50%;
    box-shadow:
        0 0 0 6px #0a2015,
        0 0 0 10px #1c4030,
        0 20px 80px rgba(0,0,0,0.8),
        inset 0 0 40px rgba(0,0,0,0.6);
}

/* Felt texture overlay */
.roulette-table::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,0.015) 2px,
        rgba(255,255,255,0.015) 4px
    );
    pointer-events: none;
}

/* ─── Wheel assembly ─────────────────────────── */
.roulette-wheel-assembly {
    position: relative;
    width: var(--rou-rim-size);
    height: var(--rou-rim-size);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Outer gold rim ─────────────────────────── */
.roulette-rim-outer {
    position: relative;
    width: var(--rou-track-size);
    height: var(--rou-track-size);
    border-radius: 50%;
    background: var(--rou-gold-metal);
    box-shadow:
        0 0 0 3px #1a0e00,
        0 0 30px rgba(212,175,55,0.4),
        inset 0 2px 6px rgba(255,255,255,0.3),
        inset 0 -2px 6px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Decorative rivets on rim */
.roulette-rim-outer::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 2px dashed rgba(0,0,0,0.25);
    pointer-events: none;
}

/* ─── Ball track ─────────────────────────────── */
.roulette-ball-track {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.4);
    pointer-events: none;
}

/* ─── Ball ───────────────────────────────────── */
.roulette-ball {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, #cccccc 50%, #888888);
    box-shadow:
        0 2px 6px rgba(0,0,0,0.8),
        inset 0 1px 2px rgba(255,255,255,0.9);
    transform-origin: 50% 50%;
    will-change: transform;
    transition: none;
    z-index: 20;
}

/* ─── Inner spinning wheel ───────────────────── */
.roulette-wheel {
    position: relative;
    width: var(--rou-wheel-size);
    height: var(--rou-wheel-size);
    border-radius: 50%;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    background: conic-gradient(
        #8b0000   0deg   45deg,
        #1a1a1a  45deg   90deg,
        #8b0000  90deg  135deg,
        #1a1a1a 135deg  180deg,
        #8b0000 180deg  225deg,
        #1a1a1a 225deg  270deg,
        #8b0000 270deg  315deg,
        #1a1a1a 315deg  360deg
    );
    box-shadow:
        0 0 0 4px var(--rou-gold-dark),
        inset 0 0 30px rgba(0,0,0,0.6);
}

/* Glossy highlight overlay */
.roulette-wheel::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at 40% 30%, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
    z-index: 10;
}


/* ─── Gold spokes ────────────────────────────── */
.roulette-spoke {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--rou-gold) 0%, var(--rou-gold-dark) 100%);
    transform-origin: 0 50%;
    transform: rotate(var(--spoke-angle));
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.7);
}

/* ─── Center hub ─────────────────────────────── */
.roulette-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--rou-gold-metal);
    transform: translate(-50%, -50%);
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 0 3px var(--rou-gold-dark),
        0 0 0 5px #0a0a0a,
        0 4px 12px rgba(0,0,0,0.8),
        inset 0 2px 4px rgba(255,255,255,0.4);
}

.roulette-hub-label {
    font-family: var(--glhf-font-heading);
    font-weight: 900;
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: #2a1800;
    text-transform: uppercase;
    user-select: none;
}

/* Idle glow pulse on wheel */
@keyframes wheelBreath {
    0%, 100% { box-shadow: 0 0 20px rgba(212,175,55,0.2), inset 0 0 30px rgba(0,0,0,0.6); }
    50%       { box-shadow: 0 0 40px rgba(212,175,55,0.4), inset 0 0 30px rgba(0,0,0,0.6); }
}
.roulette-wheel:not(.spinning) {
    animation: wheelBreath 3s ease-in-out infinite;
}

/* Spinning glow burst */
.roulette-wheel.spinning {
    animation: none;
    box-shadow:
        0 0 60px rgba(212,175,55,0.5),
        0 0 120px rgba(212,175,55,0.2),
        inset 0 0 30px rgba(0,0,0,0.4);
}

/* ─── Bet area ───────────────────────────────── */
.roulette-bet-area {
    text-align: center;
    margin-bottom: 1.75rem;
    position: relative;
    z-index: 1;
}

.roulette-bet-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--glhf-text-muted);
    margin-bottom: 0.9rem;
}

.roulette-color-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.roulette-color-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.75rem;
    border-radius: var(--glhf-radius-md);
    font-family: var(--glhf-font-heading);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: rgba(255,255,255,0.04);
    color: var(--glhf-text-secondary);
}

.roulette-color-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}

.roulette-color-btn--red .roulette-color-swatch {
    background: linear-gradient(135deg, var(--rou-red), var(--rou-red-dark));
    box-shadow: 0 0 6px var(--rou-red-glow);
}

.roulette-color-btn--black .roulette-color-swatch {
    background: linear-gradient(135deg, #333, #0a0a0a);
    border: 1px solid #555;
}

.roulette-color-btn:hover:not(:disabled) {
    border-color: var(--rou-gold);
    color: var(--rou-gold);
    background: rgba(212,175,55,0.06);
    box-shadow: 0 0 12px rgba(212,175,55,0.2);
}

.roulette-color-btn.selected {
    border-color: var(--rou-gold);
    color: var(--rou-gold);
    background: rgba(212,175,55,0.12);
    box-shadow: 0 0 20px rgba(212,175,55,0.3), inset 0 0 6px rgba(212,175,55,0.08);
}

.roulette-color-btn--red.selected {
    border-color: var(--rou-red);
    color: #ff6b5a;
    background: rgba(192,57,43,0.15);
    box-shadow: 0 0 20px var(--rou-red-glow), inset 0 0 6px rgba(192,57,43,0.1);
}

/* ─── Spin button override ───────────────────── */
.roulette-spin-btn {
    font-size: 1.3rem;
    letter-spacing: 4px;
    position: relative;
    z-index: 1;
    margin-bottom: 0.75rem;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    min-width: 280px;
    width: 280px;
    max-width: 90vw;
    white-space: nowrap;
}

/* Power fill layer (bright golden sweep) */
.roulette-spin-btn::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--power, 0) * 100%);
    background: linear-gradient(
        90deg,
        rgba(212, 175, 55, 0.55) 0%,
        rgba(245, 214, 128, 0.85) 60%,
        rgba(212, 175, 55, 0.65) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Keep text above the fill */
.roulette-spin-btn > * {
    position: relative;
    z-index: 1;
}

/* Charging: override background so fill is visible, add glow + pulse scale */
.roulette-spin-btn.charging {
    background: rgba(var(--game-accent-rgb, 212, 175, 55), 0.04) !important;
    border-color: var(--rou-gold) !important;
    color: #fff !important;
    box-shadow:
        0 0 20px rgba(212, 175, 55, 0.5),
        0 0 50px rgba(212, 175, 55, 0.2);
    animation: chargePulse 0.35s ease-in-out infinite alternate;
}

@keyframes chargePulse {
    from { transform: scale(1); }
    to   { transform: scale(1.03); }
}

/* ─── Power indicator bar ────────────────────── */
.roulette-power-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.roulette-power-bar {
    width: 280px;
    max-width: 90%;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.roulette-power-fill {
    height: 100%;
    width: 0%;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        #a00000 0%,
        #c0392b 25%,
        #e67e22 55%,
        #d4af37 80%,
        #f5d680 100%
    );
    box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
    transition: width 0ms;
}

.roulette-power-hint {
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    color: var(--glhf-text-muted);
    text-transform: uppercase;
    opacity: 0.7;
}

/* ─── Sound toggle ───────────────────────────── */
.roulette-sound-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--glhf-text-muted);
    transition: all 0.2s ease;
    z-index: 5;
}

.roulette-sound-btn:hover {
    background: rgba(212,175,55,0.1);
    border-color: rgba(212,175,55,0.3);
    color: var(--rou-gold);
}

.roulette-sound-btn.sound-off {
    color: var(--glhf-danger);
    opacity: 0.6;
}

/* ─── Result overlay ─────────────────────────── */
.roulette-result-overlay {
    position: absolute;
    inset: 0;
    border-radius: var(--glhf-radius-xl);
    background: rgba(5, 10, 8, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: overlayIn 0.3s ease;
    cursor: pointer;
}

@keyframes overlayIn {
    from { opacity: 0; backdrop-filter: blur(0); }
    to   { opacity: 1; backdrop-filter: blur(4px); }
}

.roulette-result-overlay::after {
    content: 'Натисніть, щоб продовжити';
    position: absolute;
    bottom: 1.5rem;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--glhf-text-muted);
    text-transform: uppercase;
}

.roulette-result-box {
    text-align: center;
    padding: 2rem;
    animation: resultPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes resultPop {
    from { transform: scale(0.6); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.roulette-result-icon {
    font-size: 4rem;
    line-height: 1;
    margin-bottom: 1rem;
}

.roulette-result-title {
    font-family: var(--glhf-font-heading);
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3rem);
    text-transform: uppercase;
    letter-spacing: 4px;
    line-height: 1;
    margin-bottom: 0.75rem;
}

.roulette-result-title--win {
    background: var(--rou-gold-metal);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(212,175,55,0.5));
}

.roulette-result-title--loss {
    color: var(--rou-red);
    text-shadow: 0 0 20px rgba(192,57,43,0.5);
}

.roulette-result-change {
    font-family: var(--glhf-font-heading);
    font-weight: 800;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.roulette-result-change--win { color: var(--rou-gold); }
.roulette-result-change--loss { color: var(--rou-red); }

.roulette-result-balance {
    font-size: 0.9rem;
    color: var(--glhf-text-muted);
}

/* ─── Gold confetti particles ────────────────── */
.roulette-confetti {
    position: fixed;
    top: -10px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall var(--fall-dur, 2.5s) ease-in var(--fall-delay, 0s) forwards;
}

@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg) translateX(0); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg) translateX(var(--sway, 60px)); opacity: 0; }
}

/* ─── Arena glow states ──────────────────────── */
.roulette-arena--win {
    border-color: rgba(212,175,55,0.5) !important;
    box-shadow: inset 0 0 80px rgba(212,175,55,0.06), 0 0 40px rgba(212,175,55,0.15) !important;
}

.roulette-arena--loss {
    border-color: rgba(192,57,43,0.4) !important;
    box-shadow: inset 0 0 80px rgba(192,57,43,0.05), 0 0 30px rgba(192,57,43,0.1) !important;
}

/* ─── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
    .game-page--roulette {
        --rou-wheel-size: 280px;
        --rou-track-size: calc(var(--rou-wheel-size) + 44px);
        --rou-rim-size: calc(var(--rou-track-size) + 16px);
    }
    .roulette-color-btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .game-page--roulette {
        --rou-wheel-size: 240px;
        --rou-track-size: calc(var(--rou-wheel-size) + 36px);
        --rou-rim-size: calc(var(--rou-track-size) + 14px);
    }
    .roulette-hub {
        width: 56px;
        height: 56px;
    }
    .roulette-hub-label {
        font-size: 0.6rem;
    }
    .roulette-color-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}
