/* ============================================
   FAMILY FITNESS CHALLENGE — BEAST MODE
   Dark Glassmorphism Sport Theme
   ============================================ */

/* === CSS VARIABLES === */
:root {
    /* Accent colors */
    --accent: #00FF88;
    --accent-secondary: #8B5CF6;
    --accent-orange: #FF6B35;
    --accent-pink: #EC4899;
    --accent-blue: #3B82F6;
    --accent-cyan: #06B6D4;

    /* Semantic */
    --success: #00FF88;
    --danger: #FF4757;
    --warning: #FBBF24;
    --info: #3B82F6;

    /* Backgrounds — dark first */
    --bg-deep: #05050a;
    --bg-primary: #0a0a0f;
    --bg-secondary: rgba(255, 255, 255, 0.04);
    --bg-card: rgba(255, 255, 255, 0.06);
    --bg-card-hover: rgba(255, 255, 255, 0.10);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --bg-glass-strong: rgba(255, 255, 255, 0.12);
    --bg-input: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.35);

    /* Borders */
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-hover: rgba(255, 255, 255, 0.15);
    --border-accent: rgba(0, 255, 136, 0.3);

    /* Glows */
    --glow-accent: 0 0 20px rgba(0, 255, 136, 0.25);
    --glow-accent-strong: 0 0 40px rgba(0, 255, 136, 0.35), 0 0 80px rgba(0, 255, 136, 0.1);
    --glow-violet: 0 0 20px rgba(139, 92, 246, 0.25);
    --glow-orange: 0 0 20px rgba(255, 107, 53, 0.25);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.25);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Glass blur */
    --blur-sm: blur(10px);
    --blur-md: blur(20px);
    --blur-lg: blur(40px);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light theme override */
[data-theme="light"] {
    --bg-deep: #f0f2f5;
    --bg-primary: #f5f7fa;
    --bg-secondary: rgba(0, 0, 0, 0.03);
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    --bg-input: rgba(0, 0, 0, 0.04);
    --text-primary: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.65);
    --text-muted: rgba(15, 23, 42, 0.4);
    --border-glass: rgba(0, 0, 0, 0.08);
    --border-glass-hover: rgba(0, 0, 0, 0.15);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --accent: #059669;
    --accent-secondary: #7C3AED;
}

/* === GLOBAL RESET === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100dvh;
    min-height: 100vh; /* fallback for older browsers */
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === PARTICLE CANVAS === */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.6;
}

/* === APP CONTAINER === */
.app-container {
    max-width: 100%;
    margin: 0 auto;
    min-height: 100dvh;
    min-height: 100vh; /* fallback */
    position: relative;
    z-index: 1;
    padding-bottom: 90px;
}

/* === GLASS CARD MIXIN (reused) === */
.glass {
    background: var(--bg-card);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid var(--border-glass);
    transition: all 0.3s var(--ease-out);
}

.glass:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glass-hover);
}

/* === SPLASH SCREEN === */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    font-size: 5em;
    animation: splashPulse 1.5s ease-in-out infinite;
}

.splash-title {
    font-size: 1.5em;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.splash-bar {
    width: 120px;
    height: 3px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    margin-top: 24px;
    overflow: hidden;
}

.splash-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: var(--radius-full);
    animation: splashLoad 1.8s var(--ease-out) forwards;
}

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

@keyframes splashLoad {
    to { width: 100%; }
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    min-height: 100dvh;
    min-height: 100vh; /* fallback */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Neon mesh background */
.login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(0, 255, 136, 0.15), transparent),
        radial-gradient(ellipse 50% 60% at 80% 20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 40% 50% at 50% 80%, rgba(236, 72, 153, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 70% 60%, rgba(6, 182, 212, 0.1), transparent);
    animation: meshMove 12s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes meshMove {
    0% { transform: scale(1) translate(0, 0); }
    33% { transform: scale(1.05) translate(-2%, 3%); }
    66% { transform: scale(0.97) translate(3%, -2%); }
    100% { transform: scale(1.02) translate(-1%, 1%); }
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: var(--blur-lg);
    -webkit-backdrop-filter: var(--blur-lg);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-2xl);
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: cardEntry 0.8s var(--ease-spring) both;
}

@keyframes cardEntry {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-icon {
    font-size: 4em;
    margin-bottom: 12px;
    display: inline-block;
    animation: floatBounce 3s ease-in-out infinite;
}

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

.login-logo h1 {
    font-size: 1.8em;
    font-weight: 900;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 50%, var(--accent-pink) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 4s ease infinite;
}

@keyframes gradientFlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-logo p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-size: 0.95em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    padding: 14px 16px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: 1em;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s var(--ease-out);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1), var(--glow-accent);
}

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

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: var(--text-muted);
    transition: color 0.2s;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* Neon button */
.login-btn {
    padding: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, #00cc6a 100%);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.05em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.login-btn:hover::before {
    transform: translateX(100%);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-accent-strong);
}

.login-btn:active {
    transform: translateY(0) scale(0.98);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9em;
    display: none;
}

.login-error.show {
    display: block;
    animation: shakeX 0.4s ease;
}

@keyframes shakeX {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.85em;
}

/* ============================================
   APP HEADER
   ============================================ */
.app-header {
    background: var(--bg-glass);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: white;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s var(--ease-bounce);
    box-shadow: 0 0 0 2px var(--bg-deep), 0 0 0 3px var(--accent);
}

.header-avatar:hover {
    transform: scale(1.1);
}

.header-info h2 {
    font-size: 1em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-info p {
    font-size: 0.75em;
    color: var(--text-secondary);
}

/* XP bar in header */
.header-xp-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    margin-top: 4px;
    overflow: hidden;
}

.header-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: var(--radius-full);
    transition: width 1s var(--ease-out);
    position: relative;
}

.header-xp-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-actions {
    display: flex;
    gap: 6px;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-out);
    color: var(--text-primary);
}

.header-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
    transform: scale(1.05);
}

.header-btn.admin-btn {
    background: linear-gradient(135deg, var(--accent-orange), var(--danger));
    border-color: transparent;
    color: white;
}

/* ============================================
   NAVIGATION TABS
   ============================================ */
.nav-tabs {
    display: flex;
    background: var(--bg-glass);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 71px;
    z-index: 99;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    flex: 1;
    min-width: 56px;
    padding: 12px 6px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s var(--ease-out);
    position: relative;
}

.nav-tab-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-tab-icon {
    font-size: 1.5em;
    transition: transform 0.3s var(--ease-bounce);
}

.nav-tab.active {
    color: var(--accent);
}

.nav-tab.active .nav-tab-icon {
    transform: scale(1.15);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    box-shadow: var(--glow-accent);
}

/* Nav brand (desktop sidebar only) */
.nav-brand {
    display: none;
}

/* Nav admin tab styling */
.nav-tab-admin {
    /* Same as other tabs on mobile */
}

/* App body wrapper */
.app-body {
    display: flex;
    flex-direction: column;
}

/* Main content area */
.app-main {
    flex: 1;
    min-width: 0;
}

/* Desktop layout — two columns (main + sidebar) */
.desktop-layout {
    display: block; /* single column on mobile */
}

.desktop-main, .desktop-sidebar {
    /* No special styling on mobile */
}

/* Desktop grid — 2 columns on desktop, 1 on mobile */
.desktop-grid-2 {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Challenges grid */
.challenges-grid {
    display: flex;
    flex-direction: column;
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    padding: 20px 16px;
}

.page-title {
    font-size: 1.4em;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

/* ============================================
   FEED — ACTIVITY CARDS
   ============================================ */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-radius: var(--radius-xl);
    padding: 16px;
    border: 1px solid var(--border-glass);
    transition: all 0.4s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.activity-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.activity-card:hover {
    border-color: var(--border-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Scroll reveal */
.activity-card.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.activity-card.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.activity-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    color: white;
    flex-shrink: 0;
}

.activity-user-info {
    flex: 1;
    min-width: 0;
}

.activity-user-name {
    font-weight: 700;
    font-size: 0.95em;
}

.activity-time {
    font-size: 0.78em;
    color: var(--text-muted);
}

.activity-points {
    background: linear-gradient(135deg, var(--accent) 0%, #00cc6a 100%);
    color: #000;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.82em;
    font-weight: 800;
    box-shadow: var(--glow-accent);
    white-space: nowrap;
}

.activity-content {
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border-glass);
}

.activity-exercise {
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-exercise-icon {
    font-size: 2.2em;
    line-height: 1;
}

.activity-exercise-details h4 {
    font-size: 1em;
    font-weight: 700;
}

.activity-exercise-details p {
    color: var(--text-secondary);
    font-size: 0.88em;
}

.activity-note {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-glass);
    font-size: 0.88em;
    color: var(--text-secondary);
    font-style: italic;
}

/* Compact reactions */
.activity-reactions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.reaction-btn {
    padding: 6px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    cursor: pointer;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s var(--ease-out);
    color: var(--text-primary);
}

.reaction-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
    transform: scale(1.08);
}

.reaction-btn.active {
    background: linear-gradient(135deg, var(--accent), #00cc6a);
    color: #000;
    border-color: var(--accent);
    font-weight: 700;
    box-shadow: var(--glow-accent);
}

.reaction-count {
    font-weight: 700;
    font-size: 0.8em;
}

/* ============================================
   CHALLENGES
   ============================================ */
.challenges-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.challenge-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s var(--ease-out);
    color: var(--text-secondary);
    text-align: center;
}

.challenge-tab.active {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
    color: var(--accent);
    box-shadow: var(--glow-accent);
}

.challenge-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-glass);
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-out);
}

.challenge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary), var(--accent-pink));
    opacity: 0.6;
}

.challenge-card:hover {
    border-color: var(--border-glass-hover);
    transform: translateY(-2px);
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.challenge-title {
    font-size: 1.05em;
    font-weight: 700;
}

.challenge-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.challenge-badge.pending {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.challenge-badge.active {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent);
    border: 1px solid var(--border-accent);
    box-shadow: var(--glow-accent);
}

.challenge-badge.completed {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* VS section */
.challenge-vs {
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin: 20px 0;
}

.challenge-player {
    text-align: center;
}

.challenge-player-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7em;
    color: white;
    margin: 0 auto 8px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s var(--ease-bounce);
}

.challenge-player-avatar:hover {
    transform: scale(1.1);
}

.challenge-player-name {
    font-weight: 600;
    font-size: 0.88em;
}

.challenge-player-progress {
    font-size: 1.1em;
    font-weight: 800;
    color: var(--accent);
    margin-top: 4px;
}

.challenge-vs-icon {
    font-size: 1.6em;
    font-weight: 900;
    color: var(--accent-orange);
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
    animation: vsPulse 2s ease-in-out infinite;
}

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

/* Progress bar */
.challenge-progress-bar {
    height: 6px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 16px 0;
}

.challenge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-out);
    box-shadow: var(--glow-accent);
    position: relative;
}

.challenge-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

.challenge-actions {
    display: flex;
    gap: 10px;
}

.challenge-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    font-size: 0.9em;
}

.challenge-btn.accept {
    background: var(--accent);
    color: #000;
    box-shadow: var(--glow-accent);
}

.challenge-btn.accept:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-accent-strong);
}

.challenge-btn.decline {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

/* ============================================
   VALIDATION DE DÉFI
   ============================================ */
.challenge-validation-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-glass);
}

.validation-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.validation-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: 0.9em;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s;
}

.validation-input:focus {
    border-color: var(--accent);
}

.validation-btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--accent);
    color: #000;
    font-weight: 700;
    font-size: 0.88em;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.validation-btn:hover {
    box-shadow: var(--glow-accent);
    transform: translateY(-1px);
}

.validation-message {
    margin-top: 10px;
    padding: 10px 14px;
    background: rgba(0, 255, 136, 0.06);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.85em;
}

.validation-author {
    font-weight: 700;
    color: var(--accent);
}

/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.leaderboard-tab {
    flex: 1;
    padding: 10px 8px;
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82em;
    transition: all 0.3s var(--ease-out);
    text-align: center;
    color: var(--text-secondary);
}

.leaderboard-tab:hover {
    border-color: var(--accent);
}

.leaderboard-tab.active {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
    color: var(--accent);
    box-shadow: var(--glow-accent);
}

/* Podium */
.leaderboard-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 28px;
    padding: 20px 10px;
}

.podium-place {
    text-align: center;
    padding: 18px 14px;
    border-radius: var(--radius-xl);
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    transition: all 0.4s var(--ease-spring);
    flex: 1;
    max-width: 130px;
}

.podium-place:hover {
    transform: translateY(-4px);
}

.podium-place.first {
    order: 2;
    transform: scale(1.08);
    border-color: rgba(255, 215, 0, 0.4);
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.12) 0%, var(--bg-card) 100%);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.15);
}

.podium-place.first:hover {
    transform: scale(1.08) translateY(-4px);
}

.podium-place.second {
    order: 1;
    border-color: rgba(192, 192, 192, 0.3);
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.08) 0%, var(--bg-card) 100%);
}

.podium-place.third {
    order: 3;
    border-color: rgba(205, 127, 50, 0.3);
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.08) 0%, var(--bg-card) 100%);
}

.podium-rank {
    font-size: 2em;
    margin-bottom: 8px;
}

.podium-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: white;
    margin: 0 auto 8px;
    box-shadow: var(--shadow-md);
}

.podium-place.first .podium-avatar {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.podium-name {
    font-weight: 700;
    font-size: 0.85em;
}

.podium-points {
    font-size: 0.78em;
    color: var(--accent);
    font-weight: 700;
    margin-top: 2px;
}

/* Leaderboard list */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    transition: all 0.3s var(--ease-out);
}

.leaderboard-item:hover {
    border-color: var(--border-glass-hover);
    transform: translateX(4px);
}

.leaderboard-rank {
    font-size: 1.1em;
    font-weight: 800;
    color: var(--text-muted);
    min-width: 28px;
    text-align: center;
}

.leaderboard-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: white;
}

.leaderboard-info {
    flex: 1;
    min-width: 0;
}

.leaderboard-name {
    font-weight: 700;
    font-size: 0.95em;
}

.leaderboard-level {
    font-size: 0.78em;
    color: var(--text-secondary);
}

.leaderboard-points {
    font-weight: 800;
    color: var(--accent);
    font-size: 0.95em;
}

.leaderboard-item.inactive {
    opacity: 0.4;
}

/* Titles list */
.titles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.title-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    transition: all 0.3s var(--ease-out);
}

.title-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glass-hover);
}

.title-card.special {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.06) 0%, rgba(255, 165, 0, 0.06) 100%);
    border-color: rgba(255, 215, 0, 0.2);
}

.title-badge {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}

.title-info { flex: 1; }
.title-name { font-weight: 700; }
.title-stats { font-size: 0.82em; color: var(--text-secondary); }

.title-champion { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.title-champion-avatar {
    width: 38px; height: 38px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1em; color: white;
}
.title-champion-name { font-size: 0.72em; font-weight: 600; color: var(--text-muted); }

/* ============================================
   PROFILE
   ============================================ */
.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: white;
    box-shadow: 0 0 0 3px var(--bg-deep), 0 0 0 4px var(--accent);
}

.profile-info h2 {
    font-weight: 800;
    margin-bottom: 2px;
}

.profile-info p {
    color: var(--text-secondary);
    font-size: 0.88em;
}

/* Stats grid */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    border: 1px solid var(--border-glass);
    transition: all 0.3s var(--ease-out);
}

.stat-card:hover {
    border-color: var(--border-glass-hover);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.72em;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Level progress */
.level-progress-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-glass);
}

.level-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.level-progress-bar {
    height: 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: var(--radius-full);
    transition: width 1s var(--ease-out);
    box-shadow: var(--glow-accent);
}

.my-activities-title {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   CHAT
   ============================================ */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-glass);
    scroll-behavior: smooth;
}

.chat-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: msgSlideIn 0.3s var(--ease-out);
}

@keyframes msgSlideIn {
    from { opacity: 0; transform: translateY(10px); }
}

.chat-message.own {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1em;
    color: white;
    flex-shrink: 0;
}

.chat-bubble {
    max-width: 75%;
    background: var(--bg-glass-strong);
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.chat-message.own .chat-bubble {
    background: linear-gradient(135deg, var(--accent), #00cc6a);
    color: #000;
    border-color: transparent;
}

.chat-sender {
    font-size: 0.72em;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--accent);
}

.chat-message.own .chat-sender {
    color: rgba(0,0,0,0.6);
}

.chat-text {
    font-size: 0.9em;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-time {
    font-size: 0.68em;
    opacity: 0.5;
    margin-top: 4px;
}

.chat-input-container {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 0.95em;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.3s;
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
}

.chat-send-btn {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #000;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    box-shadow: var(--glow-accent-strong);
    transform: scale(1.08);
}

.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* ============================================
   FAMILY
   ============================================ */
.family-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.family-card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-radius: var(--radius-xl);
    padding: 20px 16px;
    text-align: center;
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all 0.4s var(--ease-spring);
    position: relative;
    overflow: hidden;
}

.family-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, transparent 40%, rgba(0, 255, 136, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.family-card:hover {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--border-glass-hover);
    box-shadow: var(--shadow-lg);
}

.family-card:hover::after {
    opacity: 1;
}

.family-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    color: white;
    margin: 0 auto 12px;
    transition: transform 0.4s var(--ease-bounce);
}

.family-card:hover .family-avatar {
    transform: scale(1.1);
}

.family-name {
    font-weight: 700;
    font-size: 1.05em;
    margin-bottom: 4px;
}

.family-role {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.family-stats {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 0.78em;
    color: var(--text-secondary);
}

.family-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid var(--border-glass);
}

.admin-section-title {
    font-size: 1.05em;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
}

.admin-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    color: white;
}

.admin-user-info { flex: 1; }
.admin-user-name { font-weight: 700; font-size: 0.95em; }
.admin-user-role { font-size: 0.78em; color: var(--text-secondary); }

.admin-user-actions {
    display: flex;
    gap: 6px;
}

.admin-btn {
    padding: 7px 12px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82em;
    font-weight: 700;
    transition: all 0.2s var(--ease-out);
}

.admin-btn.edit { background: var(--info); color: white; }
.admin-btn.reset-pwd { background: var(--warning); color: #000; }
.admin-btn.delete { background: var(--danger); color: white; }
.admin-btn.add {
    background: var(--accent);
    color: #000;
    width: 100%;
    padding: 14px;
    font-size: 1em;
    border-radius: var(--radius-md);
}

.admin-btn:hover { transform: translateY(-1px); }

/* Debug */
.debug-stats { display: flex; flex-direction: column; gap: 8px; }
.debug-stat {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: var(--bg-glass); border-radius: var(--radius-sm);
}
.debug-stat-label { font-size: 0.82em; color: var(--text-secondary); }
.debug-stat-value { font-weight: 700; font-size: 0.88em; }
.debug-stat-value.demo { color: var(--warning); }
.debug-stat-value.sync { color: var(--accent); }
.debug-stat-value.warning { color: var(--danger); }

/* Error log */
.error-log-list { max-height: 400px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.error-log-item { background: var(--bg-glass); border-radius: var(--radius-sm); padding: 12px; border-left: 3px solid var(--text-muted); }
.error-log-item.network { border-left-color: var(--warning); }
.error-log-item.auth, .error-log-item.server { border-left-color: var(--danger); }
.error-log-item.timeout { border-left-color: var(--warning); }
.error-log-item.validation { border-left-color: var(--info); }
.error-log-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.error-log-type { font-weight: 700; font-size: 0.72em; text-transform: uppercase; }
.error-log-time { font-size: 0.68em; color: var(--text-muted); }
.error-log-context { font-size: 0.72em; color: var(--text-secondary); font-family: monospace; margin-bottom: 4px; }
.error-log-message { font-size: 0.82em; word-break: break-word; }
.error-log-user { font-size: 0.68em; color: var(--text-muted); margin-top: 6px; }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ease-out);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-deep);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 450px;
    max-height: 88vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s var(--ease-spring);
    box-shadow: var(--shadow-xl);
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-deep);
    z-index: 1;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.modal-title {
    font-size: 1.15em;
    font-weight: 800;
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    cursor: pointer;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-primary);
}

.modal-close:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--bg-deep);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.modal-btn {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    font-size: 0.95em;
}

.modal-btn.primary {
    background: var(--accent);
    color: #000;
}

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

.modal-btn.secondary {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.modal-btn.danger {
    background: var(--danger);
    color: white;
    flex: 0 0 auto;
}

/* Exercise grid */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.exercise-option {
    padding: 12px 6px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    cursor: pointer;
    text-align: center;
    transition: all 0.3s var(--ease-out);
    color: var(--text-primary);
}

.exercise-option:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.06);
}

.exercise-option.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.1);
    box-shadow: var(--glow-accent);
}

.exercise-option-icon {
    font-size: 1.6em;
    margin-bottom: 4px;
}

.exercise-option-name {
    font-size: 0.72em;
    font-weight: 700;
}

/* Amount input */
.amount-keyboard-input {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 16px 0;
}

.amount-input-large {
    width: 130px;
    padding: 14px 16px;
    border: 2px solid var(--accent);
    border-radius: var(--radius-lg);
    font-size: 1.8em;
    font-weight: 800;
    text-align: center;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all 0.3s;
    outline: none;
}

.amount-input-large:focus {
    box-shadow: var(--glow-accent);
}

.amount-input-large::placeholder {
    color: var(--text-muted);
    font-size: 0.45em;
    font-weight: 400;
}

.amount-unit-large {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 50px;
}

.amount-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    margin: 16px 0;
}

.amount-btn {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    cursor: pointer;
    font-size: 1.3em;
    font-weight: 700;
    transition: all 0.2s;
    color: var(--text-primary);
}

.amount-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
}

.amount-btn.small { width: 34px; height: 34px; font-size: 1em; }

.amount-display {
    font-size: 2.2em;
    font-weight: 800;
    min-width: 90px;
    text-align: center;
}

.amount-unit {
    font-size: 0.88em;
    color: var(--text-secondary);
    text-align: center;
}

.quick-amounts {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.quick-amount-btn {
    padding: 7px 14px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.82em;
    transition: all 0.2s;
    color: var(--text-primary);
}

.quick-amount-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
}

/* Direct amount input */
.amount-direct-input {
    display: flex; align-items: center; gap: 8px;
    justify-content: center; margin: 15px 0; flex-wrap: wrap;
}
.amount-input-field {
    width: 100px; padding: 12px; border: 2px solid var(--accent);
    border-radius: var(--radius-md); font-size: 1.4em; font-weight: 700;
    text-align: center; background: var(--bg-input); color: var(--text-primary); outline: none;
}
.amount-input-field:focus { box-shadow: var(--glow-accent); }
.amount-direct-input .amount-unit { font-size: 1em; font-weight: 700; min-width: 50px; }

.amount-input-section {
    background: var(--bg-glass);
    padding: 15px;
    border-radius: var(--radius-lg);
    margin: 15px 0;
}

.amount-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    color: var(--text-secondary);
}

/* Custom exercise */
.custom-exercise-section {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.04) 0%, rgba(139, 92, 246, 0.04) 100%);
    padding: 15px;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--accent);
    margin: 15px 0;
}

.form-row { display: flex; gap: 10px; }
.form-row .form-group { margin-bottom: 10px; }

/* Exercise grid small */
.exercise-grid.small .exercise-option { padding: 8px; min-width: 70px; }
.exercise-grid.small .exercise-option-icon { font-size: 1.2em; }
.exercise-grid.small .exercise-option-name { font-size: 0.7em; }

/* Avatar picker */
.avatar-picker-section {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 5px;
}

.avatar-category { margin-bottom: 14px; }
.avatar-category-title {
    font-size: 0.82em; font-weight: 700; color: var(--text-muted);
    margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border-glass);
    text-transform: uppercase; letter-spacing: 0.05em;
}

.avatar-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.avatar-option {
    width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    font-size: 1.4em; border: 1px solid var(--border-glass); border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s var(--ease-out); background: var(--bg-glass);
}

.avatar-option:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.12);
    transform: scale(1.1);
    box-shadow: var(--glow-accent);
}

/* Color picker */
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.color-option {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s; border: 3px solid transparent;
}

.color-option:hover { transform: scale(1.1); box-shadow: var(--shadow-md); }

.color-option.selected {
    border-color: var(--text-primary);
    transform: scale(1.15);
    box-shadow: var(--shadow-lg);
}

/* Member selector */
.member-selector { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.member-option {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border: 1px solid var(--border-glass); border-radius: var(--radius-md);
    cursor: pointer; transition: all 0.2s; background: var(--bg-glass);
    color: var(--text-primary);
}

.member-option:hover { border-color: var(--accent); }

.member-option.selected {
    border-color: var(--accent);
    background: rgba(0, 255, 136, 0.08);
    box-shadow: var(--glow-accent);
}

.member-option-avatar {
    width: 38px; height: 38px; border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1em; color: white;
}

.member-option-name { font-weight: 700; }

/* ============================================
   FAB (Floating Action Button)
   ============================================ */
.fab {
    position: fixed;
    bottom: 28px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    background: var(--accent);
    border: none;
    color: #000;
    font-size: 2em;
    font-weight: 700;
    cursor: pointer;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-spring);
    box-shadow: var(--glow-accent-strong);
    animation: fabPulse 3s ease-in-out infinite;
}

@keyframes fabPulse {
    0%, 100% { box-shadow: var(--glow-accent-strong); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 136, 0.4), 0 0 100px rgba(0, 255, 136, 0.15); }
}

.fab:hover {
    transform: scale(1.12) rotate(90deg);
    box-shadow: 0 0 60px rgba(0, 255, 136, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 90%;
}

.toast {
    background: var(--bg-deep);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    padding: 14px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.4s var(--ease-spring);
    pointer-events: auto;
}

@keyframes toastSlide {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
}

.toast.success { border-left: 3px solid var(--accent); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
.toast-icon { font-size: 1.2em; }
.toast-message { font-weight: 600; font-size: 0.9em; }

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state-title {
    font-size: 1.15em;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ============================================
   LOADING
   ============================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 100dvh;
    min-height: 100vh; /* fallback */
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EDIT ACTIVITY
   ============================================ */
.activity-edit-btn {
    width: 34px; height: 34px; border-radius: var(--radius-full);
    border: 1px solid var(--border-glass); background: var(--bg-glass);
    cursor: pointer; font-size: 0.95em; display: flex; align-items: center;
    justify-content: center; transition: all 0.2s; margin-right: 6px;
    color: var(--text-primary);
}

.activity-edit-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.edit-activity-preview {
    display: flex; align-items: center; gap: 12px; padding: 16px;
    background: var(--bg-glass); border-radius: var(--radius-md); margin-bottom: 20px;
    border: 1px solid var(--border-glass);
}

.edit-activity-icon { font-size: 2.2em; }
.edit-activity-name { font-size: 1.1em; font-weight: 700; }

.edit-activity-points {
    padding: 12px; background: rgba(0, 255, 136, 0.06); border-radius: var(--radius-md);
    text-align: center; margin-top: 16px; font-size: 1em;
    border: 1px solid var(--border-accent);
}

.edit-activity-points strong { color: var(--accent); }

/* ============================================
   CHALLENGE PROGRESS
   ============================================ */
.challenge-manual-progress {
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid var(--border-glass);
}

.challenge-progress-btn {
    width: 100%; padding: 12px 16px;
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-pink));
    color: white; border: none; border-radius: var(--radius-md);
    font-weight: 700; font-size: 0.92em; cursor: pointer;
    transition: all 0.3s var(--ease-out);
}

.challenge-progress-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-violet);
}

.challenge-progress-preview {
    display: flex; align-items: center; gap: 12px; padding: 16px;
    background: var(--bg-glass); border-radius: var(--radius-md); margin-bottom: 20px;
    border: 1px solid var(--border-glass);
}

.challenge-progress-icon { font-size: 2.2em; }
.challenge-progress-title { font-size: 1.1em; font-weight: 700; }

.challenge-progress-stats { display: flex; gap: 12px; margin-bottom: 20px; }

.progress-stat {
    flex: 1; padding: 12px; background: var(--bg-glass);
    border-radius: var(--radius-md); text-align: center; border: 1px solid var(--border-glass);
}

.progress-stat-label { font-size: 0.78em; color: var(--text-muted); display: block; margin-bottom: 4px; }
.progress-stat-value { font-size: 1.2em; font-weight: 800; }
.progress-stat-value.highlight { color: var(--accent); }

/* ============================================
   CELEBRATION ANIMATIONS
   ============================================ */
.progress-animation-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    z-index: 3000; opacity: 0; visibility: hidden;
    transition: all 0.4s var(--ease-out);
}

.progress-animation-overlay.show { opacity: 1; visibility: visible; }

.progress-animation-content {
    text-align: center;
    transform: scale(0.5);
    transition: transform 0.5s var(--ease-spring);
}

.progress-animation-overlay.show .progress-animation-content {
    transform: scale(1);
}

.progress-animation-icon {
    font-size: 5em;
    animation: celebBounce 0.6s ease infinite;
}

.progress-animation-text {
    font-size: 3.5em;
    font-weight: 900;
    color: white;
    margin: 12px 0;
    text-shadow: var(--glow-accent-strong);
}

.progress-animation-subtext {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--accent);
}

.progress-animation-content.completed .progress-animation-icon {
    animation: trophySpin 1s ease infinite;
}

.progress-animation-content.completed .progress-animation-text {
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFD700);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientFlow 2s ease infinite;
}

.progress-animation-content.completed .progress-animation-subtext {
    color: #FFD700;
    font-size: 1.6em;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

@keyframes celebBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.05); }
}

@keyframes trophySpin {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(10deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(-10px) rotate(-10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Confetti canvas */
#confettiCanvas {
    position: fixed;
    inset: 0;
    z-index: 2999;
    pointer-events: none;
}

/* ============================================
   SCROLL REVEAL
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ============================================
   BADGE
   ============================================ */
.badge {
    background: var(--danger);
    color: white;
    font-size: 0.68em;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    margin-left: 4px;
    font-weight: 700;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 400px) {
    .exercise-grid { grid-template-columns: repeat(2, 1fr); }
    .family-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
}

@media only screen and (max-width: 640px) {
    .page-content { padding: 16px 12px; }
    .page-title { font-size: 1.25em; }
    .activity-card, .challenge-card { padding: 14px; }
    .nav-tab { font-size: 0.68em; padding: 10px 4px; }
    .nav-tab-icon { font-size: 1.3em; }

    .challenge-vs { gap: 8px; }

    .chat-bubble { max-width: 85%; }

    .leaderboard-podium {
        gap: 6px;
        padding: 16px 6px;
    }

    .podium-place { padding: 14px 10px; }

    .form-input, .chat-input, .validation-input {
        font-size: 16px; /* No zoom on iOS */
    }

    .amount-input-large { width: 110px; font-size: 1.5em; }
    .challenge-progress-stats { flex-direction: column; gap: 8px; }

    .progress-animation-icon { font-size: 4em; }
    .progress-animation-text { font-size: 2.5em; }
    .progress-animation-subtext { font-size: 1.1em; }
}

/* iOS Safari */
@supports (-webkit-touch-callout: none) {
    .app-container {
        padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    }
    .chat-container {
        height: calc(100dvh - 250px - env(safe-area-inset-bottom, 0px));
        height: calc(100vh - 250px - env(safe-area-inset-bottom, 0px)); /* fallback */
    }
    .fab {
        bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    }
    .header {
        padding-top: env(safe-area-inset-top, 0px);
    }
    .nav-tabs {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* Smooth scrolling */
.chat-messages {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Smooth touch scrolling for scrollable containers */
.modal-body,
.exercise-grid,
.badges-section,
.guided-list {
    -webkit-overflow-scrolling: touch;
}

button, .nav-tab, .header-btn, .challenge-btn, .reaction-btn {
    touch-action: manipulation;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   NEW FEATURES v3 — Badges, Charts, Comments, Timer, Goals
   ═══════════════════════════════════════════════════════════════════ */

/* === PROFILE SUB-TABS === */
.profile-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--border-glass);
}

.profile-tab {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-tab.active {
    background: var(--accent-secondary);
    color: white;
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.profile-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* === STREAK BANNER === */
.streak-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15), rgba(255, 71, 87, 0.1));
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.streak-flame {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--accent-orange);
}

.streak-multiplier {
    padding: 3px 10px;
    background: var(--accent-orange);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.78em;
    font-weight: 700;
}

.streak-next, .streak-max {
    font-size: 0.82em;
    color: var(--text-secondary);
    margin-left: auto;
}

.streak-bonus-badge {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 8px;
    background: rgba(255, 107, 53, 0.2);
    color: var(--accent-orange);
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 107, 53, 0.3);
    margin-left: 6px;
    vertical-align: middle;
}

/* === WEEKLY GOAL CARD === */
.weekly-goal-card {
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.weekly-goal-card.completed {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}

.weekly-goal-empty {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.88em;
}

.weekly-goal-set-btn {
    margin-left: auto;
    padding: 6px 14px;
    background: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.82em;
    cursor: pointer;
    font-weight: 600;
}

.weekly-goal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.weekly-goal-title {
    font-weight: 600;
    font-size: 0.88em;
    color: var(--text-primary);
}

.weekly-goal-badge {
    margin-left: auto;
    font-size: 0.82em;
    color: var(--accent);
    font-weight: 700;
}

.weekly-goal-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.weekly-goal-fill {
    height: 100%;
    background: var(--accent-secondary);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

.weekly-goal-fill.done {
    background: var(--accent);
}

.weekly-goal-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.78em;
    color: var(--text-muted);
}

.goal-complete-text {
    color: var(--accent);
    font-weight: 700;
}

/* === QUICK ADD BAR === */
.quick-add-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    overflow-x: auto;
}

.quick-add-label {
    font-size: 0.82em;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 600;
}

.quick-add-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.quick-add-btn:hover {
    background: var(--bg-card-hover);
    transform: scale(1.08);
}

.quick-add-btn.roulette {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border-color: rgba(139, 92, 246, 0.3);
}

/* === MINI CHART (7 days bar chart) === */
.mini-chart {
    padding: 16px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.mini-chart-title {
    font-weight: 700;
    font-size: 0.88em;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.mini-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
}

.mini-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.mini-chart-value {
    font-size: 0.68em;
    color: var(--text-muted);
    margin-bottom: 4px;
    height: 14px;
    font-weight: 600;
}

.mini-chart-bar-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.mini-chart-bar {
    width: 100%;
    background: var(--accent-secondary);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.5s ease;
}

.mini-chart-bar.today {
    background: var(--accent);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.mini-chart-bar.empty {
    background: var(--bg-secondary);
}

.mini-chart-label {
    font-size: 0.72em;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}

.mini-chart-label.today {
    color: var(--accent);
    font-weight: 700;
}

/* === ACTIVITY HEATMAP === */
.heatmap {
    padding: 16px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.heatmap-title {
    font-weight: 700;
    font-size: 0.88em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-width: 0;
}

.heatmap-cell.level-0 { background: var(--bg-secondary); }
.heatmap-cell.level-1 { background: rgba(0, 255, 136, 0.2); }
.heatmap-cell.level-2 { background: rgba(0, 255, 136, 0.45); }
.heatmap-cell.level-3 { background: var(--accent); box-shadow: 0 0 6px rgba(0, 255, 136, 0.3); }

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.72em;
    color: var(--text-muted);
}

.heatmap-legend .heatmap-cell {
    width: 12px;
    height: 12px;
}

/* === PERSONAL RECORDS === */
.records-section {
    margin-bottom: 16px;
}

.records-title {
    font-weight: 700;
    font-size: 0.95em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.records-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.record-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.record-icon {
    font-size: 1.6em;
    flex-shrink: 0;
}

.record-info {
    min-width: 0;
}

.record-name {
    font-weight: 600;
    font-size: 0.82em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-best {
    font-size: 0.88em;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.record-total {
    font-size: 0.72em;
    color: var(--text-muted);
    margin-top: 2px;
}

/* === BADGES === */
.badges-section {
    margin-bottom: 16px;
}

.badges-summary {
    text-align: center;
    padding: 20px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-sm);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.badges-count {
    font-size: 2.5em;
    font-weight: 900;
    color: var(--accent);
    line-height: 1;
}

.badges-total {
    font-size: 0.88em;
    color: var(--text-muted);
    margin-top: 4px;
}

.badges-progress-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    margin-top: 12px;
    overflow: hidden;
}

.badges-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent));
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
}

.badge-category {
    margin-bottom: 16px;
}

.badge-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 0.88em;
    color: var(--text-primary);
}

.badge-category-count {
    font-size: 0.82em;
    color: var(--text-muted);
    font-weight: 500;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.badge-item.unlocked {
    border-color: rgba(0, 255, 136, 0.3);
    background: rgba(0, 255, 136, 0.05);
}

.badge-item.unlocked:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.15);
}

.badge-item.locked {
    opacity: 0.4;
}

.badge-item.locked:hover {
    opacity: 0.6;
}

.badge-icon {
    font-size: 1.6em;
}

.badge-name {
    font-size: 0.68em;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 600;
    line-height: 1.2;
}

.badge-item.unlocked .badge-name {
    color: var(--text-primary);
}

/* === BADGE UNLOCK ANIMATION === */
.badge-unlock-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.badge-unlock-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.badge-unlock-content {
    text-align: center;
    animation: badgeUnlockPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-unlock-icon {
    font-size: 4em;
    animation: badgeBounce 0.6s ease 0.3s;
}

.badge-unlock-title {
    font-size: 1.5em;
    font-weight: 800;
    color: var(--accent);
    margin-top: 12px;
}

.badge-unlock-desc {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 0.95em;
}

@keyframes badgeUnlockPop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

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

/* === COMMENTS === */
.activity-comments {
    padding: 8px 0 0 0;
    border-top: 1px solid var(--border-glass);
    margin-top: 8px;
}

.activity-comment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.82em;
}

.comment-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em;
    flex-shrink: 0;
}

.comment-author {
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.comment-more {
    font-size: 0.78em;
    color: var(--text-muted);
    padding: 4px 0;
}

.comment-input-container {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-glass);
}

.comment-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85em;
    outline: none;
}

.comment-input:focus {
    border-color: var(--accent-secondary);
}

.comment-send {
    padding: 8px 12px;
    background: var(--accent-secondary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9em;
}

.comment-btn {
    border-color: rgba(139, 92, 246, 0.3) !important;
}

/* === TIMER MODAL === */
.timer-display {
    text-align: center;
    padding: 30px 0;
}

.timer-time {
    font-size: 4em;
    font-weight: 900;
    font-family: 'Inter', monospace;
    color: var(--accent);
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.timer-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.timer-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timer-btn.start {
    background: var(--accent);
    color: #0a0a0f;
}

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

.timer-btn.reset {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.timer-btn:hover {
    transform: scale(1.05);
}

/* === FUN FACT === */
.fun-fact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(6, 182, 212, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    font-size: 0.88em;
    color: var(--text-secondary);
}

.fun-fact-icon {
    font-size: 1.3em;
}

/* === WEEKLY GOAL MODAL === */
.goal-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.goal-type-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-glass);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.88em;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.goal-type-btn.selected {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
    background: rgba(139, 92, 246, 0.1);
}

.goal-suggestions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.goal-suggestion {
    padding: 6px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.goal-suggestion:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* === RESPONSIVE FIXES FOR NEW FEATURES === */
@media (max-width: 400px) {
    .badge-grid { grid-template-columns: repeat(3, 1fr); }
    .records-grid { grid-template-columns: 1fr; }
    .timer-time { font-size: 3em; }
    .mini-chart-bars { height: 90px; }
    .streak-banner { flex-wrap: wrap; gap: 6px; }
}

/* === LIGHT THEME OVERRIDES FOR NEW FEATURES === */
[data-theme="light"] .streak-banner {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.08), rgba(255, 71, 87, 0.05));
}

[data-theme="light"] .badge-item.unlocked {
    background: rgba(0, 200, 100, 0.05);
}

[data-theme="light"] .heatmap-cell.level-1 { background: rgba(0, 200, 100, 0.15); }
[data-theme="light"] .heatmap-cell.level-2 { background: rgba(0, 200, 100, 0.35); }
[data-theme="light"] .heatmap-cell.level-3 { background: rgba(0, 200, 100, 0.6); }

[data-theme="light"] .mini-chart-bar {
    background: var(--accent-secondary);
}

[data-theme="light"] .mini-chart-bar.today {
    background: #10B981;
}

[data-theme="light"] .fun-fact {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(6, 182, 212, 0.04));
}

[data-theme="light"] .timer-time {
    color: var(--accent-secondary);
    text-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════
   v4: NEW FEATURE STYLES
   ═══════════════════════════════════════════════════════════════════ */

/* 🐾 FAMILY PET */
.pet-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}
.pet-display {
    position: relative;
    flex-shrink: 0;
}
.pet-icon {
    font-size: 3.5rem;
    text-align: center;
}
.pet-bounce {
    animation: petBounce 2s ease-in-out infinite;
}
@keyframes petBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.pet-mood {
    position: absolute;
    top: -4px;
    right: -8px;
    font-size: 1.2rem;
}
.pet-info { flex: 1; min-width: 0; }
.pet-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}
.pet-stage-label {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--primary);
    background: rgba(99,102,241,0.15);
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: 6px;
}
.pet-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.pet-happiness-bar {
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}
.pet-happiness-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.pet-stats {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 🗺️ ADVENTURE MAP */
.adventure-map {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}
.adventure-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.adventure-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.adventure-km {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}
.adventure-track {
    position: relative;
    height: 50px;
    background: rgba(255,255,255,0.05);
    border-radius: 25px;
    margin: 0 10px;
    overflow: visible;
}
.adventure-progress-line {
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #00FF88, #8B5CF6);
    border-radius: 2px;
    transform: translateY(-50%);
    transition: width 0.5s ease;
}
.adventure-waypoint {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 2;
    text-align: center;
}
.waypoint-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border-color);
    border: 2px solid var(--card-bg);
    margin: 0 auto;
    transition: all 0.3s;
}
.adventure-waypoint.reached .waypoint-dot {
    background: #00FF88;
    box-shadow: 0 0 8px rgba(0,255,136,0.5);
}
.adventure-waypoint.next .waypoint-dot {
    background: #8B5CF6;
    animation: pulse 1.5s infinite;
}
.waypoint-label {
    font-size: 0.9rem;
    margin-top: 2px;
    opacity: 0.6;
}
.adventure-waypoint.reached .waypoint-label { opacity: 1; }
.adventure-runner {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    z-index: 3;
    transition: left 0.5s ease;
    filter: drop-shadow(0 0 4px rgba(0,255,136,0.5));
}
.adventure-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* 🎯 BINGO */
.bingo-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}
.bingo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.bingo-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.bingo-score {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 600;
}
.bingo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.bingo-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 8px;
}
.bingo-cell:hover:not(.done) {
    border-color: var(--primary);
    background: rgba(99,102,241,0.1);
}
.bingo-cell.done {
    background: rgba(0,255,136,0.1);
    border-color: #00FF88;
}
.bingo-cell-icon { font-size: 1.5rem; }
.bingo-cell-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
    line-height: 1.1;
}
.bingo-cell.done .bingo-cell-name { color: #00FF88; }
.bingo-complete {
    text-align: center;
    padding: 12px;
    margin-top: 12px;
    background: linear-gradient(135deg, rgba(0,255,136,0.2), rgba(139,92,246,0.2));
    border-radius: 12px;
    font-weight: 700;
    color: #00FF88;
    animation: glow 1.5s ease-in-out infinite;
}
@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0,255,136,0.3); }
    50% { box-shadow: 0 0 20px rgba(0,255,136,0.5); }
}

/* 🏋️ GUIDED WORKOUTS */
.guided-section { margin-bottom: 16px; }
.guided-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.guided-list { display: flex; flex-direction: column; gap: 10px; }
.guided-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.guided-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}
.guided-card-icon { font-size: 2rem; flex-shrink: 0; }
.guided-card-info { flex: 1; min-width: 0; }
.guided-card-name {
    font-weight: 700;
    color: var(--text-primary);
}
.guided-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.guided-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.guided-card-arrow {
    color: var(--primary);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Guided workout active step */
.guided-active-step {
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}
.guided-step-exercise {
    font-size: 3rem;
    margin-bottom: 8px;
}
.guided-step-name {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-primary);
}
.guided-step-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin: 8px 0;
}
.guided-step-rest {
    font-size: 1.5rem;
    color: var(--text-muted);
}
.guided-step-progress {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* 🤝 COMBO */
.combo-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 2px solid;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.combo-icon { font-size: 1.3rem; }
.combo-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
}
.combo-mult {
    font-weight: 800;
    font-size: 1.1rem;
}

/* 🛡️ STREAK SHIELD */
.shield-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 10px;
}
.shield-icon { font-size: 1.3rem; }
.shield-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.shield-btn {
    background: linear-gradient(135deg, #8B5CF6, #6366f1);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

/* 🎁 DAILY BONUS */
.daily-bonus-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(255,215,0,0.1), rgba(255,184,0,0.05));
    border: 1px solid rgba(255,215,0,0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 12px;
}
.daily-bonus-icon {
    font-size: 1.5rem;
    animation: petBounce 1.5s ease-in-out infinite;
}
.daily-bonus-text {
    font-weight: 700;
    color: #FFD700;
    font-size: 0.9rem;
}
.daily-bonus-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 🎄 SEASONAL */
.seasonal-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 2px solid;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 14px;
}
.seasonal-icon { font-size: 2rem; }
.seasonal-info { flex: 1; }
.seasonal-name {
    font-weight: 800;
    font-size: 1rem;
}
.seasonal-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.seasonal-bonus {
    color: white;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 8px;
}

/* 👪 FAMILY TITLE */
.family-title-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border: 2px solid;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}
.family-title-icon { font-size: 2.5rem; }
.family-title-info { flex: 1; }
.family-title-name {
    font-weight: 800;
    font-size: 1.2rem;
}
.family-title-points {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.family-title-next, .family-title-max {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* 🎁 REWARDS SHOP */
.rewards-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}
.rewards-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.rewards-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}
.rewards-balance {
    font-weight: 700;
    color: var(--primary);
}
.rewards-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
    font-size: 0.9rem;
}
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.reward-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    transition: all 0.2s;
}
.reward-card.affordable {
    border-color: rgba(0,255,136,0.3);
}
.reward-card.affordable:hover {
    border-color: #00FF88;
    background: rgba(0,255,136,0.05);
}
.reward-icon { font-size: 2rem; margin-bottom: 6px; }
.reward-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.reward-cost {
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 4px;
    font-weight: 700;
}
.reward-claim-btn {
    margin-top: 8px;
    background: linear-gradient(135deg, #00FF88, #00CC6A);
    color: #0a0a0f;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    width: 100%;
}
.reward-claim-btn:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
}
.reward-add-btn {
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.reward-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Guided workout modal step */
.guided-modal-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
}
.guided-modal-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
}
.guided-modal-step.active-step {
    border-color: var(--primary);
    background: rgba(99,102,241,0.1);
}
.guided-modal-step-icon { font-size: 1.3rem; }
.guided-modal-step-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}
.guided-modal-step-amount {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.9rem;
}

/* Create reward modal */
.reward-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.reward-suggestion {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
}
.reward-suggestion:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES for v4
   ═══════════════════════════════════════════════════════ */
[data-theme="light"] .pet-happiness-bar { background: rgba(0,0,0,0.08); }
[data-theme="light"] .adventure-track { background: rgba(0,0,0,0.05); }
[data-theme="light"] .bingo-cell { background: rgba(0,0,0,0.03); }
[data-theme="light"] .guided-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
[data-theme="light"] .reward-card { background: rgba(0,0,0,0.02); }
[data-theme="light"] .daily-bonus-text { color: #B8860B; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE v4
   ═══════════════════════════════════════════════════════ */
@media (max-width: 400px) {
    .rewards-grid { grid-template-columns: 1fr; }
    .adventure-track { height: 40px; }
    .waypoint-label { font-size: 0.7rem; }
    .pet-card { flex-direction: column; text-align: center; }
    .bingo-cell-name { font-size: 0.6rem; }
}

/* ═══════════════════════════════════════════════════════
   TABLET (768px - 1023px)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .app-container {
        max-width: 100%;
    }

    .page-content {
        padding: 24px 32px;
    }

    .page-title {
        font-size: 1.6em;
    }

    /* Family grid — 3 columns */
    .family-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }

    /* Profile stats — bigger */
    .profile-stats {
        gap: 16px;
    }

    .stat-card {
        padding: 20px 16px;
    }

    .stat-value {
        font-size: 1.8em;
    }

    /* Challenges grid — 2 cols */
    .challenges-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .challenge-card {
        margin-bottom: 0;
    }

    /* Activity cards — bigger */
    .activity-card {
        padding: 20px;
    }

    /* Leaderboard wider */
    .leaderboard-podium {
        gap: 16px;
        padding: 28px 20px;
    }

    .podium-place {
        max-width: 180px;
        padding: 24px 18px;
    }

    /* Titles list — 2 columns */
    .titles-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Chat wider */
    .chat-container {
        max-height: 700px;
    }

    .chat-bubble {
        max-width: 65%;
    }

    /* Badges bigger grid */
    .badge-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    /* Modal wider */
    .modal {
        max-width: 520px;
    }

    /* Desktop grid — 2 columns */
    .desktop-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    /* Admin sections — items span correctly */
    .admin-section {
        padding: 24px;
    }

    /* Exercise grid in modal — 4 cols */
    .exercise-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Quick add bar scrollable → flex wrap */
    .quick-add-bar {
        flex-wrap: wrap;
    }
}

/* ═══════════════════════════════════════════════════════
   DESKTOP (>= 1024px)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    /* === LAYOUT: Sidebar + Main === */
    .app-container {
        max-width: 1440px;
        padding-bottom: 40px;
    }

    .app-body {
        flex-direction: row;
        min-height: calc(100vh - 71px);
    }

    /* === SIDEBAR NAV === */
    .nav-tabs {
        flex-direction: column;
        width: 240px;
        min-width: 240px;
        position: sticky;
        top: 71px;
        height: calc(100vh - 71px);
        overflow-y: auto;
        overflow-x: hidden;
        border-bottom: none;
        border-right: 1px solid var(--border-glass);
        padding: 16px 0;
        gap: 2px;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Show brand in sidebar */
    .nav-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 20px 20px;
        margin-bottom: 8px;
        border-bottom: 1px solid var(--border-glass);
    }

    .nav-brand-icon {
        font-size: 1.6em;
    }

    .nav-brand-text {
        font-size: 1.1em;
        font-weight: 800;
        background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    /* Nav tabs — horizontal row items */
    .nav-tab {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 12px 20px;
        font-size: 0.9em;
        gap: 12px;
        border-radius: var(--radius-md);
        margin: 0 8px;
        min-width: unset;
    }

    .nav-tab-icon {
        font-size: 1.2em;
    }

    .nav-tab.active {
        background: rgba(0, 255, 136, 0.08);
    }

    .nav-tab.active::after {
        /* Move indicator from bottom to left */
        left: 0;
        right: auto;
        top: 25%;
        bottom: 25%;
        width: 3px;
        height: auto;
        border-radius: 0 3px 3px 0;
    }

    .nav-tab:hover {
        background: var(--bg-card-hover);
    }

    /* Admin nav tab styling */
    .nav-tab-admin {
        margin-top: auto;
        border-top: 1px solid var(--border-glass);
        padding-top: 16px;
    }

    /* === MAIN CONTENT === */
    .app-main {
        flex: 1;
        min-width: 0;
    }

    .page-content {
        padding: 32px 40px;
        max-width: 1200px;
    }

    .page-title {
        font-size: 1.8em;
        margin-bottom: 28px;
    }

    /* === HEADER — full width === */
    .app-header {
        padding: 14px 32px;
    }

    /* === DESKTOP LAYOUT — 2 columns === */
    .desktop-layout {
        display: grid;
        grid-template-columns: 1fr 360px;
        gap: 28px;
        align-items: start;
    }

    .desktop-sidebar {
        position: sticky;
        top: 100px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .desktop-sidebar > * {
        margin-bottom: 0 !important;
    }

    /* === DESKTOP GRID 2-col === */
    .desktop-grid-2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .desktop-grid-2 > * {
        margin-bottom: 0 !important;
    }

    /* === FAMILY GRID — 4 columns === */
    .family-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .family-card {
        padding: 24px 20px;
    }

    .family-avatar {
        width: 72px;
        height: 72px;
        font-size: 2em;
    }

    /* === CHALLENGES — 2 columns === */
    .challenges-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .challenge-card {
        margin-bottom: 0;
    }

    /* === LEADERBOARD — wider podium === */
    .leaderboard-podium {
        gap: 24px;
        padding: 32px;
    }

    .podium-place {
        max-width: 200px;
        padding: 28px 20px;
    }

    .podium-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.7em;
    }

    /* Leaderboard list — wider */
    .leaderboard-item {
        padding: 16px 24px;
    }

    /* Titles — 2 columns */
    .titles-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* === PROFILE — bigger === */
    .profile-header {
        padding: 28px;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 2.5em;
    }

    .profile-info h2 {
        font-size: 1.3em;
    }

    .profile-stats {
        gap: 20px;
    }

    .stat-card {
        padding: 24px 20px;
    }

    .stat-value {
        font-size: 2em;
    }

    /* === CHAT — centered === */
    .chat-container {
        max-width: 800px;
        max-height: 750px;
    }

    .chat-bubble {
        max-width: 55%;
    }

    /* === ACTIVITY CARDS — wider === */
    .activity-card {
        padding: 22px;
    }

    .activity-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.4em;
    }

    /* === ADMIN — grid === */

    /* === BADGE GRID — 6 columns === */
    .badge-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    /* === RECORDS GRID — 3 columns === */
    .records-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* === MODAL — wider === */
    .modal {
        max-width: 560px;
    }

    /* === FAB — reposition === */
    .fab {
        bottom: 40px;
        right: 40px;
        width: 64px;
        height: 64px;
    }

    /* === EXERCISE GRID — 5 cols === */
    .exercise-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    /* === LOGIN — bigger card === */
    .login-card {
        max-width: 440px;
        padding: 48px 40px;
    }

    /* === BINGO GRID — bigger cells === */
    .bingo-cell {
        padding: 14px 8px;
    }

    /* === REWARDS GRID — 3 cols === */
    .rewards-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* === GUIDED WORKOUT — 2 cols === */
    .guided-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .guided-card {
        margin-bottom: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   WIDE DESKTOP (>= 1440px)
   ═══════════════════════════════════════════════════════ */
@media (min-width: 1440px) {
    .app-container {
        max-width: 1600px;
    }

    .nav-tabs {
        width: 280px;
        min-width: 280px;
    }

    .nav-tab {
        padding: 14px 24px;
        font-size: 0.95em;
    }

    .page-content {
        padding: 40px 56px;
    }

    .desktop-layout {
        grid-template-columns: 1fr 400px;
        gap: 36px;
    }

    .family-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .badge-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}
