* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: #0d1f0a;
}

/* ============================================
   INTERACTIVE ENVIRONMENT - FLOWER WORLD
   ============================================ */

.environment-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

/* --- FLOWER WORLD BACKGROUND --- */
.env-flower {
    background: linear-gradient(180deg,
        #0d1f0a 0%,
        #1a3a0f 20%,
        #2d5a1b 40%,
        #3d1a5c 70%,
        #1a0a2e 100%);
}

/* Nebula glow layers */
.env-flower .nebula-layer {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: nebulaPulse 12s ease-in-out infinite;
    transition: filter 2s ease, opacity 2s ease;
}

.env-flower .nebula-layer:nth-child(1) {
    width: 70vw;
    height: 70vh;
    top: -20vh;
    left: -20vw;
    background: radial-gradient(ellipse, rgba(180,80,220,0.35) 0%, rgba(80,180,80,0.2) 50%, transparent 80%);
    animation-delay: 0s;
    animation-duration: 14s;
}

.env-flower .nebula-layer:nth-child(2) {
    width: 60vw;
    height: 60vh;
    top: 30vh;
    right: -15vw;
    background: radial-gradient(ellipse, rgba(255,100,180,0.3) 0%, rgba(60,200,100,0.2) 50%, transparent 80%);
    animation-delay: -5s;
    animation-duration: 18s;
}

.env-flower .nebula-layer:nth-child(3) {
    width: 50vw;
    height: 50vh;
    bottom: -10vh;
    left: 20vw;
    background: radial-gradient(ellipse, rgba(100,220,140,0.25) 0%, rgba(200,80,150,0.2) 50%, transparent 80%);
    animation-delay: -9s;
    animation-duration: 22s;
}

.env-flower .nebula-layer:nth-child(4) {
    width: 40vw;
    height: 40vh;
    top: 10vh;
    left: 40vw;
    background: radial-gradient(ellipse, rgba(255,180,50,0.2) 0%, rgba(150,50,200,0.15) 50%, transparent 80%);
    animation-delay: -3s;
    animation-duration: 16s;
}

.env-flower.win-active .nebula-layer {
    filter: blur(50px) brightness(2.2);
    animation-duration: 4s;
}

@keyframes nebulaPulse {
    0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.7; }
    25%       { transform: scale(1.1) translate(3%, 2%); opacity: 0.9; }
    50%       { transform: scale(0.95) translate(-2%, 3%); opacity: 0.75; }
    75%       { transform: scale(1.05) translate(2%, -2%); opacity: 0.85; }
}

/* Stars */
.env-flower .star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    animation: starTwinkle linear infinite;
}

@keyframes starTwinkle {
    0%, 100% { opacity: 0.2; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.5); }
}

/* ============================================
   ЛЕПЕСТКИ (вместо конфетти)
   ============================================ */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.petal {
    position: absolute;
    top: -40px;
    border-radius: 50% 0 50% 0;
    animation: petalFall linear forwards;
    will-change: transform;
    opacity: 0.85;
    --drift: 0px;
}

@keyframes petalFall {
    0%   { transform: translateY(0)     rotate(0deg)   translateX(0)                   scale(1);    opacity: 0.9; }
    25%  { transform: translateY(25vh)  rotate(90deg)  translateX(calc(var(--drift) * 0.3))  scale(0.95); }
    50%  { transform: translateY(50vh)  rotate(200deg) translateX(calc(var(--drift) * 0.7))  scale(1.05); opacity: 0.75; }
    75%  { transform: translateY(75vh)  rotate(330deg) translateX(calc(var(--drift) * 0.9))  scale(0.9); }
    100% { transform: translateY(115vh) rotate(480deg) translateX(var(--drift))               scale(0.8); opacity: 0; }
}

/* ============================================
   СВЕТЛЯЧКИ
   ============================================ */
.firefly {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(
        circle,
        rgba(var(--fc-r), var(--fc-g), var(--fc-b), 0.95) 0%,
        rgba(var(--fc-r), var(--fc-g), var(--fc-b), 0.3) 50%,
        transparent 100%
    );
    box-shadow:
        0 0 var(--glow) rgba(var(--fc-r), var(--fc-g), var(--fc-b), 0.5),
        0 0 calc(var(--glow) * 2) rgba(var(--fc-r), var(--fc-g), var(--fc-b), 0.2);
    animation: fireflyFloat ease-in-out infinite, fireflyBlink ease-in-out infinite;
    animation-duration: inherit, calc(var(--blink-dur, 2.5s));
    will-change: transform, opacity;
}

.firefly-core {
    position: absolute;
    inset: 20%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    filter: blur(1px);
    animation: coreFlicker 0.15s ease-in-out infinite alternate;
}

@keyframes fireflyFloat {
    0%   { transform: translate(0px, 0px); }
    25%  { transform: translate(var(--dx1), var(--dy1)); }
    50%  { transform: translate(var(--dx2), var(--dy2)); }
    75%  { transform: translate(var(--dx3), var(--dy3)); }
    100% { transform: translate(0px, 0px); }
}

@keyframes fireflyBlink {
    0%,  100% { opacity: 0.15; }
    20%        { opacity: 0.9; }
    40%        { opacity: 0.4; }
    60%        { opacity: 1.0; }
    80%        { opacity: 0.3; }
}

@keyframes coreFlicker {
    0%   { opacity: 0.6; transform: scale(0.8); }
    100% { opacity: 1.0; transform: scale(1.2); }
}

/* Game container - slots centered, rules absolute positioned */
.game-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    position: relative;
    z-index: 100;
    padding: 20px;
}

.game-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 700px;
    position: relative;
}

/* Rules panel - absolute on right side, wider towards game */
.rules-panel {
    position: absolute;
    right: -170px;
    top: 0;
    display: block;
    background: linear-gradient(145deg, rgba(38, 20, 6, 0.92) 0%, rgba(28, 12, 4, 0.95) 100%);
    border: 1.5px solid rgba(180, 120, 30, 0.5);
    border-radius: 15px;
    padding: 15px;
    width: 250px;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(160, 90, 10, 0.2), inset 0 0 30px rgba(0,0,0,0.3);
}

/* ============================================
   ENCHANTED FRAME — ИГРОВОЕ ОКНО
   ============================================ */
.slot-machine {
    position: relative;
    z-index: 100;
    /* Тёплый деревянный фон */
    background:
        linear-gradient(160deg,
            rgba(42, 22, 8, 0.97) 0%,
            rgba(58, 32, 10, 0.97) 30%,
            rgba(35, 18, 6, 0.97) 70%,
            rgba(28, 12, 4, 0.97) 100%);
    border-radius: 22px;
    padding: 28px 26px 24px;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.75),
        inset 0 1px 0 rgba(255, 210, 120, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        0 0 60px rgba(180, 100, 20, 0.18),
        0 0 0 1px rgba(160, 90, 20, 0.4);
    /* Резная рамка через outline + border */
    border: 2px solid rgba(200, 140, 40, 0.55);
    width: 410px;
    flex-shrink: 0;
    margin: 0 auto;
    backdrop-filter: blur(12px);
    /* Деревянная текстура через повторяющийся градиент */
    background-image:
        repeating-linear-gradient(
            92deg,
            transparent 0px,
            transparent 3px,
            rgba(255,180,60,0.018) 3px,
            rgba(255,180,60,0.018) 4px
        ),
        linear-gradient(160deg,
            rgba(42, 22, 8, 0.97) 0%,
            rgba(58, 32, 10, 0.97) 30%,
            rgba(35, 18, 6, 0.97) 70%,
            rgba(28, 12, 4, 0.97) 100%);
}

/* SVG орнаментальная рамка поверх окна */
.slot-machine::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 23px;
    background: none;
    border: 2px solid transparent;
    background-clip: padding-box;
    pointer-events: none;
    z-index: 101;
    box-shadow:
        inset 0 0 0 1px rgba(220, 160, 50, 0.3),
        inset 0 0 20px rgba(180, 100, 10, 0.1);
}

/* Угловые цветочные украшения */
.slot-machine::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 18px;
    border: 1px solid rgba(180, 120, 30, 0.2);
    pointer-events: none;
    z-index: 101;
    background: none;
}

.rules-panel h3 {
    color: #f0c870;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 8px rgba(220, 160, 40, 0.6);
}

.rules-panel ul {
    list-style: none;
    color: #fff;
    font-size: 12px;
}

.rules-panel li {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.rules-panel li:last-child {
    border-bottom: none;
}

.rules-panel li.highlight {
    background: rgba(200, 140, 30, 0.2);
    border-radius: 5px;
    padding: 6px;
    margin: 2px 0;
    animation: highlightPulse 0.5s ease 3;
}

@keyframes highlightPulse {
    0%, 100% { background: rgba(200, 140, 30, 0.15); }
    50%       { background: rgba(220, 160, 40, 0.4); }
}

.rules-panel .symbol-preview {
    font-size: 16px;
    margin-right: 5px;
}

.rules-panel .payout {
    color: #f0c860;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(220, 160, 40, 0.5);
}

@media (max-width: 768px) {
    body {
        overflow: hidden;
        min-height: 100vh;
        height: 100vh;
    }
    
    .game-container {
        padding: 3px;
        min-height: 100vh;
        height: 100vh;
        align-items: flex-start;
        padding-top: 5px;
    }
    
    .game-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 5px;
        width: 100%;
        max-width: 100%;
    }
    
    .slot-machine {
        width: 100%;
        max-width: 360px;
        padding: 8px;
        transform: scale(0.93);
        transform-origin: top center;
    }
    
    .machine-header {
        margin-bottom: 6px;
    }
    
    .reel {
        width: 65px;
        height: 130px;
    }
    
    .reel-strip {
        transform: translateY(-32px);
    }
    
    @keyframes smoothSpin {
        0% { transform: translateY(-32px); }
        100% { transform: translateY(-98px); }
    }
    
    @keyframes reelBlur {
        0% { transform: translateY(-32px); }
        50% { transform: translateY(-34px); }
        100% { transform: translateY(-32px); }
    }
    
    .symbol {
        width: 65px;
        height: 65px;
        font-size: 32px;
    }
    
    .symbol img {
        max-width: 42px;
        max-height: 42px;
    }
    
    .slot-grid {
        gap: 4px;
        margin-bottom: 6px;
    }
    
    .payline {
        top: 63px;
        height: 3px;
    }
    
    .result-panel {
        height: 40px;
        min-height: 40px;
        max-height: 40px;
        padding: 6px 8px;
        margin-bottom: 6px;
    }
    
    .result-text {
        font-size: 11px;
    }
    
    .win-amount {
        font-size: 14px;
    }
    
    .bet-panel {
        padding: 6px;
        margin-bottom: 6px;
        gap: 6px;
    }
    
    .bet-input {
        padding: 6px;
        font-size: 14px;
    }
    
    .quick-bets {
        flex-wrap: wrap;
        gap: 0px !important;
    }
    
    .bet-btn {
        min-width: 40px;
        padding: 4px 2px;
        font-size: 9px;
    }
    
    .controls {
        gap: 8px;
    }
    
    .balance-display {
        padding: 6px 10px;
    }
    
    .balance-label {
        font-size: 9px;
        margin-bottom: 2px;
    }
    
    .balance-value {
        font-size: 14px;
    }
    
    .spin-btn {
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
    }
    
    .rules-panel {
        display: none;
    }
    
    .rules-btn {
        display: block;
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    
    .mute-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
    
    .header-buttons {
        gap: 6px;
    }
    
    .firefly {
        opacity: 0.7;
    }
    
    .petal {
        opacity: 0.7;
    }
    
    .game-title {
        font-size: 15px;
        letter-spacing: 1px;
    }
}

/* Desktop - hide modal button */
@media (min-width: 769px) {
    .rules-btn {
        display: none;
    }
    
    .rules-modal {
        display: none !important;
    }
}

.machine-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.game-title {
    color: #f5c842;
    font-size: 22px;
    font-weight: 900;
    text-shadow:
        0 2px 8px rgba(200, 120, 10, 0.8),
        0 0 30px rgba(240, 180, 50, 0.4),
        0 0 60px rgba(200, 100, 10, 0.2);
    letter-spacing: 3px;
}

.rules-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(180, 120, 30, 0.65);
    background: rgba(60, 30, 5, 0.55);
    color: #d4a030;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rules-btn:hover {
    background: rgba(100, 55, 8, 0.75);
    color: #ffe080;
    border-color: #d4a030;
    box-shadow: 0 0 12px rgba(200, 130, 20, 0.5);
}

/* Header buttons container */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Mute button */
.mute-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(180, 120, 30, 0.65);
    background: rgba(60, 30, 5, 0.55);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4a030;
}

.mute-btn:hover {
    background: rgba(100, 55, 8, 0.75);
    box-shadow: 0 0 12px rgba(200, 130, 20, 0.5);
}

.mute-btn.muted {
    border-color: #555;
    opacity: 0.45;
}

/* Панель результата - фиксированная высота чтобы не прыгала */
.result-panel {
    background: linear-gradient(145deg, rgba(18, 8, 2, 0.9) 0%, rgba(28, 13, 3, 0.92) 100%);
    border: 2px solid rgba(160, 100, 20, 0.35);
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 12px;
    text-align: center;
    height: 60px;
    min-height: 60px;
    max-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.result-panel.win {
    border-color: #d4a030;
    background: linear-gradient(145deg, rgba(140, 80, 5, 0.3) 0%, rgba(80, 45, 2, 0.25) 100%);
    box-shadow: 0 0 22px rgba(200, 140, 20, 0.65), inset 0 0 12px rgba(180, 110, 10, 0.2);
    animation: winPulseStrong 0.7s ease infinite;
}

.result-panel.lose {
    border-color: rgba(180, 60, 40, 0.6);
    background: linear-gradient(145deg, rgba(160, 40, 20, 0.18) 0%, rgba(18, 8, 2, 0.9) 100%);
    box-shadow: 0 0 12px rgba(180, 60, 30, 0.3);
    animation: losePulse 0.5s ease;
}

@keyframes winPulseStrong {
    0%, 100% { box-shadow: 0 0 22px rgba(200, 140, 20, 0.65), inset 0 0 12px rgba(180, 110, 10, 0.2); }
    50%       { box-shadow: 0 0 40px rgba(230, 170, 30, 0.9), inset 0 0 22px rgba(200, 130, 10, 0.35), 0 0 60px rgba(220, 160, 20, 0.4); }
}

@keyframes losePulse {
    0%, 100% { }
    50% { }
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.result-text {
    color: #b09060;
    font-size: 14px;
    font-weight: 600;
}

.result-panel.win .result-text {
    color: #f5d060;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(220, 160, 30, 0.8);
}

.result-panel.lose .result-text {
    color: #ff9060;
    font-weight: 600;
}

.win-amount {
    color: #ffe070;
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(220, 160, 30, 0.7), 0 0 22px rgba(200, 120, 10, 0.5);
    transition: transform 0.3s ease;
}

/* Slot grid - 3 reels horizontal */
.slot-grid {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
    position: relative;
}

/* Single reel container - shows center row full + half top/bottom (1.5 rows total) */
.reel {
    width: 100px;
    height: 200px;
    overflow: hidden;
    background:
        linear-gradient(145deg,
            rgba(20, 10, 3, 0.96) 0%,
            rgba(35, 18, 5, 0.96) 50%,
            rgba(20, 8, 2, 0.96) 100%);
    border: 2px solid rgba(190, 130, 35, 0.65);
    border-radius: 10px;
    position: relative;
    box-shadow:
        inset 0 0 25px rgba(0, 0, 0, 0.7),
        inset 0 0 8px rgba(200, 140, 30, 0.08),
        0 0 10px rgba(180, 110, 20, 0.25),
        0 4px 16px rgba(0, 0, 0, 0.5);
}

/* Payline indicator - positioned in center of slot-grid */
.payline {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 98px;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(220, 160, 40, 0.6) 15%,
        #ffd060 35%,
        #ffe88a 50%,
        #ffd060 65%,
        rgba(220, 160, 40, 0.6) 85%,
        transparent 100%);
    box-shadow:
        0 0 8px rgba(240, 180, 40, 0.9),
        0 0 18px rgba(220, 140, 20, 0.5);
    z-index: 10;
    pointer-events: none;
    animation: paylinePulse 2.5s ease-in-out infinite;
}

@keyframes paylinePulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; box-shadow: 0 0 12px rgba(255, 200, 50, 1), 0 0 28px rgba(220, 150, 20, 0.7); }
}

/* Position reel-strip to show center row in the middle with partial top/bottom */
.reel-strip {
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateY(-50px);
}

.reel-strip.spinning {
    animation: reelBlur 0.05s linear infinite;
}

/* No blur - just position change for crisp emojis */
@keyframes reelBlur {
    0% { transform: translateY(-50px); }
    50% { transform: translateY(-52px); }
    100% { transform: translateY(-50px); }
}

.symbol {
    width: 100px;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    flex-shrink: 0;
    background: linear-gradient(145deg,
        rgba(28, 14, 4, 0.5) 0%,
        rgba(45, 22, 6, 0.5) 100%);
    transition: transform 0.2s ease;
}

.symbol img {
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.symbol.emoji {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Анимации символов при выигрыше */
.symbol img.anim-spin {
    animation: symbolSpin 0.8s linear infinite;
}

.symbol img.anim-sway {
    animation: symbolSway 0.7s ease-in-out infinite;
}

@keyframes symbolSpin {
    0%   { transform: rotate(0deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1.1); }
}

@keyframes symbolSway {
    0%, 100% { transform: rotate(-15deg) scale(1.1); }
    50%       { transform: rotate(15deg)  scale(1.15); }
}

/* Bet panel */
.bet-panel {
    background: linear-gradient(145deg, rgba(30, 15, 4, 0.75) 0%, rgba(22, 10, 3, 0.8) 100%);
    border: 1.5px solid rgba(180, 120, 30, 0.35);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bet-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bet-label {
    color: #c8a060;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
}

.bet-input {
    background: linear-gradient(145deg, rgba(15, 7, 2, 0.95) 0%, rgba(25, 12, 3, 0.95) 100%);
    border: 2px solid rgba(180, 120, 30, 0.6);
    border-radius: 8px;
    padding: 10px;
    color: #f0c860;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    width: 100%;
}

.bet-input:focus {
    outline: none;
    box-shadow: 0 0 12px rgba(200, 140, 30, 0.4);
    border-color: #d4a030;
}

.quick-bets {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}

.bet-btn {
    flex: 1;
    padding: 8px 5px;
    background: linear-gradient(145deg, rgba(55, 30, 8, 0.85) 0%, rgba(40, 20, 5, 0.85) 100%);
    border: 1.5px solid rgba(160, 100, 20, 0.45);
    border-radius: 8px;
    color: #c8a060;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
}

.bet-btn:hover {
    background: linear-gradient(145deg, rgba(90, 55, 12, 0.9) 0%, rgba(70, 38, 8, 0.9) 100%);
    border-color: rgba(210, 150, 40, 0.75);
    color: #ffe090;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(160, 100, 10, 0.35);
}

.bet-btn.reset-btn {
    background: linear-gradient(145deg, rgba(120, 30, 15, 0.85) 0%, rgba(90, 18, 8, 0.85) 100%);
    border-color: rgba(200, 70, 40, 0.55);
    color: #ffaa88;
}

.bet-btn.reset-btn:hover {
    background: linear-gradient(145deg, rgba(180, 50, 25, 0.9) 0%, rgba(140, 30, 15, 0.9) 100%);
    border-color: rgba(240, 100, 60, 0.8);
    color: #fff;
    box-shadow: 0 4px 12px rgba(200, 60, 30, 0.4);
}

.bet-btn.active {
    background: linear-gradient(145deg, rgba(160, 100, 20, 0.9) 0%, rgba(120, 70, 10, 0.85) 100%);
    border-color: #d4a030;
    color: #ffe090;
    box-shadow: 0 0 10px rgba(200, 140, 20, 0.45);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.balance-display {
    background: linear-gradient(145deg, rgba(15, 7, 2, 0.95) 0%, rgba(25, 12, 3, 0.95) 100%);
    border-radius: 10px;
    padding: 15px 25px;
    border: 2px solid rgba(180, 120, 30, 0.55);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 0 18px rgba(160, 100, 10, 0.2), inset 0 0 15px rgba(0,0,0,0.3);
}

.balance-label {
    color: #c8a060;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.balance-value {
    color: #f5d060;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 0 12px rgba(220, 160, 30, 0.7), 0 0 25px rgba(200, 130, 10, 0.4);
    transition: transform 0.3s ease;
}

.balance-value.pulse {
    animation: balancePulse 0.5s ease;
}

@keyframes balancePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Win amount fly animation */
.win-fly {
    position: fixed;
    color: #ffe060;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(220, 160, 30, 0.95), 0 0 40px rgba(200, 120, 10, 0.6);
    pointer-events: none;
    z-index: 1000;
    transition: all 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.spin-btn {
    flex: 1;
    padding: 20px 40px;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    background: linear-gradient(145deg,
        #7a3a06 0%,
        #c07010 35%,
        #e09020 55%,
        #a05010 80%,
        #6a2e04 100%);
    background-size: 250% 100%;
    border: 2px solid rgba(220, 160, 40, 0.75);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.35s ease;
    text-transform: uppercase;
    text-shadow: 0 1px 4px rgba(80, 30, 0, 0.8);
    box-shadow:
        0 10px 30px rgba(100, 50, 0, 0.55),
        inset 0 2px 0 rgba(255, 220, 120, 0.25),
        inset 0 -2px 0 rgba(0, 0, 0, 0.3),
        0 0 20px rgba(180, 110, 10, 0.25);
    position: relative;
    overflow: hidden;
    animation: spinBtnGlow 3s ease-in-out infinite;
}

.spin-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -75%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,230,150,0.18), transparent);
    animation: spinBtnSheen 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes spinBtnSheen {
    0%   { left: -75%; }
    60%  { left: 125%; }
    100% { left: 125%; }
}

.spin-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 16px 42px rgba(120, 60, 0, 0.65),
        inset 0 2px 0 rgba(255, 220, 120, 0.3),
        inset 0 -2px 0 rgba(0,0,0,0.3),
        0 0 35px rgba(200, 130, 10, 0.4);
    background-position: right center;
}

.spin-btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
    box-shadow:
        0 4px 15px rgba(100, 50, 0, 0.5),
        inset 0 2px 6px rgba(0,0,0,0.4);
}

.spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

@keyframes spinBtnGlow {
    0%, 100% { box-shadow: 0 10px 30px rgba(100, 50, 0, 0.55), inset 0 2px 0 rgba(255,220,120,0.25), 0 0 20px rgba(180, 110, 10, 0.25); }
    50%       { box-shadow: 0 12px 38px rgba(140, 70, 0, 0.7),  inset 0 2px 0 rgba(255,220,120,0.35), 0 0 40px rgba(220, 150, 20, 0.4); }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, rgba(32, 16, 4, 0.97) 0%, rgba(22, 10, 3, 0.97) 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid rgba(180, 120, 30, 0.6);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(160, 100, 10, 0.2);
    animation: slideUp 0.3s ease;
    backdrop-filter: blur(12px);
}

.rules-modal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: #f5c842;
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 0 2px 15px rgba(200, 130, 20, 0.6);
}

.result-symbols {
    font-size: 50px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.result-symbols img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.result-symbols .emoji {
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

#resultMessage {
    color: #fff;
    font-size: 18px;
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-btn {
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(145deg, #7a3a06 0%, #c07010 50%, #7a3a06 100%);
    border: 2px solid rgba(200, 140, 40, 0.65);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 1px 3px rgba(60, 20, 0, 0.7);
    box-shadow: 0 6px 20px rgba(100, 50, 0, 0.45), inset 0 1px 0 rgba(255,220,120,0.2);
}

.modal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(140, 70, 0, 0.55), 0 0 20px rgba(200, 140, 20, 0.3);
}

.close-rules {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #8a6030;
    font-size: 30px;
    cursor: pointer;
    transition: color 0.3s;
}

.close-rules:hover {
    color: #f0c860;
}

.rules-image-container {
    display: none;
    margin: 20px 0;
}

.rules-image-container.active {
    display: block;
}

.rules-image-container img {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.rules-fallback {
    display: none;
}

.rules-fallback.active {
    display: block;
}

.rules-fallback h3 {
    color: #f0c860;
    margin-bottom: 15px;
    font-size: 18px;
    text-shadow: 0 0 8px rgba(200, 140, 30, 0.5);
}

.rules-fallback ul {
    list-style: none;
    text-align: left;
    color: #fff;
}

.rules-fallback li {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rules-fallback li:last-child {
    border-bottom: none;
}

.rules-fallback .symbol-preview {
    font-size: 24px;
    margin-right: 10px;
}

.rules-fallback .payout {
    color: #f0c860;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(200, 140, 30, 0.5);
}

.loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
}

.loader.active {
    display: flex;
}

.loader span {
    color: #c8a060;
    font-size: 16px;
    letter-spacing: 2px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(160, 100, 20, 0.3);
    border-top-color: #d4a030;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes spinReel {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

/* Smooth spin animation for reels */
.reel.spinning .reel-strip {
    animation: smoothSpin 0.15s linear infinite;
}

@keyframes smoothSpin {
    0% { transform: translateY(-50px); }
    100% { transform: translateY(-150px); }
}

.win-animation {
    animation: winPulse 0.5s ease 3;
}

@keyframes winPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: inset 0 0 20px rgba(180, 110, 10, 0.35);
    }
    50% {
        transform: scale(1.05);
        box-shadow: inset 0 0 40px rgba(220, 160, 20, 0.85), 0 0 30px rgba(200, 130, 10, 0.55);
    }
}

/* Reel win animation */
.reel.win-animation {
    animation: reelWinPulse 0.55s ease 3;
}

@keyframes reelWinPulse {
    0%, 100% {
        box-shadow:
            inset 0 0 25px rgba(0, 0, 0, 0.7),
            inset 0 0 8px rgba(200, 140, 30, 0.08),
            0 0 12px rgba(200, 140, 20, 0.45),
            0 4px 16px rgba(0, 0, 0, 0.5);
        border-color: rgba(220, 160, 40, 0.9);
    }
    50% {
        box-shadow:
            inset 0 0 30px rgba(180, 110, 5, 0.3),
            0 0 30px rgba(230, 170, 30, 0.85),
            0 0 60px rgba(200, 130, 10, 0.45);
        border-color: #f0c840;
    }
}
