
:root {
    --primary: #ff69b4; /* Hot Pink */
    --secondary: #87ceeb; /* Sky Blue */
    --accent: #ffd700; /* Gold */
    --dark: #2c003e;
    --glass: rgba(255, 255, 255, 0.3);
    --pipe-color: #55aaff;
}

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* This stops the "cutting off" scroll behavior */
    display: flex;
    justify-content: center;
    align-items: center;
    background: black;
}

canvas {
    /* This forces the game canvas to fit the window without overflowing */
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.bodyogog {
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    margin: 0;
    color: #333;
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    /*height: 100vh;*/
    overflow: hidden;
}

.game-world {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px; /* Limit width on desktop */
    height: 100vh;    /* Fill viewport height */
    box-sizing: border-box;
    padding: 10px 0; /* Small vertical padding */
}

header {
    margin-bottom: 10px;
    position: relative;
    z-index: 10;
    flex-shrink: 0; /* Don't squash header */
}

h1 {
    font-size: 3rem;
    letter-spacing: 2px;
    color: white;
    text-shadow: 
        3px 3px 0 #ff007f,
        -1px -1px 0 #ff007f,  
        1px -1px 0 #ff007f,
        -1px 1px 0 #ff007f,
        1px 1px 0 #ff007f;
    margin: 0;
    font-weight: 900;
}

h1 span { 
    color: #ffd700; 
    text-shadow: 
        3px 3px 0 #d35400,
        -1px -1px 0 #d35400,  
        1px -1px 0 #d35400,
        -1px 1px 0 #d35400,
        1px 1px 0 #d35400;
}

.free-spins-panel {
    display: none; /* Hidden by default */
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #4deeea;
    color: #fff;
    padding: 5px 20px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 0 0 10px #4deeea;
    box-shadow: 0 0 15px rgba(77, 238, 234, 0.4);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.8; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1.02); }
}

#cabinet {
    position: relative;
    /* Dark professional finish */
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    padding: 10px; /* Reduced padding */
    
    /* Frame matches .controls */
    border: 4px solid #444; 
    border-bottom-color: #222;
    border-radius: 12px; /* Matched radius */
    
    /* Shadows */
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.6), 
        inset 0 0 50px rgba(0,0,0,0.8),
        inset 0 0 0 1px rgba(255,255,255,0.05);

    /* Flex adjustments for responsiveness */
    flex: 1; /* Take remaining space */
    min-height: 0; /* Allow shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
    width: 90%; /* Fit within container */
    max-width: 580px;
    box-sizing: border-box;
}

/* Decorate top like icing - REMOVED for pro look */
#cabinet::before {
    display: none;
}

canvas {
    /* Responsive sizing */
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    aspect-ratio: 1 / 1; /* Ensure square aspect ratio is maintained */

    /* Deep OLED-like screen background */
    background: radial-gradient(circle, #2d0a35 0%, #15001c 90%);
    
    /* Frame matches .controls exactly */
    border: 4px solid #444; 
    border-bottom-color: #222;
    border-radius: 12px;
    display: block;
    margin: 0 auto; /* Centered */

    /* Shadows matching control panel vibe */
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.6),
        inset 0 0 20px rgba(0,0,0,0.8); /* Inner screen shadow */
}

.controls {
    margin-top: 15px;
    background: linear-gradient(to bottom, #2a2a2a, #111);
    border: 4px solid #444;
    border-bottom-color: #222; /* Darker bottom border for depth */
    border-radius: 12px;
    padding: 10px 20px;
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    box-sizing: border-box;
    box-shadow: 
        0 10px 20px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.control-group {
    display: flex;
    gap: 12px;
}

.panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #333;
    border-bottom: 1px solid #444; /* Light reflected on bottom bevel */
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.8);
    min-width: 90px;
    position: relative;
}

/* Glass reflection on screen */
.panel::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

/* --- CONGRATS MODAL --- */
.congrats-modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.85); 
    /* removed backdrop-filter due to positioning bugs on some setups */
    animation: fadeIn 0.5s ease;
    /* Centering */
    justify-content: center;
    align-items: center;
}

.congrats-content {
    background: linear-gradient(135deg, #222, #000);
    padding: 30px;
    border: 2px solid #555; /* Neutral professional border */
    width: 60%;
    max-width: 600px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 
        0 0 50px rgba(255, 255, 255, 0.1),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    color: #fff;
    transform: scale(0.8);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    margin: 0; /* Important for flex centering */
}

@keyframes popIn {
    to { transform: scale(1); }
}

.glow-text {
    font-size: 2rem; /* Reduced from 3rem to fit */
    white-space: nowrap; /* Prevent ugly wrapping if possible, or allow scale down */
    color: #fff; /* Changed from gold to white for professional look */
    text-shadow: 
        0 0 10px #ff007f,
        0 0 20px #ff007f;
    margin: 0 0 20px 0;
    font-style: italic;
    letter-spacing: 1px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.bonus-icon {
    font-size: 5rem;
    margin: 10px 0;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.win-label {
    font-size: 1.2rem;
    color: #aaa;
    letter-spacing: 3px;
    margin-bottom: 5px;
}

.win-amount {
    font-size: 3rem; /* Reduced */
    font-weight: 900;
    color: #4deeea;
    text-shadow: 0 0 15px #4deeea;
    font-family: 'Courier New', monospace;
    margin-bottom: 30px;
}

#collectBtn {
    background: linear-gradient(to bottom, #ffd700, #b8860b);
    border: none;
    color: #000;
    padding: 15px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
    transition: transform 0.1s;
}

#collectBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
}

#collectBtn:active {
    transform: scale(0.95);
}

.label { 
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.6rem; 
    color: #888; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.val { 
    font-family: 'Courier New', monospace;
    font-size: 1.1rem; 
    font-weight: 800; 
    color: #4deeea; /* Digital Cyan */
    text-shadow: 0 0 8px rgba(77, 238, 234, 0.6);
    letter-spacing: -0.5px;
}

/* Special color for BET val */
#betSelect {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 800;
    color: #ff007f; /* Hot Pink */
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.6);
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    text-align: center;
    width: 100%;
}

#betSelect:focus {
    outline: none;
    background: rgba(255,255,255,0.05);
}

#betSelect option {
    background: #222;
    color: #fff;
    font-family: sans-serif;
}

.action-group { display: flex; gap: 12px; align-items: center;}

#infoBtn {
    width: 36px; height: 36px; 
    border-radius: 50%; 
    background: linear-gradient(135deg, #444, #222);
    border: 2px solid #666; 
    color: #ddd; 
    font-weight: bold; 
    font-family: serif;
    font-size: 1.1rem;
    cursor: pointer; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.1s ease;
}

#infoBtn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.5);
    background: #222;
}

#spinBtn {
    height: 70px; width: 70px;
    border-radius: 50%;
    border: 4px solid #fff;
    /* Glossy Plastic Look */
    background: radial-gradient(circle at 30% 30%, #ff5eab 0%, #d60064 60%, #900043 100%); 
    color: transparent;
    cursor: pointer; 
    box-shadow: 
        0 5px 15px rgba(255, 0, 127, 0.4),
        0 2px 4px rgba(0,0,0,0.4),
        inset 0 0 10px rgba(255,255,255,0.4);
    position: relative;
    transition: transform 0.1s, box-shadow 0.1s;
}

#spinBtn:hover {
    box-shadow: 
        0 5px 20px rgba(255, 0, 127, 0.6),
        0 2px 4px rgba(0,0,0,0.4),
        inset 0 0 10px rgba(255,255,255,0.6);
}

#spinBtn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(255, 0, 127, 0.3);
}

#spinBtn::after {
    content: '↻';
    color: white;
    font-size: 2rem;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
}

#spinBtn:active { transform: scale(0.95); }
#spinBtn:disabled { filter: grayscale(1); opacity: 0.7; }

select { 
    background: #333; 
    color: white; 
    border: 1px solid #555; 
    padding: 2px 5px; 
    border-radius: 5px; 
    font-weight: bold; 
}

.modal {
    display: none; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100;
}
.modal-content { 
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: white; padding: 30px; border-radius: 20px; 
    border: 5px solid var(--primary);
    text-align: center;
    min-width: 300px;
}
.close { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; }

h2 { margin-top: 0; color: var(--primary); }

.pay-row {
    display: flex; justify-content: space-between; margin: 10px 0; font-size: 1.2rem;
    font-weight: bold; border-bottom: 1px dashed #eee;
}

/* --- FIXED CONGRATS MODAL OVERRIDES --- */
/* Placed at end of file to ensure they override generic .modal styles */

#congratsModal {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background-color: rgba(0,0,0,0.85);
    z-index: 9999;
    /* Flex box centering */
    justify-content: center;
    align-items: center;
}

#congratsModal .congrats-content {
    /* Reset abstract positioning from generic .modal-content */
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    
    /* Re-apply styling */
    width: 60%;
    max-width: 500px;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
