@font-face {
    font-family: "VAG World";
    src: url("assets/vag-world-bold.otf") format("opentype");
    font-weight: 700 900;
    font-display: swap;
}

:root {
    font-family: "VAG World", "Arial Rounded MT Bold", "Arial", sans-serif;
    color-scheme: light;
    background: #215b3b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

button {
    font: inherit;
}

button:focus-visible {
    outline: 3px solid #ffcf56;
    outline-offset: 3px;
}

img {
    display: block;
}

.wheel {
    inline-size: min(100%, 550px, max(320px, 67svh));
    margin-inline: auto;
    container-type: inline-size;
}

.stage {
    --pointer-x: 48.6%;
    --pointer-y: 47%;
    --spin-y: 79.7%;
    position: relative;
    block-size: max(100svh, 153cqw, 460px);
    overflow: hidden;
    background: #215b3b url("assets/scene.webp") center / 100% 100% no-repeat;
}

.frame,
.logo,
.stage-button {
    position: absolute;
    inset-inline-start: 50%;
    transform: translateX(-50%);
}

.frame {
    inline-size: 73.7%;
    block-size: auto;
    inset-inline-start: var(--pointer-x);
    inset-block-start: calc(var(--pointer-y) + .7cqw);
    transform: translate(-50%, -50%);
}

.reel {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.reel img {
    position: absolute;
    inset-inline-start: var(--pointer-x);
    inset-block-start: calc(var(--pointer-y) + var(--offset));
    inline-size: 34.2cqw;
    block-size: 28.8cqw;
    object-fit: contain;
    transform: translate(-50%, -50%) scale(var(--size));
}

.selected-prize {
    position: absolute;
    inset-inline-start: 50%;
    inset-block-start: calc(var(--spin-y) - max(27px, 11.8cqw));
    inline-size: max-content;
    max-inline-size: 76%;
    padding: .45em .85em;
    border-radius: 12px;
    background: #fff;
    transform: translate(-50%, -100%);
    color: #151515;
    font-size: clamp(12px, 3.3cqw, 17px);
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
    pointer-events: none;
}

.selected-prize strong {
    display: block;
    margin-block-end: .15em;
    color: #c31a19;
    font-size: 1.12em;
}

.logo {
    inline-size: 54.8%;
    inset-block-start: max(9.375%, env(safe-area-inset-top));
    margin: 0;
}

.logo-glints {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.logo-glints > span {
    position: absolute;
    inline-size: 12%;
    aspect-ratio: 1;
    background: radial-gradient(circle, rgba(255, 224, 143, .8), transparent 62%);
    opacity: 0;
    animation: logo-twinkle 6s ease-in-out infinite;
}

.logo-glints > span::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff9e6;
    clip-path: polygon(50% 0, 54% 44%, 100% 50%, 54% 55%, 50% 100%, 46% 55%, 0 50%, 46% 44%);
}

.logo-glints > span:nth-child(1) { left: 7.2%; top: 22%; animation-delay: .3s; }
.logo-glints > span:nth-child(2) { left: 72.3%; top: 6.1%; animation-delay: 1.7s; }
.logo-glints > span:nth-child(3) { left: 95.4%; top: 79%; animation-delay: 3.1s; }
.logo-glints > span:nth-child(4) { left: 31.3%; top: 91.3%; animation-delay: 4.5s; }

@keyframes logo-twinkle {
    0%, 22%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(.45); }
    8% { opacity: .95; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .logo-glints { display: none; }
}

.logo img,
.stage-button img {
    inline-size: 100%;
    block-size: auto;
}

.stage-button {
    display: grid;
    place-items: center;
    min-block-size: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    transform: translate(-50%, -50%);
}

.spin {
    inline-size: 60.65%;
    inset-block-start: var(--spin-y);
    cursor: pointer;
}

.spin:disabled {
    cursor: default;
}

.rules {
    inline-size: 36.8%;
    inset-block-start: min(91%, calc(100% - env(safe-area-inset-bottom) - 24px));
}

.prize {
    position: fixed;
    inline-size: min(80cqw, calc(100% - 32px));
    max-block-size: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    padding: 7cqw 5cqw 6cqw;
    border: 0;
    border-radius: 8cqw;
    background: #fff;
    color: #151515;
    text-align: center;
}

.prize::backdrop {
    background: rgba(0, 0, 0, .66);
}

.prize-close {
    position: absolute;
    inset-block-start: 3cqw;
    inset-inline-end: 3cqw;
}

.prize-close button {
    display: grid;
    place-items: center;
    inline-size: max(44px, 8cqw);
    block-size: max(44px, 8cqw);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.prize-close img {
    inline-size: 7.5cqw;
    block-size: auto;
}

.prize h2 {
    margin: 0;
    padding-inline: 6cqw;
    color: #ef1817;
    font-size: clamp(25px, 10.4cqw, 57px);
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -.05em;
    text-transform: uppercase;
}

.prize h2 span {
    display: block;
}

.prize h2 span:empty {
    display: none;
}

#prize-description {
    max-inline-size: 58cqw;
    margin: 4cqw auto 5cqw;
    font-size: clamp(15px, 5.2cqw, 28px);
    font-weight: 700;
    line-height: 1.15;
    text-wrap: balance;
}

.prize-actions {
    display: grid;
    gap: 2.4cqw;
    inline-size: 52cqw;
    margin-inline: auto;
}

.prize-actions button {
    min-block-size: 44px;
    padding: 5px 6px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.download {
    background: #ef1817;
    font-size: clamp(15px, 5.2cqw, 28px);
}

.email {
    background: #215b3b;
    font-size: clamp(11px, 3.25cqw, 17px);
}
