* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* How to Play Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.modal-content {
    background: linear-gradient(145deg, #1a202c, #2d3748);
    border: 2px solid #ffd700;
    border-radius: 20px;
    padding: 32px;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.3);
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}
.modal-content h2 {
    color: #ffd700;
    margin-bottom: 20px;
    font-size: 24px;
}
.modal-body h3 {
    color: #fff;
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 18px;
}
.modal-body p, .modal-body li {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 8px;
}
.modal-body ul, .modal-body ol {
    margin-left: 20px;
    margin-bottom: 12px;
}
.btn-modal-close {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    border: 2px solid #ffd700;
    border-radius: 10px;
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-modal-close:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000000;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: white;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.top-field {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100vw;
    box-sizing: border-box;
    height: 58px;
    background: linear-gradient(145deg, #1a202c, #2d3748);
    border-bottom: 2px solid #4a5568;
    display: grid;
    grid-template-columns: 40px minmax(220px, 520px) 40px;
    align-items: center;
    justify-content: center;
    column-gap: 14px;
    padding: 0 12px;
    z-index: 1500;
    backdrop-filter: blur(10px);
}

.mute-btn, .how-to-play-btn {
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border: 2px solid #718096;
    border-radius: 8px;
    padding: 8px;
    color: #ffd700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.result-display {
    background: rgba(45, 55, 72, 0.9);
    border-radius: 15px;
    padding: 8px 14px;
    text-align: center;
    border: 2px solid #4a5568;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 100%;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resultText {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.maximize-btn {
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border: 2px solid #718096;
    border-radius: 12px;
    padding: 10px;
    color: #ffd700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

body::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.3) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.2) 0%, transparent 30%),
        radial-gradient(circle at 50% 20%, rgba(255, 105, 180, 0.25) 0%, transparent 25%),
        radial-gradient(circle at 30% 80%, rgba(0, 255, 255, 0.2) 0%, transparent 25%);
    animation: glamourPulse 4s ease-in-out infinite alternate;
    z-index: -2;
}

body::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 215, 0, 0.1) 2px, transparent 2px),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
        radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.1) 3px, transparent 3px);
    background-size: 80px 80px, 60px 60px, 100px 100px;
    animation: sparkleFloat 15s linear infinite;
    z-index: -1;
}

@keyframes glamourPulse {
    0% {
        opacity: 0.3;
        filter: brightness(1);
    }
    100% {
        opacity: 0.6;
        filter: brightness(1.2);
    }
}

@keyframes sparkleFloat {
    0% {
        background-position: 0 0, 0 0, 0 0;
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        background-position: 80px 80px, 60px 60px, 100px 100px;
        opacity: 0.5;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes particleFloat {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes glowPulse {
    0% {
        opacity: 0.3;
        transform: scale(1);
    }
    100% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

.slot-machine-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: calc(100vh - 58px);
    margin-top: 58px;
    padding: 10px 12px 12px;
}

.game-wrapper {
    position: relative;
    width: min(96vw, 1400px, calc((100vh - 130px) * 2));
    aspect-ratio: 2 / 1;
    height: auto;
    margin: 0 auto;
}

.slot-machine {
    background: url('slotmachine.png') no-repeat center;
    background-size: contain;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    cursor: pointer;
    z-index: 10;
}

.reels-container {
    display: flex;
    gap: 0px;
    position: absolute;
    top: calc(46% + 5px);
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    width: 37.5%;
    height: 35%;
}

.reel {
    width: 33.3333%;
    height: 100%;
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
}

.slot-window {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
    position: relative;
    margin: 0;
    padding: 0;
}

.slot-card {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
}

.slot-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
}

.slot-card.spinning {
    animation: rollDown 0.1s linear infinite;
}

@keyframes rollDown {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(100%);
    }
}

.spin-button-container {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
}

.spin-button {
    padding: 20px 60px;
    background: linear-gradient(145deg, #e53e3e, #c53030);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(229, 62, 62, 0.4);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.spin-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(229, 62, 62, 0.5);
    background: linear-gradient(145deg, #ff6b6b, #e53e3e);
}

.spin-button:disabled {
    background: linear-gradient(145deg, #718096, #4a5568);
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.bet-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #1a202c, #2d3748);
    border-radius: 20px;
    padding: 25px;
    border: 2px solid #4a5568;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    min-width: 300px;
    backdrop-filter: blur(10px);
}

.bet-popup-content {
    text-align: center;
}

.bet-popup-content h3 {
    color: #ffd700;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bet-popup-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(145deg, #e53e3e, #c53030);
    border: 2px solid #fc8181;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bet-popup-close-btn:hover {
    background: linear-gradient(145deg, #fc8181, #f56565);
    transform: scale(1.1);
}

.bet-popup-btn {
    position: relative;
    background: linear-gradient(145deg, #48bb78, #38a169);
    border: 2px solid #68d391;
    border-radius: 12px;
    padding: 8px 16px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    z-index: 10;
}

.bet-popup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(72, 187, 120, 0.3);
    border-color: #68d391;
}

.result-display p {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffd700;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.bet-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.bet-adjust-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border: 2px solid #718096;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bet-adjust-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-color: #ffd700;
    background: linear-gradient(145deg, #718096, #4a5568);
}

.bet-adjust-btn:active {
    transform: scale(0.95);
}

.bet-amount-display {
    background: linear-gradient(145deg, #48bb78, #38a169);
    border: 2px solid #68d391;
    border-radius: 12px;
    padding: 10px 20px;
    min-width: 120px;
    text-align: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 0 20px #48bb78;
}

.jackpot-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.jackpot-content {
    background: linear-gradient(145deg, #ff6b6b, #e53e3e, #ff6b6b);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 3px solid #ffd700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
    max-width: 400px;
    animation: jackpotPopup 0.5s ease-out;
}

@keyframes jackpotPopup {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.jackpot-content h2 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: glow 1s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px #ffd700, 0 0 20px #ffd700, 0 0 30px #ffd700;
    }
    to {
        text-shadow: 0 0 20px #ffd700, 0 0 30px #ffd700, 0 0 40px #ffd700;
    }
}

.jackpot-result {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    line-height: 1.6;
}

.jackpot-close-btn {
    background: linear-gradient(145deg, #48bb78, #38a169);
    border: 2px solid #68d391;
    border-radius: 12px;
    padding: 15px 30px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.jackpot-close-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px #48bb78;
}

.bet-options {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.betting-section h3 {
    margin-bottom: 20px;
    color: #ffd700;
    font-size: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.betting-section {
    background: linear-gradient(145deg, #1a202c, #2d3748);
    border-radius: 20px;
    padding: 25px;
    border: 2px solid #4a5568;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.speed-controls {
    margin-top: 30px;
}

.speed-controls h3 {
    margin-bottom: 15px;
    color: #ffd700;
    font-size: 1.3rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.speed-options {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.speed-btn {
    padding: 10px 20px;
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border: 2px solid #718096;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.speed-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: #ffd700;
}

.speed-btn.selected {
    background: linear-gradient(145deg, #48bb78, #38a169);
    border-color: #68d391;
    box-shadow: 0 0 25px #48bb78;
    transform: scale(1.05);
}

.maximize-btn:hover {
    transform: scale(1.1);
    border-color: #ffd700;
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.maximize-btn:active {
    transform: scale(0.95);
}

.mute-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.mute-btn .mute-icon {
    display: none;
}

.mute-btn:hover {
    transform: scale(1.1);
    border-color: #ffd700;
    box-shadow: 0 6px 15px rgba(255, 215, 0, 0.2);
}

.mute-btn:active {
    transform: scale(0.95);
}

.mute-btn.muted {
    background: linear-gradient(145deg, #e53e3e, #c53030);
    border-color: #fc8181;
    color: white;
}

.mute-btn.muted .sound-icon {
    display: none;
}

.mute-btn.muted .mute-icon {
    display: flex;
    opacity: 1;
}

.mute-btn:not(.muted) .sound-icon {
    display: flex;
}

.mute-btn:not(.muted) .mute-icon {
    display: none;
}

.bet-btn {
    padding: 15px 30px;
    background: linear-gradient(145deg, #4a5568, #2d3748);
    border: 2px solid #718096;
    border-radius: 12px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bet-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border-color: #ffd700;
}

.bet-btn.selected {
    background: linear-gradient(145deg, #48bb78, #38a169);
    border-color: #68d391;
    box-shadow: 0 0 25px #48bb78;
    transform: scale(1.05);
}

@keyframes carnivalBorder {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.slot-card.winning {
    animation: winGlow 0.5s ease-in-out 3;
}

@keyframes winGlow {
    0%, 100% {
        box-shadow: 0 0 20px #ffd700;
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 40px #ffd700, 0 0 60px #ff6b6b;
        transform: scale(1.1);
    }
}

.slot-window.winning {
    border-color: #ffd700;
    box-shadow: 0 0 30px #ffd700;
    animation: borderPulse 0.5s ease-in-out 3;
}

@keyframes borderPulse {
    0%, 100% {
        border-color: #ffd700;
        box-shadow: 0 0 30px #ffd700;
    }
    50% {
        border-color: #ff6b6b;
        box-shadow: 0 0 50px #ff6b6b;
    }
}

@keyframes celebration {
    0%, 100% { 
        transform: scale(1) rotate(0deg); 
    }
    25% { 
        transform: scale(1.02) rotate(1deg); 
    }
    75% { 
        transform: scale(1.02) rotate(-1deg); 
    }
}

.celebrating {
    animation: celebration 0.5s ease-in-out 3;
}

@media (max-width: 700px) {
    .top-field {
        grid-template-columns: 36px minmax(140px, 1fr) 36px;
        column-gap: 10px;
        padding: 0 8px;
        height: 54px;
    }

    .result-display {
        min-height: 30px;
        padding: 6px 10px;
    }

    #resultText {
        font-size: 0.8rem;
        line-height: 1.1;
    }

    .slot-machine-container {
        margin-top: 54px;
        min-height: calc(100vh - 54px);
        padding-top: 8px;
    }

    .game-wrapper {
        width: min(99vw, calc((100vh - 120px) * 2));
    }

    .reels-container {
        top: calc(46% + 3px);
    }

    .bet-popup {
        min-width: min(92vw, 320px);
        padding: 18px;
    }
}

@media (max-width: 700px) and (orientation: portrait) {
    .slot-machine-container {
        padding-left: 0;
        padding-right: 0;
    }

    .game-wrapper {
        width: 100vw;
        max-width: 100vw;
        aspect-ratio: 1074 / 895;
    }

    .reels-container {
        width: 62.5%;
        height: 35%;
    }
}
