/* Base Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Prevent text selection */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
	 -webkit-tap-highlight-color: transparent;
}

/* Remove default browser focus outlines */
*:focus,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

body {
    background-color: #111115;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    overflow: hidden; /* Hide scrollbars, we will scale the machine */
    /* Lock down mobile browser touch actions */
    touch-action: none; 
    -webkit-touch-callout: none;
}

/* Prevent image ghost-dragging */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none; /* Stops accidental taps on pure visual elements */
}

/* --- Responsive Scaling Wrapper --- */
.machine-scale-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Handles mobile browser address bars seamlessly */
    overflow: hidden; /* Prevents any accidental page scrolling */
}

/* --- Main Machine Canvas --- */
.machine-wrapper {
    position: relative;
    width: 1170px;
    height: 904px;
    
    /* THE FIX: Force the container to stay exactly this size so coordinates don't break */
    min-width: 1170px;
    min-height: 904px;
    flex-shrink: 0; 
    
    background: url('/images/bg1.jpg') center/100% 100% no-repeat; /* Perfectly maps to 1170x904 */
    transform-origin: center center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}
}

/* --- Main Logo Marquee --- */
#main-logo-container {
    position: absolute;
    top: 102px; /* Adjust up/down slightly for a perfect pixel match */
    left: 50%;
    transform: translateX(-50%);
    z-index: 15; 
    perspective: 1000px; /* Adds 3D depth to the rotation */
}

#main-logo {
    height: 95px; /* Adjust based on the exact scale of the old bg1old.jpg */
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    transform-origin: bottom center; /* Rotates backward like a physical sign */
    filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.6)); /* Matches the painted-on look */
}

/* Add this class via JavaScript when a bonus triggers */
.logo-flipped {
    transform: rotateX(90deg);
    opacity: 0;
    pointer-events: none;
}

/* --- Digital Displays Overlay --- */
.digital-display {
    position: absolute;
    height: 55px;
    color: #4ade80; /* Matrix green */
    font-family: 'Courier New', Courier, monospace;
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
    z-index: 10;
}

.balance-container {
    top: 575px;
    left: 112px;
    width: 210px;
}

.win-container {
    top: 575px;
    left: 850px;
    width: 210px;
}

/* --- Mitch Raccoon Animation --- */
#mitch-raccoon {
    position: absolute;
    bottom: -25px;
    left: 679px;
    width: 569px;
    height: auto;
    z-index: 100;
    pointer-events: none;
    filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.6));
    background-color: transparent !important;
}

/* --- Raccoon Speech Bubble --- */
.speech-bubble {
    position: absolute;
    bottom: 240px; /* Positioned above the raccoon's head */
    left: 850px;   /* Aligned slightly to the right of the raccoon */
    background: #ffffff;
    border-radius: 20px;
    padding: 15px 25px;
    max-width: 200px;
    text-align: center;
    color: #111115;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 18px;
    font-weight: bold;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.4));
    z-index: 110; /* Keep it above the raccoon (z-index: 100) */
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none; /* Prevent accidental clicks */
}

/* The cartoon "tail" of the speech bubble pointing at the raccoon */
.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 30px;
    border-width: 15px 15px 0;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    display: block;
    width: 0;
}

/* Active class toggled by JavaScript */
.speech-bubble.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* --- Invisible Interactive Buttons --- */
.overlay-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0); /* Invisible but clickable */
    border: none;
    cursor: pointer;
    z-index: 20;
    border-radius: 15px;
}

/* Remove the old simulated push-down effect */
.overlay-btn:active {
    background: transparent;
    box-shadow: none;
}

/* Use bg2.jpg as the button background.
  We match the size of the machine-wrapper, then shift the image negatively 
  by the exact left and top coordinates of the button so it aligns perfectly.
*/
.overlay-buy {
    top: 665px;     
    left: 274px;    
    width: 272px;   
    height: 116px;  
}

.overlay-spin {
    top: 665px;     
    left: 640px;    
    width: 237px;   
    height: 116px;  
}

/* The background position MUST perfectly match the negative 
   values of the new top and left coordinates above. 
*/
.overlay-buy:active {
    background-image: url('/images/bg2.jpg');
    background-size: 1170px 904px; 
    background-position: -274px -665px; 
}

.overlay-spin:active,
.overlay-spin.active-simulated {
    background-image: url('/images/bg2.jpg');
    background-size: 1170px 904px;
    background-position: -640px -665px; 
}

.overlay-speed {
    top: 675px;
    left: 1050px;
    width: 43px;
    height: 77px;
    transform: skewX(30deg);
    border-radius: 5px;
}

.overlay-vol {
    top: 675px;
    left: 78px;
    width: 45px;
    height: 75px;
    transform: skewX(328deg);
    border-radius: 5px;
}

/* Optional Mobile Repositioning if you draw the slider on mobile_bg1.jpg later */
@media (max-width: 800px), (orientation: portrait) {
	/* Map the clickable area for the mobile speed toggle */
	.overlay-speed {
        display: block !important;
        top: 889px;
        left: 450px;
        width: 31px;
        height: 63px;
        transform: skewX(20deg);
        border-radius: 5px;
	}
	.overlay-vol {
        display: block !important;
        top: 884px;
        left: 15px;
        width: 31px;
        height: 66px;
        transform: skewX(341deg);
        border-radius: 5px;
	}
}

/* --- The Main Grid Architecture --- */
.slot-frame {
    position: absolute;
    top: 205px;   
    left: 358px;  
    width: 450px; 
    height: 450px; 
    overflow: hidden; 
    z-index: 5;
    background: transparent; 
}

/* Bonus UI Overlays inside the reel frame */
.bonus-ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 10, 12, 0.9);
    z-index: 25;
    padding: 10px;
    text-align: center;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(5px);
}

.bonus-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-size: 1.2rem;
    margin-top: 5px;
}

.slot-grid {
    display: flex;
    gap: 6px; 
    width: 100%;
    height: 100%;
}

.reel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: calc(20% - 4.8px);
}

.symbol {
	 position: relative;
    width: 100%;
    height: 85.2px; 
    flex-shrink: 0;
    background: transparent;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
}

.symbol img {
    width: 85%;
    height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.5));
}

.symbol video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    z-index: 5;
    pointer-events: none;
}

/* --- Base Game Visual Effects --- */
.slot-frame.has-win .symbol:not(.win-pulse):not(.scatter-trigger-pulse) {
    opacity: 0.3;
    filter: grayscale(80%);
    transition: all 0.3s ease;
}

.symbol.win-pulse {
    animation: winPulse 0.6s infinite alternate ease-in-out;
    z-index: 10;
    background: rgba(243, 156, 18, 0.2);
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.8), inset 0 0 15px rgba(243, 156, 18, 0.5);
    border: 2px solid #f39c12;
}

@keyframes winPulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

.symbol.scatter-trigger-pulse {
    z-index: 20;
    animation: scatterExplode 0.5s ease-in-out infinite alternate;
    box-shadow: 0 0 30px #ff003c, inset 0 0 20px #ff003c;
    border: 3px solid #ff003c;
    background: rgba(74, 0, 0, 0.8);
}

@keyframes scatterExplode {
    0% { transform: scale(1) rotate(-3deg); }
    100% { transform: scale(1.25) rotate(3deg); }
}

/* --- The Vault Bonus CSS --- */
.slot-frame.vault-mode {
    border-color: #ff3366;
    box-shadow: inset 0 0 40px rgba(255, 51, 102, 0.3);
}

/* --- External Vault Bonus UI --- */

/* Independent Bonus Stats */
.external-spins-container {
    top: 195px;       
    left: 135px;       
    width: 175px;
    font-size: 22px;
}

.external-multiplier-container {
    top: 195px;       
    left: 860px;      /* Symmetrically aligned to the right side */
    width: 175px;
    font-size: 22px;
}

.symbol.empty-cell img { display: none; }
.symbol.empty-cell { background: rgba(0,0,0,0.5); }

.symbol.locked-coin {
    position: relative;
    animation: lockIn 0.4s cubic-bezier(0.2, 1.1, 0.2, 1);
    background: rgba(243, 156, 18, 0.2);
}

.symbol.locked-coin::after {
    content: attr(data-multiplier) 'x';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 900;
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 2px 2px 0px #000, -1px -1px 0px #000, 0 0 10px #000;
    z-index: 5;
}

@keyframes lockIn {
    0% { transform: scale(2); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- The Ban Hammer Bonus CSS --- */
.slot-frame.ban-hammer-mode {
    box-shadow: inset 0 0 40px rgba(155, 89, 182, 0.3);
}

.sticky-overlay-cell { background: transparent; box-shadow: none; }

.symbol.locked-wild {
    background: rgba(35, 35, 44, 0.8);
    box-shadow: 0 0 25px rgba(155, 89, 182, 0.8), inset 0 0 15px rgba(155, 89, 182, 0.5);
    border: 2px solid #9b59b6;
    animation: banHammerSlam 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes banHammerSlam {
    0% { transform: scale(3) translateY(-50px); opacity: 0; filter: blur(5px); }
    50% { transform: scale(0.8); opacity: 1; filter: blur(0); }
    100% { transform: scale(1); }
}

/* --- Stream Snipe Bonus CSS --- */
.slot-frame.stream-snipe-mode {
    box-shadow: inset 0 0 40px rgba(0, 255, 204, 0.3);
}

.multiplier-pop { animation: snipePop 0.5s ease-out; }
@keyframes snipePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.6); text-shadow: 0 0 30px #00ffcc, 0 0 50px #fff; }
    100% { transform: scale(1); }
}

/* --- Buy Menu Modal CSS --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1a1a20;
    padding: 30px;
    border-radius: 12px;
    border: 2px solid #2a2a35;
    text-align: center;
    width: 800px; max-width: 95%;
}

.buy-cards-container { display: flex; gap: 15px; margin-bottom: 25px; }

.buy-card {
    flex: 1; background: #0a0a0c; padding: 20px; border-radius: 8px;
    border: 1px solid #333; display: flex; flex-direction: column; gap: 10px;
}

.buy-card p { color: #a0a0b0; font-size: 0.9rem; margin-bottom: 10px; }

.purchase-btn {
    background: #2ecc71; color: #111; border: none; padding: 10px;
    font-weight: bold; border-radius: 4px; cursor: pointer; transition: 0.2s;
}
.purchase-btn:hover { background: #27ae60; transform: scale(1.05); }

.close-btn {
    background: transparent; color: #a0a0b0; border: 1px solid #a0a0b0;
    padding: 10px 30px; cursor: pointer; border-radius: 4px;
}

/* --- Award Screen Overlays --- */
#award-screen-modal {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex; 
    justify-content: center; 
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(8px);
}

.award-image-container {
    position: relative;
    width: 800px;
    max-width: 90vw;
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
}

.award-image-container img {
    width: 100%;
    display: block;
    border-radius: 12px;
}

#award-text-cover {
    position: absolute;
    bottom: 2%;
    left: 30%;
    width: 40%;
    height: 7%;
    background-color: #1a1a20;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 1);
    z-index: 10;
}

#award-win-amount {
    font-family: 'Courier New', Courier, monospace;
    font-size: min(4vw, 2.4rem);
    font-weight: 900;
    color: #f1c40f;
    text-shadow: 2px 2px 0px #000;
}

.click-to-continue {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 1s infinite alternate;
    text-shadow: 0 0 10px rgba(255,255,255,0.5);
    pointer-events: none; /* Let the click pass through to the container */
	 text-align: center;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* --- Splash Screen Overlay --- */
#splash-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: url('images/splash_bg.jpg') center/100% 100% no-repeat; /* Matches the main wrapper */
    z-index: 50; 
    cursor: pointer;
}

/* We need to elevate the main logo permanently so it sits on top of the splash screen */
#main-logo-container {
    position: absolute;
    top: 102px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 55; /* Bumped from 15 to 55 to clear the splash overlay */
    perspective: 1000px;
} cursor: pointer;
}

/* Hide all UI elements when splash is active */
.machine-wrapper.splash-active #main-logo-container,
.machine-wrapper.splash-active .digital-display,
.machine-wrapper.splash-active .overlay-btn,
.machine-wrapper.splash-active .slot-frame,
.machine-wrapper.splash-active #vault-external-ui,
.machine-wrapper.splash-active #ban-external-ui,
.machine-wrapper.splash-active #stream-external-ui {
    display: none !important;
}

/* =========================================
   MOBILE RESPONSIVE LAYOUT
   ========================================= */
@media (max-width: 800px), (orientation: portrait) {
    
	 /* Mobile Splash Override */
    #splash-overlay {
        background: url('images/splash_mobile_bg.jpg') center/100% 100% no-repeat;
    }
	 
    /* 1. Lock dimensions and scale to fit without cropping */
    .machine-wrapper {
        width: 500px;
        height: 1000px;
        min-width: 500px;
        min-height: 1000px;
        background: url('images/mobile_bg1.jpg') center/100% 100% no-repeat;
        
        /* The Fix: Scale by whichever is smaller, width or height.
           This guarantees the entire 500x1000 box fits on screen without clipping. */
        transform-origin: center center;
    }

    /* 2. Top Screens (Bonus UI Stats: Spins / Multipliers) */
    .external-spins-container,
    .external-multiplier-container {
        height: 120px;
        font-size: 24px;
        justify-content: center;
    }
    .external-spins-container { top: 34px !important; left: 25px !important; width: 210px !important; }
    .external-multiplier-container { top: 34px !important; left: 265px !important; width: 210px !important; }

    /* 3. Logo Marquee Banner */
    #main-logo-container {
        top: 212px; /* Aligned into the top metal bezel */
        /*transform: translate(-50%, -50%) scale(0.68); */
    }

    /* 4. The Main Slot Grid */
    .slot-frame {
        top: 339px;
        left: 50%;
        width: 450px;
        height: 450px;
        transform: translateX(-50%) scale(0.74);
        transform-origin: top center;
    }

    /* 5. Bottom Screens (Balance / Win) */
    .balance-container {
		  top: 728px;
        left: 29px;
        width: 210px;
        height: 100px;
        font-size: 26px;
    }
    .win-container {
        top: 728px;
        left: 265px;
        width: 210px;
        height: 100px;
        font-size: 26px;
    }
	 #award-text-cover {
		 left: 23%;
		 width: 54%;
		 height: 11%;
		 scale: 78%;
		 bottom: 0;
	 }
	 
	/* --- Mitch Raccoon Animation --- */
	#mitch-raccoon {
        top: 797px;
        left: 155px;
        width: 215px;
	}
	
	.speech-bubble {
	  bottom: auto;
	  top: 720px; 
	  left: 220px;
	  font-size: 14px;
	  padding: 10px 15px;
	}

    /* 6. Physical Push Buttons */
    .overlay-buy { top: 909px; left: 63px; width: 167px; height: 83px; }
    .overlay-spin { top: 909px; left: 277px; width: 160px; height: 83px; }

    /* Touch Feedback using mobile_bg2.png */
    .overlay-buy:active {
        background-color: transparent;
        background-image: url('images/mobile_bg2.png');
        background-size: 500px 1000px;
        background-position: -63px -909px; 
        border-radius: 15px;
    }

    .overlay-spin:active,
	.overlay-spin.active-simulated {
		 background-color: transparent;
		 background-image: url('images/mobile_bg2.png');
		 background-size: 500px 1000px;
		 background-position: -277px -909px; 
		 border-radius: 15px;
	}
	 /* 7. Award Screen Mobile Fixes */
    .click-to-continue {
        white-space: nowrap;       /* Forces the text to stay on one single line */
        font-size: min(4vw, 14px); /* Scales the font down seamlessly on narrow phones */
        bottom: -35px;             /* Keeps it neatly tucked below the image */
        letter-spacing: 1px;
    }
	 /* 8. Feature Drop Modal Mobile Fix */
    .modal-content {
        padding: 20px 15px; 
        max-height: 95vh;
        overflow-y: auto; /* Adds a scrollbar if the phone is exceptionally short */
    }
    
    .buy-cards-container {
        flex-direction: column; /* Stacks the cards vertically */
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .buy-card {
        padding: 15px; /* Slightly tighter padding to save vertical space */
    }
}