@import url('https://fonts.googleapis.com/css2?family=Righteous&family=Luckiest+Guy&display=swap');

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a001a; /* Dark Purple/Black */
    color: #f0f0f0; /* Light Grey/Off-white */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-image: url('background_disco.png'); /* New disco background */
    background-size: cover;
    background-position: center;
    overflow: hidden; /* Hide scrollbars if background is too large */
}

#slot-machine {
    background-color: rgba(40, 0, 60, 0.9); /* Deep Purple, slightly transparent */
    border: 5px solid #c0c0c0; /* Silver border */
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 0 30px rgba(255, 105, 180, 0.5), /* Base pink shadow */
        0 0 50px rgba(20, 0, 30, 0.5) inset, /* Inner dark purple shadow */
        /* Base Neon Glow - subtle when off */
        0 0 3px #FF69B4, /* HotPink subtle */
        0 0 6px #FF69B4,
        0 0 9px #FF1493, /* DeepPink */
        inset 0 0 8px rgba(255, 105, 180, 0.3);
    text-align: center;
    width: 90%;
    max-width: 900px;
    transition: box-shadow 0.4s ease-in-out; /* Smooth transition for neon glow */
}

#slot-machine.neon-glow-active {
    box-shadow: 
        0 0 30px rgba(255, 105, 180, 0.7), /* Pink shadow */
        0 0 50px rgba(20, 0, 30, 0.5) inset,
        /* Active Neon Glow - bright! */
        0 0 8px #fff, /* white core for brightness */
        0 0 15px #FF69B4, /* HotPink */
        0 0 25px #00FFFF, /* Cyan */
        0 0 35px #FF1493, /* DeepPink */
        0 0 50px #FF1493,
        inset 0 0 15px rgba(255, 105, 180, 0.6);
}

header h1 {
    font-size: 2.8em;
    color: #FFC0CB; /* Pink */
    text-shadow: 0 0 8px #FF69B4, 0 0 15px #00FFFF, 0 0 4px #000; /* HotPink/Cyan glow */
    margin-bottom: 20px;
    font-family: 'Righteous', cursive; /* Groovy font */
}

#reels-container {
    display: flex;
    justify-content: center;
    gap: 10px; /* Spacing between reels */
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(0,0,0,0.6); /* Darker contrast for reels */
    border-radius: 10px;
    border: 2px solid #300040; /* Darker purple border */
    position: relative; /* For payline overlay */
}

.reel {
    display: flex;
    flex-direction: column;
    gap: 5px; /* Spacing between symbols in a reel */
    background-color: rgba(20, 0, 30, 0.7); /* Darker purple background for reel itself */
    padding: 5px;
    border-radius: 8px;
    overflow: hidden; /* Important for spinning animation */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.7);
}

.symbol-cell {
    width: 100px; 
    height: 100px; 
    background-color: rgba(0,0,0,0.7); /* Dark background for symbols */
    border: 1px solid #777; /* Medium Grey border */
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Ensure img fits */
    transition: outline 0.2s, box-shadow 0.2s, transform 0.2s; /* For winning highlight */
}

.symbol-cell img {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transition: transform 0.1s ease-out, opacity 0.1s ease-out;
}

.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; }
}

/* Class for symbol highlight on win */
.winning-symbol img { /* Apply to img inside for better visual consistency */
    outline: 3px solid #00FFFF; /* Cyan outline */
    outline-offset: 2px; /* Adjusted for img */
    box-shadow: 0 0 15px #FF69B4; /* HotPink shadow */
    transform: scale(1.1); /* Final state after animation */
    animation: symbolWinPulse 0.6s ease-out;
}

@keyframes symbolWinPulse {
    0% {
        transform: scale(1.0);
        box-shadow: none;
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 20px #FFF, 0 0 30px #00FFFF, 0 0 40px #FF69B4; /* Brighter, multi-layered glow */
        opacity: 1;
    }
    100% {
        transform: scale(1.1); /* Settles to the .winning-symbol img defined state */
        box-shadow: 0 0 15px #FF69B4;
        opacity: 1;
    }
}

#controls {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
    justify-content: space-around;
    align-items: center;
    margin-bottom: 15px; /* Adjusted margin for action-buttons */
    padding: 10px; /* Reduced padding */
    background-color: rgba(50,0,70,0.5); /* Dark purple tint */
    border-radius: 10px;
}

.info-display {
    font-size: 1.1em; /* Slightly reduced */
    color: #ADD8E6; /* LightBlue */
    margin: 5px 10px; /* Add some margin for spacing */
}

.info-display span:first-child {
    font-weight: bold;
    color: #DA70D6; /* Orchid */
}

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

.bet-adj-button {
    background-color: #FF1493; /* DeepPink */
    color: white;
    border: 1px solid #C71585; /* MediumVioletRed border */
    border-radius: 5px;
    width: 28px;
    height: 28px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.bet-adj-button:hover {
    background-color: #FF69B4; /* HotPink */
}

#action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px; /* Space between Paytable and Spin buttons */
    margin-top: 10px;
}

#paytable-button, #spin-button {
    padding: 12px 25px; /* Slightly smaller */
    font-size: 1.3em; /* Slightly smaller */
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 -2px 2px rgba(255,255,255,0.2), inset 0 2px 2px rgba(0,0,0,0.2);
    transition: background 0.3s ease, transform 0.1s ease;
}

#paytable-button {
    background: linear-gradient(145deg, #8A2BE2, #4B0082); /* BlueViolet to Indigo gradient */
}
#paytable-button:hover {
    background: linear-gradient(145deg, #7B1FA2, #3A006A);
    transform: translateY(-2px);
}

#spin-button {
    background: linear-gradient(145deg, #FF4500, #FF00FF); /* OrangeRed to Magenta gradient */
}

#spin-button:hover {
    background: linear-gradient(145deg, #E03D00, #D900D9);
    transform: translateY(-2px);
}

#paytable-button:active, #spin-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 -1px 1px rgba(255,255,255,0.2), inset 0 1px 1px rgba(0,0,0,0.2);
}

#spin-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
}

#message-display {
    margin-top: 15px;
    font-size: 1.1em;
    color: #00FFFF; /* Cyan */
    min-height: 20px; 
}

/* Payline Visualization */
#payline-overlay-container {
    position: absolute;
    top: 10px; /* Match reels-container padding */
    left: 10px; /* Match reels-container padding */
    right: 10px; /* Match reels-container padding */
    bottom: 10px; /* Match reels-container padding */
    pointer-events: none; /* Allow clicks to pass through */
    z-index: 10;
    overflow: visible; /* Important: default is hidden, lines might be clipped */
}

.payline-path {
    position: absolute;
    height: 4px; /* Line thickness */
    background-color: rgba(255, 20, 147, 0.8); /* DeepPink, semi-transparent */
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 8px rgba(255, 20, 147, 1), 0 0 3px white; /* DeepPink glow */
    border-radius: 2px;
    transform-origin: 0 50%; /* For rotation */
}

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

/* Floating Win Text Container */
#floating-text-container {
    position: absolute;
    /* Positioned roughly over the center of the reels area */
    top: 30%; /* Adjust based on reel container height and desired start point */
    left: 50%;
    transform: translateX(-50%);
    width: 350px; /* Wide enough for large text */
    height: 150px; /* Space for text to appear and start floating */
    pointer-events: none; /* Allow clicks to pass through */
    z-index: 101; /* Above paylines, below modal */
    display: flex;
    flex-direction: column; /* Stack multiple texts if they appear very fast (unlikely for single win) */
    align-items: center; /* Center text horizontally */
    justify-content: center; /* Center text vertically within this box for start */
}

.floating-win-text {
    font-size: 3em; /* Larger text */
    color: #FFFF00; /* Bright Yellow */
    font-weight: bold;
    font-family: 'Righteous', cursive; /* Use thematic font */
    text-shadow: 
        0 0 5px #000, /* Base shadow for depth */
        0 0 10px #FF69B4, /* HotPink glow */
        0 0 20px #00FFFF, /* Cyan highlight glow */
        0 0 30px #FFD700; /* Wider gold aura (can keep some gold for pop) */
    animation: floatUpAndFade 1.5s ease-out forwards;
    position: relative; /* For stacking if needed, and ensuring it's above other elements if z-index conflicts */
    padding: 5px 10px;
    background-color: rgba(0,0,0,0.3); /* Slight dark background for readability */
    border-radius: 10px;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.5); /* Start lower, smaller, and invisible */
    }
    15% {
        opacity: 1;
        transform: translateY(0px) scale(1); /* Appear and grow to full size */
    }
    80% {
        opacity: 1;
        transform: translateY(-60px) scale(1.1); /* Float up, slightly larger */
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.8); /* Float further up, shrink, and fade out */
    }
}

/* 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.8); /* Darker dim background */
    display: flex; /* For centering modal content */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #300040; /* Dark Purple for modal */
    margin: auto;
    padding: 20px;
    border: 3px solid #8A2BE2; /* BlueViolet border */
    border-radius: 15px;
    width: 80%;
    max-width: 700px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    color: #f0f0f0; /* Light grey text */
    position: relative;
}

.close-button {
    color: #ccc;
    float: right; /* Old style, but effective */
    position: absolute; /* Better control */
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
}

.close-button:hover,
.close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    text-align: center;
    color: #00FFFF; /* Cyan */
    font-family: 'Righteous', cursive;
    margin-bottom: 20px;
}

#paytable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Responsive grid */
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px; /* For scrollbar */
}

.paytable-symbol-entry {
    background-color: rgba(60,0,80,0.4); /* Darker purple tint */
    border: 1px solid #6A0DAD; /* Purple border */
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.paytable-symbol-entry img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
}

.paytable-symbol-entry h4 {
    margin: 5px 0;
    color: #FFC0CB; /* Pink */
    font-size: 1.1em;
}

.paytable-symbol-entry p {
    font-size: 0.9em;
    margin: 3px 0;
    color: #E6E6FA; /* Lavender */
}

.paytable-note {
    font-size: 0.9em;
    text-align: center;
    margin-top: 20px;
    color: #DA70D6; /* Orchid */
}

/* Fullscreen Animation Overlay */
#fullscreen-animation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75); /* Darker, more focused overlay */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200; /* Above paytable modal (if it were somehow open) and other elements */
    pointer-events: none; /* Animation only, no interaction */
    opacity: 0; /* Start hidden, control with JS or animation */
    transition: opacity 0.3s ease-in-out;
}

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

#fullscreen-animation-overlay img.animated-disco-ball {
    width: 30vw; /* Responsive size */
    max-width: 300px; /* Max size */
    height: auto;
    animation: discoSpinAndGlow 3s ease-in-out forwards;
}

@keyframes discoSpinAndGlow {
    0% { 
        transform: scale(0.3) rotate(-90deg); 
        opacity: 0; 
        filter: brightness(0.5);
    }
    20% { 
        transform: scale(1.1) rotate(72deg); 
        opacity: 1; 
        filter: brightness(1.5) drop-shadow(0 0 15px #fff) drop-shadow(0 0 25px #00FFFF) drop-shadow(0 0 35px #FF69B4);
    }
    80% { 
        transform: scale(1) rotate(288deg); 
        opacity: 1; 
        filter: brightness(1.2) drop-shadow(0 0 10px #fff) drop-shadow(0 0 20px #00FFFF) drop-shadow(0 0 30px #FF69B4);
    }
    100% { 
        transform: scale(0.5) rotate(360deg); 
        opacity: 0; 
        filter: brightness(0.5);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .symbol-cell {
        width: 80px;
        height: 80px;
    }
    #paytable-button, #spin-button {
        padding: 10px 20px;
        font-size: 1.2em;
    }
    header h1 {
        font-size: 2.2em;
    }
    .info-display {
        font-size: 1em;
    }
    .bet-adj-button {
        width: 24px;
        height: 24px;
        font-size: 1em;
    }
    #paytable-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 600px) {
    #slot-machine {
        padding: 15px;
    }
    #reels-container {
        gap: 5px;
    }
    .symbol-cell {
        width: 60px; 
        height: 60px;
    }
    #controls {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    .info-display {
        margin: 3px 5px;
    }
    header h1 {
        font-size: 1.8em;
    }
    #paytable-button, #spin-button {
        font-size: 1.1em;
        padding: 8px 15px;
    }
    .modal-content {
        width: 90%;
        padding: 15px;
    }
    #paytable-grid {
       grid-template-columns: 1fr; /* Single column for very small screens */
    }
    .paytable-symbol-entry img {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 450px) {
    .symbol-cell {
        width: 45px; 
        height: 45px;
    }
    header h1 {
        font-size: 1.5em;
    }
    #paytable-button, #spin-button {
        padding: 8px 12px;
        font-size: 1em;
    }
    .info-display {
        font-size: 0.9em;
    }
    .bet-adj-button {
        width: 22px;
        height: 22px;
        font-size: 0.9em;
    }
}