/* Wheel of Rewards — highest priority storefront modal */

.store-wheel-root {
    --wheel-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --wheel-ease-out: cubic-bezier(0.4, 0, 0.2, 1);
    --wheel-dur: 0.52s;
    --wheel-stagger: 0.05s;
    position: fixed;
    inset: 0;
    z-index: 15000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 10, 10, 0);
    backdrop-filter: blur(0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--wheel-dur) var(--wheel-ease-out),
        visibility var(--wheel-dur) var(--wheel-ease-out),
        background var(--wheel-dur) var(--wheel-ease-out),
        backdrop-filter var(--wheel-dur) var(--wheel-ease-out);
}

.store-wheel-root.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: rgba(10, 10, 10, 0.72);
    backdrop-filter: blur(4px);
}

.store-wheel-root.is-closing {
    pointer-events: none;
}

.store-wheel-root[hidden] {
    display: none !important;
}

.store-wheel-dialog {
    position: relative;
    width: min(960px, calc(100vw - 32px));
    max-height: min(90vh, 720px);
    overflow: hidden;
    background: linear-gradient(165deg, #1a1a1a 0%, #0e0e0e 55%, #141210 100%);
    color: #fff;
    border-radius: 24px;
    padding: 0;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    transform: translateY(28px) scale(0.94);
    opacity: 0;
    filter: blur(8px);
    transition:
        transform var(--wheel-dur) var(--wheel-ease),
        opacity var(--wheel-dur) var(--wheel-ease),
        filter var(--wheel-dur) var(--wheel-ease);
}

/* Beat global store h1–h4 dark text */
.store-wheel-dialog,
.store-wheel-dialog h1,
.store-wheel-dialog h2,
.store-wheel-dialog h3,
.store-wheel-dialog h4,
.store-wheel-dialog p,
.store-wheel-dialog li,
.store-wheel-dialog span,
.store-wheel-dialog button {
    color: #fff;
}

.store-wheel-root.is-open .store-wheel-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
    filter: blur(0);
}

.store-wheel-root.is-closing .store-wheel-dialog {
    transform: translateY(16px) scale(0.96);
    opacity: 0;
    filter: blur(6px);
    transition-duration: 0.38s;
}

.store-wheel-anim {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(4px);
    transition:
        opacity 0.48s var(--wheel-ease),
        transform 0.48s var(--wheel-ease),
        filter 0.48s var(--wheel-ease);
    transition-delay: calc(var(--wheel-i, 0) * var(--wheel-stagger));
}

.store-wheel-root.is-open .store-wheel-anim {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.store-wheel-root.is-closing .store-wheel-anim {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(3px);
    transition-duration: 0.28s;
    transition-delay: calc((4 - var(--wheel-i, 0)) * 0.03s);
}

.store-wheel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff !important;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
}

.store-wheel-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Half / half */
.store-wheel-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    min-height: min(560px, 82vh);
    max-height: min(90vh, 720px);
}

.store-wheel-left {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 24px 24px;
    background:
        radial-gradient(ellipse at 40% 45%, rgba(176, 130, 71, 0.12), transparent 55%),
        rgba(255, 255, 255, 0.02);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 0;
    min-height: 0;
}

.store-wheel-stage {
    position: relative;
    width: min(380px, 100%, 52vh);
    aspect-ratio: 1;
    transform-origin: center center;
}

.store-wheel-root.is-open .store-wheel-stage {
    animation: storeWheelStageIn 0.7s var(--wheel-ease) both;
    animation-delay: 0.08s;
}

.store-wheel-root.is-closing .store-wheel-stage {
    animation: none;
}

@keyframes storeWheelStageIn {
    from {
        opacity: 0;
        transform: scale(0.84) rotate(-10deg);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

.store-wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 22px solid #f5f5f5;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.store-wheel-canvas-wrap {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    border: 7px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 0 0 5px rgba(0, 0, 0, 0.28),
        0 12px 40px rgba(0, 0, 0, 0.35);
    transition: transform 4.2s cubic-bezier(0.12, 0.75, 0.08, 1);
    will-change: transform;
}

.store-wheel-canvas-wrap.is-spinning {
    pointer-events: none;
}

.store-wheel-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.store-wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68px;
    height: 68px;
    margin: -34px 0 0 -34px;
    border-radius: 50%;
    background: #f5f5f5;
    color: #111 !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Right column: title, prizes, conditions, result, actions */
.store-wheel-right {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 22px 22px 18px 20px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.store-wheel-header {
    margin: 0 0 12px;
    padding-right: 28px;
    text-align: left;
    flex-shrink: 0;
}

.store-wheel-title {
    margin: 0 0 4px;
    font-size: clamp(1.15rem, 1.7vw, 1.35rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #fff !important;
    line-height: 1.2;
}

.store-wheel-subtitle {
    margin: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.58) !important;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.store-wheel-right-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.store-wheel-right-scroll::-webkit-scrollbar {
    width: 4px;
}

.store-wheel-right-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 99px;
}

.store-wheel-panel {
    flex-shrink: 0;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.store-wheel-panel-title {
    margin: 0 0 6px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.42) !important;
}

.store-wheel-legend-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: none;
    overflow: visible;
}

.store-wheel-legend-item {
    display: grid;
    grid-template-columns: 7px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 5px 6px;
    border-radius: 7px;
    border: 1px solid transparent;
    opacity: 0;
    transform: translateX(12px);
    transition:
        opacity 0.4s var(--wheel-ease),
        transform 0.4s var(--wheel-ease),
        border-color 0.35s ease,
        background 0.35s ease;
    transition-delay: calc(0.16s + var(--legend-i, 0) * 0.04s);
}

.store-wheel-root.is-open .store-wheel-legend-item {
    opacity: 1;
    transform: translateX(0);
}

.store-wheel-root.is-closing .store-wheel-legend-item {
    opacity: 0;
    transform: translateX(8px);
    transition-duration: 0.2s;
    transition-delay: 0s;
}

.store-wheel-legend-item.is-won {
    border-color: rgba(176, 130, 71, 0.45);
    background: rgba(176, 130, 71, 0.14);
    animation: storeWheelLegendWon 0.55s var(--wheel-ease);
}

@keyframes storeWheelLegendWon {
    0% { transform: scale(1); }
    40% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.store-wheel-legend-swatch {
    width: 7px;
    height: 7px;
    border-radius: 99px;
    margin-top: 0;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.store-wheel-legend-copy {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 6px;
}

.store-wheel-legend-label {
    display: inline;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    color: #fff !important;
}

.store-wheel-legend-desc {
    display: inline;
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45) !important;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.store-wheel-conditions-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.store-wheel-conditions-list li {
    position: relative;
    padding-left: 12px;
    font-size: 0.72rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.62) !important;
}

.store-wheel-conditions-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.4em;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(176, 130, 71, 0.75);
}

.store-wheel-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    flex-shrink: 0;
    padding-top: 0;
}

.store-wheel-spin-btn,
.store-wheel-secondary-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
}

.store-wheel-spin-btn {
    background: #b08247;
    color: #fff !important;
    transition: background 0.2s ease, opacity 0.2s ease;
}

.store-wheel-spin-btn:hover:not(:disabled) {
    background: #c49255;
}

.store-wheel-spin-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.store-wheel-secondary-slot {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
        grid-template-rows 0.45s var(--wheel-ease),
        opacity 0.35s ease;
}

.store-wheel-secondary-slot.is-visible {
    grid-template-rows: 1fr;
    opacity: 1;
}

.store-wheel-secondary-slot-inner {
    overflow: hidden;
    min-height: 0;
}

.store-wheel-secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff !important;
    width: 100%;
    transform: translateY(8px);
    transition: background 0.2s ease, transform 0.4s var(--wheel-ease);
}

.store-wheel-secondary-slot.is-visible .store-wheel-secondary-btn {
    transform: translateY(0);
}

.store-wheel-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.store-wheel-result {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    width: 100%;
    margin: 0;
    flex-shrink: 0;
    transition:
        grid-template-rows 0.5s var(--wheel-ease),
        opacity 0.4s ease;
}

.store-wheel-result.is-visible {
    grid-template-rows: 1fr;
    opacity: 1;
}

.store-wheel-result-inner {
    overflow: hidden;
    min-height: 0;
}

.store-wheel-result-panel {
    padding: 14px 14px;
    border-radius: 12px;
    background:
        radial-gradient(120% 120% at 50% 0%, rgba(176, 130, 71, 0.18), transparent 55%),
        rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(176, 130, 71, 0.28);
    text-align: left;
    box-sizing: border-box;
    transform: translateY(12px);
    opacity: 0;
    transition:
        transform 0.45s var(--wheel-ease) 0.06s,
        opacity 0.4s ease 0.06s;
}

.store-wheel-result.is-visible .store-wheel-result-panel {
    transform: translateY(0);
    opacity: 1;
}

.store-wheel-result-kicker {
    margin: 0 0 4px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(243, 214, 168, 0.8) !important;
}

.store-wheel-result h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff !important;
}

.store-wheel-result p {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.7) !important;
    line-height: 1.4;
}

.store-wheel-code {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(176, 130, 71, 0.22);
    color: #f3d6a8 !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    transform: scale(0.94);
    opacity: 0;
    transition:
        transform 0.4s var(--wheel-ease) 0.16s,
        opacity 0.35s ease 0.16s;
}

.store-wheel-result.is-visible .store-wheel-code {
    transform: scale(1);
    opacity: 1;
}

.store-wheel-cart-link {
    display: inline-block;
    color: #f3d6a8 !important;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.store-wheel-cart-link:hover {
    color: #fff !important;
}

.store-wheel-error {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    width: 100%;
    color: #fecaca;
    font-size: 0.8rem;
    margin: 0;
    transition:
        grid-template-rows 0.35s var(--wheel-ease),
        opacity 0.3s ease;
}

.store-wheel-error.is-visible {
    grid-template-rows: 1fr;
    opacity: 1;
}

.store-wheel-error-inner {
    overflow: hidden;
    min-height: 0;
}

.store-wheel-error-inner span {
    color: #fecaca !important;
}

.store-wheel-cta {
    position: fixed;
    right: 18px;
    bottom: 18px;
    /* Below cart drawer (14000); wheel modal stays at 15000 */
    z-index: 13000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 11px 16px 11px 12px;
    background: #111;
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition:
        background 0.2s ease,
        transform 0.25s var(--wheel-ease, ease),
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.store-wheel-cta-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    line-height: 0;
}

.store-wheel-cta-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    transform-origin: 50% 50%;
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.store-wheel-cta:hover {
    background: #1f1f1f;
    transform: translateY(-1px);
}

.store-wheel-cta:hover .store-wheel-cta-icon svg {
    transform: rotate(45deg);
}

.store-wheel-cta-label {
    line-height: 1.1;
}

body.store-wheel-active .store-wheel-cta,
html.store-cart-drawer-open .store-wheel-cta {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.96);
}

@media (max-width: 820px) {
    .store-wheel-dialog {
        width: min(480px, calc(100vw - 24px));
        max-height: min(92vh, 760px);
    }

    .store-wheel-body {
        grid-template-columns: 1fr;
        min-height: 0;
        max-height: min(92vh, 760px);
        overflow: hidden;
    }

    .store-wheel-left {
        padding: 16px 16px 8px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .store-wheel-stage {
        width: min(240px, 36vh, 68vw);
    }

    .store-wheel-right {
        padding: 12px 14px 14px;
        max-height: none;
        height: auto;
        min-height: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .store-wheel-right-scroll {
        flex: 1 1 auto;
        max-height: min(42vh, 340px);
    }

    .store-wheel-legend-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2px 8px;
    }

    .store-wheel-legend-copy {
        flex-direction: column;
        gap: 0;
    }

    .store-wheel-legend-desc {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

@media (max-width: 480px) {
    .store-wheel-root {
        padding: 10px;
    }

    .store-wheel-cta {
        right: 12px;
        bottom: 12px;
        padding: 10px 14px;
        font-size: 0.8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .store-wheel-root,
    .store-wheel-dialog,
    .store-wheel-anim,
    .store-wheel-legend-item,
    .store-wheel-result,
    .store-wheel-result-panel,
    .store-wheel-code,
    .store-wheel-error,
    .store-wheel-secondary-slot,
    .store-wheel-secondary-btn,
    .store-wheel-canvas-wrap,
    .store-wheel-cta-icon svg {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        filter: none !important;
    }

    .store-wheel-root.is-open .store-wheel-stage {
        animation: none;
    }

    .store-wheel-cta:hover .store-wheel-cta-icon svg {
        transform: none;
    }
}
