:root {
  --bg: #0a0014;
  --card: rgba(30, 10, 60, 0.6);
  --card-hover: rgba(45, 15, 80, 0.7);
  --border: rgba(167, 139, 250, 0.15);
  --border-hover: rgba(167, 139, 250, 0.35);
  --text: #f0e6ff;
  --text2: #b4a0d4;
  --text3: #7c6a9e;
  --purple: #a855f7;
  --cyan: #06d6a0;
  --pink: #ff6b9d;
  --blue: #60a5fa;
  --violet: #c084fc;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0014;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  will-change: opacity, visibility;
}

.loader-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: mobileZoom 4s ease-in-out infinite;
  will-change: transform;
}

@keyframes mobileZoom {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@media (min-width: 501px) {
  .loader-video { animation: none; }
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 500px at 25% 15%, rgba(168, 85, 247, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse 600px 600px at 75% 85%, rgba(6, 214, 160, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 500px 500px at 50% 50%, rgba(255, 107, 157, 0.08) 0%, transparent 60%);
  animation: bgDrift 20s ease-in-out infinite alternate;
  z-index: 0;
  will-change: transform;
}

@keyframes bgDrift {
  0% { transform: scale(1) rotate(0deg); }
  100% { transform: scale(1.05) rotate(2deg); }
}

.bg-noise {
  position: fixed;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: float linear infinite;
  will-change: transform, opacity;
}

@keyframes float {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.5; }
  90% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

.main {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 420px;
  padding: 40px 24px;
  contain: layout style;
}

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin-bottom: 24px;
  animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  will-change: transform, opacity;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.avatar-glow {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.4), rgba(6, 214, 160, 0.2), transparent 70%);
  filter: blur(20px);
  animation: glowPulse 3s ease-in-out infinite;
  will-change: transform, opacity;
}

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

.avatar-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--cyan), var(--purple), var(--pink), var(--cyan));
  animation: ringSpin 4s linear infinite;
  opacity: 0.7;
  will-change: transform;
}

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

.avatar-img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(168, 85, 247, 0.5);
  z-index: 1;
}

.avatar-fallback {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: #fff;
  z-index: 1;
  border: 3px solid rgba(168, 85, 247, 0.5);
}

.profile-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 8px;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--cyan), var(--blue), var(--purple), var(--pink));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: slideUp 0.5s ease-out 0.2s both, nameShift 6s ease-in-out infinite;
  will-change: transform, opacity, background-position;
}

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

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

.profile-bio {
  font-size: 0.95rem;
  color: var(--text2);
  margin-bottom: 36px;
  animation: slideUp 0.5s ease-out 0.35s both;
  will-change: transform, opacity;
}

.social-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.35s ease, box-shadow 0.35s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: slideUp 0.5s ease-out var(--d, 0.6s) both;
  position: relative;
  overflow: hidden;
  contain: layout style;
}

.social-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.social-btn:hover::before,
.social-btn:active::before {
  opacity: 0.08;
}

.social-btn:hover,
.social-btn:active {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--accent);
  box-shadow: 0 8px 32px var(--glow), 0 0 20px var(--glow);
}

.btn-icon {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  flex-shrink: 0;
  transition: transform 0.35s ease, background 0.35s ease, box-shadow 0.35s ease;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.social-btn:hover .btn-icon,
.social-btn:active .btn-icon {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 12px var(--glow);
}

.btn-info {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.btn-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  font-weight: 600;
}

.btn-user {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.btn-arrow {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  color: var(--text3);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}

.social-btn:hover .btn-arrow,
.social-btn:active .btn-arrow {
  opacity: 1;
  transform: translate(0, 0);
  color: var(--accent);
}

.social-btn:hover .btn-user,
.social-btn:active .btn-user {
  color: var(--accent);
}

.profile-footer {
  margin-top: 48px;
  font-size: 0.75rem;
  color: var(--text3);
  animation: slideUp 0.5s ease-out 1s both;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.3); border-radius: 2px; }

@media (max-width: 500px) {
  .main {
    padding: 24px 16px;
    max-width: 100%;
  }

  .avatar-wrap {
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
  }

  .avatar-glow { inset: -16px; }

  .profile-name { font-size: 2rem; }

  .profile-bio {
    font-size: 0.85rem;
    margin-bottom: 24px;
  }

  .social-grid { gap: 8px; }

  .social-btn {
    padding: 12px 14px;
    gap: 12px;
    border-radius: 12px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .btn-icon svg {
    width: 18px;
    height: 18px;
  }

  .btn-user { font-size: 0.88rem; }
  .btn-label { font-size: 0.62rem; }
  .profile-footer { margin-top: 36px; }
}

@media (max-width: 360px) {
  .main { padding: 20px 12px; }
  .profile-name { font-size: 1.7rem; }
  .avatar-wrap { width: 80px; height: 80px; margin-bottom: 12px; }
  .avatar-glow { inset: -12px; }
  .social-btn { padding: 10px 12px; gap: 10px; }
}

@supports (padding-top: env(safe-area-inset-top)) {
  .main {
    padding-top: max(40px, env(safe-area-in-top));
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }
}
