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

:root {
    --neon-magenta: #ff00ff;
    --neon-cyan: #00ffff;
    --neon-lime: #39ff14;
    --dark-bg: #0d0221;
    --crt-bg: #1a1a2e;
}

body {
    margin: 0;
    padding: 0;
    background: var(--dark-bg) url('img/bg_sunset.png') no-repeat center center fixed;
    background-size: cover;
    font-family: 'VT323', monospace;
    color: var(--neon-cyan);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#arcade-cabinet {
    position: relative;
    width: 650px;
    height: 900px;
    background: linear-gradient(to bottom, #111, #000);
    border: 5px solid #222;
    box-shadow: 0 0 100px rgba(0,0,0,1), 0 0 40px rgba(255, 0, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: 40px 40px 10px 10px;
    padding: 20px;
    box-sizing: border-box;
}

#cabinet-header {
    width: 95%;
    height: 80px;
    background: #000;
    border: 4px solid var(--neon-magenta);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 2.2rem;
    color: var(--neon-lime);
    text-shadow: 0 0 15px var(--neon-lime);
    letter-spacing: 6px;
    margin-bottom: 25px;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
    clip-path: polygon(2% 0%, 98% 0%, 100% 100%, 0% 100%);
}

#cabinet-header::after {
    content: "8-BIT_SYSTEM_CORE";
    font-size: 0.8rem;
    color: var(--neon-magenta);
    letter-spacing: 2px;
}

#screen-container {
    width: 90%;
    height: 480px; /* Increased to fit 3 rows */
    background: #000;
    border: 12px solid #333;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 0 100px rgba(0, 0, 0, 1),
        0 0 30px rgba(0, 255, 255, 0.3);
}

/* Control Deck Decal */
#arcade-cabinet::after {
    content: "";
    width: 100%;
    height: 100px;
    position: absolute;
    bottom: 0;
    background: repeating-linear-gradient(45deg, #111, #111 10px, #0a0a0a 10px, #0a0a0a 20px);
    border-top: 5px solid var(--neon-magenta);
    z-index: 0;
    opacity: 0.3;
}

#reels-area {
    display: flex;
    width: 100%;
    height: 100%;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    z-index: 2;
    background: radial-gradient(circle, #1a1a2e 0%, #000 100%);
}

.reel-column {
    flex: 1;
    height: 95%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    margin: 0 4px;
}

.slot-cell {
    width: 130px;
    height: 130px;
    background: rgba(18, 18, 32, 0.4);
    border: 1px solid rgba(0, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 5px;
}

.slot-cell img {
    width: 90%;
    height: auto;
    filter: drop-shadow(0 0 5px var(--neon-magenta));
    transition: filter 0.3s, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Rolling animation: Loops multiple icons vertically to simulate a reel */
.spinning-cell {
    background: linear-gradient(to bottom, #000, #111, #000);
}

.spinning-cell img {
    animation: cell-roll 0.15s infinite linear;
    filter: blur(2px) brightness(1.2) drop-shadow(0 0 8px var(--neon-cyan));
}

@keyframes cell-roll {
    0% { transform: translateY(-100%) scaleY(1.2); opacity: 0.5; }
    50% { transform: translateY(0) scaleY(1); opacity: 1; }
    100% { transform: translateY(100%) scaleY(1.2); opacity: 0.5; }
}

.winning-symbol {
    animation: premium-glow 0.8s infinite alternate ease-in-out;
    border: 3px solid var(--neon-lime) !important;
    background: rgba(57, 255, 20, 0.2);
    z-index: 5;
    box-shadow: 0 0 20px var(--neon-lime), inset 0 0 15px var(--neon-lime);
}

.sticky-lock {
    border: 3px solid var(--neon-cyan) !important;
    background: rgba(0, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--neon-cyan), inset 0 0 10px var(--neon-cyan);
    animation: sticky-pulse 2s infinite alternate;
}

@keyframes premium-glow {
    0% { transform: scale(1); filter: drop-shadow(0 0 10px var(--neon-lime)) brightness(1); }
    100% { transform: scale(1.08); filter: drop-shadow(0 0 25px var(--neon-lime)) brightness(1.3); }
}

@keyframes sticky-pulse {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

#ui-panel {
    margin-top: 30px;
    width: 95%;
    background: rgba(5, 5, 5, 0.98);
    padding: 20px;
    border: 3px solid var(--neon-cyan);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4);
    border-radius: 8px;
    box-sizing: border-box;
    z-index: 10;
}

.ui-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

#balance-display, #status-display {
    font-size: 1.8rem;
    text-shadow: 0 0 8px var(--neon-cyan);
    letter-spacing: 2px;
}

#status-display {
    color: var(--neon-magenta);
    text-shadow: 0 0 8px var(--neon-magenta);
}

#bet-selection {
    display: flex;
    align-items: center;
    gap: 10px;
}

#bet-selection label {
    font-size: 1.4rem;
    color: var(--neon-lime);
}

select {
    background: #000;
    color: var(--neon-lime);
    border: 1px solid var(--neon-lime);
    font-family: 'VT323', monospace;
    font-size: 1.4rem;
    padding: 5px;
    outline: none;
    cursor: pointer;
}

button {
    background: #000;
    color: var(--neon-lime);
    border: 2px solid var(--neon-lime);
    padding: 10px 25px;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 0 0 5px var(--neon-lime);
    box-shadow: 0 0 5px var(--neon-lime);
    text-transform: uppercase;
}

button:hover {
    background: var(--neon-lime);
    color: #000;
    box-shadow: 0 0 20px var(--neon-lime);
}

button:disabled {
    border-color: #444;
    color: #444;
    text-shadow: none;
    box-shadow: none;
    cursor: not-allowed;
}

#help-btn {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan);
    box-shadow: 0 0 5px var(--neon-cyan);
    margin-left: 10px;
}

#help-btn:hover {
    background: var(--neon-cyan);
    color: #000;
}

/* CRT EFFECTS */
#crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.05));
    background-size: 100% 3px, 3px 100%;
    pointer-events: none;
    z-index: 15;
}

#crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.1; }
    50% { opacity: 0.15; }
    100% { opacity: 0.1; }
}

/* GLITCH OVERLAY */
#glitch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('img/glitch.png') center center;
    background-size: cover;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
}

#glitch-overlay.active {
    opacity: 0.7;
    animation: glitch-anim 0.2s infinite;
}

@keyframes glitch-anim {
    0% { transform: translate(2px, -2px); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(5px, 0); }
    75% { transform: translate(-5px, -5px); }
    100% { transform: translate(0, 0); }
}

/* SHAKE ANIMATION */
.shake {
    animation: shake-cabinet 0.1s infinite;
}

@keyframes shake-cabinet {
    0% { transform: translate(2px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

/* HELP MENU */
#help-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#help-content {
    background: #000;
    border: 4px solid var(--neon-cyan);
    padding: 40px;
    max-width: 500px;
    box-shadow: 0 0 50px var(--neon-cyan);
    text-align: center;
}

#help-content h2 {
    font-size: 2.5rem;
    color: var(--neon-magenta);
    margin-top: 0;
}

.stats-grid p {
    font-size: 1.6rem;
    margin: 10px 0;
    color: var(--neon-lime);
}

/* WIN POPUP */
#win-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    pointer-events: none;
}

#win-amount-text {
    font-size: 6rem;
    color: var(--neon-lime);
    text-shadow: 0 0 20px var(--neon-lime), 0 0 40px var(--neon-magenta);
    font-weight: bold;
    animation: win-pop 2s ease-out forwards;
}

@keyframes win-pop {
    0% { transform: scale(0.2) rotate(-10deg); opacity: 0; }
    30% { transform: scale(1.3) rotate(5deg) translateY(-30px); opacity: 1; }
    70% { transform: scale(1.1) rotate(0deg) translateY(-40px); opacity: 1; }
    100% { transform: scale(1) translateY(-80px); opacity: 0; }
}

.hidden {
    display: none !important;
}
