/* ============================================================
   PlayVidya — Daily Spin Wheel Widget
   Include this file's <link> tag on any page that has the
   student dashboard's --purple / --purple-lt CSS variables,
   or paste the :root fallback below stays self-sufficient.
   ============================================================ */

:root {
    --pv-purple: #6c3fc5;
    --pv-purple-dark: #4c1d95;
    --pv-purple-lt: #ede9fb;
    --pv-gold: #f5a623;
    --pv-text: #1a1a2e;
    --pv-muted: #64748b;
}

#pv-spin-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    font-family: 'Segoe UI', system-ui, sans-serif;
}
#pv-spin-overlay.pv-open {
    opacity: 1;
    visibility: visible;
}

#pv-spin-modal {
    background: #fff;
    border-radius: 20px;
    width: min(360px, 90vw);
    padding: 28px 24px 24px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9);
    transition: transform 0.25s ease;
}
#pv-spin-overlay.pv-open #pv-spin-modal {
    transform: scale(1);
}

.pv-spin-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--pv-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}
.pv-spin-close:hover {
    color: var(--pv-text);
}

.pv-spin-header img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    margin-bottom: 8px;
}
.pv-spin-title {
    font-size: 19px;
    font-weight: 900;
    color: var(--pv-text);
}
.pv-spin-subtitle {
    font-size: 13px;
    color: var(--pv-muted);
    margin-top: 4px;
    margin-bottom: 18px;
}

/* ── WHEEL ── */
.pv-wheel-wrap {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 20px;
}
.pv-wheel-pointer {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid var(--pv-gold);
    z-index: 3;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25));
}
.pv-wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    border: 6px solid #fff;
    box-shadow: 0 0 0 3px var(--pv-purple), 0 8px 24px rgba(0,0,0,0.25);
    background:
        conic-gradient(
            #6c3fc5 0deg 45deg,
            #8b5cf6 45deg 90deg,
            #6c3fc5 90deg 135deg,
            #8b5cf6 135deg 180deg,
            #6c3fc5 180deg 225deg,
            #f5a623 225deg 270deg,
            #6c3fc5 270deg 315deg,
            #8b5cf6 315deg 360deg
        );
    transition: transform 4.2s cubic-bezier(0.15, 0.85, 0.15, 1);
}
.pv-wheel-labels {
    position: absolute;
    inset: 0;
}
.pv-wheel-label {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90px;
    height: 20px;
    margin-top: -10px;
    margin-left: -45px;
    transform-origin: 50% 50%;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.pv-wheel-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 46px;
    height: 46px;
    margin: -23px 0 0 -23px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 2;
    font-size: 20px;
}

/* ── BUTTON ── */
.pv-spin-btn {
    background: linear-gradient(135deg, var(--pv-purple) 0%, var(--pv-purple-dark) 100%);
    color: #fff;
    border: none;
    padding: 13px 32px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.4px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(108, 63, 197, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.pv-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(108, 63, 197, 0.45);
}
.pv-spin-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.pv-spin-cooldown {
    font-size: 12.5px;
    color: var(--pv-muted);
    margin-top: 12px;
}

/* ── RESULT ── */
.pv-spin-result {
    display: none;
    margin-top: 4px;
}
.pv-spin-result.pv-show {
    display: block;
    animation: pv-pop-in 0.35s ease;
}
.pv-spin-result-icon {
    font-size: 40px;
    margin-bottom: 6px;
}
.pv-spin-result-text {
    font-size: 17px;
    font-weight: 900;
    color: var(--pv-purple);
}
.pv-spin-result-sub {
    font-size: 12.5px;
    color: var(--pv-muted);
    margin-top: 4px;
}
.pv-spin-streak {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 14px;
    background: var(--pv-purple-lt);
    color: var(--pv-purple);
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 999px;
}

@keyframes pv-pop-in {
    0% { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 420px) {
    .pv-wheel-wrap { width: 210px; height: 210px; }
    #pv-spin-modal { padding: 22px 18px 20px; }
}