:root {
    --red: #e73585;
    --red-dark: #c81d6a;
    --yellow: #ffc441;
    --blue: #0ba6d8;
    --green: #15a05f;
    --ink: #171a20;
    --muted: #626b76;
    --line: #e6e9ee;
    --paper: #f7f8fb;
    --white: #ffffff;
    --shadow: 0 18px 42px rgba(23, 26, 32, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--white);
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font: inherit;
}

.app-shell {
    position: relative;
    isolation: isolate;
    width: min(100%, 520px);
    min-height: 100svh;
    margin: 0 auto;
    padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-rows: auto auto minmax(300px, 1fr) auto;
    gap: 0;
    overflow: hidden;
}

.brand-ribbon {
    position: absolute;
    inset: 0 0 auto;
    z-index: -1;
    height: 9px;
    background:
        linear-gradient(90deg, var(--blue) 0 40%, var(--yellow) 40% 60%, var(--red) 60% 100%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 112px;
    padding-top: 10px;
    background: var(--white);
}

.brand-mark {
    display: block;
    width: 188px;
    max-width: 62%;
    height: auto;
}

.store-chip,
.win-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--red);
    background: #f4f4f5;
    font-size: 13px;
    font-weight: 800;
}

.hero-copy {
    width: calc(100% + 32px);
    margin: 0 -16px 12px;
    padding: 22px 16px;
    color: var(--white);
    background: var(--red);
}

.hero-copy h1 {
    margin: 0;
    max-width: 390px;
    font-size: 34px;
    line-height: 1.02;
}

.hero-copy p {
    max-width: 410px;
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.38;
}

.wheel-stage {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    min-height: min(57svh, 410px);
    padding-top: 8px;
    transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

.wheel-stage::before {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    width: min(95vw, 456px);
    aspect-ratio: 1;
    background:
        radial-gradient(circle, rgba(231, 53, 133, 0.13), transparent 58%),
        linear-gradient(135deg, rgba(11, 166, 216, 0.12), rgba(255, 196, 65, 0.14));
}

.pointer {
    position: absolute;
    z-index: 3;
    top: calc(50% - min(40vw, 194px) - 5px);
    width: 44px;
    height: 58px;
    background: var(--ink);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 5px 0 rgba(23, 26, 32, 0.2));
}

.pointer::before {
    content: "";
    position: absolute;
    inset: 7px 13px auto;
    height: 18px;
    border-radius: 99px;
    background: var(--red);
}

.wheel-button {
    position: relative;
    width: min(82vw, 390px);
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.wheel-button,
.wheel-button * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.wheel-button:disabled {
    cursor: wait;
}

.wheel {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
    background:
        conic-gradient(
            from -18deg,
            var(--red) 0deg 30deg,
            var(--yellow) 30deg 60deg,
            var(--white) 60deg 90deg,
            var(--blue) 90deg 120deg,
            var(--green) 120deg 150deg,
            var(--red) 150deg 180deg,
            var(--yellow) 180deg 210deg,
            var(--white) 210deg 240deg,
            var(--blue) 240deg 270deg,
            var(--green) 270deg 300deg,
            var(--red) 300deg 330deg,
            var(--yellow) 330deg 360deg
        );
    border: 12px solid var(--white);
    box-shadow:
        0 24px 55px rgba(23, 26, 32, 0.18),
        inset 0 0 0 2px rgba(23, 26, 32, 0.15),
        inset 0 0 0 17px rgba(255, 255, 255, 0.24);
    transform: rotate(var(--rotation, 0deg));
    transition: transform var(--spin-duration, 4200ms) cubic-bezier(0.12, 0.72, 0.04, 1);
}

.wheel::before {
    content: "";
    position: absolute;
    inset: 8%;
    border-radius: inherit;
    background:
        repeating-conic-gradient(
            from 0deg,
            rgba(23, 26, 32, 0.14) 0deg 1deg,
            transparent 1deg 30deg
        );
}

.wheel-gloss {
    position: absolute;
    inset: 5%;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.62), transparent 36%, rgba(255, 255, 255, 0.16) 66%, transparent);
    mix-blend-mode: screen;
}

.wheel-center {
    position: absolute;
    inset: 50%;
    z-index: 2;
    width: 36%;
    aspect-ratio: 1;
    translate: -50% -50%;
    display: grid;
    place-items: center;
    align-content: center;
    border-radius: 50%;
    background: var(--white);
    border: 6px solid var(--red);
    box-shadow: 0 12px 28px rgba(23, 26, 32, 0.24);
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.wheel-touch-shield {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: block;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.wheel-center strong {
    font-size: 28px;
    line-height: 1;
}

.wheel-center small {
    margin-top: 5px;
    color: var(--muted);
    font-weight: 800;
}

.wheel-button.is-charging .wheel {
    filter: saturate(1.18) brightness(1.04);
    scale: 1.018;
}

.charge-track {
    width: min(72vw, 330px);
    height: 10px;
    margin-top: 24px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(23, 26, 32, 0.14);
    box-shadow: inset 0 1px 3px rgba(23, 26, 32, 0.16);
}

.charge-track span {
    display: block;
    width: var(--charge, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--red), var(--yellow));
    transition: width 80ms linear;
}

.message-panel,
.claim-panel,
.state-panel {
    position: relative;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--white);
    box-shadow: 0 12px 30px rgba(23, 26, 32, 0.1);
}

.message-panel::before,
.claim-panel::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    border-radius: 8px 0 0 8px;
    background: linear-gradient(180deg, var(--red), var(--yellow), var(--blue), var(--green));
}

.message-panel h1,
.claim-panel h2,
.state-panel h1 {
    margin: 0 0 8px;
    font-size: 29px;
    line-height: 1.06;
}

.message-panel p,
.state-panel p,
.claim-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.42;
}

.claim-panel {
    z-index: 10;
    display: grid;
    gap: 14px;
}

.app-shell.has-result .wheel-stage {
    opacity: 0.16;
    transform: scale(0.96);
    filter: blur(1px);
    pointer-events: none;
}

.app-shell.has-result .message-panel {
    display: none;
}

.app-shell.has-result .claim-panel {
    position: fixed;
    left: 50%;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: min(calc(100% - 28px), 500px);
    max-height: calc(100svh - 28px);
    overflow: auto;
    transform: translateX(-50%);
    box-shadow: 0 24px 70px rgba(23, 26, 32, 0.26);
}

.win-badge {
    width: max-content;
    color: var(--white);
    background: var(--red);
}

.prize-showcase {
    display: grid;
    grid-template-columns: 116px 1fr;
    gap: 14px;
    align-items: center;
}

.prize-showcase img {
    width: 116px;
    aspect-ratio: 1;
    object-fit: contain;
    border-radius: 8px;
    background: linear-gradient(145deg, #ffffff, #eef2f7);
    border: 1px solid var(--line);
    padding: 10px;
}

.prize-name {
    margin-bottom: 8px !important;
    color: var(--ink) !important;
    font-weight: 900;
    font-size: 22px;
}

.prize-description {
    font-size: 14px;
}

.claim-panel form {
    display: grid;
    gap: 13px;
}

.contact-hint {
    padding: 10px 12px;
    border-radius: 8px;
    background: #f4f4f5;
    color: var(--ink) !important;
    font-weight: 800;
}

label {
    display: grid;
    gap: 7px;
    font-size: 14px;
    font-weight: 800;
}

input[type="email"],
input[type="tel"] {
    min-height: 50px;
    width: 100%;
    border: 1px solid #cfd5dd;
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--ink);
    background: var(--white);
}

input[type="email"]:focus,
input[type="tel"]:focus {
    outline: 3px solid rgba(227, 6, 19, 0.18);
    border-color: var(--red);
}

.check-row {
    grid-template-columns: 22px 1fr;
    align-items: start;
    font-weight: 400;
    color: var(--muted);
}

.check-row input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--red);
}

.condition {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff3bf;
    color: #5e4800 !important;
    font-weight: 800;
}

.primary-action {
    min-height: 54px;
    border: 0;
    border-radius: 8px;
    color: var(--white);
    background: linear-gradient(180deg, var(--red), var(--red-dark));
    box-shadow: 0 10px 22px rgba(227, 6, 19, 0.28);
    font-weight: 900;
    cursor: pointer;
}

.primary-action:disabled {
    opacity: 0.7;
    cursor: wait;
}

.is-hidden {
    display: none;
}

.state-panel {
    grid-row: 1 / -1;
    align-self: center;
}

.state-panel .brand-mark {
    margin-bottom: 22px;
    max-width: 210px;
}

.state-panel.is-success h1 {
    color: var(--green);
}

.confetti-layer {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 20;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -18px;
    width: 10px;
    height: 18px;
    border-radius: 2px;
    background: var(--confetti-color, var(--red));
    animation: confetti-fall var(--confetti-duration, 1500ms) ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, -20px, 0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translate3d(var(--confetti-drift, 0), 105svh, 0) rotate(720deg);
        opacity: 0;
    }
}

@media (max-width: 380px) {
    .hero-copy h1 {
        font-size: 29px;
    }

    .wheel-center strong {
        font-size: 24px;
    }

    .prize-showcase {
        grid-template-columns: 96px 1fr;
    }

    .prize-showcase img {
        width: 96px;
    }
}

@media (max-height: 720px) {
    .app-shell {
        grid-template-rows: auto auto auto auto;
        gap: 10px;
    }

    .brand-ribbon {
        height: 9px;
    }

    .topbar {
        min-height: 92px;
    }

    .hero-copy h1 {
        font-size: 28px;
    }

    .wheel-stage {
        min-height: 314px;
    }

    .wheel-button {
        width: min(74vw, 318px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wheel,
    .charge-track span,
    .confetti-piece {
        transition: none;
        animation-duration: 1ms;
    }
}
