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

body {
    font-family: 'Arial', sans-serif;
    background: #1a0000;
}

body.fullscreen {
    overflow: hidden;
    width: 100%;
    height: 100dvh;
}

body.fullscreen #game-container {
    height: 100dvh;
}

#game-container {
    width: 100%;
    min-height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

#background {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0d0d0d 0%, #2d0000 25%, #1a0000 50%, #3d0a0a 75%, #000000 100%);
    z-index: 0;
}

#background::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(139, 0, 0, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(70, 0, 0, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(100, 0, 0, 0.2) 0%, transparent 60%);
    animation: darkPulse 15s ease-in-out infinite;
}

@keyframes darkPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.08); opacity: 0.9; }
}

#game-title {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 20px;
}

#game-title h1 {
    font-size: 4em;
    background: linear-gradient(45deg, #8B0000, #FF0000, #DC143C, #8B0000);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: bloodDrip 2s linear infinite;
    text-shadow:
        3px 3px 0 #000,
        5px 5px 15px rgba(139, 0, 0, 0.9);
    letter-spacing: 0.15em;
    font-weight: bold;
}

@keyframes bloodDrip {
    0% { background-position: 0% 50%; filter: brightness(0.8); }
    50% { background-position: 100% 50%; filter: brightness(1.2); }
    100% { background-position: 0% 50%; filter: brightness(0.8); }
}

.subtitle {
    color: #DC143C;
    font-size: 1.5em;
    letter-spacing: 0.3em;
    text-shadow:
        2px 2px 0 #000,
        3px 3px 10px rgba(220, 20, 60, 0.9);
    font-weight: bold;
    font-style: italic;
}

#slot-machine {
    position: relative;
    z-index: 1;
    margin: 20px 0;
}

.slot-frame {
    background: linear-gradient(135deg, #2d0000 0%, #1a0000 50%, #3d0a0a 100%);
    border: 10px solid #8B0000;
    border-radius: 25px;
    padding: 30px;
    box-shadow:
        0 15px 60px rgba(139, 0, 0, 0.8),
        inset 0 0 40px rgba(220, 20, 60, 0.2),
        0 0 0 3px #460000;
}

#reels-container {
    display: flex;
    gap: 10px;
    background: linear-gradient(180deg, #000000 0%, #1a0000 100%);
    padding: 20px;
    border-radius: 15px;
    border: 5px solid #8B0000;
    box-shadow: inset 0 0 30px rgba(139, 0, 0, 0.6);
}

.reel {
    width: 120px;
    height: 360px;
    background: linear-gradient(180deg, #1a0000 0%, #0d0d0d 50%, #1a0000 100%);
    border: 4px solid #460000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow:
        inset 0 0 20px rgba(139, 0, 0, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.8);
}

.symbol {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5em;
    background: linear-gradient(135deg, rgba(45, 0, 0, 0.15) 0%, rgba(13, 13, 13, 0.1) 100%);
    border-bottom: 3px solid rgba(139, 0, 0, 0.3);
    transition: all 0.2s;
    user-select: none;
}

.symbol.winning {
    animation: cursedGlow 0.6s ease-in-out infinite;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.9) 0%, rgba(220, 20, 60, 0.8) 100%);
    box-shadow:
        0 0 30px rgba(255, 0, 0, 1),
        inset 0 0 20px rgba(139, 0, 0, 0.7);
}

@keyframes cursedGlow {
    0%, 100% {
        transform: scale(1);
        filter: brightness(0.8) drop-shadow(0 0 10px #8B0000);
    }
    50% {
        transform: scale(1.1);
        filter: brightness(1.3) drop-shadow(0 0 20px #DC143C);
    }
}

.reel.spinning .symbol {
    animation: hauntedSpin 0.08s linear infinite;
}

@keyframes hauntedSpin {
    0% { filter: blur(0px); transform: translateY(0); }
    50% { filter: blur(6px); transform: translateY(-5px); }
    100% { filter: blur(0px); transform: translateY(0); }
}

.symbol.cascading {
    animation: shadowFall 0.5s ease-in forwards;
}

@keyframes shadowFall {
    0% {
        transform: translateY(-120px) scale(0.7);
        opacity: 0;
        filter: blur(10px);
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: blur(0px);
    }
}

#paylines-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#control-panel {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, #2d0000 0%, #1a0000 50%, #3d0a0a 100%);
    border: 6px solid #8B0000;
    border-radius: 20px;
    padding: 25px;
    min-width: 640px;
    box-shadow:
        0 8px 40px rgba(139, 0, 0, 0.7),
        inset 0 3px 15px rgba(220, 20, 60, 0.2);
}

.info-display {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.label {
    color: #DC143C;
    font-size: 0.95em;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.value {
    color: #FFF;
    font-size: 2.1em;
    font-weight: bold;
    text-shadow:
        0 0 15px rgba(220, 20, 60, 1),
        2px 2px 6px rgba(0, 0, 0, 0.9),
        0 0 25px rgba(139, 0, 0, 0.7);
    min-width: 85px;
    text-align: center;
}

.win-value {
    color: #FF0000;
    text-shadow:
        0 0 20px rgba(255, 0, 0, 1),
        2px 2px 6px rgba(0, 0, 0, 0.9);
}

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

.btn {
    padding: 16px 28px;
    font-size: 1.15em;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.7);
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.btn-primary {
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 50%, #8B0000 100%);
    color: #FFF;
    font-size: 1.6em;
    padding: 22px 55px;
    border: 5px solid #460000;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
    box-shadow:
        0 8px 25px rgba(139, 0, 0, 0.8),
        inset 0 3px 8px rgba(220, 20, 60, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #B22222 0%, #FF0000 50%, #B22222 100%);
    box-shadow:
        0 0 35px rgba(255, 0, 0, 1),
        inset 0 3px 10px rgba(220, 20, 60, 0.6);
    transform: scale(1.08);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, #460000 0%, #2d0000 50%, #460000 100%);
    color: #DC143C;
    border: 4px solid #1a0000;
    padding: 16px 32px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #640000 0%, #460000 50%, #640000 100%);
    box-shadow: 0 0 25px rgba(139, 0, 0, 0.8);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 0, 0, 0.97);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #2d0000 0%, #1a0000 50%, #3d0a0a 100%);
    border: 6px solid #8B0000;
    border-radius: 25px;
    padding: 40px;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow:
        0 0 60px rgba(139, 0, 0, 0.9),
        inset 0 3px 25px rgba(220, 20, 60, 0.2);
}

.modal-content h2 {
    color: #DC143C;
    font-size: 2.8em;
    text-align: center;
    margin-bottom: 15px;
    text-shadow:
        2px 2px 0 #000,
        4px 4px 12px rgba(139, 0, 0, 0.9);
}

.paytable-note {
    text-align: center;
    color: #DC143C;
    font-size: 1.15em;
    margin-bottom: 20px;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.6);
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #8B0000;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 22px;
    font-size: 2.8em;
    color: #DC143C;
    cursor: pointer;
    transition: all 0.3s;
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.9);
}

.close-btn:hover {
    color: #FF0000;
    transform: rotate(90deg) scale(1.2);
}

.paytable-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.paytable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 16px;
    border-radius: 12px;
    border: 3px solid #460000;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
}

.paytable-item.special {
    background: linear-gradient(135deg, #8B0000 0%, #DC143C 100%);
    border-color: #2d0000;
}

.symbol-display {
    font-size: 1.6em;
    color: #DC143C;
    font-weight: bold;
}

.payout {
    color: #DC143C;
    font-size: 1.4em;
    font-weight: bold;
}

.paytable-item.special .symbol-display,
.paytable-item.special .payout {
    color: #FFF;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.cascade-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #8B0000;
}

.cascade-info h3 {
    color: #DC143C;
    font-size: 1.8em;
    margin-bottom: 10px;
    text-align: center;
}

.cascade-info p {
    color: #FFF;
    line-height: 1.6;
    text-align: center;
}

#win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 0, 0, 0.95);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

#win-overlay.hidden {
    display: none;
}

.win-message {
    text-align: center;
    animation: hauntedWinAnim 0.7s ease-out;
}

.win-message h2 {
    font-size: 6em;
    background: linear-gradient(45deg, #8B0000, #FF0000, #DC143C);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: bloodDrip 1s linear infinite;
    text-shadow:
        0 0 30px rgba(255, 0, 0, 1),
        0 0 50px rgba(139, 0, 0, 0.9);
    margin-bottom: 25px;
}

.win-message .win-amount {
    font-size: 3.5em;
    color: #FFF;
    font-weight: bold;
    text-shadow:
        3px 3px 0 #000,
        5px 5px 15px rgba(220, 20, 60, 0.9);
}

@keyframes hauntedWinAnim {
    0% {
        transform: scale(0);
        opacity: 0;
        filter: blur(10px);
    }
    60% {
        transform: scale(1.3);
        filter: blur(0px);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#cascade-counter {
    position: fixed;
    top: 50%;
    right: 25px;
    transform: translateY(-50%);
    z-index: 45;
}

#cascade-counter.hidden {
    display: none;
}

.cascade-badge {
    background: linear-gradient(135deg, #2d0000 0%, #1a0000 100%);
    border: 5px solid #8B0000;
    border-radius: 15px;
    padding: 20px;
    box-shadow:
        0 0 35px rgba(220, 20, 60, 0.9),
        inset 0 2px 12px rgba(139, 0, 0, 0.4);
    animation: cursedPulse 0.8s ease-in-out infinite;
}

.cascade-text {
    font-size: 1.8em;
    font-weight: bold;
    color: #DC143C;
    text-shadow:
        2px 2px 0 #000,
        3px 3px 6px rgba(139, 0, 0, 0.9);
}

@keyframes cursedPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 35px rgba(220, 20, 60, 0.9); }
    50% { transform: scale(1.1); box-shadow: 0 0 50px rgba(255, 0, 0, 1); }
}

@media (max-width: 768px) {
    .slot-frame {
        padding: 15px;
    }

    #game-title h1 {
        font-size: 2.5em;
    }

    .subtitle {
        font-size: 1.1em;
    }

    .reel {
        width: 75px;
        height: 245px;
    }

    .symbol {
        height: 81px;
        font-size: 3em;
    }

    #control-panel {
        min-width: auto;
        width: 92%;
    }

    .controls {
        gap: 10px;
        flex-wrap: wrap;
    }

    .btn-primary {
        padding: 14px 28px;
        font-size: 1.2em;
    }

    .btn-secondary {
        padding: 12px 18px;
        font-size: 0.95em;
    }

    .value {
        min-width: 60px;
    }

    #cascade-counter {
        right: 12px;
    }

    .cascade-badge {
        padding: 12px;
    }

    .cascade-text {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    #game-title h1 {
        font-size: 1.6em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .slot-frame {
        padding: 10px;
        border-width: 4px;
        border-radius: 15px;
    }

    #reels-container {
        gap: 4px;
        padding: 8px;
    }

    .reel {
        width: 52px;
        height: 168px;
    }

    .symbol {
        height: 56px;
        font-size: 2em;
    }

    #control-panel {
        width: 96%;
        padding: 10px;
        border-width: 3px;
    }

    .info-display {
        gap: 8px;
    }

    .label {
        font-size: 0.75em;
    }

    .value {
        font-size: 1.4em;
    }

    .btn-primary {
        padding: 10px 18px;
        font-size: 1em;
    }

    .btn-secondary {
        padding: 6px 10px;
        font-size: 0.8em;
        border-width: 3px;
    }

    .controls {
        gap: 5px;
        flex-wrap: wrap;
    }

    .value {
        min-width: auto;
    }

    #game-title {
        margin-bottom: 8px;
    }

    #slot-machine {
        margin: 8px 0;
    }

    #game-container {
        padding: 8px 0;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    #game-title {
        display: none;
    }

    #game-container {
        padding: 5px 0;
    }

    #slot-machine {
        margin: 5px 0;
    }

    .slot-frame {
        padding: 8px;
        border-width: 4px;
    }

    #reels-container {
        padding: 8px;
    }

    .reel {
        height: 135px;
    }

    .symbol {
        height: 45px;
        font-size: 2em;
    }

    #control-panel {
        padding: 10px;
        border-width: 3px;
    }

    .info-display {
        margin-bottom: 8px;
    }

    .value {
        font-size: 1.4em;
        min-width: auto;
    }

    .btn-primary {
        padding: 8px 20px;
        font-size: 1em;
        border-width: 3px;
    }

    .btn-secondary {
        padding: 8px 16px;
        font-size: 0.85em;
    }

    #cascade-counter {
        display: none;
    }
}
