/* styles.css - оптимизированная версия */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(18, 18, 30, 0.7);
    --glass-border: rgba(139, 92, 246, 0.3);
    --glass-border-hover: rgba(139, 92, 246, 0.8);
    --primary: #8b5cf6;
    --primary-grad: linear-gradient(135deg, #a855f7, #7c3aed);
    --secondary: #c084fc;
    --text-light: #f1f5f9;
    --text-muted: #a1a1aa;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background: var(--bg-dark);
    font-family: 'Inter', sans-serif;
    color: var(--text-light);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Оптимизированный скролл */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #1e1e2a;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 6px;
}

/* Оптимизированные частицы - меньше и легче */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}
.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(139,92,246,0.2) 0%, rgba(139,92,246,0) 70%);
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
    animation: floatParticle 20s infinite alternate ease-in-out;
}

/* Медиа-запрос для отключения тяжелых анимаций на мобилках */
@media (max-width: 768px) {
    .particle {
        animation: none;
        opacity: 0.3;
    }
    .bg-particles {
        display: none;
    }
}

@keyframes floatParticle {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(2%, 2%) scale(1.2); }
}

/* Оптимизированный контейнер */
.container {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 20px 40px;
    width: 100%;
}

/* Десктопная навигация - оптимизирована */
.desktop-nav {
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 80px;
    padding: 10px 24px;
    margin-bottom: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--glass-border);
    contain: layout style paint;
}
.logo {
    font-size: 24px;
    font-weight: 800;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.nav-links {
    display: flex;
    gap: 28px;
}
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
    padding: 4px 0;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-grad);
    transition: width 0.2s;
}
.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}
.nav-links a:hover,
.nav-links a.active {
    color: white;
}
.user-area {
    display: flex;
    align-items: center;
    gap: 16px;
}
.stars-badge {
    background: rgba(0,0,0,0.5);
    border-radius: 40px;
    padding: 6px 16px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--warning);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    padding: 6px 20px;
    border-radius: 32px;
    color: var(--secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
@media (hover: hover) {
    .btn-outline:hover {
        background: var(--primary);
        color: white;
    }
}

/* Гамбургер - оптимизирован */
.hamburger {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    background: rgba(20, 20, 35, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 50%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border: 1px solid var(--glass-border);
}
.hamburger span {
    width: 22px;
    height: 2px;
    background: var(--secondary);
    transition: 0.2s;
}
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 260px;
    height: 100vh;
    background: rgba(10, 10, 20, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1000;
    transition: right 0.25s ease-out;
    padding: 24px 20px;
    border-left: 1px solid var(--glass-border);
}
.mobile-nav.open {
    right: 0;
}
.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--glass-border);
}
.logo-mobile {
    font-size: 20px;
    font-weight: 700;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.close-nav {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--secondary);
    cursor: pointer;
    line-height: 1;
}
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.mobile-nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 16px;
    padding: 8px 0;
    cursor: pointer;
    transition: 0.2s;
}
.btn-outline-mobile {
    background: transparent;
    border: 1px solid var(--primary);
    padding: 10px;
    border-radius: 32px;
    color: var(--secondary);
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
}

/* Общие кнопки */
.btn-primary {
    background: var(--primary-grad);
    border: none;
    padding: 10px 28px;
    border-radius: 40px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    text-align: center;
}
@media (hover: hover) {
    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 16px rgba(139,92,246,0.4);
    }
}
.btn-secondary {
    background: #2d2d4a;
    border: none;
    padding: 10px 18px;
    border-radius: 40px;
    color: #ccc;
    cursor: pointer;
    width: 100%;
    margin-top: 14px;
}

/* Карточки - оптимизированы */
.card, .feature-card, .task-card, .profile-card, 
.ref-card, .leaderboard-container, .contacts-card, 
.stat-card, .testimonial-card, .faq-item {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    padding: 24px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
    text-align: center;
    contain: layout style paint;
}

@media (hover: hover) {
    .feature-card:hover, .task-card:hover, .card:hover {
        transform: translateY(-3px);
        border-color: var(--glass-border-hover);
    }
}

.task-btn {
    background: var(--primary-grad);
    border: none;
    border-radius: 32px;
    padding: 10px;
    font-weight: 600;
    cursor: pointer;
    color: white;
    width: 100%;
    margin-top: 14px;
    transition: opacity 0.2s;
}
.task-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.referral-code {
    background: #0a0a18;
    padding: 10px 16px;
    border-radius: 32px;
    word-break: break-all;
    font-family: monospace;
    font-size: 13px;
    display: inline-block;
    cursor: pointer;
}
.copy-tooltip {
    font-size: 11px;
    color: var(--success);
    margin-left: 8px;
}

/* Заголовки */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 50px 0 25px;
    text-align: center;
    background: linear-gradient(135deg, #e9d5ff, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero {
    text-align: center;
    margin: 30px auto 50px;
    max-width: 800px;
}
.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.hero h1 span {
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 16px auto;
}

/* Сетки - оптимизированы */
.features, .tasks-grid, .stats-grid, .testimonials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
    margin: 30px 0;
}
.feature-card, .task-card, .stat-card, .testimonial-card {
    flex: 1 1 260px;
    max-width: 300px;
}
.task-icon {
    font-size: 36px;
    margin-bottom: 16px;
    color: var(--secondary);
}
.task-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}
.task-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}
.task-reward {
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 20px;
    font-size: 16px;
}

/* Лидерборд */
.leaderboard-container {
    text-align: center;
}
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

/* Рефералы */
.referrals-list {
    max-width: 700px;
    margin: 0 auto;
}
.referral-header, .referral-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--glass-border);
}
.referral-header {
    font-weight: 600;
    color: var(--secondary);
}
.referral-row span {
    flex: 1;
    text-align: center;
    font-size: 14px;
}

/* FAQ */
.faq {
    max-width: 700px;
    margin: 0 auto;
}
.faq-item {
    margin-bottom: 16px;
    text-align: left;
    padding: 20px;
}
.faq-question {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
    user-select: none;
}
.faq-answer {
    margin-top: 12px;
    color: var(--text-muted);
    display: none;
    font-size: 14px;
}

/* Модалки - оптимизированы */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #14132b;
    border-radius: 36px;
    max-width: 460px;
    width: 90%;
    padding: 32px;
    border: 1px solid var(--primary);
    text-align: center;
}
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    justify-content: center;
}
.tab-btn {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}
.tab-btn.active {
    color: var(--secondary);
    border-bottom: 2px solid var(--secondary);
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}
input, select {
    background: rgba(30,30,50,0.9);
    border: 1px solid #6b21a5;
    padding: 12px 16px;
    border-radius: 32px;
    color: white;
    width: 100%;
    margin: 10px 0;
    text-align: center;
    font-size: 14px;
}
.error-message {
    color: var(--error);
    font-size: 13px;
}
.success-message {
    color: var(--success);
    font-size: 13px;
}

/* Toast - оптимизирован */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #1e1e2e;
    backdrop-filter: blur(12px);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 10px 18px;
    color: white;
    font-size: 13px;
    animation: slideIn 0.25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Анимация появления - оптимизирована */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Адаптив - мобильная оптимизация */
@media (max-width: 900px) {
    .desktop-nav { display: none; }
    .hamburger { display: flex; }
    .hero h1 { font-size: 1.8rem; }
    .section-title { font-size: 1.5rem; margin: 35px 0 20px; }
    .feature-card, .task-card, .stat-card, .testimonial-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .profile-card, .ref-card, .leaderboard-container {
        padding: 20px;
    }
    .referral-header, .referral-row {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    .feature-card, .task-card {
        padding: 20px;
    }
    .container {
        padding: 12px 16px 30px;
    }
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    color: #6b7280;
    font-size: 13px;
}

/* Telegram Popup - оптимизирован */
.telegram-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.telegram-popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.telegram-popup {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    max-width: 360px;
    width: 90%;
    margin: 16px;
    border: 1px solid rgba(42, 125, 225, 0.3);
}

.telegram-popup-content {
    padding: 28px 24px;
    text-align: center;
}

.telegram-popup-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2a7de1, #1a5bbf);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.telegram-popup-icon i {
    font-size: 30px;
    color: white;
}

.telegram-popup h3 {
    color: white;
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 700;
}

.telegram-popup p {
    color: #a0aec0;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.telegram-popup-btn {
    background: linear-gradient(135deg, #2a7de1, #1a5bbf);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
}

.telegram-popup-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 8px;
    color: #a0aec0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
}

@media (max-width: 480px) {
    .telegram-popup-content {
        padding: 20px 16px;
    }
    .telegram-popup-icon {
        width: 50px;
        height: 50px;
    }
    .telegram-popup-icon i {
        font-size: 24px;
    }
    .telegram-popup h3 {
        font-size: 18px;
    }
}