
:root {
    /* New Color Palette */
    --space-black: #0a0a14;
    --deep-space: #12121d;
    --cosmic-purple: #1a1a2e;
    --nebula-blue: #16213e;
    --galaxy-edge: #0f3460;
    
    /* Accent Colors */
    --quantum-blue: #00b4d8;
    --neon-cyan: #00e6d6;
    --plasma-purple: #7b4bce;
    --hologram-pink: #e145a6;
    --matrix-green: #00ff9d;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, var(--quantum-blue) 0%, var(--plasma-purple) 100%);
    --secondary-gradient: linear-gradient(135deg, var(--neon-cyan) 0%, var(--matrix-green) 100%);
    --success-gradient: linear-gradient(135deg, var(--matrix-green) 0%, var(--quantum-blue) 100%);
    --warning-gradient: linear-gradient(135deg, var(--hologram-pink) 0%, var(--plasma-purple) 100%);
    --danger-gradient: linear-gradient(135deg, #ff4d6d 0%, var(--hologram-pink) 100%);
    
    /* UI Colors */
    --bg: var(--space-black);
    --surface: var(--deep-space);
    --card: var(--cosmic-purple);
    --text: rgba(255, 255, 255, 0.95);
    --muted: rgba(255, 255, 255, 0.65);
    --border: rgba(102, 126, 234, 0.15);
    --glass: rgba(26, 26, 46, 0.85);
    --glass-border: rgba(102, 126, 234, 0.2);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 16px 48px rgba(0, 180, 216, 0.25);
    --glow: 0 0 20px rgba(0, 180, 216, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::selection {
    background: rgba(0, 180, 216, 0.3);
    color: #fff;
}

::-moz-selection {
    background: rgba(0, 180, 216, 0.3);
    color: #fff;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Global focus-visible states for accessibility */
:focus-visible {
    outline: 2px solid var(--quantum-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
.btn:focus-visible,
.control-btn:focus-visible,
.nav-btn:focus-visible {
    outline: 2px solid var(--quantum-blue);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.15);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
    border-color: var(--quantum-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 0px;
    height: 0px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 100px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: transparent;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Enhanced Login Screen */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--deep-space) 0%, var(--cosmic-purple) 50%, var(--nebula-blue) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.login-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(123, 75, 206, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 180, 216, 0.25) 0%, transparent 50%);
    z-index: -1;
}

.login-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-20px) scale(0.98);
}

.login-card {
    background: rgba(18, 18, 29, 0.8);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 3.5rem;
    text-align: center;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow), var(--glow);
    animation: slideInUp 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.login-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 30px rgba(0, 180, 216, 0.4);
}

.login-subtitle {
    color: var(--muted);
    margin-bottom: 3rem;
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1.6;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    padding: 1.4rem 2rem;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    margin-bottom: 1.2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.7s ease;
    z-index: 1;
}

.login-btn:hover::before {
    left: 100%;
}

.google-login-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a2e;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.demo-login-btn {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

.login-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    filter: brightness(1.08);
}

/* Enhanced Navigation - Mobile First */
.brand-section {
    position: fixed;
    top: 0;
    left: 0;
    height: 54px;
    display: flex;
    align-items: center;
    padding-left: 1rem;
    z-index: 1001;
}

@media (min-width: 768px) {
    .brand-section {
        height: 72px;
        padding-left: 2.5rem;
    }
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    white-space: normal;
    line-height: 1.2;
}

.brand-logo i {
    font-size: 2rem;
    color: var(--quantum-blue);
}

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: rgba(10, 10, 20, 0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem 0 81px;
    margin-top: 18px;
    z-index: 1000;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    gap: 2rem;
}

@media (min-width: 768px) {
    .nav {
        height: 86px;
        padding: 0 2.5rem 0 126px;
    }
    
    .user-section {
        right: 2.5rem;
    }
}

.nav-brand {
    display: none;
}

.nav-brand i {
    font-size: 2rem;
    color: var(--quantum-blue);
}

.nav-links {
    display: flex;
    gap: 0.4rem;
    background: rgba(26, 26, 46, 0.6);
    padding: 0.45rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
}

.nav-btn {
    background: transparent;
    border: none;
    padding: 0.85rem 1.6rem;
    border-radius: 12px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-btn.active {
    background: var(--primary-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 180, 216, 0.35);
}

.nav-btn:hover:not(.active) {
    color: var(--text);
    background: rgba(0, 180, 216, 0.08);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: absolute;
    right: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--glass);
    padding: 0.6rem 1.2rem;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--quantum-blue);
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 0 10px rgba(0, 180, 216, 0.2);
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(0, 180, 216, 0.35);
}

.user-name {
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-name:hover {
    color: var(--quantum-blue);
}

.logout-btn {
    background: var(--danger-gradient);
    color: white;
    border: none;
    padding: 0.9rem 1.4rem;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(255, 77, 109, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(255, 77, 109, 0.4);
}

/* Enhanced Pages - Mobile First */
.page {
    display: none;
    min-height: auto;
    padding: 82px 0rem 2.5rem;
}

.page.active {
    display: block;
    animation: fadeInUp 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (min-width: 768px) {
    .page {
        padding: 110px 2.5rem 2.5rem;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced Timer Page */
.timer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.timer-hero {
    text-align: center;
    margin-bottom: 2.8rem;
}

.timer-title {
    font-size: 3.15rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.7rem;
    text-shadow: 0 5px 30px rgba(0, 180, 216, 0.4);
    letter-spacing: -1px;
}

.timer-subtitle {
    font-size: 1rem;
    color: var(--muted);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.1rem;
    margin-bottom: 4rem;
}

.status-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 2rem 1.6rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.status-card:hover::before {
    transform: scaleX(1);
}

.status-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(0, 180, 216, 0.3);
}

.status-icon {
    font-size: 2.8rem;
    margin-bottom: 1.2rem;
    filter: drop-shadow(0 5px 15px rgba(0, 180, 216, 0.3));
}

.status-label {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.status-value {
    font-size: 2.4rem;
    font-weight: 800;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* text-shadow removed */
}

/* Enhanced Timer Display */
.timer-display-section {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 6rem 0;
    position: relative;
}

.timer-circle {
    position: relative;
    width: 450px;
    height: 450px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--quantum-blue), var(--plasma-purple), var(--matrix-green), var(--quantum-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.4),
        inset 0 0 0 10px var(--surface),
        0 0 40px rgba(0, 180, 216, 0.4);
    animation: rotateHue 20s linear infinite;
}

@keyframes rotateHue {
    from { filter: hue-rotate(0deg); }
    to { filter: hue-rotate(360deg); }
}

.timer-inner {
    width: 390px;
    height: 390px;
    border-radius: 50%;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 5px 25px rgba(0, 0, 0, 0.5);
}

.timer-time {
    font-size: 4.5rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
    text-shadow: 0 5px 20px rgba(0, 180, 216, 0.3);
    letter-spacing: 2px;
}

.timer-status {
    font-size: 1.3rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.timer-glow {
    position: absolute;
    top: -25px;
    left: -25px;
    right: -25px;
    bottom: -25px;
    border-radius: 50%;
    background: var(--primary-gradient);
    opacity: 0;
    animation: pulse 3s cubic-bezier(0.23, 1, 0.32, 1) infinite;
    z-index: -1;
}

.timer-circle.running .timer-glow {
    opacity: 0.3;
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.3; 
    }
    50% { 
        transform: scale(1.08); 
        opacity: 0.15; 
    }
}

/* Enhanced Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 4rem;
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.6rem 3.5rem;
    border: none;
    border-radius: 18px;
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.control-btn i {
    font-size: 1.4rem;
}

.control-btn.primary {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 15px 35px rgba(0, 255, 157, 0.35);
}

.control-btn.secondary {
    background: var(--warning-gradient);
    color: white;
    box-shadow: 0 15px 35px rgba(225, 69, 166, 0.35);
}

.control-btn.danger {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 15px 35px rgba(255, 77, 109, 0.35);
}

.control-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
}

.control-btn:active {
    transform: translateY(-2px);
}

/* Shortcut Hint */
.shortcut-hint {
    text-align: center;
    margin-top: 2.5rem;
    color: var(--muted);
    font-style: italic;
    font-size: 1rem;
}

.shortcut-hint:hover {
    opacity: 1;
}

.shortcut-key {
    background: var(--surface);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--quantum-blue);
    border: 1px solid rgba(0, 180, 216, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Enhanced Analytics Page */
.analytics-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2.5rem;
}


.analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.analytics-title {
    font-size: 4rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 25px rgba(0, 180, 216, 0.3);
    letter-spacing: -1px;
}

.analytics-controls {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.selector {
    padding: 1rem 1.5rem;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.selector:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2), 0 8px 20px rgba(0, 0, 0, 0.2);
}

.refresh-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 25px rgba(0, 180, 216, 0.35);
}

.refresh-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 180, 216, 0.4);
}

/* Enhanced Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* Stats Row - 4 Column Layout */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    grid-column: 1 / -1;
    width: 100%;
}

.stat-card {
    padding: 1.5rem !important;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(25, 35, 50, 0.8), rgba(35, 45, 60, 0.8));
    border: 2px solid rgba(0, 180, 216, 0.2);
}

.stat-card .metric-value {
    font-size: 2.5rem !important;
}

.stat-card .card-header {
    margin-bottom: 1rem;
}

.full-width {
    grid-column: 1 / -1 !important;
}

/* Charts Grid - Side by Side Layout */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 2rem;
}

/* Daily Study Time Card - Limit width */
.analytics-card:has(.daily-time-editor) {
    grid-column: span 2;
    max-width: 100%;
}

/* Peak Hours and Heatmap - side by side */
.analytics-card:has(.peak-hours-list),
.analytics-card:has(.heatmap-container) {
    grid-column: span 1;
}

@media (max-width: 1400px) {
    .analytics-card:has(.daily-time-editor) {
        grid-column: 1 / -1;
    }
}

.dashboard-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 1.5rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    box-sizing: border-box;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.dashboard-card:hover::before {
    transform: scaleX(1);
}

.dashboard-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.card-icon {
    font-size: 3rem;
    filter: drop-shadow(0 5px 15px rgba(0, 180, 216, 0.3));
}

.metric-value {
    font-size: 4rem;
    font-weight: 900;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    text-shadow: 0 5px 20px rgba(0, 255, 157, 0.3);
}

.metric-change {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    padding: 0.7rem 1.2rem;
    border-radius: 14px;
    background: rgba(0, 255, 157, 0.1);
    color: var(--matrix-green);
    display: inline-block;
    font-weight: 600;
    border: 1px solid rgba(0, 255, 157, 0.15);
}

/* Peak Hours List */
.peak-hours-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.peak-hour-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 180, 216, 0.08);
    border-radius: 1rem;
    border-left: 4px solid var(--primary);
}

.peak-hour-time {
    font-weight: 600;
    color: var(--text);
}

.peak-hour-duration {
    font-size: 1.2rem;
    font-weight: 700;
    background: var(--success-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Heatmap */
.heatmap-container {
    display: grid;
    gap: 1rem;
}

.heatmap-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.heatmap-day-label {
    width: 60px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.heatmap-cell {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    border: 2px solid transparent;
}

.heatmap-cell:hover {
    transform: scale(1.1);
    border-color: var(--primary);
}

.heatmap-cell[data-level="0"] {
    background: rgba(100, 100, 100, 0.2);
    color: var(--text-secondary);
}

.heatmap-cell[data-level="1"] {
    background: rgba(0, 255, 157, 0.2);
    color: var(--matrix-green);
}

.heatmap-cell[data-level="2"] {
    background: rgba(0, 255, 157, 0.5);
    color: var(--matrix-green);
}

.heatmap-cell[data-level="3"] {
    background: rgba(0, 255, 157, 0.7);
    color: white;
}

.heatmap-cell[data-level="4"] {
    background: var(--success-gradient);
    color: white;
    font-weight: 700;
}

.heatmap-legend {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* Enhanced Sessions */
.sessions-container {
    background: var(--card);
    border-radius: 20px;
    padding: 2.5rem;
    margin-top: 2rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem;
    border-radius: 18px;
    margin-bottom: 1.2rem;
    background: var(--surface);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.session-item:last-child {
    margin-bottom: 0;
}

.session-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.12);
    border-color: rgba(0, 180, 216, 0.15);
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-date {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.session-time-range {
    font-size: 0.82rem;
    opacity: 0.65;
    margin-top: 0.15rem;
}

.session-notes {
    font-size: 0.82rem;
    opacity: 0.75;
    margin-top: 0.25rem;
    font-style: italic;
    word-break: break-word;
}

.session-duration {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--quantum-blue);
    white-space: nowrap;
}

.session-actions {
    display: flex;
    gap: 0.7rem;
}

.action-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    font-size: 1rem;
    box-shadow: 0 8px 20px rgba(0, 180, 216, 0.3);
}

.action-btn.danger {
    background: var(--danger-gradient);
    box-shadow: 0 8px 20px rgba(255, 77, 109, 0.3);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Enhanced Groups Page */
/* ====== GROUPS PAGE - REDESIGNED ====== */
.groups-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Title Row --- */
.groups-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* --- Groups Body: cards left, actions right --- */
.groups-body {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.groups-body.no-groups {
    justify-content: center;
}

.groups-body.no-groups .groups-list {
    display: none;
}

.groups-body .groups-list {
    flex: 1;
    margin-bottom: 0;
}

.groups-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.groups-count {
    background: rgba(0, 180, 216, 0.15);
    color: var(--quantum-blue);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(0, 180, 216, 0.25);
}

.groups-top-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.group-join-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.group-code-input {
    padding: 1.2rem 1.4rem;
    background: var(--card);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    width: 200px;
    transition: all 0.25s ease;
}

.group-code-input:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.group-action-btn {
    padding: 1.2rem 1.8rem;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.group-action-btn.join {
    background: var(--quantum-blue);
    color: white;
}

.group-action-btn.create {
    background: rgba(0, 180, 216, 0.12);
    color: var(--quantum-blue);
    border: 1.5px solid rgba(0, 180, 216, 0.3);
}

.group-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.25);
}

/* --- Group Cards Grid --- */
.groups-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.group-card {
    background: var(--card);
    border-radius: 16px;
    padding: 1.5625rem 1.875rem;
    border: 1.5px solid rgba(255, 255, 255, 0.06);
    transition: all 0.25s ease;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
}

.group-card:hover {
    border-color: rgba(0, 180, 216, 0.15);
    background: rgba(26, 26, 46, 0.95);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.group-card.active {
    border-color: rgba(0, 180, 216, 0.3);
    background: rgba(0, 180, 216, 0.05);
    box-shadow: 0 0 0 1px rgba(0, 180, 216, 0.1), 0 4px 16px rgba(0, 180, 216, 0.08);
}

.group-card-info {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
    min-width: 0;
}

.group-card-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-card.active .group-card-name {
    color: var(--quantum-blue);
}

.group-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--muted);
}

.group-card-meta .code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--quantum-blue);
    letter-spacing: 1px;
}

.group-card-meta .separator {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.5;
}

.group-card-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.group-card-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--quantum-blue);
    box-shadow: 0 0 6px rgba(0, 180, 216, 0.4);
}

.group-card-leave {
    background: rgba(239, 68, 68, 0.1);
    border: none;
    color: #ef4444;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.group-card-leave:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
}

/* --- Active Group Bar --- */
.active-group-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.active-group-info h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.active-group-code {
    font-size: 0.8rem;
    color: var(--muted);
    font-family: 'Courier New', monospace;
}

.active-group-code span {
    color: var(--quantum-blue);
    font-weight: 700;
    letter-spacing: 1px;
}

.active-group-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- Admin Panel (compact) --- */
.admin-panel {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0;
    border: none;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    z-index: 100;
    pointer-events: all;
    margin-left: auto;
    padding-right: 1.5rem;
}

.admin-actions {
    display: flex;
    flex-direction: row;
    gap: 0.8rem;
    flex-wrap: nowrap;
}

.admin-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    pointer-events: all;
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

.admin-btn.warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

.admin-btn.danger {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.admin-btn:not(.warning):not(.danger) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

#activeGroupContainer .admin-panel {
    display: flex !important;
    visibility: visible !important;
}

/* --- Tab System: Leaderboard & Chat --- */
#activeGroupContainer {
    display: flex;
    flex-direction: column;
}

#activeGroupContainer > .admin-panel {
    order: -1;
}

#activeGroupContainer > .group-tabs-container {
    order: 0;
    display: flex;
    align-items: center;
    gap: 0;
}

.group-tabs-container {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
}

.group-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.group-tab-btn {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.group-tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.group-tab-btn.active {
    color: var(--quantum-blue);
    border-bottom-color: var(--quantum-blue);
    background: rgba(0, 180, 216, 0.1);
}

.group-tab-btn i {
    font-size: 1.1rem;
}

.group-tab-content {
    display: none;
    animation: tabFadeIn 0.3s ease-out;
}

.group-tab-content.active {
    display: block;
}

@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Side-by-side Grid: Leaderboard + Chat (Tab System) --- */
.group-content-grid {
    display: grid;
    grid-template-columns: 576px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* Enhanced Chat */
.chat-container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    height: calc(100vh - 110px);
    min-height: 1250px;
    max-height: 2787px;
    background: linear-gradient(160deg, rgba(16, 24, 40, 0.95) 0%, rgba(10, 15, 30, 0.98) 50%, rgba(12, 20, 35, 0.95) 100%);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-header {
    background: rgba(15, 52, 96, 0.95);
    backdrop-filter: blur(15px);
    padding: 1.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.chat-group-code {
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.online-indicator {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.7rem 1.2rem;
    border-radius: 18px;
    backdrop-filter: blur(5px);
}

.online-dot {
    width: 10px;
    height: 10px;
    background: var(--matrix-green);
    border-radius: 50%;
    animation: pulse-dot 2s cubic-bezier(0.23, 1, 0.32, 1) infinite;
}

@keyframes pulse-dot {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.7; 
        transform: scale(1.2);
    }
}

.chat-messages {
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  scroll-padding: 10px;
}

/* Improve scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 180, 216, 0.4);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 180, 216, 0.6);
}

/* Scroll down button - improved styling */
.scroll-down-btn {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--quantum-blue) 0%, var(--plasma-purple) 100%);
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.scroll-down-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

.scroll-down-btn.hidden {
    display: none;
}

.load-more-container {
  display: flex;
  justify-content: center;
  padding: 8px 0 12px;
}

.load-more-btn {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
}

.load-more-btn:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
  transform: none;
  box-shadow: none;
}

/* Message group with avatar */
.message-group {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 0.5rem;
  align-items: flex-end;
  animation: messageSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.message-group.own {
  flex-direction: row-reverse;
  align-items: flex-end;
}

/* Hide avatar for grouped messages (after first 3) */
.message-group.grouped-msg:not(:first-child) .message-avatar {
  visibility: hidden;
  width: 44px;
}

/* Reduce spacing between grouped messages */
.message-group.grouped-msg {
  margin-bottom: 0.2rem;
}

.message-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.message-avatar:hover {
  transform: scale(1.05);
}

.message-bubble-container {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  min-width: 200px;
  gap: 0.3rem;
  position: relative;
}

.message-group.own .message-bubble-container {
  align-items: flex-end;
}

/* Reply container styling */
.reply-container {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--quantum-blue);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 0.95rem;
  max-width: 100%;
  word-break: break-word;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reply-container:hover {
  background: rgba(255, 255, 255, 0.08);
}

.reply-sender {
  font-weight: 600;
  color: var(--quantum-blue);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.reply-text {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message {
  margin-bottom: 0;
  padding: 12px 17px;
  border-radius: 18px;
  position: relative;
  backdrop-filter: blur(8px);
  border: none;
  word-wrap: break-word;
  word-break: break-word;
  transition: all 0.2s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes messageFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.message.own {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
  border-bottom-right-radius: 4px;
}

.message:not(.own) {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ADMIN/SERVER MESSAGE STYLING - PROFESSIONAL */
.message.admin {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
  color: #e2e8f0;
  font-weight: 500;
  border: 1px solid rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px 0;
  position: relative;
}

.message.admin::before {
  content: '🔔';
  margin-right: 8px;
  font-size: 0.95rem;
}

.message.admin .message-text {
  font-size: 0.93rem;
  line-height: 1.5;
  letter-spacing: 0.15px;
}

.message-group:has(.message.admin) {
  width: 100%;
  max-width: 100%;
  margin: 8px 0;
}

.message-bubble-container:has(.message.admin) {
  max-width: 90%;
  min-width: 240px;
}

.message.admin .message-sender {
  font-weight: 600;
  color: #60a5fa;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
  display: block;
}

.message.admin .message-time {
  color: rgba(226, 232, 240, 0.6);
  font-size: 0.72rem;
  margin-top: 4px;
}

.message-sender {
    font-weight: 600;
    font-size: 1.15rem;
    opacity: 0.8;
    margin-bottom: 0.3rem;
}

.message-text {
  font-size: 1.27rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  white-space: pre-wrap;
}

.message-image {
    max-width: 100%;
    border-radius: 12px;
    margin: 0.6rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.message-time {
  font-size: 0.98rem;
  opacity: 0.6;
  text-align: right;
  margin-top: 0.2rem;
}

/* ===== MESSAGE ACTION MENU ===== */
.message-actions-menu {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  gap: 4px;
  padding: 8px;
  z-index: 100;
  animation: slideUp 0.25s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.message-action-btn:hover {
  background: var(--quantum-blue);
  transform: scale(1.1);
}

/* Hover effects for messages */
.message-group {
  transition: all 0.2s ease;
}

.message-group:hover {
  opacity: 1;
}

.message-group:hover .message {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.message-group:hover .message-actions-menu {
  display: flex;
}

/* ===== EMOJI REACTIONS ===== */
.message-reactions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.reaction-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.reaction-button:hover {
  background: rgba(0, 180, 216, 0.2);
  border-color: var(--quantum-blue);
}

.reaction-emoji {
  font-size: 1rem;
}

.reaction-count {
  font-size: 0.85rem;
  opacity: 0.8;
}

.add-reaction-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 4px 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.add-reaction-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

/* ===== TYPING INDICATOR ===== */
.typing-container {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.7rem;
  padding: 0 0.8rem;
}

.typing-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px 17px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingAnimation {
  0%, 60%, 100% {
    opacity: 0.5;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

.typing-name {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

/* Consecutive messages grouping */
.message-group:has(+ .message-group.same-user) {
  margin-bottom: 0.3rem;
}

/* Own messages (right side) */
.message-group.own .message {
  border-bottom-right-radius: 4px;
}

/* Other's messages (left side) */
.message-group:not(.own) .message {
  border-bottom-left-radius: 4px;
}


.chat-input-area {
    background: rgba(15, 52, 96, 0.95);
    backdrop-filter: blur(15px);
    padding: 1.5rem 1.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input-container {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
    position: relative;
}

.chat-input {
    flex: 1;
    padding: 1.2rem 1.8rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid transparent;
    border-radius: 24px;
    color: var(--deep-space);
    resize: none;
    font-size: 1.1rem;
    max-height: 120px;
    min-height: 60px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.chat-input::placeholder {
  color: rgba(0, 0, 0, 0.5);
}

.chat-char-count {
  position: absolute;
  bottom: 12px;
  right: 130px;
  font-size: 0.85rem;
  color: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.chat-actions {
    display: flex;
    gap: 0.7rem;
}

.chat-btn {
    background: var(--quantum-blue);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 180, 216, 0.3);
    font-size: 1.2rem;
}

.chat-btn:hover {
    transform: scale(1.12) translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 180, 216, 0.4);
}

.chat-btn:active {
    transform: scale(0.95);
}

.emoji-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.emoji-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
  transform: scale(1.08);
}

.image-input {
    display: none;
}

/* Enhanced Leaderboard */
.leaderboard {
    background: var(--card);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 210px;
    position: relative;
}

.leaderboard-header {
    background: var(--primary-gradient);
    padding: 0.8rem 2.0rem;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.leaderboard-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.leaderboard-tabs {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
}

.tab-btn {
    padding: 1rem 1.8rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 18px;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    font-weight: 600;
    backdrop-filter: blur(5px);
}

.tab-btn.active {
    background: white;
    color: var(--quantum-blue);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
}

.leaderboard-list {
    padding: 0.8rem 2.5rem;
    max-height: 1450px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 1.1rem 1.65rem;
    border-radius: 18px;
    margin-bottom: 0.8rem;
    background: var(--surface);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #9de600dd, #f5e76b);
    color: #1a1a2e;
    box-shadow: 0 4px 14px rgba(201, 226, 9, 0.3);
}

.leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #03dbeece, #e5e7eb);
    color: #1a1a2e;
    box-shadow: 0 4px 14px rgba(192, 192, 192, 0.25);
}

.leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #6e08ebc5, #d97706);
    color: white;
    box-shadow: 0 4px 14px rgba(205, 127, 50, 0.25);
}

@keyframes goldShimmer {
    0%, 100% { 
        box-shadow: 0 0 16px rgba(255, 215, 0, 0.4); 
    }
    50% { 
        box-shadow: 0 0 24px rgba(255, 215, 0, 0.6); 
    }
}

.leaderboard-item.current-user {
    border: 2px solid var(--quantum-blue);
    box-shadow: 0 4px 16px rgba(0, 180, 216, 0.25);
}

.rank {
    font-size: 2.5rem;
    font-weight: 900;
    margin-right: 1.8rem;
    min-width: 55px;
    text-align: center;
}

.rank-1 .rank::after, .rank-2 .rank::after, .rank-3 .rank::after {
    display: none;
}

/* Global Leaderboard */
.global-leaderboard {
    background: var(--card);
    border-radius: 24px;
    margin-top: 2.5rem;
    margin-bottom: 4rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.global-leaderboard-header {
    background: linear-gradient(-45deg, #00e6d6, #0099ff, #7c3aed, #00e6d6);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
    padding: 2.5rem;
    text-align: center;
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.global-leaderboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

.global-leaderboard-title {
    position: relative;
    z-index: 1;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -30px); }
    50% { transform: translate(60px, 0); }
    75% { transform: translate(30px, 30px); }
}

.reset-time-info {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.reset-note, .timezone-note {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-note span, .timezone-note span {
    font-weight: 700;
    color: white;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
}

.global-leaderboard-list {
    padding: 1.5rem;
}

.global-leaderboard-item {
    display: flex;
    align-items: center;
    padding: 1.8rem 2rem;
    border-radius: 18px;
    margin-bottom: 1.2rem;
    background: var(--surface);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    will-change: transform;
}

.global-leaderboard-item:last-child {
    margin-bottom: 0;
}

.global-leaderboard-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 230, 214, 0.15);
}

.global-leaderboard-item.rank-1 {
    background: linear-gradient(135deg, #9de600dd, #f5e76b);
    color: #1a1a2e;
    box-shadow: 0 8px 20px rgba(201, 226, 9, 0.521);
}

.global-leaderboard-item.rank-2 {
    background: linear-gradient(135deg, #03dbeece, #e5e7eb);
    color: #1a1a2e;
    box-shadow: 0 12px 30px rgba(192, 192, 192, 0.4);
}

.global-leaderboard-item.rank-3 {
    background: linear-gradient(135deg, #6e08ebc5, #d97706);
    color: white;
    box-shadow: 0 12px 30px rgba(205, 127, 50, 0.4);
}

.global-leaderboard-item.current-user {
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 12px 30px rgba(0, 230, 214, 0.4);
}

.global-leaderboard-item .rank {
    font-size: 2.5rem;
    font-weight: 900;
    margin-right: 1.8rem;
    min-width: 55px;
    text-align: center;
}

.global-leaderboard-item .user-avatar-small {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    margin-right: 1.8rem;
    border: 3px solid var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 230, 214, 0.4);
}

.global-leaderboard-item .user-details {
    flex: 1.15;
    min-width: 0;
}

.global-leaderboard-item .user-name-rank {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    word-break: break-word;
}

.global-leaderboard-item .user-status {
    font-size: 1rem;
    opacity: 1;
    font-weight: 700;
}

.global-leaderboard-item .study-time {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 3px 8px rgba(231, 240, 236, 0.2);
}

.global-leaderboard-item.rank-1 .study-time,
.global-leaderboard-item.rank-2 .study-time,
.global-leaderboard-item.rank-3 .study-time {
    color: #ffffff !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

.user-avatar-small {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    margin-right: 1.8rem;
    border: 3px solid var(--quantum-blue);
    box-shadow: 0 0 15px rgba(0, 180, 216, 0.4);
}

.user-details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.user-name-rank {
    font-size: 1.0rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 1.0rem;
    opacity: 1;
    font-weight: 600;
}

.user-status.studying {
    color: #00c853;
}

.user-status.idle {
    color: #2979ff;
    text-shadow: 0 0 6px rgba(41, 121, 255, 0.4);
}

.user-status.offline {
    color: #ff1744;
    text-shadow: 0 0 6px rgba(255, 23, 68, 0.4);
}

.study-time {
    font-size: 1.8rem;
    font-weight: 800;
    color: rgba(247, 247, 248, 0.75); /* Dimmed green */
    text-shadow: 0 3px 8px rgba(231, 240, 236, 0.2); /* Softer glow */
}
/* Dim study time for top 3 leaderboard ranks */
.rank-1 .study-time,
.rank-2 .study-time,
.rank-3 .study-time {
    color: rgba(15, 15, 196, 0.453) !important; /* Softer green */
    text-shadow: 0 2px 5px rgba(0, 255, 157, 0.10) !important; /* Minimal glow */
}
/* ===== Rank Change Arrows ===== */
.study-time-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    min-width: 90px;
}

.rank-change {
    font-size: 1.5rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 8px;
    line-height: 1.3;
    animation: rankBadgePop 0.4s ease-out;
}

.rank-change.rank-up {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.rank-change.rank-up i {
    font-size: 1.6rem;
}

.rank-change.rank-down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

.rank-change.rank-down i {
    font-size: 1.6rem;
}

.rank-change.rank-same {
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.4rem;
}

.rank-change.rank-new {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

/* Top-3 rank change overrides for dark text backgrounds */
.rank-1 .rank-change.rank-up,
.rank-2 .rank-change.rank-up,
.rank-3 .rank-change.rank-up {
    color: #15803d;
    background: rgba(34, 197, 94, 0.2);
    text-shadow: none;
}

.rank-1 .rank-change.rank-down,
.rank-2 .rank-change.rank-down,
.rank-3 .rank-change.rank-down {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.2);
    text-shadow: none;
}

.rank-1 .rank-change.rank-same,
.rank-2 .rank-change.rank-same,
.rank-3 .rank-change.rank-same {
    color: rgba(0, 0, 0, 0.3);
}

.rank-1 .rank-change.rank-new,
.rank-2 .rank-change.rank-new,
.rank-3 .rank-change.rank-new {
    color: #6d28d9;
    background: rgba(109, 40, 217, 0.15);
}

@keyframes rankBadgePop {
    0% { opacity: 0; transform: scale(0.5) translateY(4px); }
    60% { transform: scale(1.15) translateY(-1px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}


/* Enhanced Modals */
.modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.78);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal.active {
    display: flex;
    animation: modalOverlayIn 0.3s ease;
}

.modal.closing {
    display: flex;
    animation: modalOverlayOut 0.25s ease forwards;
}
.modal.closing .modal-content {
    animation: modalSlideOut 0.25s ease forwards;
}

@keyframes modalOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalOverlayOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.modal-content {
    background: var(--surface);
    border-radius: 24px;
    padding: 2rem 1.5rem;
    max-width: 650px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow), var(--glow);
    animation: modalSlideIn 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

@media (min-width: 768px) {
    .modal-content {
        padding: 3.5rem;
        width: 90%;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.modal-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 20px rgba(0, 180, 216, 0.3);
}

.close-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 2.5rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    top: 0;
}

.close-btn:hover {
    background: rgba(255, 77, 109, 0.15);
    border-color: rgba(255, 77, 109, 0.3);
    color: #ff4d6d;
    transform: scale(1.05);
}

.form-group {
    margin-bottom: 2rem;
}

.form-label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text);
}

.form-input, .form-textarea {
    width: 100%;
    padding: 1.4rem 1.8rem;
    background: var(--card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text);
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: var(--muted);
    opacity: 0.6;
}

.form-actions {
    display: flex;
    gap: 1.2rem;
    justify-content: flex-end;
}

.btn {
    padding: 1.2rem 2.4rem;
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn.primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.25);
}

.btn.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
}

.btn.danger {
    background: var(--danger-gradient);
    color: white;
    box-shadow: 0 8px 24px rgba(255, 77, 109, 0.25);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
    filter: brightness(1.05);
}

/* Enhanced Notifications - Floating Toast System */
.notification {
    position: relative;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    color: white;
    z-index: 99999;
    max-width: 450px;
    min-width: 300px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(25px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    word-wrap: break-word;
    white-space: normal;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.5;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.notification-success { 
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: rgba(34, 197, 94, 0.6);
    color: #dcfce7;
    box-shadow: 0 10px 40px rgba(34, 197, 94, 0.25);
}

.notification-error { 
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(239, 68, 68, 0.15) 100%);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fee2e2;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.25);
}

.notification-warning { 
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.6);
    color: #fef3c7;
    box-shadow: 0 10px 40px rgba(245, 158, 11, 0.25);
}

.notification.info { 
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.6);
    color: #dbeafe;
    box-shadow: 0 10px 40px rgba(59, 130, 246, 0.25);
}

.notification.success { 
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: rgba(34, 197, 94, 0.6);
    color: #dcfce7;
    box-shadow: 0 10px 40px rgba(34, 197, 94, 0.25);
}

.notification.error { 
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(239, 68, 68, 0.15) 100%);
    border-color: rgba(239, 68, 68, 0.6);
    color: #fee2e2;
    box-shadow: 0 10px 40px rgba(239, 68, 68, 0.25);
}

.notification.warning { 
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.35) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-color: rgba(245, 158, 11, 0.6);
    color: #fef3c7;
    box-shadow: 0 10px 40px rgba(245, 158, 11, 0.25);
}

@keyframes slideInNotification {
    from { 
        transform: translateX(400px); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

@keyframes slideOutNotification {
    from { 
        transform: translateX(0); 
        opacity: 1; 
    }
    to { 
        transform: translateX(400px); 
        opacity: 0; 
    }
}

@keyframes slideIn {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* Mobile Responsive Notifications */
@media (max-width: 768px) {
    #notification-container {
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-width: none !important;
    }

    .notification {
        min-width: auto !important;
        font-size: 0.9rem;
        padding: 1rem 1.2rem !important;
    }

    @keyframes slideInNotification {
        from { 
            transform: translateY(-100px); 
            opacity: 0; 
        }
        to { 
            transform: translateY(0); 
            opacity: 1; 
        }
    }

    @keyframes slideOutNotification {
        from { 
            transform: translateY(0); 
            opacity: 1; 
        }
        to { 
            transform: translateY(-100px); 
            opacity: 0; 
        }
    }
}

/* Enhanced Celebration Confetti */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

@media (max-width: 768px) {
  .nav {
    padding: 0 1rem;
    height: 60px;
  }
  .nav-brand { font-size: 1.3rem; }
  .nav-links {
    flex-direction: column;
    background: rgba(15,23,42,0.98);
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    display: none;
  }
  .nav-links.active { display: flex; }
  .mobile-menu-btn { display: block; }

  .timer-circle {
    width: 220px;
    height: 220px;
  }
  .timer-inner {
    width: 180px;
    height: 180px;
  }
  .timer-time { font-size: 2rem; }
  .status-grid, .dashboard-grid, .groups-list {
    grid-template-columns: 1fr;
  }
  .control-btn {
    width: 100%;
    padding: 1rem;
  }
  .page {
    padding: 80px 1rem 2rem;
  }
}


.hidden {
    display: none !important;
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--quantum-blue);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced Chart Container */
.chart-container {
    margin-top: 2.5rem;
    height: 320px;
    position: relative;
}

/* Enhanced Analytics Cards */
.analytics-card {
    background: var(--card);
    border-radius: 24px;
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: var(--shadow);
    box-sizing: border-box;
    width: 100%;
}

.analytics-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;

}

.analytics-card-title {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 5px 15px rgba(0, 180, 216, 0.3);
}

.analytics-card-icon {
    font-size: 3rem;
    filter: drop-shadow(0 5px 15px rgba(0, 180, 216, 0.3));
}

/* Daily Study Time Editor */

/* === Fixed: Daily Study Time Editor (updated) === */
.daily-time-editor {
    margin-top: 1.5rem;
    background: var(--surface);
    border-radius: 18px;
    padding: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}


.daily-time-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.daily-time-title {
    font-size: 1.2rem;
    font-weight: 600;
}


/* === Fixed: Daily Study Time Grid (auto-fit, compact) === */
.daily-time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); /* Responsive compact columns */
    gap: 0.5rem; /* compact gap */
    align-items: start;
    width: 100%;
    box-sizing: border-box;
}



/* === Fixed: Daily Study Time Item (smaller, fit-friendly) === */
.daily-time-item {
    background: var(--card);
    border-radius: 10px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
    font-size: 0.8rem;
    line-height: 1.1;
    word-break: break-word;
    box-sizing: border-box;
}


.daily-time-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.daily-time-item.active {
    background: var(--quantum-blue);
    color: white;
    border-color: var(--quantum-blue);
    box-shadow: 0 10px 25px rgba(0, 180, 216, 0.3);
}

.daily-time-day {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.daily-time-value {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Heatmap color levels based on goal progress */
.daily-time-item.heat-level-0 {
    background: var(--card);
}
.daily-time-item.heat-level-1 {
    background: rgba(0, 180, 216, 0.12);
    border-color: rgba(0, 180, 216, 0.15);
}
.daily-time-item.heat-level-2 {
    background: rgba(0, 180, 216, 0.28);
    border-color: rgba(0, 180, 216, 0.3);
}
.daily-time-item.heat-level-3 {
    background: rgba(0, 180, 216, 0.5);
    border-color: rgba(0, 180, 216, 0.5);
    color: #fff;
}
.daily-time-item.heat-level-4 {
    background: rgba(0, 180, 216, 0.8);
    border-color: rgba(0, 180, 216, 0.7);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 180, 216, 0.25);
}

/* Edit Modal for Daily Time */
.daily-time-edit-modal {
    max-width: 450px;
}

.time-input-group {
    display: flex;
    gap: 1.2rem;
    align-items: center;
}

.time-input {
    flex: 1;
    padding: 1.2rem;
    background: var(--card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text);
    font-size: 1.2rem;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.time-input:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.time-separator {
    font-size: 1.4rem;
    font-weight: bold;
}

/* Enhanced Leaderboard with Animations */
.leaderboard-item {
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    animation: slideInUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.leaderboard-item:hover {
    transform: scale(1.02);
}

/* Improved Mobile Experience */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.6rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 1.5rem;
        border-radius: 0 0 18px 18px;
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
        z-index: 999;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-top: none;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Study Focus Mode */
.focus-mode {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.focus-mode.hidden {
    opacity: 0;
    pointer-events: none;
}

.focus-timer {
    font-size: 7rem;
    font-weight: 900;
    color: white;
    margin-bottom: 3rem;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 30px rgba(0, 180, 216, 0.7);
}

.focus-quote {
    font-size: 1.8rem;
    color: var(--muted);
    text-align: center;
    max-width: 700px;
    margin-bottom: 4rem;
    font-style: italic;
    line-height: 1.6;
}

.focus-controls {
    display: flex;
    gap: 1.5rem;
}

/* Enhanced Progress Visualization */
.progress-ring {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0.5rem auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    filter: drop-shadow(0 0 6px rgba(0, 180, 216, 0.3));
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.progress-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
}

/* Group Invite Modal */
.invite-modal {
    max-width: 550px;
}

.invite-code {
    background: var(--card);
    padding: 2rem;
    border-radius: 18px;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: 6px;
    margin: 2rem 0;
    color: var(--quantum-blue);
    border: 2px dashed var(--quantum-blue);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.invite-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Achievement Badges */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    background: var(--card);
    padding: 0.7rem 1.2rem;
    border-radius: 24px;
    margin: 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.achievement-badge:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.achievement-badge i {
    color: gold;
    font-size: 1.4rem;
    filter: drop-shadow(0 3px 10px rgba(255, 215, 0, 0.4));
}

/* Focus Mode Styles */
#focusModeContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--space-black);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 9999;
}
.focus-mode-hidden {
    display: none !important;
}
.focus-timer {
    color: white;
    font-family: 'Orbitron', sans-serif;
    text-align: center;
}
#focusTimerTime {
    font-size: 11rem;
    margin-bottom: 25px;
    text-shadow: 0 0 40px rgba(0, 180, 216, 0.8);
}
#focusTimerStatus {
    font-size: 2.5rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0, 230, 214, 0.7);
}

/* === FlipClock Focus Mode Patch === */
.focus-mode { 
    position: fixed;
    inset: 0;
    background: var(--space-black);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.focus-mode.hidden { 
    opacity: 0;
    pointer-events: none;
}
.focus-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.flipclock {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
}
.flipclock .colon {
    font-size: clamp(55px, 10vw, 140px);
    line-height: 1;
    color: var(--muted);
    opacity: 0.9;
    transform: translateY(-4%);
    text-shadow: 0 0 15px rgba(0, 180, 216, 0.5);
}
.flipclock .tile {
    position: relative;
    width: clamp(60px, 11vw, 160px);
    height: clamp(80px, 16vw, 200px);
    border-radius: 16px;
    background: var(--deep-space);
    box-shadow: 
        0 12px 35px rgba(0, 0, 0, 0.5),
        inset 0 -3px 0 rgba(255, 255, 255, 0.05),
        inset 0 3px 0 rgba(255, 255, 255, 0.08),
        0 0 20px rgba(0, 180, 216, 0.3);
    overflow: hidden;
    perspective: 900px;
}
.flipclock .tile::before, .flipclock .tile::after {
    content: attr(data-value);
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 900 clamp(48px, 9vw, 140px) / 1.1 "Courier New", monospace;
    color: #eaeaea;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}
.flipclock .tile::before {
    top: 0;
    height: 50%;
    border-bottom: 1px solid rgba(34, 34, 34, 0.8);
    background: linear-gradient(to bottom, #222, #111);
}
.flipclock .tile::after {
    bottom: 0;
    height: 50%;
    border-top: 1px solid rgba(34, 34, 34, 0.8);
    background: linear-gradient(to bottom, #111, #000);
}

/* flip animation */
.flipclock .tile.animating .top, .flipclock .tile.animating .bottom {
    animation-duration: 0.4s;
    animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
    animation-fill-mode: forwards;
}
.flipclock .tile .top, .flipclock .tile .bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 900 clamp(48px, 9vw, 140px) / 1.1 "Courier New", monospace;
    color: #eaeaea;
    backface-visibility: hidden;
    text-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}
.flipclock .tile .top {
    top: 0;
    transform-origin: bottom;
    background: linear-gradient(to bottom, #222, #111);
    border-bottom: 1px solid rgba(34, 34, 34, 0.8);
}
.flipclock .tile .bottom {
    bottom: 0;
    transform-origin: top;
    background: linear-gradient(to bottom, #111, #000);
    border-top: 1px solid rgba(34, 34, 34, 0.8);
}

@keyframes fold {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); }
}
@keyframes unfold {
    0% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}
.flipclock .tile.animating .top {
    animation-name: fold;
}
.flipclock .tile.animating .bottom {
    animation-name: unfold;
    animation-delay: 0.2s;
}

/* helpful hint for users */
.focus-controls .control-btn {
    font-size: 1.1rem;
}

/* === Added: Unread banner + divider + 2-column layout for Group & Leaderboard === */
.unread-banner {
    position: sticky;
    top: 0;
    text-align: center;
    font-size: 1rem;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 5;
    border-radius: 0 0 12px 12px;
    color: var(--text);
    font-weight: 600;
}
.unread-divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    margin: 0.9rem 0;
}
.unread-divider::before, .unread-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
}

/* Active group container */
#activeGroupContainer {
    display: block;
}

@media (max-width: 900px) {
    .group-content-grid {
        grid-template-columns: 1fr;
    }

    .groups-top-bar {
        justify-content: center;
    }

    .groups-top-right {
        align-items: center;
    }

    .groups-top-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .group-join-row {
        width: 100%;
    }

    .group-join-row .group-code-input {
        flex: 1;
    }

    .groups-list {
        grid-template-columns: 1fr;
    }

    .active-group-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .chat-container {
        height: 70vh;
        min-height: 400px;
        max-height: 700px;
        border-radius: 24px;
    }

    .chat-header {
        padding: 1rem 1.2rem;
    }

    .chat-title {
        font-size: 1.1rem;
    }

    .chat-input-area {
        padding: 0.8rem;
    }

    .chat-input {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        min-height: 44px;
        max-height: 80px;
    }

    .chat-btn {
        width: 44px;
        height: 44px;
        padding: 0.8rem;
    }

    .chat-input-container {
        gap: 0.6rem;
    }
}
body {
    transform: scale(0.52);
    transform-origin: top center;
}

html {
    background: var(--bg, #0a0e17);
}
.scroll-down-btn {
  position: absolute;
  bottom: 90px;

  /* CENTER IT */
  left: 50%;
  transform: translateX(-50%);

  /* MAKE IT BIGGER */
  width: 64px;
  height: 64px;
  font-size: 28px;

  border-radius: 50%;
  border: none;
  cursor: pointer;

  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: white;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 20;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.2s ease, opacity 0.2s ease;
}


.scroll-down-btn.hidden {
  display: none;
}
.scroll-down-btn:not(.hidden):hover {
  transform: translateX(-50%) scale(1.08);
}
.date-divider {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 22px 0;
  width: 100%;
}

.date-divider span {
  padding: 6px 16px;
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);

  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.3px;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.date-divider span::before,
.date-divider span::after {
  content: "";
  display: none;
}
/* 🔔 ADMIN / SERVER MESSAGE */
.chat-message.admin {
  background: linear-gradient(135deg, #1e293b, #020617);
  border: 1px solid #6366f1;
  box-shadow: 0 0 12px rgba(99,102,241,0.4);
  padding: 18px 20px;
  border-radius: 12px;
  margin: 10px auto;
  max-width: 90%;
}

/* Admin name */
.chat-message.admin .name {
  color: #a5b4fc;
  font-weight: 700;
  letter-spacing: 0.4px;
  font-size: 15px;
}

/* Admin badge */
.chat-message.admin .name::after {
  content: "  • SYSTEM";
  font-size: 12px;
  color: #facc15;
}

/* Center text slightly */
.chat-message.admin .text {
  color: #e5e7eb;
  text-align: center;
  font-size: 16px;
  line-height: 1.5;
}
/* ================= SUPPORT PAGE ================= */

.support-page {
  padding: 1rem;
  height: calc(100vh - 80px); /* nav height */
  display: flex;
  flex-direction: column;
}

.support-page .ai-chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #0f1117;
  border-radius: 12px;
  overflow: hidden;
}

/* Messages */
.support-page .ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Input */
.support-page .ai-input-bar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #020617;
}

.support-page textarea {
  font-size: 16px; /* prevents mobile zoom */
  flex: 1;
}

/* Desktop */
@media (min-width: 900px) {
  .support-page .ai-chat-container {
    max-width: 900px;
    margin: 0 auto;
  }
}

/* 🔥 FORCE FULL WIDTH ANALYTICS – FINAL OVERRIDE */
body #analytics-page,
body #analytics-page.page,
body #analytics-page.page.active {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
}
body #analytics-page .analytics-container {
    max-width: 100vw !important;
    width: 100vw !important;
    margin: 0 !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}
/* === End layout fix === */

/* Global Ranking Page */
.global-ranking-container {
    max-width: 1560px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.global-ranking-header {
    text-align: center;
    margin-bottom: 3rem;
}

.global-ranking-title {
    font-size: 3rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.global-ranking-subtitle {
    font-size: 1.1rem;
    color: var(--muted);
    margin: 0;
}

.global-ranking-tabs {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.global-ranking-header .refresh-btn {
    margin-top: 1rem;
}

.reset-time-card {
    background: var(--card);
    border-radius: 24px;
    padding: 2rem;
    margin-top: 4rem;
    margin-bottom: 3rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    text-align: center;
}

.reset-time-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.reset-note, .timezone-note {
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.reset-note span, .timezone-note span {
    font-weight: 700;
    color: white;
    background: var(--primary-gradient);
    padding: 0.4rem 1rem;
    border-radius: 12px;
}

/* Loading Spinner Animation */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--card);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
    will-change: transform;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === End Global Ranking Page === */

/* ======= Site Footer ======= */
.site-footer {
    margin-top: 1.5rem;
    padding: 1.5rem 1rem;
    border-top: none;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-logo {
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-tagline {
    font-size: 0.85rem;
    color: var(--muted);
    opacity: 0.7;
    font-weight: 400;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--quantum-blue);
}

.footer-dot {
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.7rem;
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--muted);
    opacity: 0.5;
}

.footer-copy strong {
    color: var(--quantum-blue);
    font-weight: 600;
}

/* =========================================
   THEME SYSTEM – 5 Selectable Themes
   Default theme is "Cosmic Dark" (the :root vars)
   ========================================= */

/* Theme 2: Ocean Depths */
[data-theme="ocean"] {
    --space-black: #03090f;
    --deep-space: #081923;
    --cosmic-purple: #0d2137;
    --nebula-blue: #0a3352;
    --galaxy-edge: #11476d;

    --quantum-blue: #00b4d8;
    --neon-cyan: #48cae4;
    --plasma-purple: #0077b6;
    --hologram-pink: #00c2c7;
    --matrix-green: #90e0ef;

    --primary-gradient: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    --secondary-gradient: linear-gradient(135deg, #48cae4 0%, #90e0ef 100%);
    --success-gradient: linear-gradient(135deg, #90e0ef 0%, #00b4d8 100%);
    --warning-gradient: linear-gradient(135deg, #00c2c7 0%, #0077b6 100%);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);

    --bg: var(--space-black);
    --surface: var(--deep-space);
    --card: var(--cosmic-purple);
    --text: rgba(255, 255, 255, 0.95);
    --muted: rgba(200, 220, 240, 0.65);
    --border: rgba(0, 180, 216, 0.15);
    --glass: rgba(8, 25, 35, 0.85);
    --glass-border: rgba(0, 180, 216, 0.2);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 16px 48px rgba(0, 180, 216, 0.2);
    --glow: 0 0 20px rgba(0, 180, 216, 0.25);
}

/* Theme 3: Royal Purple */
[data-theme="royal"] {
    --space-black: #0a060f;
    --deep-space: #120d1a;
    --cosmic-purple: #1d1429;
    --nebula-blue: #2a1d3d;
    --galaxy-edge: #3e2c5c;

    --quantum-blue: #b388ff;
    --neon-cyan: #ce93d8;
    --plasma-purple: #7c4dff;
    --hologram-pink: #ea80fc;
    --matrix-green: #e1bee7;

    --primary-gradient: linear-gradient(135deg, #b388ff 0%, #7c4dff 100%);
    --secondary-gradient: linear-gradient(135deg, #ce93d8 0%, #e1bee7 100%);
    --success-gradient: linear-gradient(135deg, #69f0ae 0%, #00e676 100%);
    --warning-gradient: linear-gradient(135deg, #ea80fc 0%, #7c4dff 100%);
    --danger-gradient: linear-gradient(135deg, #ff5252 0%, #d50000 100%);

    --bg: var(--space-black);
    --surface: var(--deep-space);
    --card: var(--cosmic-purple);
    --text: rgba(240, 230, 255, 0.95);
    --muted: rgba(220, 210, 240, 0.65);
    --border: rgba(179, 136, 255, 0.15);
    --glass: rgba(18, 13, 26, 0.85);
    --glass-border: rgba(179, 136, 255, 0.2);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 16px 48px rgba(179, 136, 255, 0.2);
    --glow: 0 0 20px rgba(179, 136, 255, 0.25);
}

/* Theme Selector UI Styles */
.theme-selector-card {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.theme-selector-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-selector-title i {
    color: var(--quantum-blue);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.theme-option {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    text-align: center;
}

.theme-option:hover {
    transform: translateY(-3px);
    border-color: var(--quantum-blue);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.theme-option.active {
    border-color: var(--quantum-blue);
    box-shadow: 0 0 16px rgba(0, 180, 216, 0.3);
    background: rgba(0, 180, 216, 0.08);
}

.theme-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.85rem;
    color: var(--quantum-blue);
    background: rgba(0,0,0,0.5);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-preview {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 0.8rem;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
}

.theme-preview span {
    flex: 1;
    border-radius: 4px;
}

.theme-option-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

@media (max-width: 767px) {
    .theme-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

/* ======= Task Manager Styles ======= */

/* Task Manager card on timer page */
.task-manager-card {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}
.task-manager-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 180, 216, 0.3);
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.1);
}
.task-manager-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--quantum-blue), #7b4bce);
    opacity: 0.8;
}

/* Task Manager modal — wider content */
#taskManagerModal .modal-content {
    max-width: 880px;
    max-height: 85vh;
}

/* Task Create Section */
.task-create-section {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.task-create-row {
    margin-bottom: 1rem;
}

.task-input {
    width: 100%;
    padding: 1.15rem 1.3rem;
    background: var(--card);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text);
    font-size: 1.32rem;
    font-family: inherit;
    transition: all 0.3s ease;
}
.task-input:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}
.task-input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

.task-time-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.task-time-field {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.task-time-input {
    width: 64px;
    padding: 0.85rem 0.5rem;
    background: var(--card);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text);
    font-size: 1.38rem;
    font-weight: 700;
    font-family: inherit;
    text-align: center;
    transition: all 0.3s ease;
    -moz-appearance: textfield;
    appearance: textfield;
}
.task-time-input::-webkit-outer-spin-button,
.task-time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.task-time-input:focus {
    outline: none;
    border-color: var(--quantum-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.15);
}

.task-time-label {
    color: var(--muted);
    font-size: 1.26rem;
    font-weight: 600;
    user-select: none;
}

.task-add-btn {
    margin-left: auto;
    padding: 0.85rem 1.6rem;
    background: linear-gradient(135deg, var(--quantum-blue), #0096c7);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.25);
}
.task-add-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 180, 216, 0.35);
}
.task-add-btn:active {
    transform: translateY(0);
}

/* Task Empty Message */
.task-empty-msg {
    color: var(--muted);
    text-align: center;
    padding: 3rem 1rem;
    font-size: 1.38rem;
    opacity: 0.8;
}

/* Task List */
.task-list {
    max-height: 456px;
    overflow-y: auto;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.task-list::-webkit-scrollbar {
    width: 5px;
}
.task-list::-webkit-scrollbar-track {
    background: transparent;
}
.task-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* Task Item */
.task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    margin-bottom: 0.6rem;
    transition: all 0.25s ease;
}
.task-item:hover {
    border-color: rgba(0, 180, 216, 0.25);
    background: rgba(255, 255, 255, 0.04);
}
.task-item.active-task {
    border-color: var(--quantum-blue);
    background: rgba(0, 180, 216, 0.06);
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.08);
}
.task-item.completed-task {
    opacity: 0.55;
    padding: 0.85rem 1.25rem;
}
.task-item.completed-task .task-name {
    text-decoration: line-through;
    color: var(--muted);
}

.task-item-main {
    flex: 1;
    min-width: 0;
}

.task-name {
    font-weight: 600;
    font-size: 1.44rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.task-time-info {
    font-size: 1.2rem;
    color: var(--muted);
    margin-top: 0.25rem;
}
.task-time-info .elapsed {
    color: var(--quantum-blue);
    font-weight: 600;
}
.task-time-info .task-remain {
    opacity: 0.7;
    font-size: 1.14rem;
}

/* Task progress bar */
.task-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
}
.task-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--quantum-blue), #0096c7);
    border-radius: 4px;
    transition: width 0.5s ease;
}
.active-task .task-progress-fill {
    background: linear-gradient(90deg, #00ff9d, var(--quantum-blue));
}

/* Completed tasks divider */
.completed-tasks-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.6rem;
    font-size: 1.08rem;
    color: var(--muted);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.completed-tasks-divider::before,
.completed-tasks-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* Task action buttons */
.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.task-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}
.task-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    transform: scale(1.05);
}
.task-action-btn:active {
    transform: scale(0.95);
}
.task-action-btn.start-task:hover {
    border-color: #00ff9d;
    color: #00ff9d;
    background: rgba(0, 255, 157, 0.08);
}
.task-action-btn.complete-task:hover {
    border-color: var(--quantum-blue);
    color: var(--quantum-blue);
    background: rgba(0, 180, 216, 0.08);
}
.task-action-btn.delete-task:hover {
    border-color: #ff4d6d;
    color: #ff4d6d;
    background: rgba(255, 77, 109, 0.08);
}
.task-action-btn.stop-task {
    border-color: rgba(255, 159, 67, 0.3);
    color: #ff9f43;
}
.task-action-btn.stop-task:hover {
    border-color: #ff9f43;
    color: #ff9f43;
    background: rgba(255, 159, 67, 0.1);
}

/* Active task badge in modal */
.active-task-badge {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.2);
    margin-top: 1.25rem;
    font-size: 1.32rem;
    color: var(--text);
}

/* Task breakdown in save confirm */
.task-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: var(--glass);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}
.task-breakdown-item .task-b-name {
    color: var(--text);
    font-weight: 500;
}
.task-breakdown-item .task-b-time {
    color: var(--quantum-blue);
    font-weight: 600;
}

/* Task report sections */
.task-report-section {
    margin-bottom: 1rem;
}
.task-report-section h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}
.task-report-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: var(--glass);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

/* Timer active task indicator */
.timer-active-task-label {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--quantum-blue);
    display: none;
}
.timer-active-task-label.visible {
    display: block;
}

/* ======= Daily Goal Analytics Card ======= */
.daily-goal-analytics-card {
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}
.goal-analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}
.goal-progress-section {
    margin-top: 0.5rem;
}
.goal-progress-numbers {
    margin-bottom: 0.5rem;
}
.goal-progress-bar-track {
    width: 100%;
    height: 14px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    position: relative;
}
.goal-progress-bar-fill {
    height: 100%;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--quantum-blue), #00ff88);
    transition: width 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    min-width: 0;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

/* Tasks completed analytics list */
.task-analytics-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    border-radius: 10px;
    background: var(--glass);
    margin-bottom: 0.4rem;
}
.task-analytics-item .ta-name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}
.task-analytics-item .ta-date {
    font-size: 0.75rem;
    color: var(--muted);
}
.task-analytics-item .ta-time {
    font-weight: 700;
    color: var(--quantum-blue);
    white-space: nowrap;
}

/* Task Save Breakdown Row */
.task-save-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--glass-border, rgba(255,255,255,0.06));
    font-size: 0.95rem;
}
.task-save-row span:first-child {
    color: var(--text);
}
.task-save-row span:last-child {
    font-weight: 700;
    color: var(--quantum-blue);
}

/* ======= Timer Mode Selector ======= */
.timer-mode-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    flex-basis: 100%;
}

.control-btn.mode-btn {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--quantum-blue);
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.15);
    gap: 0.5rem;
}

.control-btn.mode-btn:hover {
    border-color: var(--quantum-blue);
    box-shadow: 0 12px 32px rgba(0, 180, 216, 0.25);
}

.mode-chevron {
    font-size: 0.65rem !important;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.timer-mode-wrapper.open .mode-chevron {
    transform: rotate(180deg);
}

.mode-dropdown-list {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    transform-origin: bottom center;
    min-width: 240px;
    background: var(--card);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0.5rem;
    z-index: 500;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    pointer-events: none;
}

.timer-mode-wrapper.open .mode-dropdown-list {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mode-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    position: relative;
}

.mode-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.mode-dropdown-item.active {
    background: rgba(0, 180, 216, 0.1);
    color: var(--quantum-blue);
}
.mode-dropdown-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--quantum-blue);
    border-radius: 4px;
}

.mode-icon {
    font-size: 1.2rem;
}

.mode-check {
    margin-left: auto;
    opacity: 0;
    color: var(--quantum-blue);
    font-size: 0.75rem;
    transition: opacity 0.2s;
}

.mode-dropdown-item.active .mode-check {
    opacity: 1;
}

/* Custom Time Picker Styles */
.custom-time-row {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.custom-time-field {
    text-align: center;
}

.custom-time-field .form-input {
    width: 100px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem;
}

/* Timer countdown complete pulse */
@keyframes countdownComplete {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 157, 0.4); }
    50% { box-shadow: 0 0 60px rgba(0, 255, 157, 0.8); }
}

.timer-circle.completed {
    animation: countdownComplete 1s ease infinite;
}

/* Mode badge on timer */
.timer-mode-badge {
    display: inline-block;
    background: rgba(0, 180, 216, 0.15);
    color: var(--quantum-blue);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0, 180, 216, 0.2);
}

/* Theme Dropdown Button */
.theme-dropdown-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.theme-dropdown-btn {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--quantum-blue);
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.theme-dropdown-btn:hover {
    border-color: var(--quantum-blue);
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.2);
}

.theme-dropdown-btn i:last-child {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.theme-dropdown-wrapper.open .theme-dropdown-btn i:last-child {
    transform: rotate(180deg);
}

.theme-dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scaleY(0);
    transform-origin: top center;
    min-width: 220px;
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 0.5rem;
    z-index: 500;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

.theme-dropdown-wrapper.open .theme-dropdown-list {
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
}

.theme-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    width: 100%;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.theme-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.theme-dropdown-item.active {
    background: rgba(0, 180, 216, 0.12);
    color: var(--quantum-blue);
}

.theme-dropdown-item.active .theme-check {
    opacity: 1;
}

.theme-color-dots {
    display: flex;
    gap: 3px;
}

.theme-color-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
}

.theme-check {
    margin-left: auto;
    opacity: 0;
    color: var(--quantum-blue);
    font-size: 0.8rem;
}

/* ======= Profile Page Styles ======= */
#profile-page {
    font-size: 125%;
    padding-top: 105px;
}

@media (min-width: 768px) {
    #profile-page {
        padding-top: 135px;
    }
}

#profile-page h1 {
    font-size: 2.25rem !important;
}

#profile-page h2 {
    font-size: 1.625rem !important;
}

#profile-page p,
#profile-page span,
#profile-page div,
#profile-page button {
    font-size: inherit;
}

.profile-container {
    max-width: 1350px;
    margin: 0 auto;
    padding: 0 1rem;
}

.profile-section {
    background: var(--glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s ease;
}

.profile-section:hover {
    border-color: rgba(0, 180, 216, 0.15);
}

.profile-header {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.profile-avatar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.profile-avatar-display {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border: 3px solid var(--quantum-blue);
    box-shadow: 0 0 24px rgba(0, 180, 216, 0.35);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-avatar-display:hover {
    transform: scale(1.05);
    box-shadow: 0 0 32px rgba(0, 180, 216, 0.5);
}

.profile-edit-btn {
    background: rgba(0, 180, 216, 0.15);
    color: var(--quantum-blue);
    border: 1px solid rgba(0, 180, 216, 0.3);
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    font-family: inherit;
}

.profile-edit-btn:hover {
    background: rgba(0, 180, 216, 0.25);
    transform: translateY(-1px);
}

.profile-info {
    flex: 1;
    min-width: 250px;
}

.profile-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.profile-email {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.profile-country {
    font-size: 1rem;
    color: var(--quantum-blue);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.profile-stat-card {
    background: rgba(0, 180, 216, 0.06);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.25s ease;
}

.profile-stat-card:hover {
    border-color: rgba(0, 180, 216, 0.25);
    transform: translateY(-2px);
}

.profile-stat-card.warm {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.06), rgba(255, 200, 0, 0.06));
    border-color: rgba(255, 165, 0, 0.2);
}

.profile-stat-card.warm:hover {
    border-color: rgba(255, 165, 0, 0.4);
}

.profile-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--quantum-blue);
    margin-bottom: 0.3rem;
}

.profile-stat-label {
    font-size: 0.9rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Account status bar */
.profile-status-bar {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-status-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.profile-status-icon {
    font-size: 1.2rem;
}

.profile-status-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.profile-status-label {
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-status-value {
    font-weight: 600;
    color: #00ff88;
    font-size: 1rem;
}

/* Profile section header */
.profile-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-section-title i {
    font-size: 1rem;
}

/* Bio section */
.profile-bio-box {
    background: rgba(132, 250, 176, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.profile-bio-text {
    color: var(--muted);
    word-break: break-word;
    min-height: 50px;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.profile-bio-text .placeholder {
    color: var(--muted);
    font-style: italic;
    opacity: 0.5;
}

.profile-bio-btn {
    width: 100%;
    background: rgba(0, 180, 216, 0.12);
    color: var(--quantum-blue);
    border: 1px solid rgba(0, 180, 216, 0.2);
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    font-family: inherit;
}

.profile-bio-btn:hover {
    background: rgba(0, 180, 216, 0.2);
    transform: translateY(-1px);
}

/* Weekly target section */
.profile-target-box {
    background: rgba(0, 180, 216, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}

.profile-target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.profile-target-header span {
    font-weight: 600;
    color: var(--text);
}

.profile-target-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.profile-target-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-target-stat .label {
    color: var(--muted);
}

.profile-target-stat .value {
    font-weight: 600;
    color: var(--quantum-blue);
}

.profile-progress-track {
    width: 100%;
    height: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.profile-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--quantum-blue), #00ff88);
    border-radius: 10px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Profile action buttons */
.profile-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.profile-action-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.9rem;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
    font-family: inherit;
}

.profile-action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.profile-action-btn.support {
    background: rgba(0, 180, 216, 0.15);
    color: var(--quantum-blue);
    border: 1px solid rgba(0, 180, 216, 0.3);
}

.profile-action-btn.danger {
    background: rgba(255, 77, 109, 0.12);
    color: #ff4d6d;
    border: 1px solid rgba(255, 77, 109, 0.3);
}

.profile-action-btn.logout {
    background: linear-gradient(135deg, #ff4d6d 0%, #ff006e 100%);
    color: white;
}

/* Groups/Tags list in profile */
.profile-empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
}

.profile-empty-state .emoji {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

/* ===== EMPTY STATE CONTAINERS WITH TIPS ===== */
.empty-state-container {
    text-align: center;
    padding: 2.5rem 2rem;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.25rem;
    opacity: 0.5;
}

.empty-state-message {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.empty-state-tip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    font-size: 0.92rem;
    color: var(--muted);
    max-width: 380px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    text-align: left;
}

.empty-state-tip strong {
    color: var(--text);
    white-space: nowrap;
}

/* ================================================
   VISUAL IMPROVEMENTS — Added Enhancements
   ================================================ */

/* === 1. Timer Progress Ring (SVG overlay inside timer-circle) === */
.timer-progress-ring {
    position: absolute;
    top: 5px;
    left: 5px;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    z-index: 1;
    pointer-events: none;
    transform: rotate(-90deg);
}
.timer-progress-ring circle {
    fill: none;
    stroke-width: 6;
}
.timer-progress-ring .progress-bg {
    stroke: rgba(255, 255, 255, 0.06);
}
.timer-progress-ring .progress-fill {
    stroke: url(#timerProgressGradient);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
    filter: drop-shadow(0 0 6px rgba(0, 230, 214, 0.5));
    opacity: 0;
}
.timer-progress-ring .progress-fill.active {
    opacity: 1;
}
.timer-inner {
    z-index: 2;
}

/* === 2. Session Save Celebration (ripple + confetti) === */
@keyframes celebrationRipple {
    0% { transform: scale(0.8); opacity: 0.7; }
    100% { transform: scale(2.5); opacity: 0; }
}
.celebration-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    margin: -100px 0 0 -100px;
    border-radius: 50%;
    background: var(--primary-gradient);
    pointer-events: none;
    z-index: 0;
    animation: celebrationRipple 1s ease-out forwards;
}
@keyframes confettiFall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(120px) rotate(360deg); opacity: 0; }
}
.confetti-piece {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    pointer-events: none;
    z-index: 100000;
    animation: confettiFall 1.5s ease-out forwards;
}

/* === 3. Notification Icons === */
.notification::before {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.notification-success::before, .notification.success::before { content: '✓'; }
.notification-error::before, .notification.error::before { content: '✕'; }
.notification-warning::before, .notification.warning::before { content: '⚠'; }
.notification-info::before, .notification.info::before { content: 'ℹ'; }

/* === 5. Smooth Number Transitions on Timer === */
.timer-time {
    transition: opacity 0.15s ease;
}
.timer-time.digit-change {
    animation: digitPop 0.3s ease;
}
@keyframes digitPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* === 6. Leaderboard Rank Badges === */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-right: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* === 9. Skeleton Loading States === */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease infinite;
    border-radius: 12px;
}
.skeleton-leaderboard-item {
    height: 70px;
    margin-bottom: 1rem;
    border-radius: 18px;
}
.skeleton-chart {
    height: 280px;
    border-radius: 18px;
    margin-top: 2rem;
}
.skeleton-text {
    height: 1rem;
    width: 60%;
    margin: 0.5rem 0;
    border-radius: 6px;
}
.skeleton-text.short { width: 35%; }
.skeleton-text.long { width: 85%; }

/* === 10. Nav Button Hover Micro-Interactions (desktop only) === */
@media (hover: hover) and (pointer: fine) {
    .nav-btn {
        transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    }
    .nav-btn:hover:not(.active) {
        transform: translateY(-2px) scale(1.03);
    }
    .nav-btn:hover:not(.active) i {
        transition: transform 0.3s ease;
        transform: scale(1.15);
    }
}

/* === 13. Chat Relative Timestamps on Hover === */
.message-time {
    position: relative;
}
.message-time .absolute-time {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--surface);
    color: var(--text);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 10;
}
.message-time:hover .absolute-time {
    display: block;
}

/* === 14. Dark Mode Theme Variants === */
/* Warm Amber theme */
[data-theme="amber"] {
    --quantum-blue: #f59e0b;
    --neon-cyan: #fbbf24;
    --plasma-purple: #d97706;
    --matrix-green: #34d399;
    --hologram-pink: #fb923c;
    --primary-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --secondary-gradient: linear-gradient(135deg, #fbbf24 0%, #34d399 100%);
    --success-gradient: linear-gradient(135deg, #34d399 0%, #f59e0b 100%);
    --warning-gradient: linear-gradient(135deg, #fb923c 0%, #d97706 100%);
    --glow: 0 0 20px rgba(245, 158, 11, 0.3);
    --shadow-hover: 0 16px 48px rgba(245, 158, 11, 0.25);
    --border: rgba(245, 158, 11, 0.15);
    --glass-border: rgba(245, 158, 11, 0.2);
}

/* Cool Mint theme */
[data-theme="mint"] {
    --quantum-blue: #10b981;
    --neon-cyan: #6ee7b7;
    --plasma-purple: #059669;
    --matrix-green: #34d399;
    --hologram-pink: #14b8a6;
    --primary-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --secondary-gradient: linear-gradient(135deg, #6ee7b7 0%, #34d399 100%);
    --success-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --warning-gradient: linear-gradient(135deg, #14b8a6 0%, #059669 100%);
    --glow: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-hover: 0 16px 48px rgba(16, 185, 129, 0.25);
    --border: rgba(16, 185, 129, 0.15);
    --glass-border: rgba(16, 185, 129, 0.2);
}

/* Rose theme */
[data-theme="rose"] {
    --quantum-blue: #f43f5e;
    --neon-cyan: #fb7185;
    --plasma-purple: #e11d48;
    --matrix-green: #34d399;
    --hologram-pink: #f43f5e;
    --primary-gradient: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --secondary-gradient: linear-gradient(135deg, #fb7185 0%, #34d399 100%);
    --success-gradient: linear-gradient(135deg, #34d399 0%, #f43f5e 100%);
    --warning-gradient: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
    --glow: 0 0 20px rgba(244, 63, 94, 0.3);
    --shadow-hover: 0 16px 48px rgba(244, 63, 94, 0.25);
    --border: rgba(244, 63, 94, 0.15);
    --glass-border: rgba(244, 63, 94, 0.2);
}

/* ===== DONOR PREMIUM STYLES ===== */

/* --- PREMIUM ROW: Override ALL rank backgrounds --- */
.leaderboard-item.donor-row,
.leaderboard-item.donor-row.rank-1,
.leaderboard-item.donor-row.rank-2,
.leaderboard-item.donor-row.rank-3,
.global-leaderboard-item.donor-row,
.global-leaderboard-item.donor-row.rank-1,
.global-leaderboard-item.donor-row.rank-2,
.global-leaderboard-item.donor-row.rank-3 {
    background: linear-gradient(135deg, #0a0a1a 0%, #131335 40%, #1a0a2e 70%, #0d0d24 100%) !important;
    color: #f0f0f0 !important;
    border: none !important;
    overflow: visible !important;
    box-shadow: none !important;
    animation: none !important;
    position: relative;
    isolation: isolate;
    contain: layout style;
}

/* Animated gradient border via pseudo */
.leaderboard-item.donor-row::before,
.global-leaderboard-item.donor-row::before {
    content: '';
    position: absolute;
    inset: -2.5px;
    border-radius: 20px;
    padding: 2.5px;
    background: linear-gradient(90deg, #ffd700, #e63946, #2d6aff, #2ec4b6, #f77f00, #ffd700);
    background-size: 300% 100%;
    animation: donorBorderFlow 10s linear infinite;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    z-index: -1;
    pointer-events: none;
    will-change: background-position;
}

/* Soft inner glow — GPU-efficient opacity pulse */
.leaderboard-item.donor-row::after,
.global-leaderboard-item.donor-row::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background:
        radial-gradient(ellipse at 15% 50%, rgba(255, 215, 0, 0.12), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(230, 57, 70, 0.08), transparent 50%),
        radial-gradient(ellipse at 85% 50%, rgba(45, 106, 255, 0.10), transparent 55%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
    animation: donorGlowPulse 3s ease-in-out infinite;
    will-change: opacity;
}

/* Animated sweep light */
.donor-row .donor-sweep {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.donor-row .donor-sweep::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), rgba(255,215,0,0.06), rgba(168,85,247,0.04), transparent);
    animation: donorSweepMove 10s ease-in-out infinite;
    will-change: transform;
}

/* Static outer glow + GPU-efficient opacity pulse on ::after */
.leaderboard-item.donor-row,
.global-leaderboard-item.donor-row {
    box-shadow:
        0 0 12px rgba(255, 215, 0, 0.18),
        0 0 30px rgba(45, 106, 255, 0.1),
        0 0 50px rgba(230, 57, 70, 0.06) !important;
    animation: none !important;
}

@keyframes donorBorderFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}
@keyframes donorSweepMove {
    0%   { transform: translateX(-160%); }
    50%  { transform: translateX(160%); }
    100% { transform: translateX(-160%); }
}
@keyframes donorGlowPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Keep children above pseudo layers */
.donor-row > * {
    position: relative;
    z-index: 1;
}

/* --- Study time always visible on premium row --- */
.donor-row .study-time {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.3) !important;
}

/* --- Rank # rainbow for donors --- */
.donor-row .rank {
    background: linear-gradient(135deg, #ffd700, #e63946, #2d6aff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: donorRankShift 3s ease infinite;
    font-weight: 900;
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
    will-change: background-position;
}
@keyframes donorRankShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* --- Donor NAME with rainbow shimmer --- */
.donor-name {
    background: linear-gradient(90deg, #ffd700, #ff6b6b, #a855f7, #00f2fe, #ffd700);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: donorShimmer 2.5s ease infinite;
    font-weight: 800 !important;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0;
    overflow: visible !important;
    will-change: background-position;
}

@keyframes donorShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Name glow */
.leaderboard-item .donor-name,
.global-leaderboard-item .donor-name {
    text-shadow: none;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.3));
}

/* --- Sparkle particles around the name --- */
.donor-sparkles {
    position: absolute;
    inset: -14px -20px;
    pointer-events: none;
    z-index: 3;
    overflow: visible;
}
.donor-sparkle {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: donorSparkleOrbit 3s ease-in-out infinite;
    opacity: 0;
}
.donor-sparkle:nth-child(1) { top: 0; left: 5%; animation-delay: 0s; background: #ffd700; }
.donor-sparkle:nth-child(2) { top: 50%; right: -10px; animation-delay: 0.4s; background: #ff6b6b; }
.donor-sparkle:nth-child(3) { bottom: -2px; left: 35%; animation-delay: 0.8s; background: #a855f7; }
.donor-sparkle:nth-child(4) { top: 15%; left: 65%; animation-delay: 1.2s; background: #00f2fe; }
.donor-sparkle:nth-child(5) { bottom: -6px; right: 15%; animation-delay: 1.6s; background: #ffd700; }
.donor-sparkle:nth-child(6) { top: -8px; left: 50%; animation-delay: 2.0s; background: #ff6b6b; width: 4px; height: 4px; }

@keyframes donorSparkleOrbit {
    0%   { opacity: 0; transform: translate(0, 4px) scale(0.3); }
    20%  { opacity: 1; transform: translate(3px, -8px) scale(1.4); }
    50%  { opacity: 0.8; transform: translate(-2px, -14px) scale(1); }
    80%  { opacity: 0.3; transform: translate(4px, -18px) scale(0.6); }
    100% { opacity: 0; transform: translate(0, -22px) scale(0); }
}

/* Star-cross sparkles */
.donor-sparkle-star {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0;
    animation: donorStarPop 3.5s ease-in-out infinite;
}
.donor-sparkle-star::before,
.donor-sparkle-star::after {
    content: '';
    position: absolute;
    border-radius: 1px;
}
.donor-sparkle-star::before {
    width: 2px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffd700;
}
.donor-sparkle-star::after {
    width: 100%;
    height: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: #ffd700;
}
.donor-sparkle-star:nth-child(7)  { top: -10px; left: 20%; animation-delay: 0.2s; }
.donor-sparkle-star:nth-child(8)  { top: 35%; right: -14px; animation-delay: 1.0s; }
.donor-sparkle-star:nth-child(9)  { bottom: -10px; left: 55%; animation-delay: 1.8s; }
.donor-sparkle-star:nth-child(10) { top: -6px; right: 5%; animation-delay: 0.6s; }

.donor-sparkle-star:nth-child(8)::before,
.donor-sparkle-star:nth-child(8)::after { background: #a855f7; }
.donor-sparkle-star:nth-child(9)::before,
.donor-sparkle-star:nth-child(9)::after { background: #00f2fe; }
.donor-sparkle-star:nth-child(10)::before,
.donor-sparkle-star:nth-child(10)::after { background: #ff6b6b; }

@keyframes donorStarPop {
    0%   { opacity: 0; transform: scale(0) rotate(0deg); }
    12%  { opacity: 1; transform: scale(1.5) rotate(30deg); }
    24%  { opacity: 0.9; transform: scale(0.8) rotate(60deg); }
    40%  { opacity: 0; transform: scale(0.2) rotate(120deg); }
    100% { opacity: 0; transform: scale(0) rotate(180deg); }
}

/* --- Animated diamond badge (VISIBLE) --- */
.donor-diamond {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15em;
    margin-left: 4px;
    -webkit-text-fill-color: initial !important;
    animation: donorDiamondBounce 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(0, 200, 255, 0.5));
    vertical-align: middle;
    position: relative;
    z-index: 4;
    cursor: pointer;
    flex-shrink: 0;
}

@keyframes donorDiamondBounce {
    0%   { transform: translateY(0) scale(1) rotate(0deg); }
    12%  { transform: translateY(-5px) scale(1.2) rotate(10deg); }
    24%  { transform: translateY(0) scale(1) rotate(0deg); }
    36%  { transform: translateY(-3px) scale(1.15) rotate(-8deg); }
    48%  { transform: translateY(0) scale(1) rotate(0deg); }
    100% { transform: translateY(0) scale(1) rotate(0deg); }
}

/* --- Diamond tooltip (chess.com style) --- */
.donor-diamond-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 1.5px solid rgba(255, 215, 0, 0.4);
    border-radius: 10px;
    padding: 8px 14px;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 600;
    color: #f0f0f0;
    -webkit-text-fill-color: initial !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 215, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    line-height: 1.4;
}
.donor-diamond-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255, 215, 0, 0.4);
}
.donor-diamond-tip .tip-icon {
    font-size: 1em;
    margin-right: 4px;
    -webkit-text-fill-color: initial !important;
}
.donor-diamond:hover .donor-diamond-tip,
.donor-diamond:focus .donor-diamond-tip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

/* --- Premium animated circular avatar ring for donors --- */
.donor-avatar-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
    width: 55px;
    height: 55px;
    margin-right: 1.8rem;
}

/* Outer spinning conic gradient ring */
.donor-avatar-ring::before {
    content: '';
    position: absolute;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #ffd700, #ff6b6b, #a855f7, #00d4ff, #00ff9d, #fbbf24, #ff6b6b, #ffd700
    );
    animation: donorRingSpin 3s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    will-change: transform;
}

/* Inner dark mask to create ring shape + static glow + GPU opacity pulse */
.donor-avatar-ring::after {
    content: '';
    position: absolute;
    width: 57px;
    height: 57px;
    border-radius: 50%;
    background: #0f0f23;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    box-shadow:
        0 0 15px rgba(168, 85, 247, 0.35),
        0 0 30px rgba(255, 107, 107, 0.15);
    animation: donorRingGlow 2.5s ease-in-out infinite alternate;
    will-change: opacity;
}

/* Orbiting particle dots */
.donor-avatar-ring .donor-orbit-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    z-index: 3;
    pointer-events: none;
    filter: blur(0.3px);
    will-change: transform;
}
.donor-avatar-ring .donor-orbit-dot:nth-child(1) {
    background: #ffd700;
    box-shadow: 0 0 6px #ffd700;
    animation: donorOrbit1 2.8s linear infinite;
}
.donor-avatar-ring .donor-orbit-dot:nth-child(2) {
    background: #a855f7;
    box-shadow: 0 0 6px #a855f7;
    animation: donorOrbit2 3.2s linear infinite;
    width: 4px;
    height: 4px;
}
.donor-avatar-ring .donor-orbit-dot:nth-child(3) {
    background: #00d4ff;
    box-shadow: 0 0 6px #00d4ff;
    animation: donorOrbit3 3.6s linear infinite;
    width: 3px;
    height: 3px;
}

.donor-avatar-ring img {
    width: 55px;
    height: 55px;
    display: block;
    border-radius: 50%;
    border: none !important;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.25) !important;
    position: relative;
    z-index: 2;
    object-fit: cover;
    margin: 0 !important;
}

/* Spinning conic ring */
@keyframes donorRingSpin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Glow pulse — GPU-efficient opacity */
@keyframes donorRingGlow {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* 3 orbiting dots at different speeds/offsets — GPU-only (transform) */
@keyframes donorOrbit1 {
    0%   { transform: translate(-50%, -50%) rotate(0deg) translateX(34px) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg) translateX(34px) rotate(-360deg); }
}
@keyframes donorOrbit2 {
    0%   { transform: translate(-50%, -50%) rotate(120deg) translateX(34px) rotate(-120deg); }
    100% { transform: translate(-50%, -50%) rotate(480deg) translateX(34px) rotate(-480deg); }
}
@keyframes donorOrbit3 {
    0%   { transform: translate(-50%, -50%) rotate(240deg) translateX(34px) rotate(-240deg); }
    100% { transform: translate(-50%, -50%) rotate(600deg) translateX(34px) rotate(-600deg); }
}

/* Chat avatar ring (smaller) */
.message-group .donor-avatar-ring {
    width: 36px;
    height: 36px;
    margin-right: 0;
    overflow: visible;
}
.message-group .donor-avatar-ring::before {
    width: 44px;
    height: 44px;
}
.message-group .donor-avatar-ring::after {
    width: 38px;
    height: 38px;
}
.message-group .donor-avatar-ring img {
    width: 36px;
    height: 36px;
}
.message-group .donor-avatar-ring .donor-orbit-dot {
    display: block;
    width: 3px;
    height: 3px;
}

/* Mobile: shrink donor ring + leaderboard items */
@media (max-width: 768px) {
    .global-leaderboard-item .donor-avatar-ring,
    .leaderboard-item .donor-avatar-ring {
        width: 36px;
        height: 36px;
        margin-right: 0.6rem;
    }
    .global-leaderboard-item .donor-avatar-ring::before,
    .leaderboard-item .donor-avatar-ring::before {
        width: 44px;
        height: 44px;
    }
    .global-leaderboard-item .donor-avatar-ring::after,
    .leaderboard-item .donor-avatar-ring::after {
        width: 38px;
        height: 38px;
    }
    .global-leaderboard-item .donor-avatar-ring img,
    .leaderboard-item .donor-avatar-ring img {
        width: 36px !important;
        height: 36px !important;
    }
    .global-leaderboard-item .donor-avatar-ring .donor-orbit-dot,
    .leaderboard-item .donor-avatar-ring .donor-orbit-dot {
        display: block;
        width: 3px;
        height: 3px;
    }
    .global-leaderboard-item .user-avatar-small,
    .user-avatar-small {
        width: 36px;
        height: 36px;
        margin-right: 0.6rem;
    }
    .global-leaderboard-item {
        padding: 0.9rem 1rem;
    }
    .global-leaderboard-item .rank {
        font-size: 1.1rem;
        min-width: 36px;
        margin-right: 0.6rem;
    }
    .global-leaderboard-item .user-name-rank {
        font-size: 0.78rem;
    }
    .global-leaderboard-item .user-status {
        font-size: 0.72rem;
    }
    .global-leaderboard-item .study-time {
        font-size: 0.95rem;
    }
    .global-leaderboard-item .study-time-wrapper {
        min-width: 75px;
    }

    /* Hide ::after rank badges on mobile — inline rank-badge span is enough */
    .global-leaderboard-item.rank-1 .rank::after,
    .global-leaderboard-item.rank-2 .rank::after,
    .global-leaderboard-item.rank-3 .rank::after {
        display: none !important;
    }

    /* Fix study-time visibility for premium/donor users in top 3 */
    .global-leaderboard-item.donor-row.rank-1 .study-time,
    .global-leaderboard-item.donor-row.rank-2 .study-time,
    .global-leaderboard-item.donor-row.rank-3 .study-time {
        color: rgba(255, 255, 255, 0.95) !important;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.3) !important;
    }

    /* Prevent donor name extras from pushing study-time off screen */
    .global-leaderboard-item .user-name-rank {
        overflow: visible;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Donor sparkles — keep visible on mobile */
    .global-leaderboard-item .donor-sparkles,
    .leaderboard-item .donor-sparkles {
        display: block;
        inset: -8px -12px;
    }

    /* Shrink donor diamond badge on mobile */
    .global-leaderboard-item .donor-diamond {
        font-size: 0.8em;
        margin-left: 2px;
    }

    /* Rank badge smaller on mobile */
    .global-leaderboard-item .rank-badge {
        font-size: 1rem;
        margin-right: 0.25rem;
    }
}

/* Donor sender name in chat */
.donor-chat-name {
    background: linear-gradient(90deg, #ffd700, #ff6b6b, #a855f7, #00f2fe, #ffd700);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: donorShimmer 2.5s ease infinite;
    font-weight: 700 !important;
}
.own-donor-name {
    text-align: right;
    font-size: 0.78rem;
    margin-bottom: 2px;
}
.message-group.own.donor-message-group {
    flex-direction: row-reverse;
}
.message-group.own.donor-message-group .donor-avatar-ring {
    margin-right: 0;
    margin-left: 0.5rem;
}
.donor-chat-message {
    border: 1px solid rgba(255, 215, 0, 0.15);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.06);
}

/* Donate button in profile */
.profile-action-btn.donate {
    background: linear-gradient(135deg, #f9d423 0%, #ff4e50 100%);
    color: #000;
    font-weight: 700;
    border: none;
}
.profile-action-btn.donate:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Premium modal */
.premium-modal {
    text-align: center;
    max-width: 900px;
    max-height: 95vh;
    padding: 2.5rem 2rem;
}
.premium-modal .modal-title {
    font-size: 1.6rem;
}
.premium-price-hero {
    margin: 0.75rem 0 0.25rem;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3rem;
}
.premium-price {
    font-size: 4.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #f9d423, #ff4e50);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.premium-period {
    font-size: 1.7rem;
    color: var(--text-secondary, #a8a8a8);
    font-weight: 600;
}
.premium-perks {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    text-align: left;
}
.premium-perks li {
    padding: 0.4rem 0;
    font-size: 1.3rem;
    color: var(--text-primary, #e8e8e8);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.premium-perks li:last-child {
    border-bottom: none;
}
.perk-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}
.premium-activation-note {
    text-align: center;
    font-size: 1.1rem;
    color: #ffd700;
    font-weight: 600;
    margin-top: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 215, 0, 0.06);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.15);
}
.premium-pay-label {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 0.5rem;
    text-align: center;
}
.premium-show-qr-btn {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1.5px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    background: rgba(255, 215, 0, 0.06);
    color: #ffd700;
    font-size: 1.4rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 0;
}
.premium-show-qr-btn:hover {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.5);
}
.qr-modal-content {
    background: #1a1a2e;
    border: 1.5px solid rgba(255, 215, 0, 0.2);
    border-radius: 26px;
    padding: 3.5rem 3rem;
    text-align: center;
    position: relative;
    max-width: 840px;
    width: 94%;
    margin: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 50px rgba(255, 215, 0, 0.08);
}
.qr-modal-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffd700;
    margin: 0 0 1.5rem;
}
.qr-modal-content .premium-qr-img {
    width: 756px;
    height: 756px;
}
.qr-modal-upi {
    margin: 1.5rem 0 1rem;
    font-size: 1.7rem;
    color: #ccc;
}
.qr-modal-upi strong {
    color: #f0f0f0;
    font-family: 'Courier New', monospace;
    font-size: 1.8rem;
}
.qr-modal-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.6rem;
    font-size: 1.1rem;
    color: #ffd700;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s;
}
.qr-modal-copy:hover {
    background: rgba(255, 215, 0, 0.12);
}
.premium-qr-section {
    text-align: center;
    margin: 0.75rem 0;
}
.premium-qr-img {
    width: 720px;
    height: 720px;
    border-radius: 20px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    background: #fff;
    padding: 14px;
    max-width: 90vw;
}
.premium-upi-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: rgba(255, 215, 0, 0.04);
    border: 1px solid rgba(255, 215, 0, 0.12);
    border-radius: 12px;
}
.premium-upi-left {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.premium-upi-label-sm {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.premium-upi-id-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.premium-upi-id {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0f0f0;
    letter-spacing: 0.3px;
    font-family: 'Courier New', monospace;
}
.premium-copy-btn {
    background: none;
    color: #ffd700;
    border: none;
    padding: 0.2rem 0.4rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
}
.premium-copy-btn:hover {
    background: rgba(255, 215, 0, 0.1);
}
.premium-open-upi-btn {
    padding: 0.7rem 1.4rem;
    border: 1.5px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    background: rgba(255, 215, 0, 0.06);
    color: #ffd700;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.premium-open-upi-btn:hover {
    background: rgba(255, 215, 0, 0.12);
}
.premium-note {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    font-size: 1.25rem;
    color: var(--text-secondary, #999);
    line-height: 1.6;
}
.premium-note p {
    margin: 0 0 0.35rem;
}
.premium-note p:last-child {
    margin-bottom: 0;
}
.premium-note a {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
}
.premium-note a:hover {
    text-decoration: underline;
}
.donate-preview {
    text-align: center;
    margin: 1rem 0;
    font-size: 1.15rem;
    color: var(--text-secondary, #a8a8a8);
}
.donate-preview .donor-name {
    font-size: 1.3rem;
}
.donate-btn-pay {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #f9d423 0%, #ff4e50 100%);
    color: #000;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}
.donate-btn-pay:hover {
    filter: brightness(1.1);
}
.donate-btn-pay:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== PREMIUM PAGE ========== */
.premium-page-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.premium-hero {
    text-align: center;
    margin-bottom: 2rem;
}
.premium-hero-badge {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    animation: premiumBadgePulse 2s ease-in-out infinite;
}
@keyframes premiumBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}
.premium-hero-title {
    font-size: 4.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #f77f00, #e63946);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.5rem;
}
.premium-hero-subtitle {
    font-size: 1.7rem;
    color: var(--text-secondary, #a8a8a8);
    margin: 0;
}

/* Plan Toggle */
.premium-plan-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2.5rem;
}
.premium-plan-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 1.6rem 1.2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary, #888);
}
.premium-plan-btn:hover {
    border-color: rgba(255, 215, 0, 0.25);
    background: rgba(255, 215, 0, 0.03);
}
.premium-plan-btn.active {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.06);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1), inset 0 0 20px rgba(255, 215, 0, 0.03);
}
.premium-plan-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary, #999);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.premium-plan-btn.active .premium-plan-name {
    color: #ffd700;
}
.premium-plan-price {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--text, #e0e0e0);
    line-height: 1.1;
}
.premium-plan-price small {
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.6;
}
.premium-plan-btn.active .premium-plan-price {
    background: linear-gradient(135deg, #ffd700, #f77f00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.premium-plan-btn.active .premium-plan-price small {
    -webkit-text-fill-color: #ffd700;
    opacity: 0.7;
}
.premium-plan-save {
    font-size: 1.1rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    margin-top: 0.4rem;
    display: inline-block;
}

.premium-price-card {
    text-align: center;
    background: rgba(255, 215, 0, 0.04);
    border: 1.5px solid rgba(255, 215, 0, 0.15);
    border-radius: 18px;
    padding: 2rem;
    margin-bottom: 2.5rem;
}
.premium-price-tagline {
    font-size: 1.35rem;
    color: var(--text-secondary, #888);
    margin: 0.4rem 0 0;
}

.premium-features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}
.premium-feature-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1.8rem 1.4rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}
.premium-feature-card.premium-feature-hero {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(0, 180, 216, 0.06));
    border-color: rgba(124, 58, 237, 0.25);
    padding: 2.2rem 1.4rem;
}
.premium-feature-card.premium-feature-hero:hover {
    border-color: rgba(124, 58, 237, 0.5);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(0, 180, 216, 0.08));
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.15);
}
.premium-feature-badge {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
}
.premium-feature-card:hover {
    border-color: rgba(255, 215, 0, 0.25);
    background: rgba(255, 215, 0, 0.04);
    transform: translateY(-3px);
}
.premium-feature-icon {
    font-size: 3.25rem;
    display: block;
    margin-bottom: 0.8rem;
}
.premium-feature-card h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #f0f0f0;
    margin: 0 0 0.4rem;
}
.premium-feature-card p {
    font-size: 1.3rem;
    color: var(--text-secondary, #999);
    margin: 0;
    line-height: 1.5;
}

.premium-preview-section {
    margin-bottom: 2.5rem;
}
.premium-section-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: #f0f0f0;
    margin: 0 0 1.2rem;
    text-align: center;
}

/* Animated Avatar Section */
.premium-animated-avatar-section {
    background: rgba(10, 10, 25, 0.5);
    border: 1.5px solid rgba(147, 51, 234, 0.2);
    border-radius: 20px;
    padding: 2rem 1.8rem;
    margin-bottom: 2.5rem;
}
.animated-avatar-input-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.animated-avatar-input {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #f0f0f0;
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}
.animated-avatar-input:focus {
    border-color: rgba(147, 51, 234, 0.5);
}
.animated-avatar-input::placeholder {
    color: #64748b;
}
.animated-avatar-preview-btn {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.4rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.animated-avatar-preview-btn:hover { opacity: 0.85; }
.animated-avatar-preview-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.2rem;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    margin-bottom: 0.8rem;
}
.animated-avatar-actions {
    display: flex;
    flex-direction: row;
    gap: 0.6rem;
    align-items: center;
}
.animated-avatar-save-btn {
    background: rgba(124, 58, 237, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 10px;
    padding: 0.55rem 1.3rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}
.animated-avatar-save-btn:hover {
    background: rgba(124, 58, 237, 0.22);
    border-color: rgba(124, 58, 237, 0.5);
}
.animated-avatar-remove-btn {
    background: transparent;
    color: #64748b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.55rem 1.3rem;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
}
.animated-avatar-remove-btn:hover {
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}
.animated-avatar-status {
    font-size: 0.85rem;
    min-height: 1.2rem;
    margin-top: 0.4rem;
}
.animated-avatar-status.error { color: #f87171; }
.animated-avatar-status.success { color: #34d399; }

.premium-payment-section {
    background: rgba(10, 10, 25, 0.5);
    border: 1.5px solid rgba(255, 215, 0, 0.12);
    border-radius: 20px;
    padding: 2rem 1.8rem;
}
.premium-payment-methods {
    margin-bottom: 1.2rem;
}

/* Premium Active Banner */
.premium-active-banner {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(247, 127, 0, 0.06));
    border: 1.5px solid rgba(255, 215, 0, 0.25);
    border-radius: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.08);
}
.premium-active-icon {
    font-size: 3rem;
    flex-shrink: 0;
    animation: premiumBadgePulse 2s ease-in-out infinite;
}
.premium-active-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffd700;
    margin: 0 0 0.3rem;
}
.premium-active-info p {
    font-size: 1.1rem;
    color: var(--text-secondary, #ccc);
    margin: 0;
}

.nav-btn[data-page="premium"] {
    color: #ffd700;
}
.nav-btn[data-page="premium"].active {
    background: linear-gradient(135deg, #ffd700, #f77f00);
    color: #000;
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
}
.nav-btn[data-page="premium"]:hover:not(.active) {
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
}

/* ========== SPOTIFY PLAYBACK BAR ========== */
.spotify-bar {
    width: 100%;
    max-width: 600px;
    margin: 0.8rem auto 0;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(29, 185, 84, 0.12);
    transition: all 0.4s ease;
}
.spotify-bar.sp-active {
    border-color: rgba(29, 185, 84, 0.3);
    background: linear-gradient(135deg, rgba(29, 185, 84, 0.08), rgba(0,0,0,0.2));
    box-shadow: 0 4px 24px rgba(29, 185, 84, 0.08);
}

/* Disconnected */
.sp-disconnected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.84rem;
    padding: 0.94rem 1.74rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.sp-disconnected:hover {
    background: rgba(29, 185, 84, 0.06);
}
.sp-logo {
    font-size: 1.74rem;
    color: #1DB954;
}
.sp-connect-text {
    font-size: 1.18rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.3px;
}
.sp-disconnected:hover .sp-connect-text {
    color: #1DB954;
}

/* Connected layout */
.sp-connected {
    display: flex;
    align-items: center;
    gap: 1.08rem;
    padding: 0.8rem 1.15rem 0.8rem 0.8rem;
}

/* Album art */
.sp-art {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(29, 185, 84, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1DB954;
    font-size: 1.56rem;
}
.sp-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Track info */
.sp-info {
    flex: 1;
    min-width: 0;
}
.sp-track {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--text, #f0f0f0);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.sp-artist {
    font-size: 1.03rem;
    color: #1DB954;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    font-weight: 500;
}

/* Controls */
.sp-controls {
    display: flex;
    align-items: center;
    gap: 0.22rem;
    flex-shrink: 0;
}
.sp-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.55);
    cursor: pointer;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.08rem;
    transition: all 0.2s;
    padding: 0;
}
.sp-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.sp-btn-play {
    width: 52px;
    height: 52px;
    font-size: 1.22rem;
    color: #fff;
    background: #1DB954;
    border-radius: 50%;
}
.sp-btn-play:hover {
    background: #1ed760;
    transform: scale(1.08);
}

/* Equalizer bars */
.sp-bars {
    display: flex;
    align-items: flex-end;
    gap: 3.6px;
    height: 29px;
    flex-shrink: 0;
}
.sp-bars span {
    display: block;
    width: 4px;
    height: 6px;
    border-radius: 2px;
    background: #1DB954;
    opacity: 0.2;
}
.sp-bars.playing span {
    opacity: 1;
    animation: spBar 0.8s ease-in-out infinite alternate;
}
.sp-bars.playing span:nth-child(1) { animation-delay: 0s; }
.sp-bars.playing span:nth-child(2) { animation-delay: 0.15s; }
.sp-bars.playing span:nth-child(3) { animation-delay: 0.3s; }
.sp-bars.playing span:nth-child(4) { animation-delay: 0.45s; }

@keyframes spBar {
    0%   { height: 6px; }
    100% { height: 26px; }
}

/* Disconnect X */
.sp-disconnect {
    background: none;
    border: none;
    color: rgba(255,255,255,0.2);
    font-size: 0.94rem;
    cursor: pointer;
    padding: 0.29rem;
    border-radius: 50%;
    width: 29px;
    height: 29px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.sp-disconnect:hover {
    color: #ff4d4d;
    background: rgba(255, 77, 77, 0.1);
}

/* Share Stats Button */
.share-stats-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid rgba(124, 58, 237, 0.4);
    background: rgba(124, 58, 237, 0.12);
    color: #a855f7;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
}
.share-stats-btn:hover {
    background: rgba(124, 58, 237, 0.25);
    border-color: rgba(124, 58, 237, 0.7);
    color: #c084fc;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.35);
    transform: scale(1.08);
}
.share-stats-btn:active {
    transform: scale(0.95);
}
.share-stats-btn i {
    pointer-events: none;
}

/* ============================================== */
/* MOBILE TOUCH DEVICE FIX                        */
/* Detects phones/tablets by input type,           */
/* NOT viewport width — bypasses the scale(0.52)   */
/* + no-viewport-meta dead zone entirely.          */
/* Desktop (mouse/trackpad) is NEVER affected.     */
/* ============================================== */
@media (hover: none) and (pointer: coarse) {

    /* ================================================
       THE CRITICAL FIX: undo body scale on mobile
       With proper viewport meta + no scale, the page
       renders at true device pixels — readable without
       any user zoom/pinch/adjust.
       Desktop browsers ignore the viewport meta so
       scale(0.52) stays intact for them.
       ================================================ */
    body {
        transform: none !important;
        transform-origin: unset !important;
        overflow-x: hidden;
        max-width: 100vw;
        -webkit-text-size-adjust: 100%;
    }

    #mainApp {
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* ================================================
       PERFORMANCE & SMOOTHNESS — aggressive for low-end
       ================================================ */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* ---- KILL BACKDROP-FILTER everywhere (very expensive on mobile GPU) ---- */
    .nav,
    .status-card,
    .dashboard-card,
    .analytics-card,
    .chat-container,
    .leaderboard,
    .global-leaderboard,
    .modal-content,
    .group-card,
    .notification,
    .login-card,
    .timer-container,
    .chat-header,
    .chat-input-area,
    [style*="backdrop-filter"],
    .focus-mode {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    /* ---- KILL all continuous animations ---- */
    .timer-circle {
        animation: none !important;
        filter: none !important;
    }

    .leaderboard-item.rank-1 {
        /* keep rank-1 animation on mobile */
    }

    .timer-glow {
        animation: none !important;
        display: none !important; /* glow ring = pure GPU waste */
    }

    .status-dot {
        animation: none !important;
    }

    /* ---- SIMPLIFY transitions to opacity/transform only (GPU-composited) ---- */
    /* Scoped to interactive elements — NOT *, which breaks Chart.js canvas sizing */
    .nav-btn,
    .control-btn,
    .btn,
    .login-btn,
    .group-action-btn,
    .group-card,
    .group-card-leave,
    .admin-btn,
    .action-btn,
    .tab-btn,
    .status-card,
    .dashboard-card,
    .analytics-card,
    .leaderboard-item,
    .global-leaderboard-item,
    .session-item,
    .achievement-badge,
    .chat-btn,
    .close-btn,
    .modal-content,
    .notification,
    .theme-option,
    .logout-btn,
    .refresh-btn,
    .selector {
        transition-property: opacity, transform !important;
        transition-duration: 0.2s !important;
        transition-timing-function: ease-out !important;
    }

    /* Exceptions that need specific transitions */
    .nav-links {
        transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                    opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1) !important;
    }

    /* ---- FLATTEN box-shadows (single layer, no blur spread) ---- */
    .status-card,
    .dashboard-card,
    .analytics-card,
    .group-card,
    .leaderboard-item,
    .global-leaderboard-item,
    .session-item,
    .chat-container,
    .leaderboard,
    .global-leaderboard,
    .modal-content,
    .login-card,
    .control-btn,
    .chat-input,
    .notification {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    }

    .leaderboard-item.rank-1,
    .global-leaderboard-item.rank-1 {
        box-shadow: 0 4px 16px rgba(255, 215, 0, 0.5) !important;
    }

    .leaderboard-item.rank-2,
    .global-leaderboard-item.rank-2 {
        box-shadow: 0 4px 16px rgba(3, 219, 238, 0.4) !important;
    }

    .leaderboard-item.rank-3,
    .global-leaderboard-item.rank-3 {
        box-shadow: 0 4px 16px rgba(205, 127, 50, 0.4) !important;
    }

    /* ---- PREMIUM DONOR ANIMATIONS (mobile-optimized) ----
       Keep all transform/opacity animations (GPU-composited).
       Only replace box-shadow & left-property animations. */

    /* Donor row: static glow shadow, replace box-shadow pulse with opacity pulse */
    .leaderboard-item.donor-row,
    .global-leaderboard-item.donor-row {
        box-shadow:
            0 0 15px rgba(255, 215, 0, 0.2),
            0 0 30px rgba(45, 106, 255, 0.1),
            0 0 50px rgba(230, 57, 70, 0.06) !important;
        animation: none !important;
        position: relative;
        overflow: visible !important;
    }

    /* Allow floating particles to be visible outside leaderboard containers */
    .leaderboard,
    .global-leaderboard,
    .leaderboard-list,
    .global-leaderboard-list {
        overflow: visible !important;
    }

    /* Glow pulse via opacity on ::after — GPU only */
    .leaderboard-item.donor-row::after,
    .global-leaderboard-item.donor-row::after {
        content: '' !important;
        display: block !important;
        position: absolute;
        inset: 0;
        border-radius: inherit;
        pointer-events: none;
        z-index: 0;
        background:
            radial-gradient(ellipse at 15% 50%, rgba(255, 215, 0, 0.12), transparent 55%),
            radial-gradient(ellipse at 50% 50%, rgba(230, 57, 70, 0.08), transparent 50%),
            radial-gradient(ellipse at 85% 50%, rgba(45, 106, 255, 0.10), transparent 55%);
        opacity: 0.5;
        animation: mobileGlowPulse 3s ease-in-out infinite !important;
        will-change: opacity;
    }

    /* Donor border: keep animating with transform rotation */
    .leaderboard-item.donor-row::before,
    .global-leaderboard-item.donor-row::before {
        display: block !important;
        animation: mobileBorderShift 12s linear infinite !important;
        will-change: transform;
    }

    /* Donor name rainbow shimmer — KEEP (small text area, acceptable cost) */
    .donor-name {
        animation: donorShimmer 3s ease infinite !important;
    }

    /* Donor rank rainbow shift — KEEP */
    .donor-row .rank {
        animation: donorRankShift 3s ease infinite !important;
    }

    /* Donor avatar ring spin — transform only, GPU-efficient */
    .donor-avatar-ring::before {
        animation: donorRingSpin 4s linear infinite !important;
        will-change: transform;
    }

    /* Donor avatar ring glow — replace box-shadow animation with opacity */
    .donor-avatar-ring::after {
        animation: mobileRingGlow 3s ease-in-out infinite alternate !important;
        will-change: opacity;
    }

    /* Donor orbiting dots — transform only, GPU-efficient, KEEP */
    .donor-avatar-ring .donor-orbit-dot {
        display: block !important;
    }
    .donor-avatar-ring .donor-orbit-dot:nth-child(1) {
        animation: donorOrbit1 2.8s linear infinite !important;
    }
    .donor-avatar-ring .donor-orbit-dot:nth-child(2) {
        animation: donorOrbit2 3.2s linear infinite !important;
    }
    .donor-avatar-ring .donor-orbit-dot:nth-child(3) {
        animation: donorOrbit3 3.6s linear infinite !important;
    }

    /* Donor sparkles — transform/opacity only, GPU-efficient, KEEP */
    .donor-sparkles {
        display: block !important;
    }
    .donor-sparkle {
        animation: donorSparkleOrbit 3s ease-in-out infinite !important;
    }
    .donor-sparkle-star {
        animation: donorStarPop 3.5s ease-in-out infinite !important;
    }

    /* Donor diamond bounce — transform only, GPU-efficient, KEEP */
    .donor-diamond {
        animation: donorDiamondBounce 1.8s ease-in-out infinite !important;
    }

    /* Donor sweep: replace left animation with translateX */
    .donor-row .donor-sweep::before {
        left: 0 !important;
        animation: mobileSweep 10s ease-in-out infinite !important;
        will-change: transform;
    }

    /* GPU-only keyframes for mobile */
    @keyframes mobileGlowPulse {
        0%, 100% { opacity: 0.3; }
        50% { opacity: 1; }
    }

    @keyframes mobileRingGlow {
        0% { opacity: 0.6; }
        100% { opacity: 1; }
    }

    @keyframes mobileBorderShift {
        0% { transform: translate(-50%, -50%) rotate(0deg); }
        100% { transform: translate(-50%, -50%) rotate(360deg); }
    }

    @keyframes mobileSweep {
        0% { transform: translateX(-160%); }
        50% { transform: translateX(160%); }
        100% { transform: translateX(-160%); }
    }

    /* ---- KILL text-shadows (expensive compositing) ---- */
    .timer-time,
    .timer-title,
    .analytics-title,
    .groups-title,
    .global-ranking-title,
    .leaderboard-title,
    .metric-value,
    .status-value,
    .focus-timer,
    h1, h2, h3 {
        text-shadow: none !important;
    }

    /* ---- KILL filter/drop-shadow on decorative elements ---- */
    .status-icon,
    .card-icon,
    .analytics-card-icon {
        filter: none !important;
    }

    /* ---- Disable hover transforms on touch ---- */
    .status-card:hover,
    .dashboard-card:hover,
    .analytics-card:hover,
    .group-card:hover,
    .leaderboard-item:hover,
    .global-leaderboard-item:hover,
    .session-item:hover,
    .achievement-badge:hover,
    .control-btn:hover,
    .nav-btn:hover,
    .btn:hover,
    .login-btn:hover,
    .group-action-btn:hover {
        transform: none !important;
    }

    /* ---- Reduce page-enter animation ---- */
    .page.active {
        animation-duration: 0.15s;
    }

    /* ---- GPU-accelerated scrolling containers ---- */
    .chat-messages,
    .leaderboard-list,
    .global-leaderboard-list,
    .modal-content,
    .sessions-container,
    .daily-time-grid {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        will-change: scroll-position;
    }

    /* ---- Contain layout recalc per page ---- */
    .page {
        contain: layout style;
    }

    /* ---- Hide heavy decorative pseudo-elements ---- */
    .dashboard-card::before,
    .status-card::before,
    .analytics-card::before,
    .leaderboard-item::before,
    .global-leaderboard-item::before,
    .global-leaderboard-header::before,
    .leaderboard-item.donor-row::before,
    .global-leaderboard-item.donor-row::before {
        display: none !important;
    }

    /* ---- Celebration confetti — don't block interaction ---- */
    .celebration {
        pointer-events: none;
    }

    /* ---- Reduce paint for ::-webkit-scrollbar ---- */
    ::-webkit-scrollbar {
        width: 3px;
    }

    ::-webkit-scrollbar-thumb {
        border: none;
        border-radius: 2px;
    }

    /* ================================================
       NAVIGATION — hamburger on left + left drawer
       ================================================ */

    /* Top bar — fixed, short */
    .nav {
        height: 48px;
        padding: 0 0.5rem;
        margin-top: 0;
        gap: 0;
        backdrop-filter: blur(12px);
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    /* Hamburger button — visible, left corner */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        order: -1;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        color: var(--text);
        background: transparent;
        border: none;
        cursor: pointer;
        flex-shrink: 0;
        z-index: 1001;
    }

    /* Brand — after hamburger */
    .brand-section {
        height: 48px;
        padding-left: 0.4rem;
    }

    .brand-logo {
        font-size: 1rem;
        gap: 0.4rem;
    }

    .brand-logo i {
        font-size: 1.1rem;
    }

    /* Nav links — LEFT DRAWER (slide from left, auto-height) */
    .nav-links {
        position: fixed !important;
        top: 48px;
        left: 0;
        bottom: auto;
        right: auto;
        width: 220px;
        max-width: 70vw;
        background: var(--surface);
        flex-direction: column !important;
        align-items: stretch;
        padding: 0.5rem 0.4rem;
        gap: 0.15rem;
        border-radius: 0 0 14px 0;
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-left: none;
        border-top: none;
        box-shadow: 8px 4px 30px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;

        /* Hidden by default — slide left */
        transform: translateX(-110%) !important;
        opacity: 0 !important;
        pointer-events: none;
        transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                    opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1) !important;
    }

    /* When toggled open */
    .nav-links.active {
        transform: translateX(0) !important;
        opacity: 1 !important;
        pointer-events: auto;
        display: flex !important;
    }

    /* Nav buttons — compact, icon + text, left aligned */
    .nav-btn {
        display: flex !important;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        padding: 0.5rem 0.65rem;
        font-size: 0.78rem;
        gap: 0.55rem;
        border-radius: 8px;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: var(--text);
    }

    .nav-btn i {
        font-size: 0.95rem;
        min-width: 18px;
        text-align: center;
    }

    .nav-btn img {
        width: 20px !important;
        height: 20px !important;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .nav-btn.active {
        background: rgba(0, 180, 216, 0.12);
        box-shadow: 0 2px 10px rgba(0, 180, 216, 0.15);
    }

    /* Badges inside sidebar buttons — override inline styles */
    .nav-btn span[id$="Badge"] {
        font-size: 9px !important;
        padding: 0px 5px !important;
        position: static !important;
        top: auto !important;
        right: auto !important;
        margin-left: auto;
        border-radius: 999px;
        line-height: 1.4;
    }

    /* User section — right side of top bar */
    .user-section {
        right: 0.5rem;
        gap: 0.5rem;
        margin-left: auto;
    }

    .user-info {
        padding: 0.3rem 0.6rem;
        gap: 0.4rem;
        border-radius: 14px;
    }

    .user-avatar {
        width: 26px;
        height: 26px;
        border-width: 1.5px;
    }

    .user-name {
        display: none; /* hide name in top bar, just show avatar */
    }

    .logout-btn {
        padding: 0.45rem 0.7rem;
        font-size: 0.65rem;
        border-radius: 8px;
    }

    /* ================================================
       PAGES — global padding & spacing
       ================================================ */
    .page {
        padding: 56px 0.75rem 1.5rem;
    }

    /* ================================================
       LOGIN SCREEN — mobile friendly
       ================================================ */
    .login-card {
        padding: 1.8rem 1.3rem;
        border-radius: 16px;
        width: 92%;
    }

    .login-title {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .login-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
        line-height: 1.4;
    }

    .login-btn {
        padding: 0.9rem 1.2rem;
        font-size: 0.9rem;
        border-radius: 12px;
        margin-bottom: 0.7rem;
        gap: 0.6rem;
    }

    .login-btn:hover {
        transform: none;
    }

    /* ================================================
       TIMER PAGE
       ================================================ */
    .timer-container {
        max-width: 100%;
    }

    .timer-hero {
        margin-bottom: 1rem;
    }

    .timer-title {
        font-size: 1.5rem;
        letter-spacing: -0.5px;
    }

    .timer-subtitle {
        font-size: 0.75rem;
        max-width: 100%;
    }

    /* Status cards — 2 column, compact */
    .status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .status-card {
        padding: 0.8rem 0.6rem;
        border-radius: 14px;
    }

    .status-card::before {
        height: 2px;
    }

    .status-card:hover {
        transform: none;
    }

    .status-icon {
        font-size: 1.4rem;
        margin-bottom: 0.3rem;
    }

    .status-label {
        font-size: 0.5rem;
        letter-spacing: 0.8px;
        margin-bottom: 0.3rem;
    }

    .status-value {
        font-size: 1.1rem;
    }

    #currentStreak {
        font-size: 1.1rem !important;
        min-height: 20px !important;
    }

    /* Timer circle — fits mobile screen */
    .timer-display-section {
        margin: 1.5rem 0;
    }

    .timer-circle {
        width: 220px;
        height: 220px;
        box-shadow:
            0 15px 30px rgba(0, 0, 0, 0.4),
            inset 0 0 0 6px var(--surface),
            0 0 20px rgba(0, 180, 216, 0.3);
    }

    .timer-inner {
        width: 190px;
        height: 190px;
    }

    .timer-time {
        font-size: 2.2rem;
        margin-bottom: 0.3rem;
        letter-spacing: 1px;
    }

    .timer-status {
        font-size: 0.65rem;
        letter-spacing: 2px;
    }

    .timer-glow {
        top: -10px;
        left: -10px;
        right: -10px;
        bottom: -10px;
    }

    /* Controls — 2x2 grid on mobile */
    .controls {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-top: 1.2rem;
    }

    .control-btn {
        padding: 0.75rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 12px;
        letter-spacing: 0.5px;
        gap: 0.4rem;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .control-btn i {
        font-size: 0.85rem;
    }

    .control-btn:hover {
        transform: none;
    }

    .shortcut-hint {
        display: none;
    }

    /* Theme dropdown — compact */
    .theme-dropdown-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
        border-radius: 8px;
    }

    .theme-dropdown-list {
        min-width: 170px;
        border-radius: 10px;
        padding: 0.3rem;
    }

    .theme-dropdown-item {
        padding: 0.45rem 0.7rem;
        font-size: 0.72rem;
        border-radius: 8px;
    }

    .theme-color-dots span {
        width: 10px;
        height: 10px;
    }

    /* Timer Mode Selector — mobile */
    .timer-mode-wrapper {
        grid-column: 1 / -1;
    }

    .control-btn.mode-btn {
        width: 100%;
        padding: 0.75rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 12px;
        gap: 0.4rem;
        justify-content: center;
    }

    .mode-dropdown-list {
        min-width: 200px;
        border-radius: 10px;
        padding: 0.3rem;
    }

    .mode-dropdown-item {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        border-radius: 8px;
    }

    .custom-time-row {
        gap: 1rem;
    }

    .custom-time-field .form-input {
        width: 80px;
        font-size: 1.2rem;
        padding: 0.8rem;
    }

    /* Task Manager — mobile */
    .task-create-section {
        padding: 1.1rem;
    }
    .task-time-row {
        flex-wrap: wrap;
    }
    .task-add-btn {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 0.35rem;
        padding: 0.9rem 1.2rem;
        font-size: 1rem;
    }
    .task-item {
        flex-wrap: wrap;
        gap: 0.6rem;
        padding: 0.9rem 1rem;
    }
    .task-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .daily-goal-analytics-card {
        padding: 1rem;
    }
    .goal-analytics-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    /* ================================================
       ANALYTICS PAGE
       ================================================ */
    /* Override the full-width force for mobile */
    body #analytics-page,
    body #analytics-page.page,
    body #analytics-page.page.active {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    body #analytics-page .analytics-container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .analytics-header {
        flex-direction: column;
        gap: 0.8rem;
        margin-bottom: 1.2rem;
        align-items: flex-start;
    }

    .analytics-title {
        font-size: 1.5rem;
    }

    .analytics-controls {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .selector {
        padding: 0.55rem 0.7rem;
        font-size: 0.75rem;
        border-radius: 10px;
        flex: 1;
        min-width: 0;
    }

    .refresh-btn {
        padding: 0.55rem 0.9rem;
        font-size: 0.75rem;
        border-radius: 10px;
    }

    /* Stats row — 2 column */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.8rem !important;
        min-height: auto;
    }

    .stat-card .metric-value {
        font-size: 1.3rem !important;
    }

    .stat-card .card-header {
        margin-bottom: 0.4rem;
    }

    .card-title {
        font-size: 0.72rem;
    }

    .card-icon {
        font-size: 1.3rem;
    }

    .card-header {
        margin-bottom: 0.8rem;
    }

    /* Dashboard grid — 2 columns so cards pair up */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.45rem;
    }

    /* Stats row & charts grid span full width (both columns) */
    .stats-row,
    .charts-grid,
    .analytics-card.full-width,
    .sessions-container {
        grid-column: 1 / -1;
    }

    .dashboard-card {
        padding: 0.6rem;
        border-radius: 12px;
        min-height: 0;
    }

    .dashboard-card::before {
        height: 2px;
    }

    .dashboard-card:hover {
        transform: none;
    }

    .dashboard-card .card-header {
        margin-bottom: 0.4rem;
    }

    .dashboard-card .card-title {
        font-size: 0.62rem;
    }

    .dashboard-card .card-icon {
        font-size: 1rem;
    }

    .metric-value {
        font-size: 1.3rem;
    }

    .metric-change {
        font-size: 0.6rem;
        padding: 0.2rem 0.45rem;
        margin-top: 0.3rem;
        border-radius: 8px;
    }

    /* Progress ring — smaller to fit half-width card */
    .progress-ring {
        width: 65px;
        height: 65px;
        margin-top: 0.3rem;
    }

    .progress-ring-svg {
        width: 65px;
        height: 65px;
    }

    .progress-value {
        font-size: 0.8rem;
    }

    /* Chart inside half-width card — shorter */
    .dashboard-card .chart-container {
        height: 100px;
        margin-top: 0.4rem;
    }

    /* Charts — single column, full width */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    .chart-container {
        height: 180px;
        margin-top: 0.8rem;
        position: relative;
        width: 100%;
    }

    .chart-container canvas {
        width: 100% !important;
        height: 100% !important;
    }

    /* Analytics card */
    .analytics-card {
        padding: 0.8rem;
        border-radius: 14px;
        width: 100%;
        overflow: hidden;
    }

    .analytics-card:hover {
        transform: none !important;
    }

    .analytics-card-header {
        margin-bottom: 0.8rem;
    }

    .analytics-card-title {
        font-size: 0.95rem;
    }

    .analytics-card-icon {
        font-size: 1.5rem;
    }

    /* Daily time grid */
    .daily-time-editor {
        padding: 0.8rem;
        border-radius: 12px;
    }

    .daily-time-header {
        margin-bottom: 0.8rem;
    }

    .daily-time-title {
        font-size: 0.8rem;
    }

    .daily-time-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
        gap: 0.25rem;
    }

    .daily-time-item {
        padding: 0.35rem 0.15rem;
        font-size: 0.55rem;
        border-radius: 6px;
    }

    .daily-time-day {
        font-size: 0.5rem;
        margin-bottom: 0.15rem;
    }

    .daily-time-value {
        font-size: 0.6rem;
    }

    /* Heatmap */
    .heatmap-cell {
        width: 22px;
        height: 22px;
        font-size: 0.5rem;
        border-radius: 4px;
    }

    .heatmap-day-label {
        width: 26px;
        font-size: 0.55rem;
    }

    .heatmap-row {
        gap: 0.25rem;
    }

    .heatmap-legend {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    .legend-color {
        width: 14px;
        height: 14px;
    }

    /* Peak hours */
    .peak-hour-item {
        padding: 0.5rem;
        border-radius: 0.6rem;
    }

    .peak-hour-time {
        font-size: 0.72rem;
    }

    .peak-hour-duration {
        font-size: 0.8rem;
    }

    /* Sessions */
    .sessions-container {
        padding: 0.8rem;
        border-radius: 14px;
        margin-top: 1rem;
    }

    .session-item {
        padding: 0.7rem;
        border-radius: 10px;
        margin-bottom: 0.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .session-info {
        width: 100%;
        min-width: 0;
    }

    .session-date {
        font-size: 0.82rem;
    }

    .session-time-range {
        font-size: 0.72rem;
        opacity: 0.7;
    }

    .session-notes {
        font-size: 0.72rem;
        word-break: break-word;
        opacity: 0.8;
    }

    .session-item > div:last-child {
        width: 100%;
        justify-content: space-between;
    }

    .session-duration {
        font-size: 0.9rem;
        font-weight: 600;
    }

    .session-item:hover {
        transform: none;
    }

    .session-actions {
        gap: 0.3rem;
    }

    .action-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.68rem;
        border-radius: 8px;
    }

    /* ================================================
       GROUPS PAGE
       ================================================ */
    .groups-container {
        padding: 0;
        max-width: 100%;
    }

    .groups-title-row {
        gap: 0.6rem;
        margin-bottom: 0.8rem;
    }

    .groups-title {
        font-size: 1.3rem;
    }

    .groups-count {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .groups-body {
        flex-direction: column;
        gap: 0.6rem;
        margin-bottom: 1rem;
    }

    .groups-top-actions {
        flex-direction: column;
        gap: 0.4rem;
        width: 100%;
    }

    .group-join-row {
        width: 100%;
    }

    .group-join-row .group-code-input {
        flex: 1;
        padding: 0.7rem 0.8rem;
        font-size: 16px;
        width: auto;
        letter-spacing: 2px;
        border-radius: 10px;
    }

    .group-action-btn {
        padding: 0.7rem 1rem;
        font-size: 0.8rem;
        border-radius: 10px;
    }

    .group-action-btn:hover {
        transform: none;
    }

    /* Group cards list */
    .groups-list {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .group-card {
        padding: 0.8rem 1rem;
        border-radius: 12px;
        gap: 0.6rem;
    }

    .group-card:hover {
        transform: none;
    }

    .group-card-name {
        font-size: 0.9rem;
    }

    .group-card-meta {
        font-size: 0.68rem;
        gap: 0.5rem;
    }

    .group-card-right {
        gap: 0.5rem;
    }

    .group-card-active-dot {
        width: 8px;
        height: 8px;
    }

    .group-card-leave {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    /* Active group bar */
    .active-group-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.6rem 0.8rem;
        border-radius: 10px;
        margin-bottom: 0.6rem;
    }

    .active-group-info h3 {
        font-size: 0.9rem;
    }

    .active-group-code {
        font-size: 0.65rem;
    }

    /* Admin panel */
    .admin-panel {
        padding: 0.4rem 0.6rem;
        border-radius: 8px;
        margin-bottom: 0.6rem;
    }

    .admin-actions {
        gap: 0.4rem;
    }

    .admin-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.65rem;
        border-radius: 6px;
    }

    /* Stack leaderboard on top, chat below */
    .group-content-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    /* Leaderboard */
    .leaderboard {
        border-radius: 14px;
        margin-top: 0.8rem;
    }

    .leaderboard-header {
        padding: 1rem;
    }

    .leaderboard-title {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
        gap: 6px;
    }

    .leaderboard-tabs {
        gap: 0.3rem;
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.68rem;
        border-radius: 10px;
    }

    .leaderboard-list {
        padding: 0.8rem 0.6rem;
        max-height: 400px;
    }

    .leaderboard-item {
        padding: 0.7rem;
        border-radius: 10px;
        margin-bottom: 0.4rem;
    }

    .leaderboard-item:hover {
        transform: none !important;
    }

    .user-avatar-small {
        width: 32px;
        height: 32px;
        margin-right: 0.6rem;
        border-width: 2px;
    }

    .rank {
        font-size: 1.2rem;
        margin-right: 0.6rem;
        min-width: 28px;
        position: relative;
    }

    /* Hide duplicate ::after badges — rank text is enough */
    .rank-1 .rank::after,
    .rank-2 .rank::after,
    .rank-3 .rank::after {
        display: none !important;
    }

    .user-name-rank {
        font-size: 0.68rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .user-status {
        font-size: 0.65rem;
    }

    .study-time {
        font-size: 1rem;
        flex-shrink: 0;
        text-align: right;
    }

    .study-time-wrapper {
        min-width: 70px;
        gap: 1px;
    }

    .rank-change {
        font-size: 1.2rem;
        padding: 1px 6px;
    }

    /* Hide sparkles on mobile group leaderboard too */
    .leaderboard-item .donor-sparkles {
        display: none;
    }

    .leaderboard-item .donor-diamond {
        font-size: 0.8em;
        margin-left: 2px;
    }

    /* Chat container */
    .chat-container {
        height: 65vh;
        min-height: 350px;
        max-height: 500px;
        border-radius: 14px;
    }

    .chat-header {
        padding: 0.6rem 0.8rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .chat-title {
        font-size: 0.85rem;
        gap: 0.4rem;
    }

    .chat-group-code {
        font-size: 0.7rem;
        letter-spacing: 1px;
    }

    .online-indicator {
        padding: 0.35rem 0.6rem;
        gap: 0.35rem;
        font-size: 0.65rem;
        border-radius: 10px;
    }

    .online-dot {
        width: 6px;
        height: 6px;
    }

    .chat-input-area {
        padding: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .chat-input {
        padding: 0.5rem 0.8rem;
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 36px;
        max-height: 56px;
        border-radius: 16px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .chat-btn {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        font-size: 0.85rem;
        box-shadow: 0 2px 8px rgba(0, 180, 216, 0.2);
    }

    .chat-input-container {
        gap: 0.4rem;
    }

    .chat-actions {
        gap: 0.3rem;
    }

    /* Compact messages */
    .chat-messages {
        padding: 6px 6px;
    }

    .message-group {
        gap: 0.3rem;
        margin-bottom: 0.35rem;
    }

    .message-group:has(+ .message-group.same-user) {
        margin-bottom: 0.12rem;
    }

    .message-avatar {
        width: 24px;
        height: 24px;
    }

    .message-bubble-container {
        gap: 0.12rem;
        min-width: 80px;
        max-width: 80%;
    }

    .message {
        padding: 5px 9px;
        border-radius: 12px;
    }

    .message-sender {
        font-size: 0.62rem;
        margin-bottom: 0.05rem;
    }

    .message-text {
        font-size: 0.78rem;
        line-height: 1.3;
        margin-bottom: 0.1rem;
    }

    .message-time {
        font-size: 0.55rem;
        margin-top: 0.05rem;
    }

    .message.admin {
        padding: 6px 8px;
        margin: 3px 0;
        border-radius: 8px;
    }

    .message.admin .message-text {
        font-size: 0.75rem;
    }

    .message.admin .message-sender {
        font-size: 0.55rem;
    }

    .message.admin .message-time {
        font-size: 0.5rem;
    }

    .message-image {
        border-radius: 8px;
        margin: 0.2rem 0;
        max-width: 100%;
    }

    /* Scroll down button */
    .scroll-down-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
        bottom: 55px;
    }

    /* Unread banner & divider */
    .unread-banner {
        font-size: 0.72rem;
        padding: 0.4rem 0.6rem;
        border-radius: 0 0 8px 8px;
    }

    .unread-divider {
        font-size: 0.68rem;
        margin: 0.4rem 0;
    }

    /* Date dividers in chat */
    .date-divider span {
        font-size: 0.62rem;
        padding: 0.25rem 0.6rem;
    }

    /* ================================================
       GLOBAL RANKING PAGE
       ================================================ */
    .global-ranking-container {
        padding: 1rem 0;
        max-width: 100%;
    }

    .global-ranking-header {
        margin-bottom: 1.5rem;
    }

    .global-ranking-title {
        font-size: 1.5rem;
    }

    .global-ranking-subtitle {
        font-size: 0.75rem;
    }

    .global-leaderboard {
        border-radius: 14px;
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Mobile responsive for groups tabs & chat */
    .group-tabs {
        gap: 0;
        overflow-x: auto;
    }

    .group-tab-btn {
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
    }

    .group-tab-btn span {
        display: none;
    }

    .chat-container {
        height: calc(100vh - 450px);
        min-height: 400px;
        border-radius: 16px;
    }

    .chat-input {
        font-size: 1rem;
        min-height: 50px;
        padding: 0.8rem 1.2rem;
    }

    .chat-btn {
        width: 48px;
        height: 48px;
        padding: 0.9rem;
    }

    .chat-header {
        padding: 1rem 1.2rem;
    }

    .chat-title {
        font-size: 1.2rem;
    }

    .message-bubble-container {
        max-width: 90%;
        min-width: 160px;
    }

    .leaderboard {
        min-height: 500px;
    }

    .leaderboard-header {
        padding: 1.5rem 1rem;
    }

    .leaderboard-title {
        font-size: 1.1rem;
    }

    .leaderboard-tabs {
        gap: 0.5rem;
        margin-top: 1rem;
    }

    .tab-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }

    /* ================================================
       GLOBAL RANKING PAGE - MOBILE
       ================================================ */
    .global-leaderboard-header {
        padding: 1rem;
    }

    .global-leaderboard-header::before {
        display: none; /* kill expensive floating animation */
    }

    .global-leaderboard-title {
        font-size: 1.1rem;
        gap: 6px;
    }

    .reset-time-info {
        gap: 0.4rem;
        font-size: 0.68rem;
    }

    .reset-note, .timezone-note {
        font-size: 0.65rem;
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .reset-note span, .timezone-note span {
        padding: 0.15rem 0.45rem;
        font-size: 0.62rem;
        border-radius: 8px;
    }

    .global-leaderboard-list {
        padding: 0.6rem;
    }

    .global-leaderboard-item {
        padding: 0.7rem;
        border-radius: 10px;
        margin-bottom: 0.4rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .global-leaderboard-item:hover {
        transform: none !important;
    }

    .global-leaderboard-item .rank {
        font-size: 1.3rem;
        margin-right: 0.6rem;
        min-width: 28px;
        position: relative;
    }

    /* Hide duplicate ::after rank badges — inline rank-badge span is enough */
    .global-leaderboard-item.rank-1 .rank::after,
    .global-leaderboard-item.rank-2 .rank::after,
    .global-leaderboard-item.rank-3 .rank::after {
        display: none !important;
    }

    .global-leaderboard-item .user-avatar-small {
        width: 32px;
        height: 32px;
        margin-right: 0.6rem;
        border-width: 2px;
    }

    .global-leaderboard-item .user-details {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }

    .global-leaderboard-item .user-name-rank {
        font-size: 0.68rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .global-leaderboard-item .user-status {
        font-size: 0.65rem;
    }

    .global-leaderboard-item .study-time {
        font-size: 1rem;
        flex-shrink: 0;
        text-align: right;
    }

    .global-leaderboard-item .study-time-wrapper {
        min-width: 70px;
        gap: 1px;
    }

    .global-leaderboard-item .rank-change {
        font-size: 1.2rem;
        padding: 1px 6px;
    }

    /* Rank badge inline — compact on mobile */
    .global-leaderboard-item .rank-badge {
        font-size: 1rem;
        margin-right: 0.2rem;
    }

    /* Fix premium/donor study-time visibility in top 3 */
    .global-leaderboard-item.donor-row.rank-1 .study-time,
    .global-leaderboard-item.donor-row.rank-2 .study-time,
    .global-leaderboard-item.donor-row.rank-3 .study-time {
        color: rgba(255, 255, 255, 0.95) !important;
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.3) !important;
    }

    /* Hide sparkles on mobile — too noisy and causes overflow */
    .global-leaderboard-item .donor-sparkles {
        display: none;
    }

    /* Compact donor diamond on mobile */
    .global-leaderboard-item .donor-diamond {
        font-size: 0.8em;
        margin-left: 2px;
    }

    .reset-time-card {
        padding: 0.8rem;
        border-radius: 14px;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }

    .reset-time-card .reset-time-info {
        font-size: 0.68rem;
    }
}

/* ================================================
   PROFILE PAGE
   ================================================ */
#profile-page {
    font-size: 100%;
    padding-top: 60px;
}

    #profile-page h1 {
        font-size: 1.4rem !important;
    }

    #profile-page h2 {
        font-size: 1.05rem !important;
    }

    .profile-container {
        padding: 0 0.5rem;
    }

    .profile-section {
        padding: 1.2rem;
        border-radius: 14px;
        margin-bottom: 1rem;
    }

    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.2rem;
    }

    .profile-avatar-display {
        width: 90px;
        height: 90px;
        font-size: 2.2rem;
    }

    .profile-edit-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    .profile-info {
        min-width: 0;
        width: 100%;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .profile-email {
        font-size: 0.9rem;
    }

    .profile-country {
        font-size: 0.85rem;
        justify-content: center;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .profile-stat-card {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .profile-stat-value {
        font-size: 1.3rem;
    }

    .profile-stat-label {
        font-size: 0.75rem;
    }

    .profile-status-bar {
        padding: 0.8rem 1rem;
    }

    .profile-section-title {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .profile-bio-box,
    .profile-target-box {
        padding: 1rem;
        border-radius: 10px;
    }

    .profile-bio-btn {
        padding: 0.6rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    .profile-target-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .profile-progress-track {
        height: 16px;
    }

    .profile-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .profile-action-btn {
        min-width: 0;
        padding: 0.75rem;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    .profile-empty-state {
        padding: 1.5rem;
    }

    .profile-empty-state .emoji {
        font-size: 2rem;
    }

    .theme-selector-card {
        padding: 0.8rem;
        border-radius: 10px;
        margin-bottom: 1rem;
    }

    .theme-selector-title {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .theme-option {
        padding: 0.6rem;
        border-radius: 8px;
    }

    .theme-option-label {
        font-size: 0.68rem;
    }

    .theme-preview {
        height: 24px;
        margin-bottom: 0.5rem;
    }

    /* ================================================
       MODALS — proper mobile sizing
       ================================================ */
    .modal {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        transform: none;
        padding: 0.5rem;
        display: none;
        align-items: center;
        justify-content: center;
    }

    .modal.active {
        display: flex;
    }

    .modal-content {
        padding: 1.2rem 0.8rem;
        border-radius: 16px;
        max-height: 85vh;
        width: 100%;
        max-width: 400px;
    }

    .modal-header {
        margin-bottom: 1.2rem;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .close-btn {
        font-size: 1.5rem;
        width: 32px;
        height: 32px;
    }

    .form-group {
        margin-bottom: 1.2rem;
    }

    .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .form-input, .form-textarea {
        padding: 0.75rem 1rem;
        font-size: 16px; /* prevents iOS zoom */
        border-radius: 10px;
        border-width: 1.5px;
    }

    .form-actions {
        gap: 0.6rem;
    }

    .btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.78rem;
        border-radius: 10px;
        letter-spacing: 0.8px;
    }

    .btn:hover {
        transform: none;
    }

    /* Invite modal */
    .invite-code {
        font-size: 1.5rem;
        padding: 1rem;
        letter-spacing: 4px;
        border-radius: 12px;
        margin: 0.8rem 0;
    }

    .invite-actions {
        gap: 0.6rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Time input */
    .time-input-group {
        gap: 0.8rem;
    }

    .time-input {
        padding: 0.8rem;
        font-size: 16px;
        border-radius: 10px;
    }

    .time-separator {
        font-size: 1rem;
    }

    /* ================================================
       NOTIFICATIONS
       ================================================ */
    .notification {
        font-size: 0.75rem;
        padding: 0.7rem 0.9rem;
        max-width: 90vw;
        min-width: auto;
        border-radius: 10px;
        border-width: 1.5px;
    }

    /* ================================================
       SUPPORT PAGE
       ================================================ */
    .support-page {
        padding: 0.5rem;
        height: calc(100vh - 56px);
    }

    .support-page .ai-chat-container {
        border-radius: 10px;
    }

    .support-page .ai-messages {
        padding: 0.6rem;
        gap: 6px;
    }

    .support-page .ai-input-bar {
        gap: 6px;
        padding: 6px;
    }

    .support-page textarea {
        font-size: 16px;
    }

    /* ================================================
       FOCUS MODE — touch optimized
       ================================================ */
    .flipclock {
        gap: 0.4rem;
    }

    .flipclock .tile {
        width: clamp(52px, 20vw, 80px);
        height: clamp(68px, 26vw, 100px);
        border-radius: 10px;
    }

    .flipclock .tile::before,
    .flipclock .tile::after,
    .flipclock .tile .top,
    .flipclock .tile .bottom {
        font-size: clamp(40px, 17vw, 68px);
    }

    .flipclock .colon {
        font-size: clamp(32px, 14vw, 60px);
    }

    .focus-controls {
        gap: 0.8rem;
    }

    .focus-controls .control-btn {
        font-size: 0.8rem;
        padding: 0.7rem 1.2rem;
    }

    .focus-quote {
        font-size: 1rem;
        max-width: 90%;
        margin-bottom: 2rem;
    }

    #focusTimerTime {
        font-size: 4rem !important;
    }

    #focusTimerStatus {
        font-size: 1.2rem !important;
    }

    /* ================================================
       MISCELLANEOUS TOUCH UX
       ================================================ */
    /* Prevent text selection on interactive elements */
    button, .nav-btn, .control-btn, .tab-btn,
    .group-action-btn, .group-card, .theme-option {
        -webkit-user-select: none;
        user-select: none;
    }

    /* Ensure minimum touch targets (44px Apple guideline) */
    .group-card-leave,
    .admin-btn,
    .action-btn,
    .chat-btn,
    .tab-btn,
    .close-btn {
        min-height: 32px;
        min-width: 32px;
    }

    /* Celebration container - don't block touch */
    .celebration {
        pointer-events: none;
    }

    /* Loading spinner — smaller */
    .loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 3px;
    }

    /* Achievement badges */
    .achievement-badge {
        padding: 0.4rem 0.8rem;
        margin: 0.3rem;
        font-size: 0.75rem;
    }

    .achievement-badge i {
        font-size: 1rem;
    }

    /* Footer */
    .site-footer {
        margin-top: 2rem;
        padding: 1rem 0.75rem;
    }

    .footer-brand {
        gap: 0.4rem;
    }

    .footer-logo {
        font-size: 0.95rem;
    }

    .footer-tagline {
        font-size: 0.75rem;
    }

    .footer-links {
        gap: 0.35rem;
    }

    .footer-links a {
        font-size: 0.75rem;
    }

    .footer-copy {
        font-size: 0.68rem;
    }

    /* Empty state containers — mobile */
    .empty-state-container {
        padding: 1.5rem 1rem;
    }

    .empty-state-icon {
        font-size: 2rem;
    }

    .empty-state-message {
        font-size: 0.9rem;
    }

    .empty-state-tip {
        max-width: 100%;
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }

    /* Task Manager modal — override ID specificity for mobile */
    #taskManagerModal .modal-content {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Premium page mobile */
    .premium-plan-toggle {
        gap: 0.6rem;
    }
    .premium-plan-btn {
        padding: 1.2rem 0.8rem;
        border-radius: 14px;
    }
    .premium-plan-price {
        font-size: 2.2rem;
    }
    .premium-plan-name {
        font-size: 0.9rem;
    }
    .premium-features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    .premium-hero-title {
        font-size: 2rem;
    }
    .premium-hero-subtitle {
        font-size: 1rem;
    }
    .premium-page-container {
        padding: 1rem 0.75rem 3rem;
    }
    .premium-feature-card {
        padding: 1.2rem 0.8rem;
    }
    .premium-feature-icon {
        font-size: 2rem;
    }
    .premium-feature-card h3 {
        font-size: 1.05rem;
    }
    .premium-feature-card p {
        font-size: 0.85rem;
    }
    .premium-section-title {
        font-size: 1.3rem;
    }
    .premium-price-card {
        padding: 1.2rem;
    }
    .premium-payment-section {
        padding: 1.2rem 1rem;
    }
    .premium-upi-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
    }
    .premium-open-upi-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    .premium-active-banner {
        flex-direction: column;
        text-align: center;
        padding: 1.2rem;
        gap: 0.8rem;
    }
    .premium-active-info h2 {
        font-size: 1.2rem;
    }
    .premium-active-info p {
        font-size: 0.95rem;
    }
    .qr-modal-content {
        max-width: 96%;
        padding: 2rem 1.2rem;
    }
    .qr-modal-content .premium-qr-img {
        width: 576px;
        max-width: 90vw;
        height: auto;
        aspect-ratio: 1;
    }
    .qr-modal-title {
        font-size: 1.6rem;
    }
    .qr-modal-upi {
        font-size: 1.2rem;
    }
    .qr-modal-upi strong {
        font-size: 1.3rem;
    }

    /* Spotify bar mobile */
    .spotify-bar {
        max-width: 100%;
        border-radius: 12px;
        margin-top: 0.6rem;
    }
    .sp-connected {
        gap: 0.5rem;
        padding: 0.65rem 0.65rem;
        flex-wrap: wrap;
    }
    .sp-art {
        width: 44px;
        height: 44px;
        border-radius: 8px;
    }
    .sp-info {
        flex: 1 1 0;
        min-width: 90px;
    }
    .sp-track {
        font-size: 0.95rem;
    }
    .sp-artist {
        font-size: 0.82rem;
    }
    .sp-controls {
        gap: 0.1rem;
    }
    .sp-btn {
        width: 36px;
        height: 36px;
        font-size: 0.88rem;
    }
    .sp-btn-play {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    .sp-bars {
        display: none;
    }
}

/* ===== AI ANALYSIS PANEL ===== */
.ai-analysis-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.35);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}
.ai-analysis-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(124, 58, 237, 0.5);
}
.ai-analysis-btn i {
    font-size: 1.05rem;
}

/* Overlay */
.ai-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
.ai-panel-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Slide-in panel */
.ai-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(520px, 92vw);
    height: 100vh;
    background: var(--surface, #0a0a14);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}
.ai-panel.active {
    transform: translateX(0);
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(124, 58, 237, 0.08);
}
.ai-panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text, #fff);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.ai-panel-title i {
    color: #a855f7;
    font-size: 1.2rem;
}
.ai-panel-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--muted, rgba(255,255,255,0.65));
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ai-panel-close:hover {
    background: rgba(255, 77, 109, 0.2);
    color: #ff4d6d;
}
.ai-panel-month {
    padding: 0.75rem 1.5rem;
    font-size: 0.85rem;
    color: var(--muted, rgba(255,255,255,0.65));
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}
.ai-panel-body::-webkit-scrollbar {
    width: 6px;
}
.ai-panel-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.ai-panel-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--muted, rgba(255,255,255,0.65));
    font-size: 0.95rem;
    line-height: 1.6;
}

.ai-generate-btn {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 0.9rem 2.2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.4);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.ai-generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.55);
}
.ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* AI Report Rendering */
.ai-report {
    color: var(--text, rgba(255,255,255,0.95));
    font-size: 0.92rem;
    line-height: 1.7;
}
.ai-report-section {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--card, #12121e);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.ai-report-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #a855f7;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ai-report-section p,
.ai-report-section ul {
    margin: 0;
    color: var(--text, rgba(255,255,255,0.95));
}
.ai-report-section ul {
    padding-left: 1.2rem;
}
.ai-report-section li {
    margin-bottom: 0.35rem;
}

.ai-report-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 0.5rem;
}
.ai-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: rgba(124, 58, 237, 0.08);
    border-radius: 8px;
    font-size: 0.85rem;
}
.ai-score-item .score-label {
    color: var(--muted, rgba(255,255,255,0.65));
    font-weight: 500;
}
.ai-score-item .score-value {
    color: #a855f7;
    font-weight: 700;
    font-size: 0.95rem;
}
.ai-score-item.overall {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.2);
}
.ai-score-item.overall .score-value {
    font-size: 1.1rem;
}

/* Loading animation */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    gap: 1.2rem;
}
.ai-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(124, 58, 237, 0.15);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: aiSpin 0.8s linear infinite;
}
@keyframes aiSpin {
    to { transform: rotate(360deg); }
}
.ai-loading-text {
    color: var(--muted, rgba(255,255,255,0.65));
    font-size: 0.92rem;
    font-weight: 500;
}

.ai-error {
    text-align: center;
    padding: 2rem;
    color: #ff8fa3;
    font-size: 0.92rem;
}
.ai-error i {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    display: block;
    color: #ff4d6d;
}
.ai-error button {
    margin-top: 1rem;
    background: rgba(255, 77, 109, 0.15);
    border: 1px solid rgba(255, 77, 109, 0.3);
    color: #ff8fa3;
    padding: 0.6rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}
.ai-error button:hover {
    background: rgba(255, 77, 109, 0.25);
}

/* Mobile responsiveness for AI panel */
@media (max-width: 600px) {
    .ai-analysis-btn {
        padding: 0.7rem 1.2rem;
        font-size: 0.82rem;
    }
    .ai-panel {
        width: 100vw;
    }
    .ai-report-scores {
        grid-template-columns: 1fr;
    }
}

/* ========== RESPECT REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    .donor-row .donor-sweep::before,
    .leaderboard-item.donor-row::before,
    .global-leaderboard-item.donor-row::before,
    .leaderboard-item.donor-row::after,
    .global-leaderboard-item.donor-row::after,
    .donor-name,
    .donor-row .rank,
    .donor-sparkle,
    .donor-sparkle-star,
    .donor-diamond,
    .donor-avatar-ring::before,
    .donor-avatar-ring::after,
    .donor-avatar-ring .donor-orbit-dot {
        animation: none !important;
    }
    .donor-sparkle, .donor-sparkle-star { opacity: 0 !important; }
    .leaderboard-item.donor-row::after,
    .global-leaderboard-item.donor-row::after { opacity: 0.6 !important; }
    .donor-avatar-ring::after { opacity: 0.8 !important; }
}

/* ========== INTERSECTION OBSERVER PAUSING ========== */
.donor-row.donor-offscreen .donor-sweep::before,
.donor-row.donor-offscreen::before,
.donor-row.donor-offscreen::after,
.donor-row.donor-offscreen .donor-name,
.donor-row.donor-offscreen .rank,
.donor-row.donor-offscreen .donor-sparkle,
.donor-row.donor-offscreen .donor-sparkle-star,
.donor-row.donor-offscreen .donor-diamond,
.donor-row.donor-offscreen .donor-avatar-ring::before,
.donor-row.donor-offscreen .donor-avatar-ring::after,
.donor-row.donor-offscreen .donor-avatar-ring .donor-orbit-dot {
    animation-play-state: paused !important;
}