/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ===== Design Tokens ===== */
:root {
    --bg-color: #0a0610;
    --text-color: #ffffff;
    --text-secondary: #b0a3ba;
    --hint-color: #8a7e94;

    /* Тёмно-красная палитра бренда */
    --accent-color: #ff2a5f;
    --accent-hover: #ff1449;
    --accent-glow: rgba(255, 42, 95, 0.5);
    --accent-soft: rgba(255, 42, 95, 0.15);

    --success-color: #00e676;
    --success-glow: rgba(0, 230, 118, 0.4);
    --warning-color: #ff9f0a;

    /* Glass */
    --glass-bg: rgba(18, 12, 28, 0.6);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-highlight: rgba(255, 42, 95, 0.08);

    /* Размеры */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-pill: 50px;
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== Body & Background ===== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Анимированные орбы на фоне */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
    animation: orbFloat 8s ease-in-out infinite;
}

body::before {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 42, 95, 0.25), transparent 70%);
    top: -80px;
    right: -60px;
    animation-duration: 8s;
}

body::after {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(180, 0, 60, 0.2), transparent 70%);
    bottom: -60px;
    left: -40px;
    animation-duration: 10s;
    animation-delay: -4s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(15px, -20px) scale(1.05);
    }

    66% {
        transform: translate(-10px, 15px) scale(0.95);
    }
}

/* ===== App Container ===== */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 100%;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 32px;
}

/* ===== Glassmorphism Cards ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative;
    overflow: hidden;
}

/* Тонкая красная подсветка сверху карточки */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.5;
}

/* ===== Profile Header ===== */
.profile-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 24px;
}

/* Аватар */
.avatar-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.avatar-ring {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--accent-color), #ff6b8a, var(--accent-color));
    box-shadow: 0 0 30px var(--accent-glow);
    animation: ringPulse 3s ease-in-out infinite;
}

.avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-inner svg {
    width: 44px;
    height: 44px;
    fill: var(--hint-color);
}

.avatar-inner img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

@keyframes ringPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(255, 42, 95, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(255, 42, 95, 0.5);
    }
}

/* VIP бейдж */
.vip-badge {
    position: absolute;
    bottom: 0;
    right: -4px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border: 2px solid var(--bg-color);
    transition: all 0.3s ease;
}

.vip-badge.inactive {
    background: rgba(255, 255, 255, 0.1);
}

.vip-badge.active {
    background: linear-gradient(135deg, var(--accent-color), #ff6b8a);
    box-shadow: 0 0 12px var(--accent-glow);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

#user-name {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: -0.3px;
}

#user-id {
    font-size: 13px;
    color: var(--hint-color);
    font-family: 'Inter', monospace;
    font-weight: 500;
}

/* ===== Stats Cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 8px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 30%;
    right: 30%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.3;
}

.stat-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: var(--accent-soft);
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--hint-color);
    font-weight: 500;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Progress Section ===== */
.progress-section {
    text-align: center;
}

.progress-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-secondary);
    letter-spacing: -0.2px;
}

/* Круговой прогресс */
.circular-progress {
    position: relative;
    height: 170px;
    width: 170px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px auto;
    background: conic-gradient(var(--accent-color) 0deg, rgba(255, 255, 255, 0.05) 0deg);
    box-shadow: 0 0 40px rgba(255, 42, 95, 0.15);
    transition: background 1.2s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 1.2s ease;
    will-change: background, box-shadow;
}

.inner-circle {
    position: absolute;
    height: 148px;
    width: 148px;
    border-radius: 50%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

#ref-count {
    font-size: 48px;
    font-weight: 900;
    color: var(--text-color);
    text-shadow: 0 0 25px var(--accent-glow);
    line-height: 1;
    transition: text-shadow 1s ease;
}

.ref-total {
    font-size: 18px;
    color: var(--hint-color);
    font-weight: 600;
    margin-top: 4px;
}

.progress-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.4;
}

/* Статус награды */
.reward-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.25);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.4s ease;
}

.reward-status.pending {
    color: var(--warning-color);
    border: 1px solid rgba(255, 159, 10, 0.25);
}

.reward-status.success {
    color: var(--text-color);
    border: 1px solid rgba(255, 42, 95, 0.4);
    background: rgba(255, 42, 95, 0.15);
    box-shadow: 0 0 25px rgba(255, 42, 95, 0.2);
}

/* ===== Achievements ===== */
.achievements-section {
    padding: 20px 24px;
}

.achievements-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
    letter-spacing: -0.2px;
}

.achievements-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.achievements-grid::-webkit-scrollbar {
    display: none;
}

.achievement {
    flex: 0 0 auto;
    width: 72px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.achievement-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: all 0.3s ease;
}

.achievement-icon.locked {
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    filter: grayscale(1) opacity(0.4);
}

.achievement-icon.unlocked {
    background: var(--accent-soft);
    border: 1px solid rgba(255, 42, 95, 0.3);
    box-shadow: 0 0 15px rgba(255, 42, 95, 0.15);
}

.achievement-label {
    font-size: 10px;
    color: var(--hint-color);
    font-weight: 500;
    line-height: 1.2;
}

/* ===== Referral Link ===== */
.ref-link-section {
    padding: 18px 24px;
}

.ref-link-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: -0.2px;
}

.ref-link-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ref-link-box:active {
    transform: scale(0.98);
}

.ref-link-text {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: 'Inter', monospace;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 15px;
    transition: all 0.2s ease;
}

.ref-link-box.copied .copy-icon {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success-color);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    color: var(--success-color);
    padding: 10px 20px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 100;
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Buttons ===== */
.action-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

button {
    border: none;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.3s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(0.97);
}

.main-btn {
    background: linear-gradient(135deg, #ff2a5f, #e01245);
    color: var(--text-color);
    box-shadow: 0 6px 24px rgba(255, 42, 95, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    letter-spacing: -0.2px;
}

.main-btn:active {
    box-shadow: 0 2px 12px rgba(255, 42, 95, 0.3);
}

.secondary-btn {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid rgba(255, 42, 95, 0.3);
    letter-spacing: -0.2px;
}

.secondary-btn:active {
    background: rgba(255, 42, 95, 0.05);
}

/* ===== Skeleton Loader ===== */
.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-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 14px;
    width: 60%;
    margin: 4px auto;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-number {
    height: 48px;
    width: 60px;
    margin: 0 auto;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Confetti Container ===== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    top: -10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.3);
        opacity: 0;
    }
}

/* ===== Animations ===== */
@keyframes popIn {
    0% {
        transform: translateY(16px) scale(0.96);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.app-container>* {
    animation: popIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

.profile-header {
    animation-delay: 0.05s;
}

.stats-grid {
    animation-delay: 0.1s;
}

.progress-section {
    animation-delay: 0.15s;
}

.achievements-section {
    animation-delay: 0.2s;
}

.ref-link-section {
    animation-delay: 0.25s;
}

.action-section {
    animation-delay: 0.3s;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body::before,
    body::after {
        animation: none;
    }

    .circular-progress {
        transition: none;
    }
}