/* Corgen Viewer Counter Styles */
:root {
    --corgen-red: #ad0909;
    --corgen-dark: #000000;
    --corgen-glass: rgba(5, 5, 5, 0.95);
    --corgen-text: #ffffff;
    --corgen-subtext: #ffffff;
    --corgen-glow: 0 0 15px rgba(173, 9, 9, 0.4);
}

/* --- Container & Animations --- */
#corgen-viewer-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
    color: var(--corgen-text);
    transition: all 0.3s ease;

    /* Initial State: Hidden */
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

#corgen-viewer-widget.cv-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* --- Mini Mode (Capsule) --- */
.cv-mini-card {
    background: #000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cv-mini-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(173, 9, 9, 0.3);
}

/* Live Indicator */
.cv-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--corgen-red);
}

.cv-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--corgen-red);
    border-radius: 50%;
    animation: cv-pulse 1.5s infinite;
}

@keyframes cv-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(173, 9, 9, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(173, 9, 9, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(173, 9, 9, 0);
    }
}

.cv-count-text {
    font-size: 14px;
    font-weight: 500;
}

.cv-count-number {
    font-weight: 800;
    color: #ffffff;
}

/* --- Expanded Mode (Full Card) --- */
.cv-expanded-card {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 300px;
    background: #000000;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: scale(0.9);
    transform-origin: bottom right;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Show Expanded */
#corgen-viewer-widget.cv-expanded .cv-mini-card {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* Hide mini when expanded */
}

#corgen-viewer-widget.cv-expanded .cv-expanded-card {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

/* Header */
.cv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.cv-title {
    font-size: 13px;
    color: #ffffff;
    /* User Preference: White */
    display: flex;
    align-items: center;
    gap: 5px;
}

.cv-close-btn {
    background: none;
    border: none;
    color: #ffffff;
    /* User Preference: White */
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}

.cv-close-btn:hover {
    transform: scale(1.4);
    background: none;
}

.cv-close-btn:focus {
    transform: scale(1.4);
    background: none;
}

/* Main Stats */
.cv-main-stat {
    text-align: center;
    padding: 5px 0;
}

.cv-big-number {
    font-size: 36px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    text-shadow: 0 0 20px rgba(173, 9, 9, 0.3);
}

.cv-stat-label {
    font-size: 12px;
    color: #ffffff;
    /* User Preference: White */
    margin-top: 5px;
}

/* Platforms Grid */
.cv-platforms {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cv-platform-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.cv-platform-btn:hover {
    background: rgba(173, 9, 9, 0.1);
    border-color: rgba(173, 9, 9, 0.3);
    transform: translateY(-2px);
}

.cv-p-name {
    font-size: 10px;
    color: #ffffff;
    margin-top: 4px;
}

.cv-p-count {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

/* Trend Mode (Glow) */
#corgen-viewer-widget.cv-trending .cv-mini-card,
#corgen-viewer-widget.cv-trending .cv-expanded-card {
    box-shadow: 0 0 30px rgba(173, 9, 9, 0.4);
    border-color: rgba(173, 9, 9, 0.4);
}

.cv-trend-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #ff9a00, #ff4e00);
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(255, 78, 0, 0.4);
    display: none;
}

#corgen-viewer-widget.cv-trending .cv-trend-badge {
    display: block;
}

/* Confetti Canvas */
#corgen-confetti-canvas {
    position: absolute;
    top: -200px;
    /* Start higher up */
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 500px;
    pointer-events: none;
    z-index: 9998;
    /* Behind the card content but on top of card bg? No, let's put it high but transparent */
}

/* Mini Close Button */
.cv-mini-close {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    margin-left: 5px;
    transition: background 0.2s;
}

.cv-mini-close:hover {
    background: rgba(173, 9, 9, 0.8);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #corgen-viewer-widget {
        bottom: 10px;
        right: 10px;
        left: auto;
        /* Don't stretch */
        width: auto;
        display: block;
        /* Default block to let children size themselves */
    }

    .cv-mini-card {
        padding: 8px 15px;
        gap: 8px;
        white-space: nowrap;
        /* Prevent stacking */
        width: auto;
        max-width: 100%;
        margin-left: auto;
        /* Align right */
    }

    .cv-expanded-card {
        width: 300px;
        /* Fixed width even on mobile if fits, or calc */
        max-width: 90vw;
        right: 0;
        bottom: 0;
    }
}