/* Body & Container */
body {
    margin: 0;
    padding: 0;
    background-color: #1a0b0b;
    color: #ffd700;
    font-family: 'Rye', serif;
    font-family: 'Rye', serif;
    display: flex;
    flex-direction: column;
    /* FIX: Ensure column layout */
    align-items: center;
    min-height: 100vh;
    min-height: 100vh;
    padding-top: 0;
    /* Let sticky header handle flow */
    box-sizing: border-box;
}

.casino-container {
    width: 100%;
    max-width: 400px;
    display: block;
    flex-direction: column;
    align-items: center;
    margin: 800px 0;
    padding: 40px 20px;
    box-sizing: border-box;
    /* Background managed by body or specific container */
}

/* Header Spacer handled by ios-frame.css usually or manual padding */

/* Slot Machine Frame */
.slot-machine {
    display: block;
    background: linear-gradient(135deg, #4a0404 0%, #2b0000 100%);
    margin: 40px 20px;
    border-radius: 30px;
    padding: 20px;
    border: 6px solid #ffd700;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.8),
        inset 0 0 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-top: 10px;
}

/* Machine Top Section (Title & Credits) */
.machine-top {
    width: 100%;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: inset 0 0 10px #000;
    display: block;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.machine-title {
    font-size: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 5px #ff0000;
    letter-spacing: 2px;
}

.credit-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #220000;
    padding: 5px 15px;
    border-radius: 5px;
    border: 1px solid #ff0000;
    box-shadow: inset 0 0 5px #000;
}

.credit-display .label {
    font-size: 0.8rem;
    color: #ffaaaa;
}

.credit-display .digits {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.2rem;
    color: #ff3333;
    text-shadow: 0 0 5px #ff0000;
    font-weight: bold;
}

/* Reels Window */
.reels-window {
    background: #000;
    padding: 15px;
    border-radius: 10px;
    border: 4px solid #330000;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.reels-container {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    height: 90px;
    /* overflow: visible;  No, keep hidden for the reel-wrapper */
}

.reel-wrapper {
    flex: 1;
    height: 100%;
    background: #fff;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
    border: 1px solid #666;
}

.reel {
    width: 100%;
    height: 100%;
    background-image: url('stripe.png');
    background-repeat: repeat-y;
    background-size: 100px 770px;
    background-position-x: center;
    background-position-y: 0;
}

/* Shading styling */
.reel-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    z-index: 2;
}

.reel-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    z-index: 2;
}

.win-line {
    position: absolute;
    top: 50%;
    left: -5px;
    right: -5px;
    height: 2px;
    background: rgba(255, 0, 0, 0.4);
    box-shadow: 0 0 4px red;
    z-index: 10;
    pointer-events: none;
}

/* Controls */
.controls {
    margin-top: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    /* Cash out left, Spin right */
    gap: 15px;
}

button {
    font-family: 'Rye', serif;
    font-size: 0.8rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
    color: white;
    padding: 10px;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
}

button:active {
    transform: translateY(4px);
    box-shadow: none;
}

#cashout-btn {
    background: linear-gradient(to bottom, #ffaa00, #cc8800);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border: 2px solid #ffd700;
}

#spin-btn {
    background: linear-gradient(to bottom, #ff0000, #990000);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    border: 2px solid #ff5555;
    font-size: 0.9rem;
    /* Slightly bigger */
}

#spin-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
}

.message {
    margin-top: 15px;
    height: 20px;
    font-size: 1rem;
    text-align: center;
    color: #ffd700;
    text-shadow: 0 1px 2px #000;
}

.info-panel {
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #bbb;
    margin-top: 20px;
    text-align: center;
}

/* Animation */
.blink {
    animation: blink-anim 0.5s infinite;
}

@keyframes blink-anim {
    0% {
        opacity: 1;
        color: #ffd700;
    }

    50% {
        opacity: 0.5;
        color: #fff;
    }

    100% {
        opacity: 1;
        color: #ffd700;
    }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #2b0000 0%, #1a0b0b 100%);
    border: 4px solid #ffd700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    color: #ffd700;
    max-width: 300px;
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.5);
    animation: popIn 0.3s ease-out;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin: 10px 0;
    text-shadow: 0 0 10px #ff0000;
}

.modal-content p {
    font-size: 1rem;
    color: #fff;
    margin-bottom: 20px;
}

.modal-content button {
    background: #ff0000;
    border: 2px solid #ffd700;
    padding: 10px 20px;
    font-size: 1rem;
    box-shadow: 0 5px 0 #990000;
}

.modal-content button:active {
    box-shadow: none;
    transform: translateY(5px);
}

.flomo-anim {
    width: 100px;
    height: 100px;
    object-fit: contain;
    animation: spin-clown 2s infinite linear;
    margin-bottom: 10px;
}

@keyframes spin-clown {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.2);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}