.user-avatar-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.user-avatar {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255, 0, 146, 0.7);
  box-shadow:
    0 0 8px rgba(255, 0, 146, 0.4),
    0 0 14px rgba(0, 191, 255, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background-color: #111;
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 16px rgba(255, 0, 146, 0.6),
    0 0 26px rgba(0, 191, 255, 0.6);
}

.avatar-preview-wrapper {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  perspective: 500px;
}

#avatar-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  transform: rotateY(0deg);
  transition: transform 0.3s ease;
  cursor: pointer;
}

#avatar-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

#avatar-modal.visible {
  display: flex;
}

#avatar-modal .modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  padding: 1rem;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#avatar-modal img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
}

#avatar-modal .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.5);
  color: #ff0092;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 10px rgba(255, 0, 146, 0.3),
    0 0 20px rgba(0, 191, 255, 0.2);
  animation: glowPulseSmooth 2s ease-in-out infinite;
  transition: transform 0.3s ease, box-shadow 0.3s ease, color 0.3s ease, background 0.3s ease;
  cursor: pointer;
}

#avatar-modal .close-btn:hover {
  transform: scale(1.05);
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  box-shadow:
    0 0 20px rgba(255, 0, 146, 0.5),
    0 0 40px rgba(0, 191, 255, 0.4);
}

#avatar-input {
  display: none !important;
}

#close-avatar-modal {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#close-avatar-modal.glow-button {
  background: rgba(0,0,0,0.5);
  color: #ff0092;
  border: none;
  border-radius: 50%;
  box-shadow:
    0 0 10px rgba(255,0,146,0.3),
    0 0 20px rgba(0,191,255,0.2);
  animation: glowPulseSmooth 2s ease-in-out infinite;
  transition: transform .3s ease, box-shadow .3s ease, background .3s ease, color .3s ease;
}

#close-avatar-modal.glow-button:hover {
  transform: scale(1.05);
  background: rgba(0,0,0,0.6);
  color: #fff;
  box-shadow:
    0 0 20px rgba(255,0,146,0.5),
    0 0 40px rgba(0,191,255,0.4);
}

.topbar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 30px;
}

.topbar-nav li a {
  position: relative;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #ddd;
  overflow: hidden;
  background: none;
  transition: box-shadow 0.4s ease-in-out;
}

.topbar-nav li a.active::before,
.topbar-nav li a.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-size: 200% 200%;
  z-index: -1;
  animation: activeGradientShift 6s ease infinite, activePulse 3s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

.topbar-nav li a.active::before {
  background: linear-gradient(135deg, rgba(0,191,255,0.2), rgba(0,191,255,0.4), rgba(0,191,255,0.2));
  opacity: 1;
}

.topbar-nav li a.active::after {
  background: linear-gradient(135deg, rgba(255,0,146,0.4), rgba(255,0,146,0.6), rgba(255,0,146,0.4));
  opacity: 0;
}

.topbar-nav li a.active:hover::before {
  opacity: 0;
}

.topbar-nav li a.active:hover::after {
  opacity: 1;
}

.topbar-nav li a.active:hover {
  box-shadow:
    0 0 20px rgba(255,0,146,0.5),
    0 0 40px rgba(0,191,255,0.4);
}

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

@keyframes activePulse {
  0%, 100% {
    box-shadow:
      0 0 12px rgba(255, 0, 146, 0.4),
      0 0 24px rgba(255, 0, 146, 0.3);
  }
  50% {
    box-shadow:
      0 0 20px rgba(255, 0, 146, 0.7),
      0 0 40px rgba(255, 0, 146, 0.5);
  }
}

.user-menu {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-username {
  color: #ddd;
  font-weight: 500;
}

.user-menu .dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  margin: 8px 0 0 -32px;
  list-style: none;
  padding: 8px 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  border-radius: 8px;
  display: none;
  min-width: max-content;
  width:auto;
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
  white-space: nowrap;
}

.user-menu.open .dropdown-menu {
  display: block;
}

.dropdown-menu li a {
  display: flex;
  flex-direction: column; /* вертикальная колонка пунктов */
  align-items: center; 
  padding: 8px 16px;
  color: #ddd;
  text-decoration: none;
  transition: background 0.2s;
}

.dropdown-menu li a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.topbar {
  display: flex;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
}

@media (max-width: 768px) {
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: center;
    background: rgba(0,0,0,0.9);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
  }

  .topbar.visible {
    transform: translateY(0);
  }

  .topbar-nav {
    flex-direction: column;
    gap: 16px;
    padding: 16px 0;
  }

  .mobile-toggle {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 11000;
    background: none;
    border: none;
    cursor: pointer;
  }

  .mobile-toggle .bar {
    display: block;
    width: 28px;
    height: 3px;
    margin: 5px 0;
    background: #fff;
    transition: all 0.3s ease;
  }

  .mobile-toggle.active .top {
    transform: rotate(45deg) translateY(8px);
  }
  .mobile-toggle.active .middle {
    opacity: 0;
  }
  .mobile-toggle.active .bottom {
    transform: rotate(-45deg) translateY(-8px);
  }
}