@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Montserrat:wght@400;700&display=swap');

body {
    font-family: 'Montserrat', sans-serif; 
    background-color: #1a1a2e; /* Dark navy blue */
    color: #E0E0E0; /* Light grey for text */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background-image: url('background_spy.png'); 
    background-size: cover;
    background-position: center;
    overflow: hidden; 
}

#slot-machine {
    background-color: rgba(10, 20, 40, 0.92); /* Darker, sophisticated blue/grey */
    border: 5px solid #FFD700; /* Gold border */
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 0 20px rgba(0,0,0,0.7), /* Outer shadow */
        0 0 40px rgba(255, 215, 0, 0.3), /* Gold glow */
        inset 0 0 15px rgba(25,25,112,0.5); /* Midnight blue inset */
    text-align: center;
    width: 90%;
    max-width: 900px;
    transition: box-shadow 0.4s ease-in-out; 
    background-image: url(spy_fg.png);
    
}

#slot-machine.neon-glow-active { /* Renamed from neon-glow for thematic fit */
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.7), /* Gold */
        0 0 50px rgba(192, 192, 192, 0.5) inset, /* Silver inset */
        0 0 8px #fff, 
        0 0 15px #FFFFE0, 
        0 0 25px #C0C0C0, /* Silver */
        0 0 35px #FFD700, /* Gold */
        0 0 50px #FFD700,
        inset 0 0 15px rgba(255, 215, 0, 0.6); 
}

header h1 {
    font-size: 2.8em;
    color: #FFD700; /* Gold */
    text-shadow: 0 0 8px #000, 0 0 15px #C0C0C0, 0 0 4px rgba(0,0,0,0.8); 
    margin-bottom: 20px;
    font-family: 'Cinzel Decorative', cursive; 
}

#reels-container {
    display: flex;
    justify-content: center;
    gap: 10px; 
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(25, 25, 112, 0.65); /* Midnight Blue */
    border-radius: 10px;
    border: 2px solid #B0C4DE; /* Light Steel Blue */
    position: relative; 
}

.reel {
    display: flex;
    flex-direction: column;
    gap: 5px; 
    background-color: rgba(70, 130, 180, 0.3); /* Steel Blue, semi-transparent */
    padding: 5px;
    border-radius: 8px;
    overflow: hidden; 
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

.symbol-cell {
    width: 100px; 
    height: 100px; 
    background-color: rgba(40,50,70,0.75); /* Dark slate grey */
    border: 1px solid #708090; /* Slate Grey */
    border-radius: 5px;
    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;
}

.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: 3px solid #FFD700; /* Gold outline */
    outline-offset: 2px; 
    box-shadow: 0 0 15px #FFEB3B; /* Brighter Gold/Yellow */
    transform: scale(1.1); 
    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 #C0C0C0, 0 0 40px #FFD700; /* White, Silver, Gold */
        opacity: 1;
    }
    100% {
        transform: scale(1.1); 
        box-shadow: 0 0 15px #FFD700; /* Gold */
        opacity: 1;
    }
}

#controls {
    display: flex;
    flex-wrap: wrap; 
    justify-content: space-around;
    align-items: center;
    margin-bottom: 15px; 
    padding: 10px; 
    background-color: rgba(0, 0, 0, 0.753); /* Darker, transparent black */
    border-radius: 10px;
}

.info-display {
    font-size: 1.1em; 
    color: #C0C0C0; /* Silver */
    margin: 5px 10px; 
}

.info-display span:first-child {
    font-weight: bold;
    color: #FFBF00; /* Amber/Gold */
}

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

.bet-adj-button {
    background-color: #B22222; /* Firebrick Red */
    color: white;
    border: 1px solid #800000; /* Maroon */
    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: #DC143C; /* Crimson */
}

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

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

#paytable-button {
    background: linear-gradient(145deg, #696969, #2F4F4F); /* DimGray to DarkSlateGray */
}
#paytable-button:hover {
    background: linear-gradient(145deg, #505050, #1E3E3E);
    transform: translateY(-2px);
}

#spin-button {
    background: linear-gradient(145deg, #DAA520, #B8860B); /* Goldenrod to DarkGoldenrod */
}

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

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

#message-display {
    margin-top: 15px;
    font-size: 1.1em;
    color: #7FFF00; /* Chartreuse - for win messages */
    min-height: 20px; 
    font-weight: bold;
}

#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: 4px; 
    background-color: rgba(255, 215, 0, 0.85); /* Gold */
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 8px rgba(255, 215, 0, 1), 0 0 4px #FFFFFF; /* Gold, White */
    border-radius: 2px;
    transform-origin: 0 50%; 
}

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

#floating-text-container {
    position: absolute;
    top: 30%; 
    left: 50%;
    transform: translateX(-50%);
    width: 350px; 
    height: 150px; 
    pointer-events: none; 
    z-index: 101; 
    display: flex;
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
}

.floating-win-text {
    font-size: 3em; 
    color: #FFD700; /* Gold color */
    font-weight: bold;
    font-family: 'Cinzel Decorative', cursive; 
    text-shadow: 
        0 0 5px #000, 
        0 0 10px #FFFFFF, 
        0 0 20px #C0C0C0, 
        0 0 30px #FFD700; 
    animation: floatUpAndFade 1.5s ease-out forwards;
    position: relative; 
    padding: 5px 10px;
    background-color: rgba(0,0,0,0.4); 
    border-radius: 10px;
}

@keyframes floatUpAndFade {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.5); 
    }
    15% {
        opacity: 1;
        transform: translateY(0px) scale(1); 
    }
    80% {
        opacity: 1;
        transform: translateY(-60px) scale(1.1); 
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.8); 
    }
}

.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 overlay */
    display: flex; 
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #1c1c3c; /* Dark blue-purple */
    margin: auto;
    padding: 20px;
    border: 3px solid #DAA520; /* Goldenrod */
    border-radius: 15px;
    width: 80%;
    max-width: 700px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6);
    color: #E0E0E0; /* Light grey text */
    position: relative;
    font-family: 'Montserrat', sans-serif;
}

.close-button {
    color: #555; 
    float: right; 
    position: absolute; 
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
}

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

.modal-content h2 {
    text-align: center;
    color: #FFD700; /* Gold */
    font-family: 'Cinzel Decorative', cursive; 
    margin-bottom: 20px;
}

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

.paytable-symbol-entry {
    background-color: rgba(40, 50, 70, 0.5); /* Dark slate grey, semi-transparent */
    border: 1px solid #708090; /* Slate Grey */
    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: #FFD700; /* Gold */
    font-size: 1.1em;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

.paytable-symbol-entry p {
    font-size: 0.9em;
    margin: 3px 0;
    color: #B0C4DE; /* Light Steel Blue */
}

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

.bonus-modal-content {
    max-width: 600px;
    text-align: center;
}

#bonus-choices-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 20px 0;
    gap: 15px;
}

.bonus-choice-item {
    width: 120px;
    height: 120px;
    background-color: #2f2f4f; /* Darker purple-blue */
    border: 2px solid #DAA520; /* Goldenrod */
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bonus-choice-item:hover:not(.chosen):not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px #FFD700;
}

.bonus-choice-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.bonus-choice-item img {
    width: 80px;
    height: auto;
    margin-bottom: 5px;
}

.bonus-choice-item p {
    font-size: 1em;
    color: #FFD700;
    font-weight: bold;
    margin: 0;
}

#bonus-result-text {
    font-size: 1.5em;
    color: #7FFF00; /* Chartreuse */
    font-weight: bold;
    margin-top: 15px;
    min-height: 30px;
}

#bonus-continue-button {
    padding: 10px 20px;
    font-size: 1.2em;
    background: linear-gradient(145deg, #DAA520, #B8860B);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    font-family: 'Montserrat', sans-serif;
}

#bonus-continue-button:hover {
    background: linear-gradient(145deg, #C9901A, #A07409);
}

@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));
    }
    .bonus-choice-item {
        width: 100px;
        height: 100px;
    }
    .bonus-choice-item img {
        width: 60px;
    }
}

@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; 
    }
    .paytable-symbol-entry img {
        width: 50px;
        height: 50px;
    }
    .bonus-choice-item {
        width: 80px;
        height: 80px;
    }
    .bonus-choice-item img {
        width: 50px;
    }
    #bonus-choices-container {
        flex-direction: column; /* Stack vertically on small screens */
    }
}

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