* {
    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;
}

/* ============================================
   INTERACTIVE ENVIRONMENT - AURORA
   ============================================ */

.environment-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

/* --- AURORA ENVIRONMENT --- */
.env-aurora {
    background: linear-gradient(180deg, #0a0a1a 0%, #1a1a2e 50%, #0a0a1a 100%);
}

.env-aurora .aurora-layer {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    height: 150%;
    filter: blur(60px);
    opacity: 0.6;
    animation: auroraWave 15s ease-in-out infinite;
    transition: filter 2s ease, opacity 2s ease;
}

.env-aurora .aurora-layer:nth-child(1) {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(0,255,150,0.3) 25%, 
        rgba(0,200,255,0.2) 50%, 
        rgba(150,0,255,0.3) 75%, 
        transparent 100%);
    animation-delay: 0s;
}

.env-aurora .aurora-layer:nth-child(2) {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,0,200,0.2) 25%, 
        rgba(0,255,200,0.3) 50%, 
        rgba(200,100,255,0.2) 75%, 
        transparent 100%);
    animation-delay: -5s;
    animation-duration: 20s;
}

.env-aurora .aurora-layer:nth-child(3) {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(100,255,100,0.2) 30%, 
        rgba(255,200,0,0.15) 60%, 
        transparent 100%);
    animation-delay: -10s;
    animation-duration: 25s;
}

.env-aurora.win-active .aurora-layer {
    filter: blur(40px) brightness(2);
    opacity: 0.9;
}

@keyframes auroraWave {
    0%, 100% { 
        transform: translateX(-10%) skewX(-5deg) rotate(-2deg);
        opacity: 0.4;
    }
    25% { 
        transform: translateX(5%) skewX(3deg) rotate(1deg);
        opacity: 0.6;
    }
    50% { 
        transform: translateX(10%) skewX(-3deg) rotate(2deg);
        opacity: 0.5;
    }
    75% { 
        transform: translateX(-5%) skewX(5deg) rotate(-1deg);
        opacity: 0.7;
    }
}

/* Конфетти */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.confetti {
    position: absolute;
    top: -30px;
    animation: confettiFall linear forwards;
    will-change: transform;
}

.confetti svg {
    width: 12px;
    height: 12px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 1;
    }
    25% {
        transform: translateY(25vh) rotate(180deg) translateX(20px);
    }
    50% {
        transform: translateY(50vh) rotate(360deg) translateX(-10px);
    }
    75% {
        transform: translateY(75vh) rotate(540deg) translateX(15px);
        opacity: 0.8;
    }
    100% {
        transform: translateY(110vh) rotate(720deg) translateX(0);
        opacity: 0;
    }
}

/* 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(0,0,0,0.8) 0%, rgba(30,30,30,0.9) 100%);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 15px;
    width: 250px;
}

.slot-machine {
    position: relative;
    z-index: 100;
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 2px 0 rgba(255, 255, 255, 0.1);
    width: 400px;
    flex-shrink: 0;
    margin: 0 auto;
}

.rules-panel h3 {
    color: #ffd700;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.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(255, 215, 0, 0.2);
    border-radius: 5px;
    padding: 6px;
    margin: 2px 0;
    animation: highlightPulse 0.5s ease 3;
}

@keyframes highlightPulse {
    0%, 100% { background: rgba(255, 215, 0, 0.2); }
    50% { background: rgba(255, 215, 0, 0.5); }
}

.rules-panel .symbol-preview {
    font-size: 16px;
    margin-right: 5px;
}

.rules-panel .payout {
    color: #ffd700;
    font-weight: bold;
}

@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;
    }
    
    .game-title {
        font-size: 16px;
    }
    
    .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;
    }
}

/* 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: #ffd700;
    font-size: 22px;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.5);
    letter-spacing: 3px;
}

.rules-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    background: transparent;
    color: #ffd700;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rules-btn:hover {
    background: #ffd700;
    color: #1a1a2e;
}

/* 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 #ffd700;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mute-btn:hover {
    background: #ffd700;
}

.mute-btn.muted {
    border-color: #888;
    opacity: 0.6;
}

/* Панель результата - фиксированная высота чтобы не прыгала */
.result-panel {
    background: linear-gradient(145deg, rgba(0,0,0,0.8) 0%, rgba(30,30,30,0.9) 100%);
    border: 3px solid #444;
    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: #ffd700;
    background: linear-gradient(145deg, rgba(255,215,0,0.3) 0%, rgba(0,0,0,0.8) 100%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), inset 0 0 10px rgba(255, 215, 0, 0.3);
    animation: winPulseStrong 0.6s ease infinite;
}

.result-panel.lose {
    border-color: #ff4444;
    background: linear-gradient(145deg, rgba(255,0,0,0.2) 0%, rgba(0,0,0,0.8) 100%);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
    animation: losePulse 0.5s ease;
}

@keyframes winPulseStrong {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), inset 0 0 10px rgba(255, 215, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.9), inset 0 0 20px rgba(255, 215, 0, 0.5);
    }
}

@keyframes losePulse {
    0%, 100% { }
    50% { }
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.result-text {
    color: #888;
    font-size: 14px;
    font-weight: 600;
}

.result-panel.win .result-text {
    color: #ffd700;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.result-panel.lose .result-text {
    color: #ff6b6b;
    font-weight: 600;
}

.win-amount {
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* 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, #2a2a3e 0%, #1a1a2e 100%);
    border: 3px solid #ffd700;
    border-radius: 10px;
    position: relative;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 10px rgba(255, 215, 0, 0.3);
}

/* Payline indicator - positioned in center of slot-grid */
.payline {
    position: absolute;
    left: 10px;
    right: 10px;
    top: 98px;
    height: 4px;
    background: linear-gradient(90deg, transparent 0%, #ff0000 30%, #ff0000 70%, transparent 100%);
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 0 0 20px rgba(255, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
}

/* 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, #fff 0%, #f0f0f0 100%);
}

.symbol img {
    max-width: 70px;
    max-height: 70px;
    object-fit: contain;
}

.symbol.emoji {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Bet panel */
.bet-panel {
    background: linear-gradient(145deg, rgba(0,0,0,0.6) 0%, rgba(30,30,30,0.8) 100%);
    border: 2px solid #444;
    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: #888;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
}

.bet-input {
    background: linear-gradient(145deg, #000 0%, #1a1a1a 100%);
    border: 2px solid #ffd700;
    border-radius: 8px;
    padding: 10px;
    color: #ffd700;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    width: 100%;
}

.bet-input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.quick-bets {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}

.bet-btn {
    flex: 1;
    padding: 8px 5px;
    background: linear-gradient(145deg, #444 0%, #333 100%);
    border: 2px solid #555;
    border-radius: 6px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bet-btn:hover {
    background: linear-gradient(145deg, #555 0%, #444 100%);
    border-color: #666;
}

.bet-btn.reset-btn {
    background: linear-gradient(145deg, #c41e3a 0%, #a01729 100%);
    border-color: #e94560;
    color: #fff;
}

.bet-btn.reset-btn:hover {
    background: linear-gradient(145deg, #e94560 0%, #c41e3a 100%);
    border-color: #ff6b6b;
}

.bet-btn.active {
    background: linear-gradient(145deg, #ffd700 0%, #ffed4e 100%);
    border-color: #ffd700;
    color: #1a1a2e;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.balance-display {
    background: linear-gradient(145deg, #000 0%, #1a1a1a 100%);
    border-radius: 10px;
    padding: 15px 25px;
    border: 2px solid #ffd700;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.balance-label {
    color: #888;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.balance-value {
    color: #ffd700;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    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: #ffd700;
    font-size: 24px;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    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: 24px;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    background: linear-gradient(145deg, #e94560 0%, #c41e3a 100%);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 
        0 10px 30px rgba(233, 69, 96, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.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, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid #ffd700;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.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: #ffd700;
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.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: #1a1a2e;
    background: linear-gradient(145deg, #ffd700 0%, #ffed4e 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
}

.close-rules {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #888;
    font-size: 30px;
    cursor: pointer;
    transition: color 0.3s;
}

.close-rules:hover {
    color: #fff;
}

.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: #ffd700;
    margin-bottom: 15px;
    font-size: 18px;
}

.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: #ffd700;
    font-weight: bold;
}

.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: #ffd700;
    font-size: 16px;
    letter-spacing: 2px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 215, 0, 0.3);
    border-top-color: #ffd700;
    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(255, 215, 0, 0.5);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: inset 0 0 40px rgba(255, 215, 0, 1), 0 0 30px rgba(255, 215, 0, 0.5);
    }
}

/* Reel win animation */
.reel.win-animation {
    animation: reelWinPulse 0.5s ease 3;
}

@keyframes reelWinPulse {
    0%, 100% { 
        box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
    }
    50% { 
        box-shadow: inset 0 0 40px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 215, 0, 0.6);
    }
}
