        :root {
            --bg-primary: #0a0e27;
            --bg-secondary: #151b3d;
            --bg-card: #1a2147;
            --accent-primary: #00ff88;
            --accent-secondary: #00d4ff;
            --accent-tertiary: #ff00ff;
            --accent-sleep: #9d4edd;
            --accent-water: #4cc9f0;
            --accent-bad: #ff3366;
            --text-primary: #ffffff;
            --text-secondary: #a0a8cc;
            --text-muted: #6b7199;
            --border-color: #2a3358;
            --success: #00ff88;
            --warning: #ffaa00;
            --danger: #ff3366;
            --shadow-glow: 0 0 20px rgba(0, 255, 136, 0.3);
        }

        /* Neon Retro Theme */
        body.theme-neon {
            --bg-primary: #0a0015;
            --bg-secondary: #1a0033;
            --bg-card: #2a0050;
            --accent-primary: #ff006e;
            --accent-secondary: #00f0ff;
            --accent-tertiary: #8b00ff;
            --accent-sleep: #8b00ff;
            --accent-water: #00f0ff;
            --accent-bad: #ff006e;
            --text-primary: #ffffff;
            --text-secondary: #b8b8ff;
            --text-muted: #6b5b95;
            --border-color: #8b00ff;
            --success: #00f0ff;
            --warning: #ffea00;
            --danger: #ff006e;
            --shadow-glow: 0 0 30px rgba(255, 0, 110, 0.5);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: 'Fredoka', sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            overflow-x: hidden;
            min-height: 100vh;
            position: relative;
        }

        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }

        .app-container {
            position: relative;
            z-index: 1;
            max-width: 100vw;
            min-height: 100vh;
            padding-bottom: 80px;
        }

        /* Header */
        .header {
            background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
            padding: 20px;
            border-bottom: 2px solid var(--accent-primary);
            box-shadow: 0 4px 20px rgba(0, 255, 136, 0.2);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .logo {
            font-size: 28px;
            font-weight: 700;
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            text-align: center;
            letter-spacing: -0.5px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .version-badge {
            font-size: 10px;
            font-weight: 600;
            background: rgba(0, 255, 136, 0.2);
            color: var(--accent-primary);
            padding: 2px 6px;
            border-radius: 4px;
            border: 1px solid var(--accent-primary);
            letter-spacing: 0.5px;
            font-family: 'JetBrains Mono', monospace;
        }

        .user-greeting {
            text-align: center;
            margin-top: 8px;
            font-size: 14px;
            color: var(--text-secondary);
        }

        .date-selector {
            margin-top: 12px;
            text-align: center;
        }

        .date-selector input[type="date"] {
            background: var(--bg-card);
            border: 2px solid var(--accent-primary);
            border-radius: 8px;
            color: var(--text-primary);
            padding: 8px 16px;
            font-family: 'Fredoka', sans-serif;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
        }

        .date-selector input[type="date"]::-webkit-calendar-picker-indicator {
            filter: invert(1);
            cursor: pointer;
        }

        /* Registration Screen */
        .registration-screen {
            padding: 30px 20px;
            max-width: 400px;
            margin: 0 auto;
        }

        .registration-screen h2 {
            font-size: 24px;
            margin-bottom: 10px;
            color: var(--accent-primary);
            text-align: center;
        }

        .registration-screen p {
            text-align: center;
            color: var(--text-secondary);
            margin-bottom: 30px;
            font-size: 14px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-size: 14px;
            font-weight: 600;
            color: var(--text-secondary);
        }

        .form-group input, .form-group select, .form-group textarea {
            width: 100%;
            padding: 14px 16px;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            color: var(--text-primary);
            font-family: 'Fredoka', sans-serif;
            font-size: 16px;
            transition: all 0.3s ease;
        }

        .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: var(--shadow-glow);
        }

        .btn {
            width: 100%;
            padding: 16px;
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
            border: none;
            border-radius: 12px;
            color: var(--bg-primary);
            font-family: 'Fredoka', sans-serif;
            font-size: 16px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
        }

        .btn:active {
            transform: scale(0.98);
        }

        .btn-secondary {
            background: var(--bg-card);
            color: var(--text-primary);
            border: 2px solid var(--border-color);
            box-shadow: none;
        }

        .btn-danger {
            background: var(--danger);
            box-shadow: 0 4px 15px rgba(255, 51, 102, 0.4);
        }

        /* Main Content */
        .main-content {
            padding: 20px;
            padding-bottom: 100px;
        }

        /* Stats Cards */
        .stats-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
            margin-bottom: 20px;
        }

        .stat-card {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 16px;
            text-align: center;
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
        }

        .stat-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 2px;
            background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
            animation: shimmer 2s infinite;
        }

        .stat-card.sleep::before {
            background: linear-gradient(90deg, transparent, var(--accent-sleep), transparent);
        }

        .stat-card.water::before {
            background: linear-gradient(90deg, transparent, var(--accent-water), transparent);
        }

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

        /* Streak Card - Compact Horizontal Layout */
        .streak-card {
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 12px;
            padding: 12px 16px;
            color: white;
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
            position: relative;
            overflow: hidden;
        }

        .streak-card::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 3s ease-in-out infinite;
        }

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

        .streak-content {
            display: flex;
            align-items: center;
            gap: 20px;
            position: relative;
            z-index: 1;
        }

        .streak-left {
            display: flex;
            align-items: center;
            gap: 12px;
            flex-shrink: 0;
        }

        .streak-flames {
            font-size: 32px;
            animation: flicker 2s infinite;
            line-height: 1;
        }

        @keyframes flicker {
            0%, 100% { opacity: 1; transform: scale(1); }
            25% { opacity: 0.9; transform: scale(1.05); }
            50% { opacity: 0.95; transform: scale(1.1); }
            75% { opacity: 0.9; transform: scale(1.05); }
        }

        .streak-days {
            display: flex;
            align-items: baseline;
            gap: 6px;
        }

        .streak-number {
            font-size: 36px;
            font-weight: 900;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            line-height: 1;
        }

        .streak-label {
            font-size: 12px;
            font-weight: 600;
            letter-spacing: 1px;
            opacity: 0.9;
        }

        .streak-right {
            flex: 1;
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .streak-message {
            font-size: 13px;
            opacity: 0.95;
            flex-shrink: 0;
            min-width: 140px;
        }

        .streak-progress {
            flex: 1;
            min-width: 120px;
        }

        .progress-bar {
            width: 100%;
            height: 6px;
            background: rgba(255, 255, 255, 0.3);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: 4px;
            box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #fff 0%, #ffe66d 100%);
            border-radius: 3px;
            transition: width 0.5s ease;
            box-shadow: 0 0 6px rgba(255,255,255,0.5);
        }

        .progress-text {
            font-size: 10px;
            opacity: 0.85;
        }

        .streak-stats {
            display: flex;
            gap: 8px;
            flex-shrink: 0;
        }

        .streak-stat-box {
            background: rgba(255, 255, 255, 0.2);
            padding: 6px 10px;
            border-radius: 6px;
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .streak-stat-value {
            font-size: 14px;
            font-weight: 700;
        }

        .streak-stat-label {
            font-size: 10px;
            opacity: 0.85;
        }

        /* Mobile responsive */
        @media (max-width: 768px) {
            .streak-content {
                flex-direction: column;
                gap: 12px;
            }

            .streak-left {
                width: 100%;
                justify-content: center;
            }

            .streak-right {
                width: 100%;
                flex-direction: column;
                gap: 10px;
            }

            .streak-message {
                text-align: center;
                min-width: auto;
            }

            .streak-stats {
                justify-content: center;
            }
        }

        /* Streak milestone celebration */
        .streak-milestone-popup {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
            color: white;
            padding: 40px;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.5);
            z-index: 10001;
            text-align: center;
            transition: all 0.3s ease;
        }

        .streak-milestone-popup.active {
            transform: translate(-50%, -50%) scale(1);
        }

        .streak-milestone-popup h2 {
            font-size: 48px;
            margin: 0 0 20px 0;
        }

        .streak-milestone-popup p {
            font-size: 24px;
            margin: 10px 0;
        }

        /* Confetti animation */
        .confetti {
            position: fixed;
            width: 10px;
            height: 10px;
            background: #ffd700;
            position: absolute;
            animation: confetti-fall 3s ease-out forwards;
            z-index: 10000;
        }

        @keyframes confetti-fall {
            to {
                transform: translateY(100vh) rotate(360deg);
                opacity: 0;
            }
        }

        /* Social Card (for messages and activity feed) */
        .social-card {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 14px;
            transition: all 0.3s ease;
        }

        .social-card:hover {
            border-color: var(--accent-primary);
            box-shadow: 0 4px 12px rgba(0, 255, 136, 0.15);
        }

        .stat-label {
            font-size: 12px;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 6px;
        }

        .stat-value {
            font-size: 24px;
            font-weight: 700;
            color: var(--accent-primary);
            font-family: 'JetBrains Mono', monospace;
        }

        .stat-value.sleep { color: var(--accent-sleep); }
        .stat-value.water { color: var(--accent-water); }

        .stat-sub {
            font-size: 11px;
            color: var(--text-secondary);
            margin-top: 4px;
        }

        /* Weight Display */
        .weight-display {
            background: linear-gradient(135deg, var(--bg-card), var(--bg-secondary));
            border: 2px solid var(--accent-primary);
            border-radius: 20px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: var(--shadow-glow);
        }

        .weight-main {
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-bottom: 16px;
        }

        .weight-item {
            text-align: center;
        }

        .weight-item-label {
            font-size: 11px;
            color: var(--text-muted);
            text-transform: uppercase;
            margin-bottom: 4px;
        }

        .weight-item-value {
            font-size: 20px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
        }

        .current-weight { color: var(--accent-secondary); }
        .weight-lost { color: var(--success); }
        .starting-weight { color: var(--text-secondary); }
        .target-weight { color: var(--accent-tertiary); }

        /* Target Progress Bar */
        .target-progress {
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid var(--border-color);
        }

        .target-progress-label {
            font-size: 12px;
            color: var(--text-secondary);
            margin-bottom: 8px;
            text-align: center;
        }

        .progress-bar {
            height: 8px;
            background: var(--bg-secondary);
            border-radius: 4px;
            overflow: hidden;
            position: relative;
        }

        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-primary), var(--accent-tertiary));
            border-radius: 4px;
            transition: width 0.5s ease;
        }

        /* Chart Container */
        .chart-container {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 20px;
            margin-bottom: 20px;
        }

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

        .chart-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .chart-tabs {
            display: flex;
            gap: 6px;
        }

        .chart-tab {
            padding: 6px 12px;
            background: transparent;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-secondary);
            font-size: 12px;
            font-family: 'Fredoka', sans-serif;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .chart-tab.active {
            background: var(--accent-primary);
            color: var(--bg-primary);
            border-color: var(--accent-primary);
        }

        #progressChart {
            width: 100%;
            height: 280px;
            background: var(--bg-secondary);
            border-radius: 12px;
            padding: 10px;
        }

        /* Action Buttons */
        .action-section {
            margin-bottom: 20px;
        }

        .action-section h3 {
            font-size: 14px;
            color: var(--text-muted);
            text-transform: uppercase;
            margin-bottom: 12px;
            letter-spacing: 0.5px;
        }

        .action-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .action-grid.three-col {
            grid-template-columns: 1fr 1fr 1fr;
        }

        .action-btn {
            background: var(--bg-card);
            border: 2px solid var(--accent-primary);
            border-radius: 16px;
            padding: 20px 16px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
        }

        .action-btn.sleep {
            border-color: var(--accent-sleep);
        }

        .action-btn.water {
            border-color: var(--accent-water);
        }

        .action-btn.bad {
            border-color: var(--accent-bad);
        }

        .action-btn:active {
            transform: scale(0.95);
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
        }

        .action-btn-icon {
            font-size: 32px;
            margin-bottom: 8px;
        }

        .action-btn-label {
            font-size: 14px;
            font-weight: 600;
            color: var(--text-primary);
        }

        /* Water Quick Buttons */
        .water-quick-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 8px;
            margin-top: 16px;
        }

        .water-quick-btn {
            padding: 12px;
            background: var(--bg-secondary);
            border: 2px solid var(--accent-water);
            border-radius: 12px;
            color: var(--accent-water);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .water-quick-btn:active {
            background: var(--accent-water);
            color: var(--bg-primary);
        }

        /* Leaderboard */
        .leaderboard-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 16px;
            overflow-x: auto;
            padding-bottom: 8px;
        }

        .leaderboard-tab {
            padding: 10px 16px;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            color: var(--text-secondary);
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.3s ease;
        }

        .leaderboard-tab.active {
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
            color: var(--bg-primary);
            border: 2px solid var(--accent-primary);
        }

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

        .leaderboard-item {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 12px;
            transition: all 0.3s ease;
        }

        .leaderboard-item.current-user {
            border-color: var(--accent-primary);
            box-shadow: var(--shadow-glow);
        }

        .leaderboard-rank {
            font-size: 24px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            width: 40px;
            text-align: center;
        }

        .rank-1 { color: #ffd700; }
        .rank-2 { color: #c0c0c0; }
        .rank-3 { color: #cd7f32; }

        .leaderboard-info {
            flex: 1;
        }

        .leaderboard-name {
            font-size: 15px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .leaderboard-stat {
            font-size: 12px;
            color: var(--text-secondary);
            margin-top: 2px;
        }

        .leaderboard-value {
            font-size: 18px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            color: var(--accent-secondary);
        }

        /* 1v1 Comparison Modal */
        .comparison-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.85);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
            padding: 20px;
        }

        .comparison-modal.active {
            display: flex;
        }

        .comparison-content {
            background: var(--bg-card);
            border: 2px solid var(--accent-primary);
            border-radius: 16px;
            max-width: 600px;
            width: 100%;
            max-height: 90vh;
            overflow-y: auto;
            padding: 24px;
        }

        .comparison-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .comparison-header h3 {
            color: var(--accent-primary);
            font-size: 22px;
        }

        .close-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 24px;
            cursor: pointer;
            padding: 0;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
        }

        .close-btn:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .opponent-selector {
            margin-bottom: 24px;
        }

        .opponent-selector label {
            display: block;
            color: var(--text-secondary);
            font-size: 14px;
            margin-bottom: 8px;
        }

        .opponent-selector select {
            width: 100%;
            padding: 12px;
            background: var(--bg-secondary);
            border: 2px solid var(--border-color);
            border-radius: 8px;
            color: var(--text-primary);
            font-family: 'Fredoka', sans-serif;
            font-size: 16px;
        }

        .comparison-grid {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            gap: 12px;
            align-items: center;
        }

        .comparison-stat {
            background: var(--bg-secondary);
            padding: 12px;
            border-radius: 8px;
            text-align: center;
        }

        .comparison-stat.winner {
            border: 2px solid var(--accent-primary);
            box-shadow: 0 0 12px rgba(0, 255, 136, 0.3);
        }

        .comparison-label {
            text-align: center;
            color: var(--text-secondary);
            font-size: 13px;
            font-weight: 600;
        }

        .comparison-value {
            font-size: 18px;
            font-weight: 700;
            font-family: 'JetBrains Mono', monospace;
            color: var(--accent-secondary);
        }

        .comparison-name {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 4px;
        }

        .vs-divider {
            color: var(--accent-tertiary);
            font-size: 20px;
            font-weight: 700;
        }

        /* Achievements */
        .achievements-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }

        .achievement-card {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 16px;
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .achievement-card.earned {
            border-color: var(--accent-primary);
            box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
        }

        .achievement-icon {
            width: 50px;
            height: 50px;
            background: var(--bg-secondary);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 28px;
            flex-shrink: 0;
        }

        .achievement-card.earned .achievement-icon {
            background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
        }

        .achievement-info {
            flex: 1;
        }

        .achievement-name {
            font-size: 15px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 4px;
        }

        .achievement-desc {
            font-size: 12px;
            color: var(--text-secondary);
        }

        .achievement-progress {
            margin-top: 8px;
            height: 6px;
            background: var(--bg-secondary);
            border-radius: 3px;
            overflow: hidden;
        }

        .achievement-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
            transition: width 0.5s ease;
        }

        /* Bottom Navigation */
        /* Quick Action Bar */
        .quick-action-bar {
            position: fixed;
            bottom: 70px; /* Above bottom nav */
            left: 0;
            width: 100%;
            background: var(--bg-secondary);
            border-top: 2px solid var(--accent-primary);
            display: none; /* Hidden by default */
            justify-content: space-around;
            align-items: center;
            padding: 2px 8px 20px 8px; /* Minimal top, extra bottom padding for text */
            box-shadow: 0 -2px 10px rgba(0, 255, 136, 0.2);
            z-index: 99;
            transition: all 0.3s ease;
            min-height: 75px;
        }

        .quick-action-bar.active {
            display: flex;
        }

        .quick-action-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            cursor: pointer;
            transition: all 0.3s ease;
            padding: 8px 6px;
            border-radius: 8px;
            flex: 1;
            max-width: 80px;
        }

        .quick-action-item:active {
            transform: scale(0.95);
            background: rgba(0, 255, 136, 0.1);
        }

        .quick-action-icon {
            font-size: 28px;
            line-height: 1;
        }

        .quick-action-label {
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            color: var(--text-primary);
            white-space: nowrap;
            line-height: 1.3;
        }

        .quick-action-item.sleep .quick-action-label {
            color: var(--accent-sleep);
        }

        .quick-action-item.water .quick-action-label {
            color: var(--accent-water);
        }

        .quick-action-item.bad .quick-action-label {
            color: #ff6b6b;
        }

        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background: var(--bg-secondary);
            border-top: 2px solid var(--accent-primary);
            display: flex;
            justify-content: space-around;
            padding: 12px 0;
            box-shadow: 0 -4px 20px rgba(0, 255, 136, 0.2);
            z-index: 100;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            cursor: pointer;
            transition: all 0.3s ease;
            padding: 8px 16px;
        }

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

        .nav-icon {
            font-size: 24px;
        }

        .nav-label {
            font-size: 11px;
            font-weight: 600;
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(10, 14, 39, 0.95);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: var(--bg-card);
            border: 2px solid var(--accent-primary);
            border-radius: 20px;
            padding: 30px 20px;
            max-width: 400px;
            width: 100%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 0 40px rgba(0, 255, 136, 0.4);
            animation: modalSlideIn 0.3s ease;
        }

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

        @keyframes slideDown {
            from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
            to { transform: translateX(-50%) translateY(0); opacity: 1; }
        }
        
        @keyframes slideUp {
            from { transform: translateX(-50%) translateY(0); opacity: 1; }
            to { transform: translateX(-50%) translateY(-100%); opacity: 0; }
        }

        .modal-title {
            font-size: 22px;
            font-weight: 700;
            color: var(--accent-primary);
            margin-bottom: 20px;
            text-align: center;
        }

        .modal-buttons {
            display: flex;
            gap: 12px;
            margin-top: 20px;
        }

        .modal-buttons .btn {
            flex: 1;
        }

        /* Loading */
        .loading {
            display: none;
            text-align: center;
            padding: 40px;
        }

        .loading.active {
            display: block;
        }

        .spinner {
            width: 50px;
            height: 50px;
            border: 4px solid var(--border-color);
            border-top: 4px solid var(--accent-primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }

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

        /* Hidden */
        .hidden {
            display: none !important;
        }

        /* Error Message */
        .error-message {
            background: var(--danger);
            color: white;
            padding: 12px 16px;
            border-radius: 12px;
            margin-bottom: 16px;
            font-size: 14px;
            text-align: center;
        }

        /* Success Message */
        .success-message {
            background: var(--success);
            color: var(--bg-primary);
            padding: 12px 16px;
            border-radius: 12px;
            margin-bottom: 16px;
            font-size: 14px;
            font-weight: 600;
            text-align: center;
        }

        /* Tab Content */
        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* Settings */
        .settings-section {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 20px;
            margin-bottom: 16px;
        }

        .settings-section h3 {
            font-size: 16px;
            color: var(--accent-primary);
            margin-bottom: 16px;
        }

        .settings-item {
            margin-bottom: 16px;
        }

        .settings-item:last-child {
            margin-bottom: 0;
        }

        .settings-label {
            font-size: 13px;
            color: var(--text-secondary);
            margin-bottom: 6px;
            display: block;
        }

        .settings-value {
            font-size: 15px;
            color: var(--text-primary);
            font-family: 'JetBrains Mono', monospace;
        }

        /* Bad Habit Types */
        .habit-type-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 16px;
        }

        .habit-type-btn {
            padding: 16px 12px;
            background: var(--bg-secondary);
            border: 2px solid var(--accent-bad);
            border-radius: 12px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .habit-type-btn.selected {
            background: var(--accent-bad);
            color: var(--bg-primary);
        }

        .habit-type-btn:active {
            transform: scale(0.95);
        }

        .habit-type-icon {
            font-size: 24px;
            margin-bottom: 6px;
        }

        .habit-type-label {
            font-size: 13px;
            font-weight: 600;
        }

        /* Score Info Button */
        .score-info-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            background: var(--accent-primary);
            color: var(--bg-primary);
            border-radius: 50%;
            font-weight: bold;
            font-size: 14px;
            cursor: pointer;
            margin-left: 8px;
            vertical-align: middle;
            transition: all 0.3s ease;
        }

        .score-info-btn:active {
            transform: scale(0.9);
        }

        .scoring-table {
            width: 100%;
            margin: 16px 0;
            border-collapse: collapse;
        }

        .scoring-table th,
        .scoring-table td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid var(--border-color);
        }

        .scoring-table th {
            color: var(--accent-primary);
            font-weight: 600;
            font-size: 13px;
        }

        .scoring-table td {
            color: var(--text-primary);
            font-size: 14px;
        }

        .scoring-table tr:last-child td {
            border-bottom: none;
        }

        .scoring-note {
            background: var(--bg-secondary);
            padding: 12px;
            border-radius: 8px;
            margin-top: 12px;
            font-size: 13px;
            color: var(--text-secondary);
        }

        /* Message Board Styles */
        .message-board {
            padding: 0;
        }

        .message-input-section {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 16px;
            margin-bottom: 20px;
        }

        .message-input-section h3 {
            font-size: 16px;
            color: var(--accent-primary);
            margin-bottom: 12px;
        }

        .message-textarea {
            width: 100%;
            min-height: 80px;
            padding: 12px;
            background: var(--bg-secondary);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            color: var(--text-primary);
            font-family: 'Fredoka', sans-serif;
            font-size: 14px;
            resize: vertical;
            margin-bottom: 12px;
        }

        .message-textarea:focus {
            outline: none;
            border-color: var(--accent-primary);
            box-shadow: var(--shadow-glow);
        }

        /* Image preview in message input */
        #imagePreviewContainer {
            padding: 8px 12px;
            background: var(--card-bg);
            border-radius: 8px;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        #imagePreviewText {
            display: flex;
            align-items: center;
            gap: 5px;
        }

        /* Image viewer modal */
        .image-viewer-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            z-index: 10000;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }

        .image-viewer-modal.active {
            display: flex;
        }

        .image-viewer-content {
            position: relative;
            max-width: 90%;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .image-viewer-content img {
            max-width: 100%;
            max-height: 85vh;
            object-fit: contain;
            border-radius: 8px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        }

        .image-viewer-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            color: white;
            font-size: 24px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .image-viewer-close:hover {
            background: rgba(255, 255, 255, 0.2);
            transform: scale(1.1);
        }

        /* Image link in messages */
        .message-image-link {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            margin-top: 8px;
            padding: 6px 12px;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 6px;
            color: var(--accent);
            text-decoration: none;
            font-size: 0.9em;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .message-image-link:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: var(--accent);
            transform: translateX(2px);
        }

        .btn-icon {
            background: rgba(255, 0, 0, 0.2);
            border: 1px solid rgba(255, 0, 0, 0.3);
            color: #ff6b6b;
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.3s ease;
        }

        .btn-icon:hover {
            background: rgba(255, 0, 0, 0.3);
            border-color: #ff6b6b;
        }

        .messages-container {
            max-height: calc(100vh - 400px);
            overflow-y: auto;
        }

        .month-section {
            margin-bottom: 24px;
        }

        .month-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 12px;
            padding: 14px 16px;
            cursor: pointer;
            margin-bottom: 12px;
            transition: all 0.3s ease;
        }

        .month-header:active {
            transform: scale(0.98);
        }

        .month-header-title {
            font-size: 16px;
            font-weight: 600;
            color: var(--accent-primary);
        }

        .month-header-toggle {
            font-size: 18px;
            color: var(--text-secondary);
            transition: transform 0.3s ease;
        }

        .month-header.collapsed .month-header-toggle {
            transform: rotate(-90deg);
        }

        .month-messages {
            display: flex;
            flex-direction: column;
            gap: 12px;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }

        .month-messages.collapsed {
            max-height: 0;
            margin: 0;
        }

        .message-bubble {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 14px 16px;
            position: relative;
        }

        .message-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        .message-username {
            font-weight: 600;
            color: var(--accent-primary);
            font-size: 14px;
        }

        .message-date {
            font-size: 12px;
            color: var(--text-muted);
        }

        .message-content {
            color: var(--text-primary);
            font-size: 14px;
            line-height: 1.5;
            word-wrap: break-word;
        }

        .no-messages {
            text-align: center;
            padding: 40px 20px;
            color: var(--text-secondary);
        }

/* ============================================
   PERSONAL RECORDS STYLES
   FitQuest v1.2 - Personal Bests Feature
   ============================================ */

/* Personal Records Card */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.record-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
}

.record-item:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
}

.record-icon {
    font-size: 32px;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

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

.record-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.record-value {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-date {
    font-size: 0.8em;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .records-grid {
        grid-template-columns: 1fr;
    }
    
    .record-item {
        padding: 10px;
    }
    
    .record-icon {
        font-size: 28px;
    }
}

/* ============================================
   NEW RECORD CELEBRATION POPUP
   ============================================ */

.record-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.record-popup.active {
    opacity: 1;
    visibility: visible;
}

.record-popup-content {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 20px;
    padding: 40px 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: recordPopupBounce 0.6s ease-out;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.4);
}

@keyframes recordPopupBounce {
    0% {
        transform: scale(0.3) translateY(-100px);
        opacity: 0;
    }
    50% {
        transform: scale(1.05) translateY(0);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.record-popup-icon {
    font-size: 80px;
    margin-bottom: 10px;
    animation: recordIconPulse 1s ease-in-out infinite;
}

@keyframes recordIconPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1));
    }
}

.record-popup-title {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    animation: recordTitleGlow 1.5s ease-in-out infinite;
}

@keyframes recordTitleGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
    }
    50% {
        text-shadow: 0 0 30px rgba(139, 92, 246, 0.8);
    }
}

.record-popup-type {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 10px;
}

.record-popup-value {
    font-size: 2.5em;
    font-weight: bold;
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    animation: recordValueScale 0.8s ease-out;
}

@keyframes recordValueScale {
    0% {
        transform: scale(0);
    }
    60% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.record-popup-message {
    font-size: 1.1em;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.5;
}

.record-popup-bonus {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a1a;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    animation: recordBonusPulse 1s ease-in-out infinite;
}

@keyframes recordBonusPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 25px rgba(255, 215, 0, 0.6);
    }
}

.record-popup-content .btn {
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    border: none;
    padding: 12px 30px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.record-popup-content .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

/* Confetti effect */
.record-popup.active::before,
.record-popup.active::after {
    content: '🎉';
    position: absolute;
    font-size: 40px;
    animation: confettiFall 3s ease-out forwards;
}

.record-popup.active::before {
    left: 20%;
    top: 10%;
    animation-delay: 0.2s;
}

.record-popup.active::after {
    right: 20%;
    top: 10%;
    animation-delay: 0.4s;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(300px) rotate(360deg);
        opacity: 0;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .record-popup-content {
        padding: 30px 20px;
        width: 95%;
    }
    
    .record-popup-icon {
        font-size: 60px;
    }
    
    .record-popup-title {
        font-size: 1.4em;
    }
    
    .record-popup-value {
        font-size: 2em;
    }
    
    .record-popup-message {
        font-size: 1em;
    }
}
/* ============================================
   YEARLY CHALLENGES STYLES
   FitQuest v1.3 - Add to styles.css
   ============================================ */

/* Yearly Challenge Card Styling */
.challenge-yearly {
    background: var(--bg-card);
    border: 2px solid rgba(255, 215, 0, 0.6);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.challenge-yearly::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.8), transparent);
    animation: shimmer 2s infinite;
    z-index: 1;
}

.challenge-yearly .challenge-title {
    color: #FFD700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Progress Image Container */
.yearly-progress-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.yearly-progress-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    display: block;
}

/* Vertical Progress Bar Overlay */
.yearly-progress-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 30px;
    height: calc(100% - 40px);
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.yearly-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to bottom, #8B5CF6, #00d4ff, #00ff88);
    border-radius: 15px;
    transition: height 0.8s ease-out;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

/* Progress Marker (shows current position) */
.yearly-progress-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    width: 44px;
    height: 44px;
    background: radial-gradient(circle, #FFD700, #FFA500);
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5);
    transition: top 0.8s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    animation: markerPulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes markerPulse {
    0%, 100% {
        transform: translateX(-50%) translateY(-50%) scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: translateX(-50%) translateY(-50%) scale(1.15);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1), 0 0 60px rgba(255, 215, 0, 0.7);
    }
}
}

/* Progress Stats Box */
.yearly-progress-stats {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.15));
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.yearly-progress-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.yearly-progress-stats-label {
    font-weight: 600;
    color: var(--text-primary);
}

.yearly-progress-stats-value {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--accent-primary);
}

.yearly-progress-stats-detail {
    display: flex;
    justify-content: space-between;
    font-size: 0.95em;
    color: var(--text-muted);
    padding-top: 10px;
    border-top: 1px solid rgba(139, 92, 246, 0.2);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .yearly-progress-overlay {
        right: 15px;
        width: 25px;
        top: 15px;
        height: calc(100% - 30px);
    }
    
    .yearly-progress-marker {
        width: 38px;
        height: 38px;
        font-size: 20px;
    }
}

/* Admin Panel - Challenge Type Toggle */
.challenge-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.challenge-type-toggle button {
    flex: 1;
    padding: 10px;
    border: 2px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.challenge-type-toggle button.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(59, 130, 246, 0.3));
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.challenge-type-toggle button:hover {
    border-color: var(--accent-primary);
}

/* Image Upload Preview */
.image-upload-preview {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    max-width: 400px;
    border: 2px solid rgba(139, 92, 246, 0.3);
}

.image-upload-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.image-upload-label {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.image-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.image-upload-label input[type="file"] {
    display: none;
}
