@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Luckiest+Guy&family=Bangers&family=Fredoka+One&display=swap'); /* Added Fredoka One for candy feel */

body {
    font-family: 'Fredoka One', cursive; /* Fun, rounded, candy-like font */
    background-color: #ffe0f0; /* Light Pink background */
    color: #4a148c; /* Deep Purple text */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-image: url('background_candy_craze.png'); /* New candy craze background */
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

#slot-machine {
    background-color: rgba(255, 105, 180, 0.92); /* Hot Pink, slightly transparent */
    border: 6px solid #ffffff; /* Clean white border */
    border-radius: 25px;
    padding: 20px;
    box-shadow: 
        0 0 35px rgba(138, 43, 226, 0.6), /* BlueViolet shadow */
        0 0 55px rgba(255, 20, 147, 0.4), /* DeepPink accent shadow */
        inset 0 0 15px rgba(0,0,0,0.3), /* Inner shadow for depth */
        /* Base Neon Glow - subtle when off */
        0 0 4px #FFD700, /* Gold subtle */
        0 0 7px #FFD700,
        0 0 10px #FF69B4, /* HotPink */
        inset 0 0 10px rgba(255, 255, 255, 0.4);
    text-align: center;
    width: 90%;
    max-width: 900px;
    transition: box-shadow 0.4s ease-in-out;
}

#slot-machine.neon-glow-active {
    box-shadow: 
        0 0 35px rgba(138, 43, 226, 0.8), 
        0 0 55px rgba(255, 20, 147, 0.6),
        inset 0 0 15px rgba(0,0,0,0.3),
        /* Active Neon Glow - bright candy colors! */
        0 0 10px #fff, /* white core */
        0 0 20px #ADFF2F, /* GreenYellow */
        0 0 35px #00BFFF, /* DeepSkyBlue */
        0 0 50px #FF1493, /* DeepPink */
        0 0 70px #FF1493,
        inset 0 0 20px rgba(255, 255, 100, 0.7); /* Light yellow inner glow */
}

header h1 {
    font-size: 3em; /* Larger, more impactful */
    color: #FFFF00; /* Bright Yellow */
    text-shadow: 
        3px 3px 0px #FF69B4, /* HotPink offset */
        -2px -2px 0px #8A2BE2, /* BlueViolet offset */
        0 0 15px #FFF, 0 0 5px #000; /* White glow and subtle dark */
    margin-bottom: 20px;
    font-family: 'Bangers', cursive; /* Pop-art/comic style font */
}

#reels-container {
    display: flex;
    justify-content: center;
    gap: 10px; 
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5); /* Frosty white, more transparent */
    border-radius: 15px;
    border: 3px solid rgba(173, 216, 230, 0.8); /* LightBlue border */
    position: relative;
}

.reel {
    display: flex;
    flex-direction: column;
    gap: 5px; 
    background-color: rgba(255, 182, 193, 0.3); /* LightPink, more transparent reel background */
    padding: 5px;
    border-radius: 10px;
    overflow: hidden; 
    box-shadow: inset 0 0 10px rgba(0,0,0,0.4);
}

.symbol-cell {
    width: 100px; 
    height: 100px; 
    background-color: rgba(221, 160, 221, 0.7); /* Plum, slightly transparent */
    border: 2px solid #FFC0CB; /* Pink border */
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: outline 0.2s, box-shadow 0.2s, transform 0.2s;
}

.symbol-cell img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transition: transform 0.1s ease-out, opacity 0.1s ease-out;
    filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3)); /* Subtle shadow for pop */
}

.reel.spinning .symbol-cell img {
    animation: spinSymbol 0.1s linear infinite;
}

@keyframes spinSymbol {
    0% { transform: translateY(-15px) scale(0.9); opacity: 0.7; }
    50% { transform: translateY(0px) scale(1); opacity: 1; }
    100% { transform: translateY(15px) scale(0.9); opacity: 0.7; }
}

.winning-symbol img { 
    outline: 4px solid #FFFF00; /* Bright Yellow outline */
    outline-offset: 2px;
    box-shadow: 0 0 20px #FFD700, 0 0 30px #FF1493; /* Gold and DeepPink glow */
    transform: scale(1.1); 
    animation: symbolWinPulse 0.6s ease-out;
}

@keyframes symbolWinPulse {
    0% {
        transform: scale(1.0);
        box-shadow: none;
        filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 25px #FFF, 0 0 35px #FFFF00, 0 0 50px #ADFF2F; /* White, Yellow, GreenYellow glow */
        filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.1));
        opacity: 1;
    }
    100% {
        transform: scale(1.1); 
        box-shadow: 0 0 20px #FFD700, 0 0 30px #FF1493;
        filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
        opacity: 1;
    }
}

#controls {
    display: flex;
    flex-wrap: wrap; 
    justify-content: space-around;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background-color: rgba(147, 112, 219, 0.6); /* MediumPurple tint */
    border-radius: 10px;
}

.info-display {
    font-size: 1.2em; 
    color: #fff; /* White text on purple */
    margin: 5px 10px; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.info-display span:first-child {
    font-weight: bold;
    color: #FFFF00; /* Yellow for labels */
}

.bet-control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bet-adj-button {
    background-color: #00BCD4; /* Cyan */
    color: white;
    border: 2px solid #0097A7; /* Darker Cyan border */
    border-radius: 8px; /* More rounded */
    width: 32px;
    height: 32px;
    font-size: 1.4em; /* Bigger font */
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bet-adj-button:hover {
    background-color: #00E5FF; /* Brighter Cyan */
    transform: scale(1.1);
}

#action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px; 
    margin-top: 10px;
}

#paytable-button, #spin-button {
    padding: 14px 28px; 
    font-size: 1.5em; 
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    box-shadow: 0 5px 10px rgba(0,0,0,0.4), inset 0 -3px 3px rgba(255,255,255,0.25), inset 0 3px 3px rgba(0,0,0,0.25);
    transition: background 0.3s ease, transform 0.1s ease;
    font-family: 'Bangers', cursive; /* Pop art font for buttons */
    letter-spacing: 1px;
}

#paytable-button {
    background: linear-gradient(145deg, #8A2BE2, #4B0082); /* BlueViolet to Indigo gradient */
}
#paytable-button:hover {
    background: linear-gradient(145deg, #9932CC, #6A0DAD); /* DarkOrchid to Purple */
    transform: translateY(-2px);
}

#spin-button {
    background: linear-gradient(145deg, #FF1493, #C71585); /* DeepPink to MediumVioletRed gradient */
}

#spin-button:hover {
    background: linear-gradient(145deg, #FF69B4, #DB7093); /* HotPink to PaleVioletRed */
    transform: translateY(-2px);
}

#paytable-button:active, #spin-button:active {
    transform: translateY(1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.4), inset 0 -2px 2px rgba(255,255,255,0.25), inset 0 2px 2px rgba(0,0,0,0.25);
}

#spin-button:disabled {
    background: #B0C4DE; /* LightSteelBlue */
    cursor: not-allowed;
    opacity: 0.7;
}

#message-display {
    margin-top: 15px;
    font-size: 1.3em; 
    color: #4B0082; /* Indigo for readability */
    text-shadow: 1px 1px 1px #fff;
    min-height: 25px; 
    font-weight: bold;
}

/* Payline Visualization */
#payline-overlay-container {
    position: absolute;
    top: 10px; 
    left: 10px; 
    right: 10px; 
    bottom: 10px; 
    pointer-events: none; 
    z-index: 10;
    overflow: visible; 
}

.payline-path {
    position: absolute;
    height: 5px; /* Thicker line */
    background-color: rgba(50, 205, 50, 0.9); /* LimeGreen, more opaque */
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 10px rgba(124, 252, 0, 1), 0 0 5px white; /* LawnGreen glow */
    border-radius: 3px;
    transform-origin: 0 50%; 
}

.payline-path.active {
    opacity: 1;
}

/* Floating Win Text Container */
#floating-text-container {
    position: absolute;
    top: 30%; 
    left: 50%;
    transform: translateX(-50%);
    width: 380px; 
    height: 160px; 
    pointer-events: none; 
    z-index: 101; 
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
}

.floating-win-text {
    font-size: 3.5em; /* Even larger */
    color: #FF4500; /* OrangeRed */
    font-weight: bold;
    font-family: 'Bangers', cursive; /* Thematic font */
    text-shadow: 
        2px 2px 0 #fff, /* White outline */
        4px 4px 0 #4a148c, /* Deep Purple shadow for pop */
        0 0 15px #FFFF00; /* Yellow glow */
    animation: floatUpAndFade 1.5s ease-out forwards;
    position: relative; 
    padding: 5px 15px;
    background-color: rgba(0,0,0,0.1); 
    border-radius: 10px;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.4); 
    }
    15% {
        opacity: 1;
        transform: translateY(0px) scale(1); 
    }
    80% {
        opacity: 1;
        transform: translateY(-70px) scale(1.15); 
    }
    100% {
        opacity: 0;
        transform: translateY(-140px) scale(0.7); 
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.85); 
    display: flex; 
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ff69b4; /* HotPink modal background */
    margin: auto;
    padding: 25px;
    border: 4px solid #fff; /* White border */
    border-radius: 20px;
    width: 85%;
    max-width: 750px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
    color: #fff; /* White text */
    position: relative;
}

.close-button {
    color: #f0f0f0;
    position: absolute; 
    top: 15px;
    right: 20px;
    font-size: 32px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.close-button:hover,
.close-button:focus {
    color: #FFFF00; /* Yellow hover */
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    text-align: center;
    color: #FFFF00; /* Yellow title */
    font-family: 'Bangers', cursive;
    font-size: 2.5em;
    margin-bottom: 25px;
    text-shadow: 2px 2px 0 #4B0082; /* Indigo shadow */
}

#paytable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 20px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 15px; 
    font-family: 'Fredoka One', cursive; /* Match body font for readability here */
}

.paytable-symbol-entry {
    background-color: rgba(255,255,255,0.15); /* Light tint for contrast */
    border: 2px solid #ADFF2F; /* GreenYellow border */
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.paytable-symbol-entry img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(3px 3px 4px rgba(0,0,0,0.5));
}

.paytable-symbol-entry h4 {
    margin: 8px 0;
    color: #FFFFE0; /* LightYellow symbol name */
    font-size: 1.3em;
    text-shadow: 1px 1px 1px #000;
}

.paytable-symbol-entry p {
    font-size: 1em;
    margin: 4px 0;
    color: #fff;
}

.paytable-note {
    font-size: 1em;
    text-align: center;
    margin-top: 25px;
    color: #FFFFE0; /* LightYellow */
    font-family: 'Fredoka One', cursive;
}

/* Fullscreen Animation Overlay */
#fullscreen-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(75, 0, 130, 0.7); /* Indigo overlay, slightly transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200; 
    pointer-events: none; 
    opacity: 0; 
    transition: opacity 0.5s ease-in-out; 
}

#fullscreen-animation-overlay.active {
    opacity: 1;
}

/* Renamed from animated-soda-bubbles to animated-candy-explosion */
#fullscreen-animation-overlay img.animated-candy-explosion {
    width: 50vw; /* Larger explosion */
    max-width: 450px; 
    height: auto;
    animation: candyExplosionEffect 2.5s ease-out forwards; /* New animation name */
}

/* New keyframes for candy explosion */
@keyframes candyExplosionEffect {
    0% { 
        transform: translateY(100px) scale(0.2) rotate(0deg); 
        opacity: 0; 
        filter: brightness(0.5) drop-shadow(2px 2px 3px rgba(0,0,0,0.2));
    }
    10% {
        transform: translateY(50px) scale(0.5) rotate(-15deg);
        opacity: 0.7;
    }
    40% { 
        transform: translateY(-40px) scale(1.25) rotate(15deg); 
        opacity: 1; 
        filter: brightness(1.5) drop-shadow(0 0 15px #fff) drop-shadow(0 0 25px #FF69B4) drop-shadow(0 0 40px #00BFFF); /* White, HotPink, Blue shimmer */
    }
    70% { 
        transform: translateY(-130px) scale(1.1) rotate(-10deg); 
        opacity: 0.9; 
        filter: brightness(1.2) drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #FFFF00);
    }
    100% { 
        transform: translateY(-200px) scale(1.5) rotate(20deg); /* Final burst effect */
        opacity: 0; 
        filter: brightness(1.8) drop-shadow(0 0 30px #fff);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .symbol-cell {
        width: 80px;
        height: 80px;
    }
    #paytable-button, #spin-button {
        padding: 12px 22px;
        font-size: 1.3em;
    }
    header h1 {
        font-size: 2.5em;
    }
    .info-display {
        font-size: 1.1em;
    }
    .bet-adj-button {
        width: 30px;
        height: 30px;
        font-size: 1.2em;
    }
    #paytable-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
    .floating-win-text {
        font-size: 3em;
    }
    #fullscreen-animation-overlay img.animated-candy-explosion {
        width: 60vw;
        max-width: 350px;
    }
}

@media (max-width: 600px) {
    #slot-machine {
        padding: 15px;
        border-width: 4px;
    }
    #reels-container {
        gap: 5px;
    }
    .symbol-cell {
        width: 60px; 
        height: 60px;
    }
    #controls {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    .info-display {
        margin: 4px 5px;
    }
    header h1 {
        font-size: 2em;
    }
    #paytable-button, #spin-button {
        font-size: 1.2em;
        padding: 10px 18px;
    }
    .modal-content {
        width: 90%;
        padding: 20px;
    }
    #paytable-grid {
       grid-template-columns: 1fr; 
    }
    .paytable-symbol-entry img {
        width: 60px;
        height: 60px;
    }
    .floating-win-text {
        font-size: 2.5em;
    }
    #fullscreen-animation-overlay img.animated-candy-explosion {
        width: 70vw;
        max-width: 300px;
    }
}

@media (max-width: 450px) {
    .symbol-cell {
        width: 48px; /* Adjusted for 6 reels to fit better */
        height: 48px;
    }
    header h1 {
        font-size: 1.7em;
    }
    #paytable-button, #spin-button {
        padding: 9px 14px;
        font-size: 1.1em;
    }
    .info-display {
        font-size: 1em;
    }
    .bet-adj-button {
        width: 26px;
        height: 26px;
        font-size: 1em;
    }
     .floating-win-text {
        font-size: 2em;
    }
    #fullscreen-animation-overlay img.animated-candy-explosion {
        width: 80vw;
        max-width: 250px;
    }
}