@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* =========================================
   1. BASE RESET & TYPOGRAPHY
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

*: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;
    touch-action: none; 
    -webkit-touch-callout: none;
}

img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Feature Colors */
.text-vault { color: #ff3366; }
.text-banhammer { color: #9b59b6; }
.text-snipe { color: #00ffcc; }

/* General Utilities */
.stat-pad-r { margin-right: 8px; }
.stat-pad-l { margin-left: 8px; }

/* =========================================
   2. MAIN LAYOUT & MACHINE CANVAS
   ========================================= */
.machine-scale-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh; 
    overflow: hidden; 
}

.machine-wrapper {
    position: relative;
    width: 1170px;
    height: 904px;
    min-width: 1170px;
    min-height: 904px;
    flex-shrink: 0; 
    background: url('/images/bg1.jpg') center/100% 100% no-repeat; 
    transform-origin: center center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

/* NEW: Desktop Replay Background */
.machine-wrapper.replay-active {
    background: url('images/replay_bg.jpg') center/100% 100% no-repeat; 
}

#main-logo-container {
    position: absolute;
    top: 102px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 51; 
    perspective: 1000px; 
}

#main-logo {
    height: 95px; 
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s ease;
    transform-origin: bottom center; 
    filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.6)); 
}

.logo-flipped {
    transform: rotateX(90deg);
    opacity: 0;
    pointer-events: none;
}

#splash-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: url('images/splash_bg.jpg') center/100% 100% no-repeat; 
    z-index: 50; 
    cursor: pointer;
}

/* Hide 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;
}

/* =========================================
   3. DIGITAL DISPLAYS & SCREENS
   ========================================= */
.digital-display {
    position: absolute;
    height: 55px;
    color: #4ade80; 
    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;
}

/* =========================================
   4. INTERACTIVE OVERLAYS & BUTTONS
   ========================================= */
.state-toggle-img {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    z-index: 18;
}

.overlay-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0); 
    border: none;
    cursor: pointer;
    z-index: 20;
    border-radius: 15px;
}

.overlay-btn:active {
    background: transparent;
    box-shadow: none;
}

.overlay-buy { top: 665px; left: 274px; width: 272px; height: 116px; }
.overlay-spin { top: 665px; left: 640px; width: 237px; height: 116px; }

.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;
}

.overlay-options {
    top: 354px;
    left: 242px; 
    width: 105px;
    height: 120px;
    border-radius: 12px;
}

.overlay-leaderboard {
    top: 354px;
    left: 823px;
    width: 105px;
    height: 120px;
    border-radius: 12px;
}

.overlay-giveaway {
    top: 479px;
    left: 850px;
    width: 70px;
    height: 63px;
    border-radius: 12px;
	 display: none;
}

/* Lightning Hover States */
.overlay-options:hover,
.overlay-leaderboard:hover,
.overlay-giveaway:hover {
    background-color: transparent;
    background-image: url('images/bg_lightning.png');
    background-size: 1170px 904px;
    cursor: pointer;
}

.overlay-options:hover { background-position: -242px -354px; }
.overlay-leaderboard:hover { background-position: -823px -354px; }
.overlay-giveaway:hover { background-position: -850px -479px; }

/* Disable hover effects and interactions during replays */
.machine-wrapper.replay-active .overlay-options,
.machine-wrapper.replay-active .overlay-leaderboard,
.machine-wrapper.replay-active .overlay-giveaway {
    pointer-events: none !important;
    display: none !important;
}

/* =========================================
   5. SLOT GRID & SYMBOLS
   ========================================= */
.slot-frame {
    position: absolute;
    top: 210px;   /* Adjust this by a few pixels if it needs to move up or down */
    left: 50%;    /* Centers the frame dynamically */
    width: 515px; /* Keep original base width */
    height: 450px; /* Keep original base height */
    
    /* Shrinks the entire frame and its contents by 15% */
    transform: translateX(-50%) scale(0.85); 
    transform-origin: top center; 
    
    overflow: hidden; 
    z-index: 5;
    
    /* --- NEW MASKING CSS --- */
    -webkit-mask-image: url('images/mask_mainconsole.png');
    mask-image: url('images/mask_mainconsole.png');
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.slot-grid {
    display: flex;
    gap: 6px; 
    width: 100%;
    height: 100%;
}

#sticky-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    pointer-events: none; 
    z-index: 15;
}

.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;
}

.symbol.empty-cell img { display: none; }
.symbol.empty-cell { background: rgba(0,0,0,0.5); }

/* Win Animations */
.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); }
}

/* Static Tease Layer (RED GLOW) */
.tease-highlight-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    gap: 6px;
    pointer-events: none;
    z-index: 12; /* Above the spinning reels, below sticky overlays */
}

.tease-col {
    width: calc(20% - 4.8px);
    height: 100%;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tease-col.active-tease {
    opacity: 1;
    animation: teaseGlow 0.4s infinite alternate ease-in-out;
}

@keyframes teaseGlow {
    0% { 
        box-shadow: inset 0 0 20px rgba(255, 0, 50, 0.3);
        background: rgba(255, 0, 50, 0.05);
    }
    100% { 
        box-shadow: inset 0 0 80px rgba(255, 0, 50, 0.9), 0 0 20px rgba(255, 0, 50, 0.5);
        background: rgba(255, 0, 50, 0.25);
    }
}

/* Dim inactive symbols, but EXCLUDE the landed scatters */
.slot-frame.teasing .reel:not(.tease-spinning) .symbol:not(.tease-scatter) {
    filter: grayscale(80%) brightness(0.5);
    transition: filter 0.3s ease;
}

/* Make the landed scatters pop and pulse red during the tease */
.slot-frame.teasing .reel:not(.tease-spinning) .symbol.tease-scatter {
    filter: none;
    z-index: 25;
    animation: teaseScatterPop 0.4s infinite alternate ease-in-out;
}

@keyframes teaseScatterPop {
    0% { 
        transform: scale(1); 
        box-shadow: 0 0 15px rgba(255, 0, 50, 0.4); 
        border-radius: 8px; 
    }
    100% { 
        transform: scale(1.15); 
        box-shadow: 0 0 35px rgba(255, 0, 50, 0.9), inset 0 0 10px rgba(255, 0, 50, 0.4); 
        border-radius: 8px; 
        background: rgba(255, 0, 50, 0.15); 
    }
}

/* =========================================
   6. BONUS MODES & EXTERNAL UI
   ========================================= */
.external-ui-layer {
    display: none; 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    z-index: 15;
}

.external-spins-container {
    top: 195px;       
    left: 135px;       
    width: 175px;
    font-size: 22px;
}

.external-multiplier-container {
    top: 195px;       
    left: 860px;      
    width: 175px;
    font-size: 22px;
}

/* Vault CSS */
.slot-frame.vault-mode {
    border-color: #ff3366;
    box-shadow: inset 0 0 40px rgba(255, 51, 102, 0.3);
}

.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; }
}

/* Ban Hammer 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 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); }
}

/* =========================================
   7. AVATARS & SPEECH BUBBLES
   ========================================= */
.avatar-container {
    position: absolute;
    bottom: -25px; 
    left: 679px;
    width: 569px;
    height: auto;
    z-index: 100;
    transition: bottom 0.8s ease-in-out;
    pointer-events: none; 
}

#mitch-avatar {
    width: 100%;
    height: auto;
    pointer-events: none;
    filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.6));
}

#avatar-stomach-hitbox {
    position: absolute;
    bottom: 67px;
    left: 225px;
    width: 126px;
    height: 126px;
    z-index: 105;
    cursor: pointer;
    pointer-events: auto; 
}

.avatar-slide-in { animation: slideIn 0.8s forwards; }
.avatar-slide-out { animation: slideOut 0.8s forwards; }

@keyframes slideIn { from { bottom: -600px; } to { bottom: -25px; } }
@keyframes slideOut { from { bottom: -25px; } to { bottom: -650px; } }

.speech-bubble {
    position: absolute;
    bottom: 300px;
    left: 200px;
    background: #ffffff;
    border-radius: 20px;
    border: 3px solid #111115; 
    padding: 15px 25px;
    max-width: 220px; 
    text-align: center;
    color: #111115;
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
    font-size: 16px;
    font-weight: 900;
    text-transform: uppercase; 
    line-height: 1.2;
    letter-spacing: 0.5px;
    box-shadow: 6px 6px 0px rgba(17, 17, 21, 0.9);
    z-index: 110;
    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;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 28px;
    border-width: 16px 16px 0;
    border-style: solid;
    border-color: #111115 transparent transparent transparent;
    display: block;
    width: 0;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 31px; 
    border-width: 13px 13px 0;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    display: block;
    width: 0;
}

.speech-bubble.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* =========================================
   8. MODALS & POPUPS
   ========================================= */
.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%;
    max-height: 90vh; /* NEW: Caps height */
    overflow-y: auto; /* NEW: Adds scrollbar if screen is very short */
}

/* --- Modal Frame Container (Leaderboard, Options, Giveaway) --- */
.modal-frame-container {
    /* Removed fixed widths so the container shrink-wraps the image */
    position: relative;
    cursor: default; 
    background: none; 
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
    border-radius: 12px;
}

.modal-frame-img {
    width: 700px;       /* Moved from container */
    max-width: 95vw;    /* Moved from container */
    max-height: 85vh;   /* NEW: Caps height so it never cuts off vertically */
    height: auto;       /* NEW: Maintains aspect ratio */
    display: block; 
    border-radius: 12px; 
    position: relative; 
    z-index: 15; 
    pointer-events: none;
}

.close-btn {
    background: transparent; color: #a0a0b0; border: 1px solid #a0a0b0;
    padding: 10px 30px; cursor: pointer; border-radius: 4px;
}

.close-lb-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 12%; 
    height: 16%;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 30; 
}

.close-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('images/award_frame_close.png') center/100% 100% no-repeat;
    opacity: 0; 
    pointer-events: none; 
    z-index: 25;
    transition: opacity 0.15s ease;
}

.close-lb-btn:hover ~ .close-hover-overlay {
    opacity: 1;
}

#leaderboard-modal { z-index: 300; }

.leaderboard-header {
    position: absolute;
    bottom: 1.5%; 
    left: 0;
    width: 100%;
    text-align: center;
    pointer-events: none;
    z-index: 20;
}

.leaderboard-header span {
    position: relative;
    display: inline-block;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: min(3.7vw, 4vh, 26px); /* Add the 4vh constraint */
    letter-spacing: -1px;
    color: #111115;
    -webkit-text-stroke: min(0.4vw, 3px) #111115; 
    text-shadow: 0px min(0.7vw, 5px) 0px #111115; 
    z-index: 5;
}

.leaderboard-header span::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, #fef1a4 0%, #f6cd32 45%, #e58814 55%, #b94c06 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    -webkit-text-stroke: 0;
    text-shadow: none; 
}

.leaderboard-content {
    position: absolute;
    padding: 0px 20px;
    top: 6%; 
    left: 5%;
    width: 90%;
    height: 78%; 
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    scrollbar-width: thin;
    scrollbar-color: #f1c40f transparent;
    z-index: 5;
}

.lb-row {
    display: flex;
    justify-content: space-between;
    padding: 2% 4%;
    font-size: min(3.2vw, 3.5vh, 1.1rem); /* Add the 3.5vh constraint */; 
    color: #fff;
    border-radius: 6px;
    margin-bottom: 1%;
}

.lb-row:nth-child(odd) { background: rgba(255, 255, 255, 0.05); }
.lb-row:nth-child(even) { background: rgba(0, 0, 0, 0.4); }
.lb-row:hover { background: rgba(241, 196, 15, 0.2); }
.lb-empty { width: 100%; text-align: center; }

.lb-rank { width: 10%; font-weight: 900; color: #4ade80; }
.lb-name { width: 50%; text-align: left; font-weight: bold; text-transform: uppercase; }
.lb-score { width: 40%; text-align: right; color: #f1c40f; font-family: 'Courier New', Courier, monospace; font-weight: 900; }

/* Award Modal */
#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 (Win Screens) --- */
.award-image-container {
    /* Removed fixed widths so the container shrink-wraps the image */
    position: relative;
    cursor: pointer;
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.9);
}

.award-image-container img {
    width: 800px;       /* Moved from container */
    max-width: 90vw;    /* Moved from container */
    max-height: 85vh;   /* NEW: Caps height for horizontal screens */
    height: auto;       /* NEW: Maintains aspect ratio */
    display: block;
    border-radius: 12px;
}

#award-start-text {
position: absolute;
    top: -3%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: min(1.5vw, 2.5vh, 1rem); /* Add the 2.5vh constraint */
    color: #f1c40f;
    background: url(images/PromptTextFrame.png) center / 100% 100% no-repeat;
    padding: 15px 35px;
    text-shadow: 2px 2px 0 #000;
    text-align: center;
    z-index: 10;
    white-space: nowrap;
    pointer-events: none;
    letter-spacing: 1px;
}

#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, 5vh, 2.4rem); /* Add the 5vh constraint */
    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; 
    text-align: center;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* =========================================
   9. MENUS & INTERNAL MODAL UI
   ========================================= */

/* Feature Drop Buy Menu */
.feature-drop-title {
    color: #fff; 
    margin-bottom: 20px; 
    text-transform: uppercase;
}

.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); }

/* Options Menu */
.options-menu-content {
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
    gap: 30px; 
}

.options-toggle-row {
    display: flex; 
    width: 100%; 
    justify-content: space-around; 
}

.options-toggle-row .purchase-btn {
    width: 200px; 
    font-size: 16px;
}

/* Avatar Selection Area */
.avatar-selection-wrapper {
    text-align: center; 
    width: 100%; 
    margin-top: 20px;
}

.avatar-selection-title {
    font-family: 'Press Start 2P', monospace; 
    font-size: 12px; 
    margin-bottom: 15px; 
    color: #f1c40f;
}

#avatar-selection-container {
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    flex-wrap: wrap;
}

.award-image-container .avatar-select-icon {
    width: 65px;         
    height: 65px;
    display: inline-block; 
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid #333;
    transition: all 0.2s ease;
    filter: grayscale(80%) brightness(0.6);
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.award-image-container .avatar-select-icon:hover {
    transform: scale(1.1);
    filter: grayscale(0%) brightness(1);
    border-color: #f1c40f;
}

.award-image-container .avatar-select-icon.selected {
    filter: grayscale(0%) brightness(1);
    border: 3px solid #4ade80;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.6);
    transform: scale(1.1);
}

/* Twitch Connect Logic */
.twitch-btn {
    background-color: #9146FF;
    color: #ffffff;
    border: 2px solid #5c16c5;
    padding: 15px 30px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 6px 0 #5c16c5, 0 10px 20px rgba(0,0,0,0.5);
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twitch-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 #5c16c5, 0 4px 10px rgba(0,0,0,0.5);
}

.twitch-btn:hover { background-color: #a970ff; }

.twitch-btn-icon {
    margin-right: 10px; 
    vertical-align: middle;
}

.twitch-btn-connected {
    background-color: #333; 
    border-color: #222;
}

/* Giveaway Area */
.giveaway-video-container {
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center;
}

#giveaway-video {
    width: 90%; 
    border-radius: 8px; 
    border: 2px solid #f1c40f; 
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
}

.giveaway-subtitle {
    color: #fff; 
    margin-top: 15px; 
    text-align: center; 
    font-family: 'Press Start 2P', monospace; 
    font-size: 12px; 
    line-height: 1.5;
}

/* Live Status Indicator Badge */
.live-badge {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #e91916;
    color: #ffffff;
    font-family: 'Press Start 2P', monospace; /*[cite: 4] */
    font-size: 8px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(233, 25, 22, 0.8);
    z-index: 8;
    pointer-events: none;
    border: 1px solid #ffffff;
    animation: liveBadgePulse 1s infinite alternate ease-in-out;
}

/* Custom Live Badges for UI Elements */
.avatar-menu-badge {
    bottom: -5px;
    font-size: 8px;
    z-index: 20;
}

.main-avatar-badge {
    bottom: 25px; 
    font-size: 12px;
    padding: 4px 8px;
    border-width: 2px;
    box-shadow: 0 0 15px rgba(233, 25, 22, 0.9);
    z-index: 106; /* Ensure it floats above the video and hitbox */
}

@keyframes liveBadgePulse {
    0% { opacity: 0.85; transform: translateX(-50%) scale(0.95); }
    100% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}


/* =========================================
   DESKTOP MEDIA CONTROLS
   ========================================= */
.overlay-music-control {
    position: absolute;
    bottom: 61px;
    height: 34px;
    border-radius: 12px;
}

/* Adjust the widths and left positions to fit your cabinet art */
.overlay-music-prev { left: 463px; width: 71px; }
.overlay-music-play { left: 548px; width: 75px; }
.overlay-music-next { left: 638px; width: 72px; }

/* Lightning Hover State */
.overlay-music-control:hover {
    /*background-color: transparent;
    background-image: url('images/bg_lightning.png');
    background-size: 1170px 904px;*/
    cursor: pointer;
}

/* Specific background offsets for the lightning hover */
.overlay-music-prev:hover { background-position: -463px -477px; }
.overlay-music-play:hover { background-position: -548px -477px; }
.overlay-music-next:hover { background-position: -638px -477px; }


/* =========================================
   MOBILE MEDIA CONTROLS
   ========================================= */
@media (max-width: 800px), (orientation: portrait) {
    .overlay-music-control {
        bottom: 109px;
        height: 20px;
    }
    
    .overlay-music-prev { left: 177px; width: 43px; }
    .overlay-music-play { left: 228px; width: 44px; }
    .overlay-music-next { left: 281px; width: 41px; }

    .overlay-music-control:hover,
    .overlay-music-control:active {
        /*background-color: transparent;
        background-image: url('images/mobile_bg_lightning.png');
        background-size: 500px 1000px;*/
    }

    .overlay-music-prev:hover, .overlay-music-prev:active { background-position: -177px -21px; }
    .overlay-music-play:hover, .overlay-music-play:active { background-position: -228px -21px; }
    .overlay-music-next:hover, .overlay-music-next:active { background-position: -281px -21px; }
}

/* =========================================
   LYRIC / SUBTITLE DISPLAY
   ========================================= */
#lyric-display-container {
    cursor: pointer;
    position: relative;
    top: 624px;
    left: 49.8%;
    transform: translateX(-49.8%);
    width: 438px;
    height: 25px;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 20px;
    overflow: hidden;
    /* border: 2px solid black; */
    z-index: 25;
}

#lyric-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%; 
    background-color: rgba(0, 0, 0, 0.25); 
    z-index: 1; 
    pointer-events: none; 
    border-radius: 8px; /* Rounds the corners */
}

#lyric-text {
    color: #111115; /* Dark text for high contrast on the green bar */
    font-weight: 900; /* Thicker weight for readability */
    font-family: 'Press Start 2P', 'Courier New', monospace;
    font-size: 12px;
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: none; /* Removed the green glow since the background is now green */
    opacity: 0;
    margin: 0 auto; 
	 position: relative;
    z-index: 2;
}

/* Smooth slide and fade animations */
.lyric-fade-in {
    animation: lyricIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.lyric-fade-out {
    animation: lyricOut 0.4s ease-in forwards;
}

@keyframes lyricIn {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes lyricOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-15px); }
}

/* Music Paused Blinking State */
.lyric-paused-blink {
    animation: lyricPausedBlink 1.5s infinite alternate ease-in-out !important;
}

@keyframes lyricPausedBlink {
    0% { opacity: 0.2; transform: translateY(0); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Mobile Adjustment */
@media (max-width: 800px), (orientation: portrait) {
    #lyric-display-container {
        top: 713px;
        width: 410px;
        height: 20px;
    }
    #lyric-text {
        font-size: 12px;
    }
}

/* =========================================
   10. MOBILE RESPONSIVE LAYOUT
   ========================================= */
@media (max-width: 800px), (orientation: portrait) {
    
    #splash-overlay {
        background: url('images/splash_mobile_bg.jpg') center/100% 100% no-repeat;
    }
	 
    .machine-wrapper {
        width: 500px;
        height: 1000px;
        min-width: 500px;
        min-height: 1000px;
        background: url('images/mobile_bg1.jpg') center/100% 100% no-repeat;
        transform-origin: center center;
    }
	 
	 /* NEW: Mobile Replay Background */
    .machine-wrapper.replay-active {
        background: url('images/replay_mobile_bg.jpg') center/100% 100% no-repeat;
    }

    .external-spins-container,
    .external-multiplier-container {
        height: 120px;
        font-size: 24px;
        justify-content: center;
        top: 70px !important; 
    }
    
    .external-spins-container { left: 40px !important; width: 210px !important; }
    .external-multiplier-container { left: 252px !important; width: 210px !important; }

    #main-logo-container { top: 212px; }

	 .slot-frame {
		  top: 339px;
        left: 50%;
        width: 555px;
        height: 450px;
        transform: translateX(-50%) scale(0.74);
        transform-origin: top center;
        -webkit-mask-image: url(images/mask_mobile_mainconsole.png);
        mask-image: url(images/mask_mobile_mainconsole.png);
        -webkit-mask-size: 100% 100%;
        mask-size: 100% 98%;
        -webkit-mask-position: 0 0;
        mask-position: 0px 5px;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
    }

    .balance-container {
        top: 762px;
        left: 29px;
        width: 210px;
        height: 100px;
        font-size: 26px;
    }

    .win-container {
        top: 762px;
        left: 265px;
        width: 210px;
        height: 100px;
        font-size: 26px;
    }

    #award-text-cover {
        left: 23%;
        width: 54%;
        height: 11%;
        scale: 78%;
        bottom: 0;
    }
	 
    .avatar-container {
        position: absolute;
        bottom: 80px;
        left: 300px;
        width: 165px;
        height: auto;
        z-index: 100;
        transition: bottom 0.8s ease-in-out;
    }
	
    #avatar-selection-container { flex-wrap: nowrap !important; }

    .award-image-container .avatar-select-icon {
        width: 45px; 
        height: 45px;
    }
	
    #avatar-stomach-hitbox {
        top: 33px;
        left: 50px;
        width: 65px;
        height: 50px;
        bottom: auto;
    }
	
    .speech-bubble {
        top: auto;
        bottom: 100px;
        left: 50px;
        font-size: 14px;
        padding: 10px 15px;
    }
	
    @keyframes slideIn { from { bottom: -650px; } to { bottom: 80px; } }
    @keyframes slideOut { from { bottom: 80px; } to { bottom: -650px; } }

    .overlay-buy { top: 909px; left: 63px; width: 167px; height: 83px; }
    .overlay-spin { top: 909px; left: 277px; width: 160px; height: 83px; }

    .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;
    }

    .click-to-continue {
        white-space: nowrap;       
        font-size: min(4vw, 14px); 
        bottom: -35px;             
        letter-spacing: 1px;
    }

    .modal-content {
        padding: 20px 15px; 
        max-height: 95vh;
        overflow-y: auto; 
    }
    
    .buy-cards-container {
        flex-direction: column; 
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .buy-card { padding: 15px; }

    .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;
    }

    .overlay-options {
        top: 20px;
        left: 75px; 
        width: 65px;
        height: 58px;
    }

    .overlay-leaderboard {
        top: 20px;
        left: 364px;
        width: 65px;
        height: 58px;
    }

    .overlay-options:hover,
    .overlay-options:active,
    .overlay-leaderboard:hover,
    .overlay-leaderboard:active {
        background-color: transparent;
        background-image: url('images/mobile_bg_lightning.png');
        background-size: 500px 1000px;
    }

    .overlay-options:hover,
    .overlay-options:active { background-position: -75px -20px; }
    .overlay-leaderboard:hover,
    .overlay-leaderboard:active { background-position: -364px -20px; }

    .leaderboard-frame {
        position: absolute;
        top: 50%;
        left: 50%;
        margin-top: -240px; 
        margin-left: -350px; 
        transform: scale(calc(95vw / 700));
        transform-origin: center center;
    }
	 
    .overlay-giveaway {
        top: 21px;
        left: 218px;
        width: 64px;
        height: 57px;
    }

    .overlay-giveaway:hover,
    .overlay-giveaway:active {
        background-color: transparent;
        background-image: url('images/mobile_bg_lightning.png?cache=0');
        background-size: 500px 1000px;
        background-position: -218px -21px;
    }
}

/* =========================================
   NOLIMIT STYLE RESPIN MODAL
   ========================================= */
#respin-modal {
    z-index: 400; /* Keep it above everything else */
}

#respin-modal .modal-content {
    background: linear-gradient(180deg, #112238 0%, #08101a 100%);
    border: 4px solid #3498db;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(52, 152, 219, 0.6), inset 0 0 15px rgba(52, 152, 219, 0.4);
    width: 600px; /* Increased to fit 3 buttons */
    max-width: 95%;
    padding: 35px 20px;
    position: relative;
    overflow: hidden; /* Kills the scrollbars */
}

/* Corner Accents */
#respin-modal .modal-content::before,
#respin-modal .modal-content::after {
    content: ''; position: absolute; width: 10px; height: 10px; border: 2px solid #85c1e9;
}
#respin-modal .modal-content::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
#respin-modal .modal-content::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.respin-title {
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 32px;
    font-weight: 900;
    font-style: italic;
    margin-bottom: 10px;
    text-shadow: 2px 2px 0px #000;
    letter-spacing: 1px;
}

.respin-cost {
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 38px;
    font-weight: 900;
    font-style: italic;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0px #000;
}

.respin-btn-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Allows buttons to stack on mobile */
    gap: 15px;
}

.respin-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ffffff;
    color: #ffffff;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.1);
}

.respin-btn:hover {
    background: #ffffff;
    color: #000000;
    box-shadow: 0 0 15px rgba(255,255,255,0.8);
}

.respin-btn:active {
    transform: scale(0.95);
}

/* =========================================
   TEMPORARY HITBOX DEBUGGING 
   (Delete this when you're done!)
   ========================================= */

/* Highlights the 80x80 Ship Hitbox in Red
#beanlander-ship {
    border: 2px solid red !important;
    background-color: rgba(255, 0, 0, 0.4) !important;
}

/* Highlights the Landing Pads in Neon Green
.bl-prize {
    border: 2px solid lime !important;
    background-color: rgba(0, 255, 0, 0.4) !important;
}*/