/* =====================================================================
   HolyDiy WheelSpinner — All Styles
   ===================================================================== */

/* --- Utility --- */
.wheel-hidden { display: none !important; }

/* =====================================================================
   1. FLOATING BUTTON
   ===================================================================== */
.wheel-float-btn {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    cursor: pointer;
    width: 80px;
    height: 80px;
}

.wheel-float-btn__img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    animation: wheelBtnRotate 3.5s linear infinite;
    transition: transform 0.2s;
}
.wheel-float-btn:hover .wheel-float-btn__img {
    box-shadow: 0 6px 28px rgba(0,0,0,0.25);
}

@keyframes wheelBtnRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.wheel-float-btn__close {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    z-index: 41;
    padding: 0;
    opacity: 0;
    transition: opacity 0.2s;
}
.wheel-float-btn:hover .wheel-float-btn__close { opacity: 1; }

/* =====================================================================
   2. WHEEL MODAL
   ===================================================================== */
.wheel-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.wheel-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.wheel-modal__content {
    position: relative;
    z-index: 1;
    background: #F9F7F3;
    border-radius: 24px;
    padding: 30px 20px 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: wheelFadeIn 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(246,201,87,0.08) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(108,179,227,0.08) 0%, transparent 20%);
}
.wheel-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: color 0.2s, box-shadow 0.2s;
    z-index: 2;
    padding: 0;
}
.wheel-modal__close:hover { color: #333; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

@keyframes wheelFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Wheel Game Area --- */
.wheel-game { text-align: center; width: 100%; }
.wheel-game__title {
    font-size: 24px;
    font-weight: 900;
    color: #333;
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}
.wheel-game__subtitle {
    font-size: 14px;
    color: #888;
    margin: 0 0 20px;
}

.wheel-game__container {
    position: relative;
    width: 320px;
    height: 320px;
    margin: 0 auto 10px;
}

/* Indicator arrow */
.wheel-indicator {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
}
.wheel-indicator__arrow {
    width: 28px;
    height: 36px;
    background: linear-gradient(to bottom, #41A4B6, #3A94A5);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    border-radius: 2px 2px 0 0;
}

/* Outer white ring */
.wheel-outer-ring {
    position: absolute;
    inset: 0;
    z-index: 10;
    border-radius: 50%;
    background: #fff;
    padding: 10px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08), inset 0 2px 4px rgba(0,0,0,0.05);
}

/* Spinning disk */
.wheel-disk {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.25, 0.1, 0.15, 1);
    transition-duration: 4.5s;
    background: conic-gradient(
        from -30deg,
        #F6C957 0deg 60deg,
        #347B59 60deg 120deg,
        #F27A59 120deg 180deg,
        #6CB3E3 180deg 240deg,
        #3A94A5 240deg 300deg,
        #E59882 300deg 360deg
    );
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

/* Sector text */
.wheel-sector-text {
    position: absolute;
    width: 41%;
    height: 28px;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    transform-origin: left center;
    z-index: 20;
    pointer-events: none;
}

/* Divider line */
.wheel-divider {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50%;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), rgba(255,255,255,0.7));
    transform-origin: left center;
    z-index: 10;
    pointer-events: none;
}

/* Decorative dots */
.wheel-dot-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    padding-top: 8px;
    z-index: 10;
    pointer-events: none;
}
.wheel-dot {
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    opacity: 0.9;
}
.wheel-dot--lg  { width: 8px; height: 8px; }
.wheel-dot--sm  { width: 6px; height: 6px; margin-top: 2px; }

/* Center spin button */
.wheel-spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 50%;
    color: #3A94A5;
    font-weight: 900;
    font-size: 18px;
    border: 5px solid #3A94A5;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    padding: 0;
}
.wheel-spin-btn:hover { transform: translate(-50%, -50%) scale(1.05); }

.wheel-spin-btn--animated {
    animation: wheelPulse 2s infinite;
}
@keyframes wheelPulse {
    0%   { box-shadow: 0 0 0 0 rgba(58,148,165,0.4); }
    70%  { box-shadow: 0 0 0 15px rgba(58,148,165,0); }
    100% { box-shadow: 0 0 0 0 rgba(58,148,165,0); }
}

/* =====================================================================
   3. POSTER MODAL
   ===================================================================== */
.poster-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.poster-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.poster-modal__content {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 24px;
    width: 100%;
    max-width: 440px;
    max-height: 95vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    animation: wheelFadeIn 0.4s cubic-bezier(0.16,1,0.3,1) forwards;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Header */
.poster-modal__header {
    position: relative;
    padding: 20px 24px;
    text-align: center;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}
.poster-modal__title {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0;
}
.poster-modal__close {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: color 0.2s;
    padding: 0;
}
.poster-modal__close:hover { color: #333; }

/* Body */
.poster-modal__body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    background: #fff;
}
.poster-modal__canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}
.poster-modal__canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.poster-modal__loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    z-index: 10;
}
.poster-modal__spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid #e5e5e5;
    border-top-color: #3A94A5;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Template selector */
.poster-modal__templates {
    margin-top: 20px;
    text-align: center;
}
.poster-modal__templates-label {
    font-size: 11px;
    color: #999;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px;
}
.poster-modal__templates-grid {
    display: flex;
    gap: 14px;
    justify-content: center;
}
.poster-tpl-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    padding: 0;
    background-size: cover;
    background-position: center;
}
.poster-tpl-btn:hover { transform: translateY(-3px); box-shadow: 0 4px 14px rgba(0,0,0,0.15); }
.poster-tpl-btn--active { border-color: #3A94A5 !important; }
.poster-tpl-btn--minimalist { background-color: #FDFBF7; border-color: #3A94A5; }
.poster-tpl-btn--nature { background-image: url('https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?auto=format&fit=crop&w=200&q=80'); }
.poster-tpl-btn--art { background-image: url('https://images.unsplash.com/photo-1541701494587-cb58502866ab?auto=format&fit=crop&w=200&q=80'); }
.poster-tpl-btn--brand { background-color: #347B59; }

/* Action buttons */
.poster-modal__actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: #f9f9f9;
}
.poster-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 0;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.poster-action-btn:hover { transform: translateY(-2px); }
.poster-action-btn--download {
    background: #3A94A5;
    box-shadow: 0 4px 16px rgba(58,148,165,0.3);
}
.poster-action-btn--download:hover { background: #2F7A89; }
.poster-action-btn--share {
    background: #F27A59;
    box-shadow: 0 4px 16px rgba(242,122,89,0.3);
}
.poster-action-btn--share:hover { background: #D96B4D; }

/* =====================================================================
   4. RESPONSIVE
   ===================================================================== */
@media (max-width: 639px) {
    .wheel-float-btn { width: 60px; height: 60px; right: 16px; }
    .wheel-game__container { width: 280px; height: 280px; }
    .wheel-spin-btn { width: 64px; height: 64px; font-size: 15px; border-width: 4px; }
    .wheel-game__title { font-size: 20px; }
    .wheel-modal__content { padding: 20px 14px 18px; }
    .poster-modal__content { max-width: 95vw; }
    .poster-tpl-btn { width: 42px; height: 42px; }
    .poster-action-btn { font-size: 13px; padding: 12px 0; }
    .wheel-sector-text { font-size: 10px; padding-right: 10px; }
}

@media (min-width: 640px) {
    .wheel-game__container { width: 380px; height: 380px; }
    .wheel-spin-btn { width: 90px; height: 90px; font-size: 20px; }
    .wheel-sector-text { font-size: 13px; }
}
