/* ============================================
   MIND-MATCH FRONTEND - MAIN STYLES
   Based on mind-match.app design
   ============================================ */

:root {
    /* ── Mind Match Brand Palette — DARK (default) ────────────────
       Existing var names are retained as aliases for backwards-
       compat with the rest of the codebase; they now resolve to
       the new palette. New `--brand-*` names are the canonical
       references for fresh code. */

    /* Brand surfaces */
    --bg-main:        #0B0F1A;
    --bg-secondary:   #121826;
    --surface-card:   #1A2236;
    --logo-dock-bg:   #05070D;  /* Slightly darker than bg-main for the header logo dock */

    /* Brand accents */
    --brand-blue:        #3ABEFF;  /* Electric Blue */
    --brand-blue-deep:   #1E6BFF;
    --brand-orange:      #FF5A3C;  /* Neon Orange/Red — opponent / energy */
    --brand-orange-glow: #FF8A3D;
    --brand-purple:      #8A5CFF;  /* Gradient middle */
    --brand-gradient: linear-gradient(90deg, #3ABEFF, #8A5CFF, #FF5A3C);

    /* Functional */
    --success: #22C55E;
    --error:   #EF4444;
    --warning: #F59E0B;
    --info:    #3ABEFF;

    /* Text */
    --text-primary:   #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted:     #64748B;
    /* Aliases used by inline styles in templates */
    --text: var(--text-primary);
    --dim:  var(--text-secondary);

    /* Legacy aliases — keep names, point at new palette */
    --primary-purple:      var(--brand-purple);
    --primary-blue:        var(--brand-blue);
    --primary-dark:        var(--bg-secondary);
    --primary-darker:      var(--bg-main);
    --accent-cyan:         var(--brand-blue);
    --accent-purple-light: #B79BFF;
    --accent-pink:         var(--error);
    --accent-green:        var(--success);
    --background-card:       rgba(255, 255, 255, 0.05);
    --background-card-hover: rgba(255, 255, 255, 0.08);
    --border-color:          rgba(255, 255, 255, 0.10);

    /* Brand alpha helpers (since CSS vars can't carry runtime alpha) */
    --brand-blue-a08:   rgba(58, 190, 255, 0.08);
    --brand-blue-a18:   rgba(58, 190, 255, 0.18);
    --brand-blue-a30:   rgba(58, 190, 255, 0.30);
    --brand-purple-a20: rgba(138, 92, 255, 0.20);
    --brand-purple-a30: rgba(138, 92, 255, 0.30);
    --brand-purple-a50: rgba(138, 92, 255, 0.50);
    --brand-orange-a20: rgba(255, 90, 60, 0.20);
    --surface-overlay:  rgba(11, 15, 26, 0.85);
    /* Translucent surface tints (auto-flip light/dark) */
    --tint-08: rgba(255, 255, 255, 0.08);
    --tint-15: rgba(255, 255, 255, 0.15);
    --tint-18: rgba(255, 255, 255, 0.18);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(58, 190, 255, 0.45);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ── LIGHT MODE OVERRIDE ──────────────────────────────────────── */
:root[data-theme="light"] {
    --bg-main:        #F5F7FA;
    --bg-secondary:   #E9EEF5;
    --surface-card:   #FFFFFF;
    --logo-dock-bg:   #E2E8F0;  /* Slightly darker than bg-main */

    --brand-blue:        #2563EB;
    --brand-blue-deep:   #3B82F6;
    --brand-orange:      #F97316;
    --brand-orange-glow: #FB923C;
    --brand-purple:      #8B5CF6;
    --brand-gradient: linear-gradient(90deg, #3B82F6, #8B5CF6, #F97316);

    --success: #16A34A;
    --error:   #DC2626;
    --warning: #D97706;
    --info:    #2563EB;

    --text-primary:   #0F172A;
    --text-secondary: #475569;
    --text-muted:     #94A3B8;

    --background-card:       rgba(0, 0, 0, 0.03);
    --background-card-hover: rgba(0, 0, 0, 0.06);
    --border-color:          rgba(0, 0, 0, 0.10);

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 8px 32px rgba(15, 23, 42, 0.15);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.30);

    --brand-blue-a08:   rgba(37, 99, 235, 0.08);
    --brand-blue-a18:   rgba(37, 99, 235, 0.18);
    --brand-blue-a30:   rgba(37, 99, 235, 0.30);
    --brand-purple-a20: rgba(139, 92, 246, 0.20);
    --brand-purple-a30: rgba(139, 92, 246, 0.30);
    --brand-purple-a50: rgba(139, 92, 246, 0.50);
    --brand-orange-a20: rgba(249, 115, 22, 0.20);
    --surface-overlay:  rgba(245, 247, 250, 0.92);
    --tint-08: rgba(15, 23, 42, 0.05);
    --tint-15: rgba(15, 23, 42, 0.08);
    --tint-18: rgba(15, 23, 42, 0.12);
}

/* Smooth theme switching on the surfaces that change */
body, .modal-content, .friends-dropdown, .notifications-dropdown,
.card, .nav-avatar, .top-nav, .sidebar {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    margin: 0;                          /* reset default 8px body margin */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-main) 0%, var(--bg-secondary) 50%, var(--bg-main) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(107, 70, 193, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(74, 144, 226, 0.15) 0%, transparent 50%);
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
    line-height: 1.7;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-purple-light);
}

/* ============================================
   TOP NAVIGATION
   ============================================ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(26, 27, 46, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: all var(--transition-base);
}

.top-nav.scrolled {
    box-shadow: var(--shadow-md);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.nav-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    list-style: none;
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--background-card);
}

.nav-link.active {
    color: var(--accent-cyan);
    background: rgba(0, 217, 255, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-avatar:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-sm);
}

/* Back Button */
.back-button {
    display: none;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--background-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.back-button:hover {
    background: var(--background-card-hover);
    color: var(--text-primary);
    border-color: var(--primary-purple);
}

.back-button.active {
    display: flex;
}

/* ============================================
   SIDEBAR / MOBILE MENU
   ============================================ */

.sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 280px;
    height: calc(100vh - 70px);
    background: rgba(26, 27, 46, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: var(--spacing-xl) var(--spacing-lg);
    overflow-y: auto;
    transition: transform var(--transition-base);
    z-index: 900;
}

.sidebar.mobile-hidden {
    transform: translateX(-100%);
}

.sidebar-section {
    margin-bottom: var(--spacing-xl);
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.sidebar-items {
    list-style: none;
}

.sidebar-item {
    margin-bottom: var(--spacing-sm);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.sidebar-link:hover {
    background: var(--background-card);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(107, 70, 193, 0.2);
    color: var(--accent-cyan);
    border-left: 3px solid var(--primary-purple);
}

.sidebar-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 850;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.main-content {
    margin-top: 70px;
    margin-left: 280px;
    padding: var(--spacing-2xl);
    min-height: calc(100vh - 70px);
    transition: margin-left var(--transition-base);
}

.main-content.full-width {
    margin-left: 0;
}

.content-header {
    margin-bottom: var(--spacing-2xl);
}

.content-title {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.content-subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--background-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--background-card-hover);
    border-color: var(--primary-purple);
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
}

.card-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.card-body {
    color: var(--text-secondary);
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* App Cards */
.app-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(107, 70, 193, 0.1), rgba(74, 144, 226, 0.1));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.app-card:hover::before {
    opacity: 1;
}

.app-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--background-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background-card-hover);
    border-color: var(--primary-purple);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: 1.125rem;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    display: block;
    margin-top: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================
   MODALS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-lg);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--spacing-sm);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    color: var(--error);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--spacing-xl);
}

.modal-footer {
    padding: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.alert-success {
    background: rgba(0, 196, 140, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(233, 76, 137, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
}

.alert-warning {
    background: rgba(255, 176, 32, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid var(--info);
    color: var(--info);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background: rgba(107, 70, 193, 0.2);
    color: var(--primary-purple);
}

.badge-success {
    background: rgba(0, 196, 140, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 176, 32, 0.2);
    color: var(--warning);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-links {
        display: none;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.mobile-visible {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: var(--spacing-lg);
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 var(--spacing-md);
    }
    
    .main-content {
        padding: var(--spacing-md);
    }
    
    .modal-content {
        margin: var(--spacing-md);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary-purple); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }

.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   USER DROPDOWN MENU
   ============================================ */

.nav-user .dropdown-menu {
    background: var(--primary-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 250px;
    padding: var(--spacing-sm) 0;
    margin-top: var(--spacing-sm);
}

.nav-user .dropdown-header {
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-primary);
}

.nav-user .dropdown-header strong {
    display: block;
    font-size: 1rem;
    margin-bottom: var(--spacing-xs);
}

.nav-user .dropdown-divider {
    border-color: var(--border-color);
    margin: var(--spacing-sm) 0;
}

.nav-user .dropdown-item {
    color: var(--text-secondary);
    padding: var(--spacing-md) var(--spacing-lg);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

.nav-user .dropdown-item:hover {
    background: var(--background-card-hover);
    color: var(--text-primary);
}

.nav-user .dropdown-item:active {
    background: var(--background-card-hover);
    color: var(--text-primary);
}

.nav-user .dropdown-item.text-danger {
    color: var(--error);
}

.nav-user .dropdown-item.text-danger:hover {
    background: rgba(233, 76, 137, 0.1);
    color: var(--error);
}

.nav-user .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* ============================================
   SETTINGS MODAL TABS
   ============================================ */

.settings-tab-pane {
    display: none;
}

.settings-tab-pane.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

#settingsModal .nav-tabs {
    border-bottom: 2px solid var(--border-color);
}

#settingsModal .nav-tabs .nav-link {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: var(--spacing-md) var(--spacing-lg);
    cursor: pointer;
    font-weight: 600;
    position: relative;
    transition: all var(--transition-fast);
    border-radius: 0;
}

#settingsModal .nav-tabs .nav-link:hover {
    color: var(--text-primary);
    background: var(--background-card);
}

#settingsModal .nav-tabs .nav-link.active {
    color: var(--primary-purple);
    background: none;
}

#settingsModal .nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-blue));
}

@media (display-mode: standalone) {
  .top-nav{
    margin-top: 16px !important;
  }
}

/* ============================================
 * Dashboard Play / Education tabs
 * Shown only when Education Mode is enabled.
 * ============================================ */
.dashboard-tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.dashboard-tab {
    min-width: 140px;
    padding: 7px 20px;
    border: 2px solid;
    border-radius: 10px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    background: transparent;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.08s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.2;
}
.dashboard-tab:active { transform: scale(0.97); }
.dashboard-tab[data-tab="play"] { color: #63a0be; border-color: #63a0be; }
.dashboard-tab[data-tab="play"].active {
    background: linear-gradient(135deg, #63a0be, var(--brand-blue-deep, #1E6BFF));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 160, 190, 0.35);
}
.dashboard-tab[data-tab="education"] { color: #ef9e57; border-color: #ef9e57; }
.dashboard-tab[data-tab="education"].active {
    background: linear-gradient(135deg, #ef9e57, var(--brand-orange, #FF5A3C));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 158, 87, 0.35);
}
.dashboard-tab-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: #e63946;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 11px;
    border: 2px solid var(--bg-main, #0f1015);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.dashboard-tab.active .dashboard-tab-badge {
    border-color: #fff;
}

/* ─── Learning Command Center (ported from mm-edu) ──────────────
   Welcome hero + Streak/XP/Rank stat cards + Active Challenges +
   Recent Badges preview. Uses consumer's brand tokens
   (--surface-card / --text-primary / --border-color / --brand-*),
   so light/dark theme flips automatically. */
.cc-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 22px;
    margin-bottom: 22px;
}
.cc-hero {
    background: linear-gradient(135deg, rgba(58, 190, 255, 0.10) 0%, rgba(138, 92, 255, 0.10) 50%, rgba(245, 158, 11, 0.10) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
}
.cc-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(58, 190, 255, 0.12), transparent 60%);
    pointer-events: none;
}
.cc-hero-eyebrow {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.cc-hero-greeting {
    color: var(--text-primary);
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 8px 0;
    line-height: 1.15;
}
.cc-hero-sub {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
    line-height: 1.55;
    max-width: 560px;
}

.cc-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
/* ── v1.2 — Dashboard stat-card glow-up ─────────────────────────
   The pre-v1.2 cards were correct but visually flat. Native iOS
   feedback (2026-06-06) flagged the dashboard as "bland." Per-card
   accent stripe + larger gradient value + halo on the icon + a
   subtle keyframe animation on streak (flicker), XP (pulse), rank
   (shimmer) makes the stats the visual centerpiece of the
   dashboard without changing the data layer. */
.cc-stat-card {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast, 150ms ease), box-shadow 250ms ease, border-color var(--transition-fast, 150ms ease);
    cursor: default;
}
/* Per-card top accent stripe — sweeps the brand gradient. */
.cc-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    opacity: 0.55;
}
.cc-stat-card.is-streak { color: #FF5A3C; }
.cc-stat-card.is-xp     { color: #3ABEFF; }
.cc-stat-card.is-rank   { color: #F5C247; }

.cc-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px -8px var(--shadow, rgba(0,0,0,0.18)), 0 0 28px -10px currentColor;
    border-color: color-mix(in srgb, currentColor 40%, var(--border-color));
}

.cc-stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    box-shadow: 0 0 24px -4px currentColor, inset 0 0 18px -8px currentColor;
}
.cc-stat-icon.is-streak { background: linear-gradient(135deg, rgba(255, 90, 60, 0.22), rgba(239, 68, 68, 0.10)); color: var(--brand-orange, #FF5A3C); animation: ccStreakFlicker 2.6s ease-in-out infinite; }
.cc-stat-icon.is-xp     { background: linear-gradient(135deg, rgba(58, 190, 255, 0.22), rgba(138, 92, 255, 0.18)); color: var(--brand-blue, #3ABEFF);   animation: ccXpPulse      3.2s ease-in-out infinite; }
.cc-stat-icon.is-rank   { background: linear-gradient(135deg, rgba(245, 194, 71, 0.22), rgba(255, 90, 60, 0.10));  color: #F5C247;                      animation: ccRankShimmer  3.8s ease-in-out infinite; }

@keyframes ccStreakFlicker {
    0%, 100% { transform: scale(1)    rotate(0deg);   filter: brightness(1)   drop-shadow(0 0 6px currentColor); }
    20%      { transform: scale(1.07) rotate(-2deg);  filter: brightness(1.25) drop-shadow(0 0 12px currentColor); }
    40%      { transform: scale(0.97) rotate(1.5deg); filter: brightness(0.95); }
    60%      { transform: scale(1.05) rotate(-1deg);  filter: brightness(1.15) drop-shadow(0 0 10px currentColor); }
    80%      { transform: scale(1.00) rotate(0deg);   filter: brightness(1.05); }
}
@keyframes ccXpPulse {
    0%, 100% { transform: scale(1);    filter: brightness(1); }
    50%      { transform: scale(1.08); filter: brightness(1.35) drop-shadow(0 0 14px currentColor); }
}
@keyframes ccRankShimmer {
    0%, 100% { transform: translateY(0)    rotate(0deg); filter: brightness(1); }
    50%      { transform: translateY(-3px) rotate(3deg); filter: brightness(1.3) drop-shadow(0 0 12px currentColor); }
}

.cc-stat-body { min-width: 0; flex: 1; }

.cc-stat-eyebrow {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 4px;
}
.cc-stat-value {
    color: var(--text-primary);
    font-size: 2.05rem;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, currentColor, var(--text-primary, #e0e6ff));
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
            color: transparent;
}
.cc-stat-card.is-streak .cc-stat-value,
.cc-stat-card.is-xp     .cc-stat-value,
.cc-stat-card.is-rank   .cc-stat-value {
    /* color reverts to inherited currentColor for the gradient stop */
}
.cc-stat-meta {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 4px;
}

/* Hide the now-empty "Jump into a match" CTA wrapper. The inner
   eyebrow/title/body each carry style="display:none;" already from
   the index.html surgical edit; this :has() rule collapses the
   surrounding cc-module card so it doesn't render as an empty
   padded box. Chromium / Safari 17+ both support :has(). */
.cc-module:has(> .cc-module-eyebrow[style*="display:none"]) {
    display: none;
}

/* When the module row only carries Active Challenges (i.e. it
   also contains the hidden "PLAY MIND MATCH" eyebrow), collapse
   the grid to a single column so the remaining card spans full
   width instead of sitting awkwardly in the 2fr slot with empty
   1fr space beside it. Safari 17+ / Chrome 105+ ship :has(). */
.cc-module-row:has(.cc-module-eyebrow[style*="display:none"]),
.cc-module-row.cc-module-row--single {
    grid-template-columns: 1fr;
}

.cc-module {
    background: var(--surface-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 22px 24px;
}
.cc-module-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 14px;
}
.cc-module-eyebrow {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.cc-module-title {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    line-height: 1.25;
}
.cc-module-body {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 12px 0;
}
.cc-module-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}
.cc-module-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-blue);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
}
.cc-module-cta:hover { text-decoration: underline; }

/* ── v3.6 (2026-06-08) — Open Matches card polish ──────────────────
   When the card is "active" (has at least one open match), give it a
   purple-blue accent border + soft glow + a pulsing live-dot beside
   the title so it reads as something to act on. Empty state stays
   visually quiet but its CTA button is brand-purple. */
#ccConsumerChallengesCard {
    position: relative;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
#ccConsumerChallengesCard[data-state="active"] {
    border-color: rgba(122, 76, 255, 0.45);
    box-shadow: 0 0 0 1px rgba(122, 76, 255, 0.18),
                0 10px 32px -16px rgba(122, 76, 255, 0.45);
}
#ccConsumerChallengesCard[data-state="active"]::before {
    /* Thin gradient accent stripe along the top edge */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
    background: linear-gradient(90deg, transparent, #7a4cff 30%, #3aa0ff 70%, transparent);
    opacity: 0.85;
    pointer-events: none;
}
/* Pulsing live-dot next to the title when there's at least one async
   invite. Inline ::after on the title — no DOM change required. */
#ccConsumerChallengesCard[data-state="active"][data-async-count]:not([data-async-count="0"])
    .cc-module-title#ccConsumerChallengesTitle::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 10px;
    vertical-align: middle;
    border-radius: 50%;
    background: #7a4cff;
    box-shadow: 0 0 0 0 rgba(122, 76, 255, 0.65);
    animation: ccOpenMatchesPulse 1.8s ease-out infinite;
}
@keyframes ccOpenMatchesPulse {
    0%   { box-shadow: 0 0 0 0 rgba(122, 76, 255, 0.65); transform: scale(1); }
    70%  { box-shadow: 0 0 0 10px rgba(122, 76, 255, 0);   transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(122, 76, 255, 0);     transform: scale(1); }
}

/* Async invite row hover lift — gives the rows a tactile feel
   without changing their colour identity (purple vs yellow). */
#ccConsumerChallengesCard [onclick*="openAsyncChallenge"] {
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
#ccConsumerChallengesCard [onclick*="openAsyncChallenge"]:hover {
    transform: translateY(-1px);
    filter: brightness(1.12);
}
@media (hover: hover) {
    #ccConsumerChallengesCard #ccConsumerChallengesBody > div:hover {
        box-shadow: 0 6px 22px -10px rgba(122, 76, 255, 0.55);
    }
}

@media (prefers-reduced-motion: reduce) {
    #ccConsumerChallengesCard[data-state="active"][data-async-count]:not([data-async-count="0"])
        .cc-module-title#ccConsumerChallengesTitle::after { animation: none; }
}

@media (max-width: 720px) {
    .cc-stats { grid-template-columns: 1fr; }
    .cc-module-row { grid-template-columns: 1fr; }
    .cc-hero { padding: 22px 22px; }
    .cc-hero-greeting { font-size: 1.4rem; }
}

/* ── v3 (2026-06-07) — chromeless dashboard ───────────────────
   Hero + 3 stat cards now sit directly on the page background
   with no card chrome. Number is overlaid on the icon. Label sits
   below the figure. Grid is forced to 3 columns even on mobile so
   the row never stacks. */
.cc-wrap.cc-wrap--chromeless { gap: 16px; }

.cc-hero.cc-hero--chromeless {
    background: transparent;
    border: none;
    border-radius: 0;
    /* Top-nav header logo extends ~60px past its 65px container
       (PR #1247: margin-top:25px + height:100px on the .logo-nav
       img). v3.2 (2026-06-08): trimmed from 64px → 40px per user. */
    padding: 40px 0 0 0;
    overflow: visible;
    position: relative; /* anchor for .cc-hero-aurora */
}
.cc-hero.cc-hero--chromeless::before { display: none; }

/* v3.3 (2026-06-08): aurora glow behind the greeting. A soft
   conic-gradient orb in the brand palette (orange / cyan / purple
   / yellow) that breathes + drifts. Positioned absolutely so it
   layers behind the text without affecting layout. Gives the hero
   uniqueness that fits the brand. */
.cc-hero-aurora {
    position: absolute;
    top: -10px;
    left: -40px;
    width: 360px;
    height: 220px;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 25% 40%, rgba(245, 158, 11, 0.30), transparent 55%),
        radial-gradient(circle at 75% 60%, rgba(0, 240, 255, 0.22), transparent 60%),
        radial-gradient(circle at 55% 30%, rgba(191, 0, 255, 0.20), transparent 55%),
        radial-gradient(circle at 50% 80%, rgba(244, 190, 38, 0.18), transparent 60%);
    filter: blur(28px);
    opacity: 0.85;
    animation: ccHeroAuroraBreathe 12s ease-in-out infinite alternate;
}
@keyframes ccHeroAuroraBreathe {
    0%   { transform: translate(0, 0)   scale(1);    opacity: 0.75; }
    50%  { transform: translate(20px, -8px) scale(1.08); opacity: 0.95; }
    100% { transform: translate(-12px, 6px) scale(1.04); opacity: 0.85; }
}

/* v3.3: greeting text gets the brand palette as a gradient so it
   reads as a proper hero, not just a plain label. */
.cc-hero-greeting {
    position: relative;
    z-index: 1;
    background: linear-gradient(
        90deg,
        #ef9e57 0%,
        #f4be26 35%,
        #ffffff 55%,
        #63a0be 90%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: ccHeroGreetingShift 10s ease-in-out infinite;
}
@keyframes ccHeroGreetingShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* v3.2 (2026-06-08): animated brand-color divider that replaces the
   old "Your personal dashboard…" subtitle. Same blue/yellow/orange
   palette as the login card's static border, but with a slow
   left↔right slide so it feels alive. */
.cc-hero-divider {
    position: relative;
    z-index: 1;
    margin-top: 14px;
    height: 3px;
    border-radius: 2px;
    background: linear-gradient(
        90deg,
        #63a0be 0%,
        #63a0be 25%,
        #ef9e57 50%,
        #f4be26 75%,
        #f4be26 100%
    );
    background-size: 200% 100%;
    animation: ccHeroDividerShift 9s ease-in-out infinite;
}
@keyframes ccHeroDividerShift {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}

/* v3.3 (2026-06-08): staggered fade-up entrance for each dashboard
   block. The cc-wrap is the parent — its direct children animate in
   in order so the page feels assembled rather than just blinking
   into existence. */
.cc-wrap.cc-wrap--chromeless > * {
    opacity: 0;
    transform: translateY(14px);
    animation: ccDashRise 0.55s ease-out forwards;
}
.cc-wrap.cc-wrap--chromeless > *:nth-child(1) { animation-delay: 0ms;   }
.cc-wrap.cc-wrap--chromeless > *:nth-child(2) { animation-delay: 90ms;  }
.cc-wrap.cc-wrap--chromeless > *:nth-child(3) { animation-delay: 180ms; }
.cc-wrap.cc-wrap--chromeless > *:nth-child(4) { animation-delay: 270ms; }
.cc-wrap.cc-wrap--chromeless > *:nth-child(5) { animation-delay: 360ms; }
@keyframes ccDashRise {
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cc-hero-divider,
    .cc-hero-greeting,
    .cc-hero-aurora { animation: none; }
    .cc-wrap.cc-wrap--chromeless > * {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* Force 3-column grid at every viewport — including narrow phones.
   Override the @media (max-width: 720px) rule above. */
.cc-stats.cc-stats--chromeless {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px;
    align-items: start;
}

/* Individual stat — chrome stripped, vertical stack centered. */
.cc-stats--chromeless .cc-stat {
    background: transparent;
    border: 0;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    min-width: 0;
}

/* The figure holds the icon + the overlaid number (or the rank
   image). Sized responsively so it never overflows on a 320-wide
   iPhone SE. clamp(64, 22vw, 110) → ~70px on small phones, ~110px
   on tablets/desktop. */
.cc-stats--chromeless .cc-stat-figure {
    position: relative;
    width: clamp(64px, 22vw, 110px);
    height: clamp(64px, 22vw, 110px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Icon — can be an emoji <span> OR a custom <img> from the
   Image Library (streak=fire, xp=lightning per PR #1255). Reset
   the v1.2 chip styles. Size so emoji uses font-size and img uses
   width/height 100% inside the figure.
   min-width:0 + min-height:0 + max-* clamps defeat the flex-item
   default `min-width:auto` (which resolves to the img's 1024px
   intrinsic size and lets it overflow the 110px figure → image
   invisible / blown past container). */
.cc-stats--chromeless .cc-stat-icon {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
    background: none;
    font-size: clamp(56px, 18vw, 96px);
    line-height: 1;
    display: inline-block;
    flex-shrink: 0;
    z-index: 1;
    object-fit: contain;
}
/* Force img-variant to render as block so the inline-block
   baseline alignment doesn't leave a half-pixel gap and the
   sizing rules above resolve correctly. */
.cc-stats--chromeless img.cc-stat-icon {
    display: block;
}
/* Force the number to render above the icon at every viewport. */
.cc-stats--chromeless .cc-stat-value { z-index: 2; }

/* ── Animated overlay layers (PR #1255) ──────────────────────
   Custom images from the Image Library already include static
   sparks (fire) and cracks (lightning) baked into the artwork.
   These pseudo-element overlays add additional small animated
   particles ON TOP of the figure so the static art appears
   to crackle / spark in real time. Subtle enough to layer over
   the brand asset without obscuring it.

   z-index 0 puts them BEHIND the icon and number — they only
   show in the transparent areas of the PNG (the surrounding
   negative space around the bolt / flame). */

/* 🔥 Streak — orange/yellow sparks drifting upward like embers. */
.cc-stats--chromeless .is-streak .cc-stat-figure::before {
    content: '';
    position: absolute;
    inset: -8%;
    background-image:
        radial-gradient(3px 3px at 18% 78%, #FFB050, transparent 70%),
        radial-gradient(2px 2px at 32% 62%, #FFD964, transparent 70%),
        radial-gradient(2.5px 2.5px at 72% 70%, #FF6030, transparent 70%),
        radial-gradient(3px 3px at 84% 48%, #FFA040, transparent 70%),
        radial-gradient(2px 2px at 50% 85%, #FFE0A0, transparent 70%),
        radial-gradient(2px 2px at 14% 40%, #FF8C30, transparent 70%);
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: streakEmbers 2.4s ease-in-out infinite;
}
@keyframes streakEmbers {
    0%   { opacity: 0;   transform: translateY(0)    scale(1); }
    25%  { opacity: 0.9; transform: translateY(-4px) scale(1.05); }
    60%  { opacity: 0.6; transform: translateY(-10px) scale(1.1); }
    100% { opacity: 0;   transform: translateY(-18px) scale(1.15); }
}

/* ⚡ XP — blue electric crackle. Random-feeling flicker that
   bursts a few times per cycle rather than a smooth pulse. */
.cc-stats--chromeless .is-xp .cc-stat-figure::before {
    content: '';
    position: absolute;
    inset: -6%;
    background-image:
        radial-gradient(4px 4px at 15% 30%, #00F0FF, transparent 60%),
        radial-gradient(3px 3px at 85% 22%, #3ABEFF, transparent 60%),
        radial-gradient(3px 3px at 22% 72%, #80E0FF, transparent 60%),
        radial-gradient(4px 4px at 78% 68%, #00C8FF, transparent 60%),
        radial-gradient(2px 2px at 50% 12%, #00F0FF, transparent 60%),
        radial-gradient(2px 2px at 50% 88%, #3ABEFF, transparent 60%);
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: xpCrackle 1.6s steps(8, end) infinite;
    filter: blur(0.5px);
}
@keyframes xpCrackle {
    0%, 14%   { opacity: 0; }
    16%, 22%  { opacity: 0.95; }
    24%, 44%  { opacity: 0.15; }
    46%, 50%  { opacity: 1; }
    52%, 78%  { opacity: 0.3; }
    80%, 86%  { opacity: 0.9; }
    88%, 100% { opacity: 0; }
}

/* Boost the per-image drop-shadow so the bolt / fire art itself
   glows in their brand color (independent of the spark overlay). */
/* Per-stat icon brand-color glow. Animation is INTENTIONALLY only
   on the spark/crack overlay layers (streakEmbers + xpCrackle
   pseudo-elements above) per user direction 2026-06-07 — the
   image itself stays static so the overlay sparks/cracks read
   cleanly without competing motion. */
.cc-stats--chromeless .is-streak .cc-stat-icon {
    filter:
        drop-shadow(0 0 8px rgba(255, 120, 40, 0.55))
        drop-shadow(0 0 22px rgba(255, 90, 40, 0.35));
}
.cc-stats--chromeless .is-xp .cc-stat-icon {
    filter:
        drop-shadow(0 0 8px rgba(0, 240, 255, 0.55))
        drop-shadow(0 0 22px rgba(58, 190, 255, 0.35));
}

/* The big number — absolutely centered over the icon. Text-shadow
   + outline carves it out against the icon's color so it stays
   readable on bright icons (⚡ yellow especially). */
.cc-stats--chromeless .cc-stat-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    pointer-events: none;
    /* Override the v1.2 .cc-stat-value gradient text-fill that was
       inherited here (lines 1247-1258). On the chromeless layout
       the number sits OVER the emoji, so gradient-on-emoji muddies
       to grey — we want pure white instead. */
    background: none !important;
    -webkit-background-clip: border-box;
            background-clip: border-box;
    -webkit-text-fill-color: #FFFFFF;
            color: #FFFFFF;
    /* Hard dark outline (1px stroke) + soft drop shadows so the
       white digit always reads against the icon underneath. */
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.7);
    text-shadow:
        0 0 6px rgba(0, 0, 0, 0.7),
        0 2px 4px rgba(0, 0, 0, 0.55),
        0 0 18px rgba(0, 0, 0, 0.4);
}

/* Rank image / fallback emoji. v3.2 (2026-06-08): ccRankShimmer
   animation removed per user — the rank tile now sits still while
   streak (flicker) and XP (pulse) keep their micro-motion.
   v3.3 (2026-06-08): static gold halo behind it so it still has
   presence without movement (compensates for the now-still icon
   so the rank tile doesn't feel flat next to the animated ones). */
.cc-stats--chromeless .is-rank .cc-stat-figure::after {
    content: '';
    position: absolute;
    inset: -4%;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
        rgba(245, 194, 71, 0.35) 0%,
        rgba(245, 194, 71, 0.12) 40%,
        transparent 70%);
    filter: blur(8px);
}
.cc-stats--chromeless .cc-stat-rank-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(245, 194, 71, 0.5));
    position: relative;
    z-index: 1;
}
.cc-stats--chromeless .cc-stat-rank-fallback {
    font-size: clamp(56px, 18vw, 96px);
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(245, 194, 71, 0.55));
    position: relative;
    z-index: 1;
}

/* Label below the figure — the human-readable label per card. */
.cc-stats--chromeless .cc-stat-label {
    font-weight: 700;
    font-size: clamp(0.78rem, 2.6vw, 0.98rem);
    color: var(--text-primary);
    line-height: 1.2;
}

/* Meta line — small secondary text below the label. */
.cc-stats--chromeless .cc-stat-meta {
    font-size: clamp(0.65rem, 2.2vw, 0.78rem);
    color: var(--text-secondary);
    line-height: 1.3;
    margin-top: 0;
}

/* Rank tile: rank name is baked INTO the admin's uploaded rank
   image, so the on-screen text label would be redundant. Hide
   visually but keep in the DOM (the JS still writes to it for
   the alt= attribute on the rank img + future analytics). */
.cc-stats--chromeless .is-rank .cc-stat-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Recent Badges — chromeless (2026-06-08) ──────────────────
   Section sits directly on the page background, matching the
   3-stat tile band above it. Each badge tile is the image with
   "Earned <date>" caption — no card chrome around it. Slot count
   is computed in JS from the container width so the row never
   wraps; if more badges exist than fit, the last slot becomes a
   "See all" tile that opens MindMatchUserProfile. */
.cc-badges-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}
.cc-badges-header {
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.cc-badges-grid {
    /* Flex (not grid) so tiles take their natural ~120px width and
       pack to the left, leaving empty space on the right when the
       row isn't full. JS still computes a slot count to decide
       when to swap the last tile for a "See all" button. */
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 12px;
}
.cc-badges-empty {
    flex: 1 1 100%;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.cc-badge-tile {
    background: transparent;
    border: 0;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    color: inherit;
    font: inherit;
    cursor: default;
    flex: 0 0 120px;
    min-width: 0;
}
.cc-badge-tile-img {
    width: 100%;
    max-width: 96px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
}
.cc-badge-tile-emoji {
    font-size: 3rem;
    line-height: 1;
    width: 100%;
    max-width: 96px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cc-badge-tile-when {
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.2;
}
.cc-badge-tile--see-all {
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease;
}
.cc-badge-tile--see-all .cc-badge-tile-emoji {
    background: rgba(0, 240, 255, 0.08);
    border: 2px dashed rgba(0, 240, 255, 0.55);
    border-radius: 14px;
    color: var(--brand-blue, #00f0ff);
}
.cc-badge-tile-see-all-label {
    color: var(--brand-blue, #00f0ff);
    font-weight: 800;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    line-height: 1.2;
}
@media (hover: hover) {
    .cc-badge-tile--see-all:hover { transform: translateY(-2px); }
    .cc-badge-tile--see-all:hover .cc-badge-tile-emoji {
        background: rgba(0, 240, 255, 0.14);
        border-color: rgba(0, 240, 255, 0.85);
    }
}
.cc-badge-tile--see-all:focus-visible {
    outline: 2px solid var(--brand-blue, #00f0ff);
    outline-offset: 4px;
    border-radius: 12px;
}

/* ── Dashboard background ambience (2026-06-08) ───────────────
   Twinkling star field + slow diagonal shimmer sweep behind the
   dashboard content. Two pseudo-element layers on #dashboardView:
   ::before is a static scatter of stars with a slow opacity
   pulse; ::after is a wide diagonal highlight band that drifts
   across the viewport. Both sit behind real content via z-index
   and pointer-events:none.
   Gated to dark theme (light theme stays clean) and disabled
   under prefers-reduced-motion. */
#dashboardView {
    position: relative;
    isolation: isolate;
}
#dashboardView::before,
#dashboardView::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
#dashboardView > * {
    position: relative;
    z-index: 1;
}

/* Star field — multiple radial gradients at fixed coordinates so
   the pattern looks scattered without an actual canvas. Two
   layers stacked with mismatched timings give a "twinkling"
   feel (one breathes slower than the other). */
#dashboardView::before {
    background-image:
        radial-gradient(1.5px 1.5px at 8% 6%,   rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(1px 1px   at 17% 14%,   rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(2px 2px   at 24% 9%,    rgba(186,231,255,0.80), transparent 60%),
        radial-gradient(1px 1px   at 33% 19%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(1.5px 1.5px at 42% 6%,  rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(1px 1px   at 53% 12%,   rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(2px 2px   at 62% 4%,    rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(1px 1px   at 71% 17%,   rgba(186,231,255,0.65), transparent 60%),
        radial-gradient(1.5px 1.5px at 81% 8%,  rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(1px 1px   at 91% 14%,   rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(1px 1px   at 5% 28%,    rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(2px 2px   at 14% 36%,   rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(1px 1px   at 23% 31%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(1.5px 1.5px at 36% 38%, rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(1px 1px   at 48% 33%,   rgba(186,231,255,0.60), transparent 60%),
        radial-gradient(2px 2px   at 57% 42%,   rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(1px 1px   at 68% 30%,   rgba(255,255,255,0.45), transparent 60%),
        radial-gradient(1.5px 1.5px at 76% 39%, rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(1px 1px   at 86% 32%,   rgba(255,236,179,0.55), transparent 60%),
        radial-gradient(1px 1px   at 95% 41%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(2px 2px   at 9% 55%,    rgba(255,255,255,0.70), transparent 60%),
        radial-gradient(1px 1px   at 19% 64%,   rgba(186,231,255,0.55), transparent 60%),
        radial-gradient(1px 1px   at 31% 58%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(1.5px 1.5px at 44% 66%, rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(1px 1px   at 56% 60%,   rgba(255,236,179,0.65), transparent 60%),
        radial-gradient(2px 2px   at 65% 70%,   rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(1px 1px   at 75% 62%,   rgba(255,255,255,0.45), transparent 60%),
        radial-gradient(1.5px 1.5px at 88% 71%, rgba(186,231,255,0.75), transparent 60%),
        radial-gradient(1px 1px   at 97% 65%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(1px 1px   at 6% 82%,    rgba(255,255,255,0.55), transparent 60%),
        radial-gradient(2px 2px   at 18% 90%,   rgba(255,236,179,0.70), transparent 60%),
        radial-gradient(1px 1px   at 28% 85%,   rgba(255,255,255,0.50), transparent 60%),
        radial-gradient(1.5px 1.5px at 41% 92%, rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(1px 1px   at 53% 84%,   rgba(186,231,255,0.55), transparent 60%),
        radial-gradient(2px 2px   at 62% 96%,   rgba(255,255,255,0.65), transparent 60%),
        radial-gradient(1px 1px   at 74% 88%,   rgba(255,255,255,0.45), transparent 60%),
        radial-gradient(1.5px 1.5px at 84% 95%, rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(1px 1px   at 93% 87%,   rgba(255,236,179,0.50), transparent 60%);
    background-repeat: no-repeat;
    /* v3.4 (2026-06-08): brighter twinkle so the stars actually pop
       against the dashboard background. Was peaking at 0.85 — bumped
       to 1.0 with stronger brightness boost. */
    animation: ccDashStarsTwinkle 5.6s ease-in-out infinite alternate;
    opacity: 0.92;
}

/* v3.5 (2026-06-08): edge-focused star band. Most of the sparkle
   layers (::before scatter + .cc-bright-stars central blink) cluster
   toward the middle of the dashboard. This layer fills the left and
   right margins (X < 18% + X > 82%) at every Y, so the page feels
   star-rimmed instead of star-centered. Slow, soft twinkle so it
   doesn't fight the other layers. */
#dashboardView .cc-edge-stars {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        /* LEFT EDGE — X 2-18%, full Y range */
        radial-gradient(1.5px 1.5px at 3% 5%,    rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(2px 2px   at 7% 11%,     rgba(186,231,255,0.80), transparent 60%),
        radial-gradient(1.5px 1.5px at 12% 17%,  rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 4% 22%,   rgba(255,255,255,0.95), transparent 60%),
        radial-gradient(1.5px 1.5px at 9% 28%,   rgba(255,255,255,0.70), transparent 60%),
        radial-gradient(2px 2px   at 14% 34%,    rgba(186,231,255,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 2% 40%,   rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(2px 2px   at 11% 46%,    rgba(255,236,179,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 6% 52%,   rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 15% 58%,  rgba(186,231,255,0.90), transparent 60%),
        radial-gradient(1.5px 1.5px at 3% 64%,   rgba(255,255,255,0.65), transparent 60%),
        radial-gradient(2px 2px   at 9% 71%,     rgba(255,236,179,0.80), transparent 60%),
        radial-gradient(1.5px 1.5px at 14% 77%,  rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(2px 2px   at 5% 83%,     rgba(186,231,255,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 11% 89%,  rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 7% 95%,   rgba(255,255,255,0.90), transparent 60%),
        /* RIGHT EDGE — X 82-98%, full Y range */
        radial-gradient(1.5px 1.5px at 97% 4%,   rgba(255,255,255,0.85), transparent 60%),
        radial-gradient(2px 2px   at 93% 10%,    rgba(186,231,255,0.80), transparent 60%),
        radial-gradient(1.5px 1.5px at 88% 16%,  rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 96% 23%,  rgba(255,255,255,0.95), transparent 60%),
        radial-gradient(1.5px 1.5px at 91% 29%,  rgba(255,255,255,0.70), transparent 60%),
        radial-gradient(2px 2px   at 86% 35%,    rgba(186,231,255,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 98% 41%,  rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(2px 2px   at 89% 47%,    rgba(255,236,179,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 94% 53%,  rgba(255,255,255,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 85% 59%,  rgba(186,231,255,0.90), transparent 60%),
        radial-gradient(1.5px 1.5px at 97% 65%,  rgba(255,255,255,0.65), transparent 60%),
        radial-gradient(2px 2px   at 91% 72%,    rgba(255,236,179,0.80), transparent 60%),
        radial-gradient(1.5px 1.5px at 86% 78%,  rgba(255,255,255,0.80), transparent 60%),
        radial-gradient(2px 2px   at 95% 84%,    rgba(186,231,255,0.85), transparent 60%),
        radial-gradient(1.5px 1.5px at 89% 90%,  rgba(255,236,179,0.75), transparent 60%),
        radial-gradient(2.5px 2.5px at 93% 96%,  rgba(255,255,255,0.90), transparent 60%);
    background-repeat: no-repeat;
    opacity: 0.85;
    animation: ccEdgeStarsTwinkle 7.2s ease-in-out infinite alternate;
}
@keyframes ccEdgeStarsTwinkle {
    0%   { opacity: 0.50; filter: brightness(1.00); }
    50%  { opacity: 1.00; filter: brightness(1.25); }
    100% { opacity: 0.75; filter: brightness(1.10); }
}

/* v3.4 (2026-06-08): a few "bright stars" with a sharper blink, on
   top of the steady field. Different cadence + locations so the
   sparkle feels alive instead of metronome-y. */
#dashboardView .cc-bright-stars {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(2.5px 2.5px at 12% 11%, rgba(255,255,255,1.0), transparent 55%),
        radial-gradient(3px 3px at 38% 8%,    rgba(186,231,255,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 64% 16%, rgba(255,236,179,1.0), transparent 55%),
        radial-gradient(3px 3px at 88% 9%,    rgba(255,255,255,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 21% 33%, rgba(186,231,255,1.0), transparent 55%),
        radial-gradient(3px 3px at 48% 42%,   rgba(255,255,255,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 75% 36%, rgba(255,236,179,1.0), transparent 55%),
        radial-gradient(3px 3px at 30% 58%,   rgba(255,255,255,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 60% 64%, rgba(186,231,255,1.0), transparent 55%),
        radial-gradient(3px 3px at 90% 60%,   rgba(255,236,179,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 15% 80%, rgba(255,255,255,1.0), transparent 55%),
        radial-gradient(3px 3px at 50% 86%,   rgba(186,231,255,1.0),  transparent 55%),
        radial-gradient(2.5px 2.5px at 80% 90%, rgba(255,236,179,1.0), transparent 55%);
    background-repeat: no-repeat;
    animation: ccDashStarsBlink 3.2s steps(6, end) infinite;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.6));
}
@keyframes ccDashStarsBlink {
    0%, 18%  { opacity: 0.35; }
    20%, 28% { opacity: 1.0;  }
    30%, 55% { opacity: 0.45; }
    57%, 65% { opacity: 1.0;  }
    67%, 100%{ opacity: 0.55; }
}

/* Diagonal shimmer band that drifts across the dashboard every
   ~12s — slow enough not to distract, fast enough to feel alive. */
#dashboardView::after {
    background: linear-gradient(
        115deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.045) 50%,
        rgba(186, 231, 255, 0.025) 55%,
        transparent 60%,
        transparent 100%
    );
    background-size: 220% 220%;
    background-repeat: no-repeat;
    animation: ccDashShimmer 12s linear infinite;
    mix-blend-mode: screen;
}

@keyframes ccDashStarsTwinkle {
    0%   { opacity: 0.55; filter: brightness(1.00); }
    35%  { opacity: 1.00; filter: brightness(1.25); }
    65%  { opacity: 0.70; filter: brightness(1.10); }
    100% { opacity: 0.95; filter: brightness(1.20); }
}
@keyframes ccDashShimmer {
    0%   { background-position: -60% 0%; }
    100% { background-position: 160% 0%; }
}

/* Light theme: kill the stars + shimmer entirely. The light
   palette is already bright; sparkles read as noise. */
[data-theme="light"] #dashboardView .cc-bright-stars,
[data-theme="light"] #dashboardView .cc-edge-stars { display: none; }
[data-theme="light"] #dashboardView::before,
[data-theme="light"] #dashboardView::after {
    display: none;
}

/* Accessibility: honor the user's motion preference. The stars
   stay visible as a static field, but they stop pulsing and the
   shimmer band stops sweeping. */
@media (prefers-reduced-motion: reduce) {
    #dashboardView::before { animation: none; opacity: 0.55; }
    #dashboardView::after  { animation: none; }
    #dashboardView .cc-bright-stars { animation: none; opacity: 0.7; }
    #dashboardView .cc-edge-stars   { animation: none; opacity: 0.7; }
}
