/* ===========================
   Slot Machine Styles (Anime.js Ready)
   =========================== */

.slots-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.slots-container h1 {
    text-align: center;
    color: var(--mud-palette-warning);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.slot-machine {
    background: var(--mud-palette-background-grey);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.reels-container {
    background: var(--mud-palette-overlay-dark);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
}

.reels {
    display: flex;
    justify-content: center;
    gap: 20px;
    min-height: 150px;
    align-items: center;
}

/* ===========================
   REEL CONTAINER (Outer wrapper)
   =========================== */
.slot-reel-container {
    position: relative;
    width: 120px;
    height: 240px; /* Half-symbol (60px) + Full center (120px) + Half-symbol (60px) */
}

/* Fade overlays to dim the half-visible symbols at top and bottom */
.slot-reel-container::before,
.slot-reel-container::after {
    content: '';
    position: absolute;
    left: 4px;
    right: 4px;
    height: 60px;
    pointer-events: none;
    z-index: 2;
}

.slot-reel-container::before {
    top: 4px;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%);
    border-radius: 8px 8px 0 0;
}

.slot-reel-container::after {
    bottom: 4px;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(0, 0, 0, 0.3) 50%,
        transparent 100%);
    border-radius: 0 0 8px 8px;
}

/* Center payline indicator */
.slot-reel-container .payline-indicator {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 120px;
    border: 2px solid rgba(255, 215, 0, 0.4);
    border-radius: 4px;
    pointer-events: none;
    z-index: 3;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

/* ===========================
   SLOT REEL (Viewport with overflow hidden)
   =========================== */
.slot-reel {
    width: 120px;
    height: 240px; /* Shows: half top symbol, full center symbol, half bottom symbol */
    background: var(--mud-palette-surface);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 4px solid var(--mud-palette-primary);
    overflow: hidden; /* Critical: hides symbols outside viewport */
    position: relative;
}

/* ===========================
   REEL STRIP (Animated vertically by anime.js)
   =========================== */
.reel-strip {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* Position to show center symbol (index 6 of 12) in middle of 240px viewport 
       Center symbol top = 6 * 120 = 720px
       Viewport center = 120px (half of 240px)
       To center the symbol in viewport:
       translateY = -(centerIndex * symbolHeight - viewportHeight/2 + symbolHeight/2)
       = -(6 * 120 - 120 + 60) = -(720 - 60) = -660px
    */
    transform: translateY(-660px);
    will-change: transform; /* GPU acceleration hint */
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Motion blur during spin (CSS filter) */
.reel-strip.motion-blur {
    filter: blur(4px);
    will-change: transform, filter;
    opacity: 0.85;
}

/* Symbol blur during fast spinning - works with SVG */
.spinning .reel-symbol {
    animation: symbolBlur 0.15s infinite;
}

.spinning .slot-symbol-svg {
    filter: blur(2px);
    opacity: 0.6;
}

@keyframes symbolBlur {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===========================
   REEL SYMBOL (Individual symbol)
   =========================== */
.reel-symbol {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    user-select: none;
    flex-shrink: 0; /* Prevent symbol size changes */
}

/* ===========================
   WINNING SYMBOL GLOW
   =========================== */
.win-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 16px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, transparent 70%);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6),
                0 0 40px rgba(255, 215, 0, 0.4),
                inset 0 0 20px rgba(255, 215, 0, 0.2);
    animation: glowPulse 1.5s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

/* ===========================
   WIN MESSAGE
   =========================== */
.win-message {
    text-align: center;
    padding: 20px;
    margin: 20px 0;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 12px;
    border: 2px solid #4caf50;
    animation: winPulse 1s ease-in-out;
}

@keyframes winPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.win-message h2 {
    color: var(--mud-palette-warning);
    font-size: 32px;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.win-amount {
    color: var(--mud-palette-success);
    font-size: 36px;
    font-weight: bold;
    margin: 10px 0;
}

.loss-message {
    text-align: center;
    padding: 15px;
    margin: 20px 0;
    color: var(--mud-palette-warning);
    font-size: 18px;
}

.slot-controls {
    text-align: center;
    margin: 30px 0;
}

.btn-spin {
    background: linear-gradient(145deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 50px;
    margin-top: 20px;
    transition: all 0.3s;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn-spin:hover:not(:disabled) {
    background: linear-gradient(145deg, #ee5a6f, #ff6b6b);
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(255, 107, 107, 0.6);
}

.btn-spin:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.paytable {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    margin: 30px 0;
}

.paytable h3 {
    text-align: center;
    color: var(--mud-palette-warning);
    margin-bottom: 15px;
}

.paytable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.paytable-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.paytable-item .symbol {
    font-size: 24px;
}

.paytable-item .payout {
    color: var(--mud-palette-warning);
    font-weight: bold;
    font-size: 18px;
}

.paytable-note {
    grid-column: 1 / -1;
    text-align: center;
    color: #aaa;
    margin-top: 10px;
}

.slot-actions {
    text-align: center;
    margin-top: 20px;
}

/* Responsive Slots */
@media (max-width: 768px) {
    .reels {
        gap: 10px;
    }
    
    .slot-reel {
        width: 90px;
        height: 90px;
    }
    
    .reel-symbol {
        font-size: 48px;
    }
    
    .btn-spin {
        padding: 15px 40px;
        font-size: 20px;
    }
    
    .paytable-grid {
        grid-template-columns: 1fr;
    }
}
