:root {
    --primary-color: #ffd700;
    --secondary-color: #9400d3;
    --bg-dark: #120a2e;
    --panel-bg: rgba(0, 0, 0, 0.7);
    --border-gold: #c5a028;
}

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Press Start 2P', cursive, 'Roboto Mono', monospace;
    background-image:
        radial-gradient(circle at 20% 30%, #4a0080 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, #000080 0%, transparent 50%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    /* Prevent scroll on shake */
    touch-action: manipulation;
    /* Improve touch response */
}

.game-container {
    background: rgba(20, 10, 40, 0.9);
    border: 8px ridge var(--border-gold);
    border-radius: 10px;
    padding: 2vh 2vw;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8),
        inset 0 0 50px rgba(75, 0, 130, 0.5);
    width: 95%;
    max-width: 800px;
    text-align: center;
    position: relative;
    backdrop-filter: blur(5px);
    box-sizing: border-box;
    transition: background-color 0.3s;
}

.reach-mode {
    background-color: rgba(60, 0, 0, 0.9);
    box-shadow: 0 0 50px red;
    border-color: red;
}

/* Shake Animation Class */
.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.top-decoration {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.top-decoration h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.2rem, 4vw, 3rem);
    /* Responsive font size */
    margin: 0;
    color: #ffcc00;
    text-shadow: 4px 4px 0px #8b0000;
    letter-spacing: 2px;
    background: -webkit-linear-gradient(#ffee00, #ff8800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(4px 4px 0 #800);
    flex-grow: 1;
}

.lang-btn {
    background: #444;
    color: #fff;
    border: 2px solid #fff;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    margin-left: 10px;
}

.display-area {
    background: #000;
    border: 4px solid #666;
    border-radius: 5px;
    height: clamp(50px, 10vh, 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.message {
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 0 10px;
}

.win-anim {
    color: #ffcc00;
    animation: flash 0.5s infinite;
}

.win-big {
    color: #ff0000;
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: bold;
    text-shadow: 0 0 10px yellow;
    animation: bounce 0.5s infinite, rainbow 2s linear infinite;
}

.reels-container {
    display: flex;
    justify-content: space-around;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0IiBoZWlnaHQ9IjQiPgo8cmVjdCB3aWR0aD0iNCIgaGVpZ2h0PSI0IiBmaWxsPSIjMjIyMjIyIi8+CjxyZWN0IHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9IiMzMzMzMzMiLz4KPC9zdmc+');
    padding: 10px;
    border: 4px solid #444;
    border-radius: 5px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 30px #000;
    gap: 5px;
}

.reel-window {
    background: #000;
    width: 30%;
    aspect-ratio: 1/1;
    /* Keep square */
    border: 4px solid var(--border-gold);
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    max-width: 200px;
    /* PC cap */
}

.reel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Stop Buttons Styling */
.controls-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stop-buttons {
    display: flex;
    justify-content: space-around;
    padding: 0 5px;
    gap: 5px;
}

.stop-btn {
    background: linear-gradient(to bottom, #ff5555, #cc0000);
    color: white;
    border: 2px solid #fff;
    width: 30%;
    height: clamp(40px, 8vh, 60px);
    border-radius: 5px;
    font-weight: bold;
    font-family: inherit;
    box-shadow: 0 4px 0 #880000;
    cursor: pointer;
    font-size: clamp(0.6rem, 2.5vw, 1rem);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stop-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: none;
}

.stop-btn:disabled {
    background: #444;
    border: 2px solid #666;
    box-shadow: none;
    color: #888;
    transform: translateY(4px);
    cursor: default;
}

/* Main Controls */
.main-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2a1a4a;
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid #5533aa;
    flex-wrap: wrap;
    /* Wrap on very small screens */
    gap: 10px;
}

.credit-display {
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: #ffd700;
    text-shadow: 2px 2px 0 #000;
}

.spin-btn {
    background: linear-gradient(to bottom, #44ccff, #0066aa);
    color: white;
    border: 3px solid #fff;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: clamp(1rem, 4vw, 1.5rem);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 0 #003366, 0 10px 20px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    transition: transform 0.1s;
    flex-grow: 1;
    /* Expand to fill */
    max-width: 200px;
    margin-left: auto;
}

.spin-btn:active:not(:disabled) {
    transform: translateY(6px);
    box-shadow: 0 0 0 #003366;
}

.spin-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
}

/* Start Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
}

.start-btn {
    background: #ffcc00;
    color: black;
    border: none;
    padding: 20px 40px;
    font-size: 1.5rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 0 20px #ffcc00;
    animation: pulse 1s infinite;
}

/* Effects */
.blur {
    filter: blur(10px);
    transition: filter 0.1s;
}

.hidden {
    display: none !important;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(4px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-8px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(8px, 0, 0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes flash {

    0%,
    100% {
        opacity: 1;
        filter: brightness(1.5);
    }

    50% {
        opacity: 0.5;
        filter: brightness(1);
    }
}

@keyframes rainbow {
    0% {
        color: #ff0000;
        text-shadow: 0 0 10px #ff0000;
    }

    20% {
        color: #ffff00;
        text-shadow: 0 0 10px #ffff00;
    }

    40% {
        color: #00ff00;
        text-shadow: 0 0 10px #00ff00;
    }

    60% {
        color: #00ffff;
        text-shadow: 0 0 10px #00ffff;
    }

    80% {
        color: #0000ff;
        text-shadow: 0 0 10px #0000ff;
    }

    100% {
        color: #ff00ff;
        text-shadow: 0 0 10px #ff00ff;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Media Query for Mobile Portrait */
.main-controls {
    padding: 10px;
}
}

/* V2 Upgrades */
.top-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #ffd700;
}

#volume-btn {
    width: 60px;
    cursor: pointer;
}

/* Intense Efcts */
.flash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: white;
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
}

.flash-active {
    animation: flash-white 0.5s ease-out;
}

.jackpot-rotate {
    animation: spin-board 2s ease-in-out;
}

@keyframes flash-white {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes spin-board {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(0.8);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 20px red;
        background-color: rgba(60, 0, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 80px red;
        background-color: rgba(100, 0, 0, 0.8);
    }

    100% {
        box-shadow: 0 0 20px red;
        background-color: rgba(60, 0, 0, 0.5);
    }
}

.reach-mode {
    animation: pulse-red 0.5s infinite alternate;
    border-color: #ff0000;
}