:root {
    --spin-palette-page: #fff;
    --spin-palette-surface: #fff;
    --spin-palette-elevated: #f4f6fb;
    --spin-palette-hover: #eef1f8;
    --spin-palette-border: rgba(20, 23, 68, 0.12);
    --spin-palette-text: #141744;
    --spin-palette-muted: #5c6478;
    --spin-palette-green: var(--color-solid-sentiment-positive-default, #00b24b);
    --spin-palette-blue: var(--color-solid-brand-primary-default, #1e46eb);
    --spin-palette-gold: var(--color-solid-brand-accent-default, #d8ae50);
    --spin-palette-slate: #44516f;
    --spin-palette-purple: var(--theme-color-light-blue, #67baf4);
    --spin-palette-danger: #e75263;
    --spin-focus-ring: var(--theme-focus-ring, rgba(103, 186, 244, 0.52));
}

.spin-wheel-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-index-modal-layout, 1100) + 30);
    display: grid;
    place-items: center;
    padding: 16px;
    overflow-y: auto;
}

.spin-wheel-modal.is-hidden,
.spin-wheel-modal[hidden] {
    display: none !important;
}

.spin-wheel-modal.is-open {
    display: grid;
}

.spin-wheel-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 12, 35, 0.78);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.spin-wheel-modal.is-open .spin-wheel-modal__backdrop {
    opacity: 1;
}

.spin-wheel-modal__panel {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    max-height: calc(100dvh - 32px);
    border: 1px solid var(--spin-palette-border);
    border-radius: 18px;
    color: var(--spin-palette-text);
    background: var(--spin-palette-surface);
    box-shadow: 0 28px 72px rgba(0, 0, 0, 0.38);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
}

.spin-wheel-modal.is-open .spin-wheel-modal__panel {
    opacity: 1;
    transform: none;
}

.spin-wheel-modal.is-leaving .spin-wheel-modal__panel {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
}

.spin-wheel-modal.is-leaving .spin-wheel-modal__backdrop {
    opacity: 0;
}

.spin-wheel-modal__header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 10px 16px 10px 20px;
    border-bottom: 1px solid var(--spin-palette-border);
    background: #fff;
    backdrop-filter: blur(12px);
}

.spin-wheel-modal__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.spin-wheel-modal__brand-logo {
    display: inline-flex;
    align-items: center;
}

.spin-wheel-modal__brand-logo .p101-logo__word {
    font-size: 18px;
}

.spin-wheel-modal__brand-logo .p101-logo__mark svg {
    width: 30px;
    height: 30px;
}

.spin-wheel-modal__brand strong {
    padding-inline-start: 10px;
    border-inline-start: 1px solid var(--spin-palette-border);
    color: var(--spin-palette-text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
}

.spin-wheel-modal__close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--spin-palette-border);
    border-radius: 12px;
    color: var(--spin-palette-text);
    background: rgba(20, 23, 68, 0.06);
    cursor: pointer;
}

.spin-wheel-modal__close:hover {
    background: rgba(20, 23, 68, 0.1);
}

.spin-wheel-modal__close:focus-visible,
.spin-wheel-modal__btn:focus-visible {
    outline: 3px solid var(--spin-focus-ring);
    outline-offset: 2px;
}

.spin-wheel-modal__layout {
    display: grid;
    grid-template-columns: minmax(480px, 1.25fr) minmax(320px, 0.75fr);
}

.spin-wheel-modal__info {
    display: flex;
    min-width: 0;
    padding: 42px 34px 34px;
    flex-direction: column;
    justify-content: center;
    border-inline-start: 1px solid var(--spin-palette-border);
    background: var(--spin-palette-surface);
}

.spin-wheel-modal__eyebrow {
    margin: 0 0 10px;
    color: var(--spin-palette-blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.11em;
}

.spin-wheel-modal__title {
    margin: 0;
    color: var(--spin-palette-text);
    font-size: clamp(28px, 3.2vw, 38px);
    font-weight: 760;
    line-height: 1.05;
    letter-spacing: -0.035em;
}

.spin-wheel-modal__text {
    margin: 16px 0 0;
    color: var(--spin-palette-muted);
    font-size: 14px;
    line-height: 1.55;
}

.spin-wheel-modal__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 18px;
}

.spin-wheel-modal__meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--spin-palette-border);
    border-radius: 999px;
    color: var(--spin-palette-muted);
    background: rgba(20, 23, 68, 0.05);
    font-size: 11px;
    font-weight: 650;
}

.spin-wheel-modal__play {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 570px;
    padding: 42px 30px;
    overflow: hidden;
    background: var(--spin-palette-page);
}

.spin-wheel-modal__play::before {
    content: "";
    position: absolute;
    width: 78%;
    aspect-ratio: 1;
    inset: 50% auto auto 50%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30, 70, 235, 0.2), rgba(30, 70, 235, 0.06) 48%, transparent 72%);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.spin-wheel-modal__status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 44px;
    margin-top: 24px;
    padding: 11px 13px;
    border: 1px solid var(--spin-palette-border);
    border-radius: 12px;
    background: var(--spin-palette-surface);
}

.spin-wheel-modal__status > span {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--spin-palette-blue);
}

.spin-wheel-modal__status p {
    margin: 0;
    color: var(--spin-palette-muted);
    font-size: 12px;
    line-height: 1.45;
}

.spin-wheel-modal__stage {
    position: relative;
    z-index: 1;
    width: min(450px, 82vw);
    margin: 0 auto;
    padding: 10px;
    border: 1px solid rgba(216, 174, 80, 0.28);
    border-radius: 50%;
    background: rgba(25, 40, 89, 0.76);
    box-shadow: 0 0 0 7px rgba(30, 70, 235, 0.08), 0 22px 48px rgba(0, 0, 0, 0.28);
}

.spin-wheel-modal__pointer {
    position: absolute;
    top: -9px;
    left: 50%;
    z-index: 2;
    width: 0;
    height: 0;
    margin-left: -12px;
    border-right: 12px solid transparent;
    border-left: 12px solid transparent;
    border-top: 23px solid var(--spin-palette-gold);
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.42));
}

.spin-wheel-modal__canvas {
    width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
}

.spin-wheel-modal__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 12px;
}

.spin-wheel-modal__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

.spin-wheel-modal__btn[disabled] {
    border-color: var(--spin-palette-border);
    color: rgba(245, 247, 251, 0.48);
    background: var(--spin-palette-elevated);
    cursor: not-allowed;
}

.spin-wheel-modal__btn--primary {
    color: #fff;
    background: var(--spin-palette-blue);
}

.spin-wheel-modal__btn--primary:hover:not([disabled]) {
    background: var(--brand-primary-dark-10, #3158ee);
}

.spin-wheel-modal__btn--cta {
    color: #fff;
    background: var(--spin-palette-green);
}

.spin-wheel-modal__btn--cta:hover {
    filter: brightness(1.08);
}

.spin-wheel-modal__btn.is-hidden,
.spin-wheel-modal__btn[hidden] {
    display: none !important;
}

.spin-wheel-modal__result {
    display: grid;
    gap: 3px;
    margin: 0 0 12px;
    padding: 13px 15px;
    border: 1px solid rgba(0, 178, 75, 0.32);
    border-radius: 12px;
    background: rgba(0, 178, 75, 0.1);
}

.spin-wheel-modal__result[hidden] {
    display: none;
}

.spin-wheel-modal__result span {
    color: var(--spin-palette-muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.1em;
}

.spin-wheel-modal__result strong {
    color: #7dffb0;
    font-size: 16px;
    line-height: 1.3;
}

.spin-wheel-modal__fineprint {
    margin: 11px 0 0;
    color: rgba(245, 247, 251, 0.48);
    font-size: 10px;
    line-height: 1.4;
    text-align: center;
}

html.is-spin-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .spin-wheel-modal {
        place-items: end center;
        padding: 8px 8px 0;
    }

    .spin-wheel-modal__panel {
        width: 100%;
        max-height: calc(100dvh - 8px);
        border-radius: 20px 20px 0 0;
    }

    .spin-wheel-modal__header {
        min-height: 58px;
        padding: 8px 12px 8px 16px;
    }

    .spin-wheel-modal__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .spin-wheel-modal__info {
        padding: 24px 18px 22px;
        border-inline-start: 0;
        border-block-start: 1px solid var(--spin-palette-border);
    }

    .spin-wheel-modal__title {
        max-width: 300px;
        font-size: 28px;
    }

    .spin-wheel-modal__text {
        margin-top: 10px;
        font-size: 13px;
    }

    .spin-wheel-modal__meta {
        margin-top: 13px;
    }

    .spin-wheel-modal__meta span {
        min-height: 28px;
        font-size: 10px;
    }

    .spin-wheel-modal__play {
        min-height: 390px;
        padding: 24px 18px;
    }

    .spin-wheel-modal__stage {
        width: min(340px, 80vw);
    }
}

@media (max-width: 600px) {
    .spin-wheel-modal {
        display: block;
        padding: 0;
        overflow: hidden;
    }

    .spin-wheel-modal__panel {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-width: 0;
        border-radius: 0;
        overflow-x: hidden;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .spin-wheel-modal__header {
        min-height: 54px;
        padding: 7px 10px 7px 14px;
    }

    .spin-wheel-modal__brand {
        min-width: 0;
        gap: 7px;
    }

    .spin-wheel-modal__brand-logo .p101-logo__word {
        font-size: 15px;
    }

    .spin-wheel-modal__brand-logo .p101-logo__mark svg {
        width: 26px;
        height: 26px;
    }

    .spin-wheel-modal__brand strong {
        padding-inline-start: 7px;
        font-size: 11px;
    }

    .spin-wheel-modal__close {
        flex: 0 0 auto;
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .spin-wheel-modal__layout {
        display: flex;
        min-height: calc(100dvh - 54px - env(safe-area-inset-bottom, 0px));
        flex-direction: column;
    }

    .spin-wheel-modal__play {
        flex: 0 0 auto;
        min-height: 0;
        padding: 16px 12px 12px;
    }

    .spin-wheel-modal__play::before {
        width: min(300px, 82vw);
    }

    .spin-wheel-modal__stage {
        width: min(270px, 72vw);
        padding: 7px;
        box-shadow: 0 0 0 5px rgba(30, 70, 235, 0.1), 0 14px 32px rgba(5, 9, 30, 0.28);
    }

    .spin-wheel-modal__pointer {
        top: -7px;
        margin-left: -10px;
        border-right-width: 10px;
        border-left-width: 10px;
        border-top-width: 19px;
    }

    .spin-wheel-modal__info {
        flex: 1 0 auto;
        padding: 14px 16px 18px;
        justify-content: flex-start;
    }

    .spin-wheel-modal__eyebrow {
        margin-bottom: 5px;
        font-size: 10px;
    }

    .spin-wheel-modal__title {
        max-width: none;
        font-size: 23px;
        line-height: 1.08;
    }

    .spin-wheel-modal__text {
        margin-top: 7px;
        font-size: 12px;
        line-height: 1.4;
    }

    .spin-wheel-modal__status {
        min-height: 40px;
        margin-top: 10px;
        padding: 9px 11px;
    }

    .spin-wheel-modal__actions {
        margin-top: 9px;
    }

    .spin-wheel-modal__btn {
        min-height: 42px;
    }

    .spin-wheel-modal__meta {
        gap: 5px;
        margin-top: 9px;
    }

    .spin-wheel-modal__meta span {
        min-height: 26px;
        padding-inline: 8px;
    }

    .spin-wheel-modal__fineprint {
        margin-top: 8px;
    }
}

@media (max-width: 380px) and (max-height: 700px) {
    .spin-wheel-modal__stage {
        width: min(250px, 68vw);
    }

    .spin-wheel-modal__play {
        padding-block: 12px 9px;
    }

    .spin-wheel-modal__info {
        padding-block: 11px 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .spin-wheel-modal__backdrop,
    .spin-wheel-modal__panel,
    .spin-wheel-modal__btn {
        transition: none;
    }
}
