/* ============================================
   GAMIFICATION — Streak, XP, Achievements
   ============================================ */

/* ── STREAK BADGE (header) ── */
.bj-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-base);
    user-select: none;
    font-family: var(--font-body);
}

.bj-streak-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(245, 175, 25, 0.3);
}

.bj-streak-badge__fire {
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

.bj-streak-badge.active .bj-streak-badge__fire {
    color: #f5af19;
}

.bj-streak-badge.hot .bj-streak-badge__fire {
    color: #f5576c;
    animation: bjFirePulse 1.5s ease-in-out infinite;
}

.bj-streak-badge.blazing .bj-streak-badge__fire {
    color: #f12711;
    animation: bjFirePulse 0.8s ease-in-out infinite;
}

@keyframes bjFirePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.bj-streak-badge__count {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 14px;
    text-align: center;
}

.bj-streak-badge__level {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ── STATS PANEL (dropdown) ── */
.bj-stats-panel {
    position: fixed;
    top: 70px;
    right: var(--space-md);
    width: 320px;
    max-width: calc(100vw - 2rem);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    z-index: 1000;
    animation: bjPanelIn 0.25s ease;
    overflow: hidden;
}

@keyframes bjPanelIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.bj-stats-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.bj-stats-panel__header strong {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.95rem;
}

.bj-stats-panel__header button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.bj-stats-panel__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border-subtle);
}

.bj-stat {
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    text-align: center;
}

.bj-stat__value {
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.bj-stat__value i {
    color: #f5af19;
}

.bj-stat__label {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 2px;
}

.bj-stats-panel__cta {
    padding: 0.85rem 1rem;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}

/* ── GAMIFY TOASTS ── */
.bj-gamify-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    opacity: 0;
    z-index: 10000;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    backdrop-filter: blur(12px);
}

.bj-gamify-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Level-up toast */
.bj-levelup-toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.bj-levelup-toast__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    animation: bjLevelUpBounce 0.6s ease;
}

@keyframes bjLevelUpBounce {
    0%   { transform: scale(0.3); }
    50%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.bj-levelup-toast strong {
    display: block;
    color: var(--accent-purple);
    font-size: 0.85rem;
}

.bj-levelup-toast span {
    display: block;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Achievement toast */
.bj-achievement-toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.bj-achievement-toast__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-gold);
    border-radius: 50%;
    color: #fff;
    font-size: 1rem;
    animation: bjAchBounce 0.5s ease;
}

@keyframes bjAchBounce {
    0%   { transform: scale(0) rotate(-45deg); }
    60%  { transform: scale(1.15) rotate(5deg); }
    100% { transform: scale(1) rotate(0); }
}

.bj-achievement-toast strong {
    display: block;
    color: var(--accent-gold);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bj-achievement-toast span {
    display: block;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
}

/* ── LIGHT THEME ── */
[data-theme="light"] .bj-streak-badge {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .bj-streak-badge:hover {
    background: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .bj-stats-panel {
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .bj-stat {
    background: #fff;
}

[data-theme="light"] .bj-gamify-toast {
    background: #fff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ── MOBILE ── */
@media (max-width: 480px) {
    .bj-stats-panel {
        top: auto;
        bottom: 80px;
        right: var(--space-sm);
        left: var(--space-sm);
        width: auto;
    }

    .bj-streak-badge__level {
        display: none;
    }
}
