* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    overflow: hidden;
    background: #000;
    width: 100vw;
    height: 100vh;
}

.stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffc000 url("images/background.jpg") center/cover no-repeat;
}

.container {
    width: 1080px;
    height: 1920px;
    flex: 0 0 auto;
    max-width: 1080px;
    max-height: 1920px;
    margin: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(var(--stage-scale, 1));
    transform-origin: center;
}

.stage.is-prize-shaking .container {
    animation: camera-shake 0.72s cubic-bezier(.36,.07,.19,.97) both;
    will-change: transform;
}

.header {
    position: absolute;
    top: 50px;
    width: 694px;
    max-width: 694px;
    height: auto;
    margin-top: 0;
    z-index: 10;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.fullscreen-button {
    position: absolute;
    top: 22px;
    left: 22px;
    z-index: 40;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.15);
    color: rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.fullscreen-button.is-active {
    border-color: rgba(255,255,255,0.12);
}

.fullscreen-icon {
    width: 10px;
    height: 10px;
}

.cache-button {
    position: absolute;
    top: 22px;
    right: 22px;
    z-index: 40;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.12);
    color: rgba(255,255,255,0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.12;
}

.cache-icon {
    width: 10px;
    height: 10px;
}

.version-tag {
    position: absolute;
    right: 14px;
    bottom: 10px;
    z-index: 40;
    font-size: 12px;
    letter-spacing: 0;
    font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
    color: #222;
    background: rgba(255, 255, 255, 0.86);
    padding: 4px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    pointer-events: none;
}

.wheel-container {
    position: absolute;
    top: 620px;
    left: 0;
    height: 1030px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    --wheel-size: 1030px;
}

.background {
    display: none;
}

.wheel-wrapper {
    position: relative;
    width: var(--wheel-size);
    height: var(--wheel-size);
    flex: 0 0 auto;
    max-width: var(--wheel-size);
    max-height: var(--wheel-size);
    aspect-ratio: 1 / 1;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 5s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.prize-arrow {
    position: absolute;
    top: -105px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: auto;
    z-index: 25;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    pointer-events: none;
}

#wheel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wheel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    pointer-events: none;
    z-index: 6;
}

.spin-button {
    position: absolute;
    width: 230px;
    height: calc(230px * 180 / 271);
    aspect-ratio: 271 / 180;
    border: none;
    background: none;
    cursor: pointer;
    z-index: 20;
    padding: 0;
    border-radius: 0;
    transition: transform 0.2s;
}

.spin-button:hover {
    transform: scale(1.05);
}

.spin-button:active {
    transform: scale(0.95);
}

.spin-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.spin-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spin-button:disabled:hover {
    transform: scale(1);
}

.result {
    position: absolute;
    bottom: 55px;
    color: #fff;
    text-align: center;
    z-index: 30;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 36px 22px;
    max-width: 760px;
    isolation: isolate;
    border-radius: 26px;
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(255,255,255,0.35), rgba(255,255,255,0) 60%),
        linear-gradient(145deg, rgba(0,0,0,0.55), rgba(0,0,0,0.88));
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 18px 40px rgba(0,0,0,0.35), 0 6px 14px rgba(0,0,0,0.25);
    --result-accent-1: #ff2f2f;
    --result-accent-2: #ffb347;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.result::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--result-accent-1), var(--result-accent-2));
    box-shadow: 0 0 12px rgba(255,255,255,0.4);
    pointer-events: none;
}

.result::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 30px;
    background: linear-gradient(135deg, var(--result-accent-1), var(--result-accent-2));
    opacity: 0.35;
    filter: blur(12px);
    z-index: -1;
    pointer-events: none;
}

.result-prefix {
    font-size: 18px;
    letter-spacing: 4px;
    font-weight: 700;
    text-transform: uppercase;
    font-family: "Bebas Neue", "Oswald", "Impact", sans-serif;
    text-shadow: 0 3px 8px rgba(0,0,0,0.35);
}

.result-text {
    font-size: 44px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: "Montserrat", "Segoe UI", "Arial Black", sans-serif;
    line-height: 1.05;
    text-shadow: 0 6px 12px rgba(0,0,0,0.35);
    text-wrap: balance;
}

.result--retry {
    --result-accent-1: #2b6bff;
    --result-accent-2: #25e0a6;
}

.result--prize {
    --result-accent-1: #ff2f2f;
    --result-accent-2: #ffb347;
}

.result.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: result-pop 0.55s ease-out;
}

@keyframes result-pop {
    0% {
        transform: translateY(16px) scale(0.96);
        opacity: 0;
    }
    60% {
        transform: translateY(-2px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes camera-shake {
    0%, 100% {
        transform: scale(var(--stage-scale, 1)) translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: scale(var(--stage-scale, 1)) translate3d(-12px, 7px, 0);
    }
    20%, 40%, 60%, 80% {
        transform: scale(var(--stage-scale, 1)) translate3d(12px, -7px, 0);
    }
    35%, 65% {
        transform: scale(var(--stage-scale, 1)) translate3d(-6px, -10px, 0);
    }
}

.confetti-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 80;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 1;
    border-radius: 2px;
    will-change: transform, opacity;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, 0, 0) scale(0.4) rotate(0deg);
        opacity: 0;
    }
    30% {
        transform: translate3d(var(--burst-x), var(--burst-y), 0) scale(1) rotate(var(--rot-start));
        opacity: 1;
    }
    100% {
        transform: translate3d(var(--fall-x), var(--fall-y), 0) scale(0.85) rotate(var(--rot-end));
        opacity: 0;
    }
}

@media (max-width: 1080px) {
    .fullscreen-button {
        top: 16px;
        left: 16px;
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }

    .fullscreen-icon {
        width: 16px;
        height: 16px;
    }

    .cache-button {
        top: 16px;
        right: 16px;
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }

    .cache-icon {
        width: 16px;
        height: 16px;
    }

    .version-tag {
        right: 12px;
        bottom: 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .fullscreen-button {
        top: 12px;
        left: 12px;
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .fullscreen-icon {
        width: 15px;
        height: 15px;
    }

    .cache-button {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .cache-icon {
        width: 15px;
        height: 15px;
    }

    .version-tag {
        right: 10px;
        bottom: 6px;
        font-size: 12px;
    }
}
