* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100vh;
    overflow: hidden;
}

body {
    width: 100%;
    position: relative;
    background-image: url('../images/bg.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.wheel-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2vh;
    position: relative;
    z-index: 1;
    transition: opacity 0.5s ease;
}

[data-role="game-screen"][data-state="hidden"] {
    opacity: 0;
    pointer-events: none;
}

[data-role="game-screen"][data-state="spinning"] {
    animation: wrapperShake 0.12s ease-in-out infinite;
}

@keyframes wrapperShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

.wheel-assembly {
    width: 60vh;
    position: relative;
    transform-origin: center center;
    will-change: transform;
}

.wheel-stage {
    width: 100%;
}

.wheel-wr {
    position: relative;
}

.arrow {
    position: absolute;
    width: 10%;
    z-index: 5;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wheel-container {
    width: 100%;
}

.wheel {
    width: 100%;
    display: block;
    filter: drop-shadow(0 0 2vh rgba(0, 0, 0, 0.45));
}

.jocker {
    width: 25%;
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    filter: drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.5));
    pointer-events: none;
}

[data-role="spin-button"] {
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-transform: uppercase;
    font-weight: bold;
    -webkit-text-stroke: 0.1vh black;
    font-size: 5vh;
    width: 30vh;
    aspect-ratio: 659 / 322;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('../images/spin.webp');
    background-size: 100% 100%;
    background-color: transparent;
    border: none;
    outline: none;
    padding-top: 1.5vh;
    cursor: pointer;
    position: relative;
    z-index: 3;
    transition: transform 0.2s ease, filter 0.2s ease;
}

[data-role="spin-button"]:not(:disabled) {
    animation: spinButtonIdle 1.4s ease-in-out infinite;
}

@keyframes spinButtonIdle {
    0%, 100% {
        transform: scale(1) translateY(0);
        filter: brightness(1) drop-shadow(0 0 0 transparent);
    }

    70% {
        transform: scale(1.03) translateY(0);
        filter: brightness(1.08) drop-shadow(0 0 1.2vh rgba(255, 180, 30, 0.5));
    }
}

[data-role="spin-button"]:not(:disabled):active {
    transform: scale(0.97);
}

[data-role="spin-button"]:disabled,
[data-role="spin-button"][data-state="disabled"] {
    cursor: not-allowed;
    opacity: 0.75;
    filter: grayscale(0.35);
    animation: none;
}

[data-role="coin-rain"],
.win-modal__coin-rain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.falling-coin {
    position: absolute;
    top: -12vh;
    animation-name: coinFall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    will-change: transform;
    filter: drop-shadow(0 0.4vh 0.8vh rgba(0, 0, 0, 0.35));
}

@keyframes coinFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(720deg) scale(0.85);
        opacity: 0.85;
    }
}

body > canvas {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 250 !important;
}

.win-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    overflow: hidden;
}

[data-role="win-modal"][data-state="visible"] {
    pointer-events: auto;
}

.win-modal[hidden] {
    display: none;
}

.win-modal__backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(circle at center, rgba(80, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.82) 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

[data-role="win-modal"][data-state="visible"] .win-modal__backdrop {
    opacity: 1;
}

.win-modal__content {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2vh;
    transform: scale(0.2);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

[data-role="win-modal"][data-state="visible"] .win-modal__content {
    transform: scale(1);
    opacity: 1;
}

.win-modal__banner {
    width: 55vh;
    animation: bannerPop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both;
    filter: drop-shadow(0 1vh 3vh rgba(255, 200, 0, 0.6));
}

@keyframes bannerPop {
    0% {
        transform: scale(0.3) rotate(-8deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.win-modal__amount-wrap {
    animation: amountRise 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s both;
}

@keyframes amountRise {
    0% {
        transform: translateY(4vh) scale(0.5);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.win-modal__amount {
    display: inline-block;
    font-family: Impact, 'Arial Black', sans-serif;
    font-size: 10vh;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
    background: linear-gradient(180deg, #FFF70D 45.77%, #E39E09 53.22%, #FFC616 61.98%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    paint-order: stroke fill;
    -webkit-text-stroke: .1vh #930000;
    filter: drop-shadow(0 0.6vh 0 #930000) drop-shadow(0 0 2vh rgba(255, 220, 60, 0.8));
    animation: amountPulse 0.8s ease-in-out infinite alternate;
}

@keyframes amountPulse {
    from {
        filter: drop-shadow(0 0.6vh 0 #930000) drop-shadow(0 0 1.5vh rgba(255, 220, 60, 0.6));
        transform: scale(1);
    }
    to {
        filter: drop-shadow(0 0.8vh 0 #930000) drop-shadow(0 0 3vh rgba(255, 240, 100, 1));
        transform: scale(1.04);
    }
}

.final-screen {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(120, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.92) 100%);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.final-screen[hidden] {
    display: none;
}

[data-role="final-screen"][data-state="visible"] {
    opacity: 1;
}

.final-screen__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3vh;
    width: 65vh;
    min-width: 65vh;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

[data-role="final-screen"][data-state="visible"] .final-screen__inner {
    transform: scale(1);
    opacity: 1;
}

.final-screen__card {
    position: relative;
    width: 100%;
}

.final-screen__frame {
    width: 100%;
    display: block;
    filter: drop-shadow(0 1.5vh 4vh rgba(0, 0, 0, 0.55));
}

.final-screen__info {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3.2vh;
    padding: 18% 14% 8%;
    text-align: center;
}

.final-screen__label,
.final-screen__spins {
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.15;
    paint-order: stroke fill;
    -webkit-text-stroke: 0.15vh #000;
    text-shadow: 0 0.2vh 0.6vh rgba(0, 0, 0, 0.65);
}

.final-screen__label {
    font-size: 4.2vh;
}

.final-screen__spins {
    font-size: 4.5vh;
}

.final-screen__amount {
    color: #fff;
    font-family: Impact, 'Arial Black', sans-serif;
    font-size: 9vh;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    paint-order: stroke fill;
    -webkit-text-stroke: 0.35vh #000;
    text-shadow: 0 0.3vh 0.8vh rgba(0, 0, 0, 0.7);
}

[data-role="install-button"] {
    width: 39vh;
    aspect-ratio: 588 / 200;
    padding: 0;
    border: none;
    background-color: transparent;
    background-image: url('../images/final-btn.webp');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 4.5vh;
    font-weight: bold;
    text-transform: uppercase;
    paint-order: stroke fill;
    -webkit-text-stroke: 0.12vh #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0.8vh 2vh rgba(0, 0, 0, 0.45));
    transition: transform 0.2s ease, filter 0.2s ease;
    animation: finalBtnPulse 1.4s ease-in-out infinite;
}

[data-role="install-button"]:active {
    transform: scale(0.97);
}

@keyframes finalBtnPulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.04);
        filter: brightness(1.12) drop-shadow(0 0 2vh rgba(255, 200, 60, 0.55));
    }
}

@media (max-aspect-ratio: 9/16) {
    .wheel-assembly {
        width: 44vh;
    }

    .win-modal__banner {
        width: 45vh;
    }

    .final-screen__inner {
        gap: 4.5vh;
        width: 45vh;
        min-width: 45vh;
    }

    .final-screen__label {
        font-size: 3.2vh;
    }

    .final-screen__amount {
        font-size: 5vh;
    }

    .final-screen__spins {
        font-size: 3.5vh;
    }

    .final-screen__info {
        gap: 2.2vh;
    }

    [data-role="install-button"] {
        width: 35vh;
        font-size: 4vh;
    }
}
