/* Irada Spin the Wheel Popup Styles - Modern Theme */
.spinwheel-dialog {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(380px, calc(100vw - 32px));
    max-width: 380px;
    height: fit-content !important;
    height: -moz-fit-content !important;
    min-height: unset !important;
    max-height: min(94vh, 600px);
    padding: 0;
    border: 1px solid #eedcd4;
    border-radius: 24px;
    background: #fffdfa;
    box-shadow: 0 24px 80px rgba(45, 10, 18, 0.35);
    color: #351b20;
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    font-family: inherit;
    z-index: 99999;
    box-sizing: border-box;
}

.spinwheel-dialog::-webkit-scrollbar,
.spinwheel-body::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.spinwheel-dialog::backdrop {
    background: rgba(30, 7, 13, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.spinwheel-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: spinwheel-pop-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes spinwheel-pop-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.spinwheel-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 35;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: #f7eeea;
    color: #4d1018;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.spinwheel-close:hover {
    background: #eedad2;
    transform: rotate(90deg);
}

.spinwheel-body {
    padding: 24px 20px 24px;
    text-align: center;
    position: relative;
    overflow: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: auto !important;
    min-height: unset !important;
}

/* Ensure hidden elements are strictly NEVER displayed */
.spinwheel-dialog [hidden],
.spinwheel-main-stage[hidden],
.spinwheel-phone-view[hidden],
.spinwheel-loading-view[hidden],
.spinwheel-result-view[hidden],
[hidden] {
    display: none !important;
}

/* Stage 1 & 2 Container */
.spinwheel-main-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0 auto;
    text-align: center;
}

/* Tap center hint with comfortable breathing space */
.spinwheel-tap-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    padding: 6px 18px;
    background: #fbf5ee;
    border: 1px solid #ebdcd6;
    border-radius: 999px;
    color: #947243;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    user-select: none;
    box-shadow: 0 2px 6px rgba(77, 16, 24, 0.05);
}

/* The Wheel Stage */
.spinwheel-stage {
    position: relative;
    width: 270px;
    height: 270px;
    margin: 0 auto;
    transition: width 0.35s ease, height 0.35s ease, margin 0.35s ease;
}

@media (max-width: 380px) {
    .spinwheel-stage {
        width: 240px;
        height: 240px;
    }
}

/* When spinning active: Wheel scales to top center while held */
.spinwheel-main-stage.is-spinning-active .spinwheel-tap-hint {
    display: none;
}

.spinwheel-main-stage.is-spinning-active .spinwheel-stage {
    width: 165px;
    height: 165px;
    margin: 0 auto 12px;
}

.spinwheel-canvas-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 8px 30px rgba(61, 13, 22, 0.22), 0 0 0 5px #eedcd4, 0 0 0 8px #dbc28f;
    overflow: hidden;
    cursor: pointer;
}

#spinwheel-canvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
}

/* Top pointer */
.spinwheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 26px;
    z-index: 5;
    pointer-events: none;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.spinwheel-main-stage.is-spinning-active .spinwheel-pointer {
    top: -8px;
    width: 18px;
    height: 22px;
}

.spinwheel-pointer svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Center Hub: Plain logo without blink, glow, or outline stroke */
.spinwheel-center-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 58px;
    height: 58px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: radial-gradient(circle, #4d1018 60%, #350b11 100%);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    display: grid;
    place-items: center;
    z-index: 6;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    outline: none;
    transition: transform 0.15s ease, width 0.35s ease, height 0.35s ease;
}

.spinwheel-center-hub:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.spinwheel-center-hub:active {
    transform: translate(-50%, -50%) scale(0.96);
}

.spinwheel-center-hub img {
    width: 28px;
    height: auto;
    display: block;
    pointer-events: none;
    filter: none;
    opacity: 1;
}

.spinwheel-main-stage.is-spinning-active .spinwheel-center-hub {
    width: 44px;
    height: 44px;
    cursor: default;
    pointer-events: none;
}

.spinwheel-main-stage.is-spinning-active .spinwheel-center-hub img {
    width: 20px;
}

/* Stage 2: Phone Input Form (Positioned below the held wheel) */
.spinwheel-phone-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: spinwheel-fade-up 0.28s ease forwards;
    margin-top: 2px;
}

@keyframes spinwheel-fade-up {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.spinwheel-phone-header {
    margin-bottom: 8px;
    text-align: center;
}

.spinwheel-eyebrow {
    margin: 0 0 4px;
    color: #947243;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.spinwheel-title {
    margin: 0;
    font: 800 clamp(19px, 4.5vw, 22px)/1.2 'Playfair Display', Georgia, serif;
    color: #4d1018;
}

.spinwheel-phone-form {
    width: 100%;
    margin-top: 8px;
    padding: 14px 14px 10px;
    background: #fbf7f4;
    border: 1px solid #ebdcd6;
    border-radius: 14px;
    box-sizing: border-box;
}

.spinwheel-phone-group {
    display: flex;
    align-items: center;
    border: 1.5px solid #dbcac7;
    border-radius: 10px;
    background: #ffffff;
    overflow: hidden;
    margin-bottom: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.spinwheel-phone-group:focus-within {
    border-color: #4d1018;
    box-shadow: 0 0 0 3px rgba(77, 16, 24, 0.12);
}

.spinwheel-phone-prefix {
    padding: 0 10px;
    font-size: 13.5px;
    font-weight: 700;
    color: #4d1018;
    background: #f7ede8;
    border-right: 1px solid #dbcac7;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.spinwheel-phone-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 12px;
    font-size: 15.5px;
    font-family: inherit;
    font-weight: 600;
    color: #351b20;
    background: transparent;
    min-width: 0;
    letter-spacing: 0.05em;
}

.spinwheel-error {
    margin: 0 0 8px;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fff3f3;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

/* Action Buttons */
.spinwheel-submit-btn,
.spinwheel-shop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid #4d1018;
    border-radius: 12px;
    background: #4d1018;
    color: #fffaf7;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(77, 16, 24, 0.25);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.spinwheel-submit-btn:hover,
.spinwheel-shop-btn:hover {
    background: #380b11;
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(77, 16, 24, 0.35);
}

.spinwheel-submit-btn:active,
.spinwheel-shop-btn:active {
    transform: translateY(0);
}

.spinwheel-submit-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

/* Small Loading Screen (When Claim is clicked) */
.spinwheel-loading-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    width: 100%;
    box-sizing: border-box;
    animation: spinwheel-fade-up 0.25s ease forwards;
}

.spinwheel-loading-spinner {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    border: 3.5px solid #eedcd4;
    border-top-color: #4d1018;
    border-radius: 50%;
    animation: spinwheel-spin 0.7s linear infinite;
}

@keyframes spinwheel-spin {
    to { transform: rotate(360deg); }
}

.spinwheel-loading-title {
    margin: 0 0 6px;
    font: 800 20px/1.2 'Playfair Display', Georgia, serif;
    color: #4d1018;
}

.spinwheel-loading-desc {
    margin: 0;
    color: #7a6268;
    font-size: 13px;
}

/* Stage 3: Celebration Result View (Centered, Modern UI/UX) */
.spinwheel-result-view {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6px 0;
    animation: spinwheel-pop-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    box-sizing: border-box;
}

.spinwheel-result-icon {
    font-size: 42px;
    margin-bottom: 6px;
    display: block;
    animation: spinwheel-bounce 0.6s ease;
}

@keyframes spinwheel-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.22); }
}

.spinwheel-result-title {
    margin: 0 0 6px;
    font: 800 23px/1.2 'Playfair Display', Georgia, serif;
    color: #4d1018;
}

.spinwheel-result-desc {
    margin: 0 0 10px;
    color: #5c4349;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

/* 24-Hour Expiry Urgency Badge */
.spinwheel-expiry-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 14px;
    background: #fbf5ee;
    border: 1.5px solid #dbc28f;
    border-radius: 999px;
    color: #854d0e;
    font-size: 12px;
    font-weight: 700;
    margin: 4px auto 14px;
    box-shadow: 0 2px 8px rgba(219, 194, 143, 0.2);
}

.spinwheel-expiry-badge strong {
    color: #4d1018;
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.spinwheel-coupon-box {
    width: 100%;
    margin: 4px 0 16px;
    padding: 12px 16px;
    border: 2px dashed #dbc28f;
    border-radius: 12px;
    background: #fbf7f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
}

.spinwheel-coupon-code {
    font-family: monospace;
    font-size: 19px;
    font-weight: 800;
    color: #4d1018;
    letter-spacing: 0.08em;
}

.spinwheel-copy-btn {
    padding: 8px 14px;
    border: 1px solid #4d1018;
    border-radius: 8px;
    background: #ffffff;
    color: #4d1018;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.spinwheel-copy-btn:hover {
    background: #4d1018;
    color: #ffffff;
}

.spinwheel-copy-btn.is-copied {
    background: #15803d;
    border-color: #15803d;
    color: #ffffff;
}

/* Confetti container */
.spinwheel-confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 30;
}

.spinwheel-confetti {
    position: absolute;
    width: 8px;
    height: 12px;
    opacity: 0.9;
    animation: spinwheel-confetti-fall 2.5s ease-out forwards;
}

@keyframes spinwheel-confetti-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(460px) rotate(720deg); opacity: 0; }
}
