/* ==========================================================================
   VERA PLAYER - TOKEN GATE SYSTEM
   Design System: Violet glassmorphism, glowing accents, premium dark theme
   ========================================================================== */

/* Overlay Container (sits inside .video-viewport) */
.player-gate-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at center, rgba(17, 10, 36, 0.94) 0%, rgba(7, 3, 15, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.player-gate-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.97);
    pointer-events: none;
}

/* Central Card */
.gate-card {
    position: relative;
    max-width: 480px;
    width: 100%;
    max-height: 92%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 107, 255, 0.4) transparent;
    background: rgba(18, 11, 38, 0.88);
    border: 1px solid rgba(139, 107, 255, 0.32);
    border-radius: 24px;
    padding: 2.2rem 2rem;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.7),
        0 0 50px rgba(139, 107, 255, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    text-align: center;
    animation: gateCardPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes gateCardPop {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Glow Flare on top of card */
.gate-card::before {
    content: '';
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 120px;
    background: radial-gradient(circle, rgba(139, 107, 255, 0.4) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(20px);
}

/* Icon Header */
.gate-icon-wrapper {
    position: relative;
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(139, 107, 255, 0.25) 0%, rgba(91, 63, 214, 0.15) 100%);
    border: 1px solid rgba(139, 107, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(91, 63, 214, 0.3);
    animation: gateIconFloat 3s ease-in-out infinite;
}

@keyframes gateIconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.gate-icon-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #5b3fd6;
    border: 2px solid #0d0819;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

/* Typography */
.gate-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.gate-desc {
    font-size: 0.88rem;
    color: #a8a2c2;
    line-height: 1.55;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Balance Pill Badge */
.gate-balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(139, 107, 255, 0.12);
    border: 1px solid rgba(139, 107, 255, 0.3);
    margin-bottom: 1.25rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #d1c7f7;
}

.gate-balance-pill .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 10px #34d399;
}

.gate-balance-pill.low .dot {
    background: #f87171;
    box-shadow: 0 0 10px #f87171;
}

.gate-balance-pill strong {
    color: #ffffff;
    font-weight: 700;
}

/* State Panels (Toggle active display) */
.gate-state-panel {
    display: none !important;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.gate-state-panel.active {
    display: flex !important;
}

/* Buttons */
.gate-btn-primary {
    position: relative;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0.95rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, #8b6bff 0%, #5b3fd6 100%);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 
        0 8px 24px rgba(91, 63, 214, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    overflow: hidden;
}

.gate-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #9d82ff 0%, #6f52f0 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 12px 30px rgba(91, 63, 214, 0.55),
        0 0 20px rgba(139, 107, 255, 0.35);
}

.gate-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.gate-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.gate-btn-secondary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.85rem 1.5rem;
    font-size: 0.92rem;
    font-weight: 600;
    font-family: inherit;
    color: #e5e0f8;
    background: rgba(139, 107, 255, 0.12);
    border: 1px solid rgba(139, 107, 255, 0.28);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
}

.gate-btn-secondary:hover:not(:disabled) {
    background: rgba(139, 107, 255, 0.22);
    border-color: rgba(139, 107, 255, 0.45);
    color: #ffffff;
    transform: translateY(-1px);
}

.gate-btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Faucet Box in State 2 */
.gate-faucet-card {
    width: 100%;
    background: rgba(13, 8, 25, 0.6);
    border: 1px solid rgba(139, 107, 255, 0.2);
    border-radius: 16px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

.gate-faucet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.gate-faucet-tag {
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #8b6bff;
    background: rgba(139, 107, 255, 0.15);
    padding: 2px 8px;
    border-radius: 6px;
}

.gate-faucet-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.gate-input {
    flex: 1;
    min-width: 0;
    background: rgba(7, 3, 15, 0.8);
    border: 1px solid rgba(139, 107, 255, 0.25);
    border-radius: 10px;
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.gate-input:focus {
    border-color: #8b6bff;
    box-shadow: 0 0 0 2px rgba(139, 107, 255, 0.2);
}

.gate-use-btn {
    flex: none;
    padding: 0 12px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(139, 107, 255, 0.15);
    border: 1px solid rgba(139, 107, 255, 0.3);
    border-radius: 10px;
    color: #c9beff;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.gate-use-btn:hover {
    background: rgba(139, 107, 255, 0.3);
    color: #ffffff;
}

/* Alert inside Gate */
.gate-alert {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: left;
    display: none;
}

.gate-alert.success {
    display: block;
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #6ee7b7;
}

.gate-alert.error {
    display: block;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

/* Cost Specs Box in State 3 */
.gate-cost-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.gate-cost-item {
    background: rgba(13, 8, 25, 0.6);
    border: 1px solid rgba(139, 107, 255, 0.18);
    border-radius: 14px;
    padding: 0.85rem;
    text-align: center;
}

.gate-cost-label {
    font-size: 0.72rem;
    color: #8f88a8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.gate-cost-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.gate-cost-value.violet {
    color: #a892ff;
}

.gate-cost-value.green {
    color: #34d399;
}

/* Footer micro-text */
.gate-footnote {
    font-size: 0.75rem;
    color: #7b7496;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Mini Unlocked Floating Badge in Video Viewport */
.player-unlocked-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    left: auto;
    z-index: 45;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(13, 8, 25, 0.85);
    border: 1px solid rgba(52, 211, 153, 0.4);
    border-radius: 999px;
    color: #34d399;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
}

.player-unlocked-badge.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.player-unlocked-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px #34d399;
    animation: pulse 1.8s infinite;
}

.player-unlocked-badge .time-left {
    color: #94a3b8;
    font-size: 0.72rem;
    margin-left: 4px;
}

/* Confetti Burst Overlay (Keyframes) */
.gate-sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b6bff;
    pointer-events: none;
    animation: sparkleBurst 0.8s ease-out forwards;
}

@keyframes sparkleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .gate-card {
        padding: 1.75rem 1.25rem;
        border-radius: 20px;
    }
    .gate-title {
        font-size: 1.25rem;
    }
    .gate-desc {
        font-size: 0.82rem;
    }
    .gate-cost-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .gate-faucet-input-wrap {
        flex-direction: column;
    }
    .gate-use-btn {
        padding: 8px 12px;
    }
}
