:root {
  /* DarkReader-compatible color scheme */
  color-scheme: dark;

  /* Use slightly off-black to work better with DarkReader filter mode */
  --bg-primary: #0a0a0a;
  --bg-secondary: #141414;
  --text-primary: #FDFCFB;
  --text-secondary: rgba(253, 252, 251, 0.75);
  --accent-primary: #00e5ff;
  --accent-secondary: #0099cc;
  --accent-glow: rgba(0, 229, 255, 0.4);
  --border-color: rgba(0, 229, 255, 0.2);
  --border-hover: rgba(0, 229, 255, 0.5);
  --glass-bg: rgba(253, 252, 251, 0.04);
  --glass-hover: rgba(253, 252, 251, 0.08);
  --card-bg: rgba(10, 10, 10, 0.6);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  min-height: 100vh;
  color: var(--text-primary);
  overflow-x: hidden;
  line-height: 1.5;
  /* Ensure DarkReader respects the dark theme */
  color-scheme: dark;
}

/* Animated gradient background - DarkReader compatible */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg-primary);
  /* Prevent DarkReader from inverting this element */
  filter: none;
  overflow: hidden;
}

.bg-gradient::before,
.bg-gradient::after {
  content: '';
  position: absolute;
  inset: 0;
  animation: gradientFloat 25s ease-in-out infinite;
}

.bg-gradient::before {
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 153, 204, 0.25) 0%, transparent 50%);
  animation-delay: 0s;
}

.bg-gradient::after {
  background:
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 229, 255, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 10% 80%, rgba(0, 153, 204, 0.1) 0%, transparent 50%);
  animation-delay: -12.5s;
}

@keyframes gradientFloat {
  0%, 100% {
    opacity: 0.4;
    transform: translateY(0px) scale(1);
  }
  20% {
    opacity: 0.6;
    transform: translateY(-40px) scale(1.05);
  }
  40% {
    opacity: 0.5;
    transform: translateY(-80px) scale(1.1);
  }
  60% {
    opacity: 0.55;
    transform: translateY(-40px) scale(1.08);
  }
  80% {
    opacity: 0.45;
    transform: translateY(-20px) scale(1.02);
  }
}

/* Subtle noise texture overlay - DarkReader compatible */
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  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='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  /* Prevent DarkReader from inverting this element */
  filter: none;
  mix-blend-mode: overlay;
}

.page-wrapper {
  min-height: 100vh;
  padding: 3rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.links-container {
  width: 100%;
  max-width: 440px;
  animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Profile Section */
.profile {
  text-align: center;
  margin-bottom: 2.5rem;
}

.avatar-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto 1.25rem;
}

.avatar-glow {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      var(--accent-primary),
      var(--accent-secondary),
      var(--accent-primary));
  animation: rotate 4s linear infinite;
  opacity: 0.6;
  filter: blur(8px);
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
  z-index: 1;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Prevent DarkReader from inverting the avatar image */
  filter: none;
}

.profile h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profile .bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 280px;
  margin: 0 auto;
}

.profile .bio span {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Section Titles */
.section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-secondary);
  margin: 2rem 0 1rem;
  font-weight: 600;
  text-align: center;
  opacity: 0.8;
}

/* Links List */
.links-list {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.link-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 1rem 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  /* Ensure proper contrast with DarkReader */
  background-color: var(--glass-bg);
}

.link-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(0, 229, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.link-item:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px rgba(0, 229, 255, 0.15),
    0 0 0 1px rgba(0, 229, 255, 0.1);
}

.link-item:hover::before {
  opacity: 1;
}

.link-item:active {
  transform: translateY(0);
  transition-duration: 0.1s;
}

.link-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: currentColor;
  opacity: 0.9;
}

/* Primary Link Variant */
.link-item.primary {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12) 0%, rgba(0, 153, 204, 0.08) 100%);
  border-color: rgba(0, 229, 255, 0.35);
  position: relative;
}

.link-item.primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0%,
  100% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
}

.link-item.primary:hover {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2) 0%, rgba(0, 153, 204, 0.15) 100%);
  box-shadow:
    0 8px 40px rgba(0, 229, 255, 0.25),
    0 0 0 1px rgba(0, 229, 255, 0.2);
}

/* Highlight Link Variant */
.link-item.highlight {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.12) 0%, rgba(0, 153, 204, 0.08) 100%);
  border-color: rgba(0, 229, 255, 0.35);
}

.link-item.highlight:hover {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.2) 0%, rgba(0, 153, 204, 0.15) 100%);
  box-shadow:
    0 8px 40px rgba(0, 229, 255, 0.25),
    0 0 0 1px rgba(0, 229, 255, 0.2);
}

/* Social Cards with Follower Counts */
.social-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.social-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(0, 229, 255, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.social-card:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 229, 255, 0.15);
}

.social-card:hover::before {
  opacity: 1;
}

.social-card:hover .social-card-icon {
  color: var(--accent-primary);
}

.social-card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 229, 255, 0.1);
  border-radius: 10px;
  flex-shrink: 0;
  transition: color 0.25s ease;
}

.social-card-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.social-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.social-card-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.social-card-count {
  font-size: 0.7rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: opacity 0.3s ease;
}

.social-card-count.loading {
  opacity: 0.5;
}

.social-card-count.loaded {
  color: var(--accent-primary);
}

/* Social Icons Row */
.social-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.social-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.social-icon:hover {
  background: var(--glass-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0, 229, 255, 0.2);
  color: var(--accent-primary);
}

.social-icon:active {
  transform: translateY(-1px);
}

.social-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Social Icon Tooltips */
.social-icon::after {
  content: attr(aria-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 0.4rem 0.6rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 10;
}

.social-icon:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}

/* Live Status Badge */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ef4444;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* Follower Count Badge in Link Items */
.follower-count {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  margin-left: auto;
  transition: all 0.25s ease;
}

.follower-count.loaded {
  color: var(--accent-primary);
  border-color: rgba(0, 229, 255, 0.4);
}

.link-item:hover .follower-count {
  background: rgba(0, 229, 255, 0.15);
}

/* Footer */
.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(253, 252, 251, 0.08);
  text-align: center;
}

.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s ease;
  padding: 0.5rem 1rem;
  display: inline-block;
}

.footer a:hover {
  color: var(--accent-primary);
}

/* Stagger animation for links */
.link-item,
.social-icon,
.social-card {
  animation: fadeInUp 0.5s ease-out backwards;
}

.links-list .link-item:nth-child(1) { animation-delay: 0.1s; }
.links-list .link-item:nth-child(2) { animation-delay: 0.15s; }
.links-list .link-item:nth-child(3) { animation-delay: 0.2s; }
.links-list .link-item:nth-child(4) { animation-delay: 0.25s; }
.links-list .link-item:nth-child(5) { animation-delay: 0.3s; }
.links-list .link-item:nth-child(6) { animation-delay: 0.35s; }

.social-cards .social-card:nth-child(1) { animation-delay: 0.35s; }
.social-cards .social-card:nth-child(2) { animation-delay: 0.4s; }
.social-cards .social-card:nth-child(3) { animation-delay: 0.45s; }

.social-row .social-icon:nth-child(1) { animation-delay: 0.5s; }
.social-row .social-icon:nth-child(2) { animation-delay: 0.55s; }
.social-row .social-icon:nth-child(3) { animation-delay: 0.6s; }
.social-row .social-icon:nth-child(4) { animation-delay: 0.65s; }
.social-row .social-icon:nth-child(5) { animation-delay: 0.7s; }
.social-row .social-icon:nth-child(6) { animation-delay: 0.75s; }
.social-row .social-icon:nth-child(7) { animation-delay: 0.8s; }

/* Floating particles */
.particle {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  z-index: -1;
  animation: particleFloat var(--duration) var(--delay) linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 480px) {
  .page-wrapper {
    padding: 2rem 1rem;
  }

  .profile h1 {
    font-size: 1.5rem;
  }

  .avatar-wrapper {
    width: 96px;
    height: 96px;
  }

  .link-item {
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
  }

  .social-icon {
    width: 44px;
    height: 44px;
  }

  .social-cards {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .social-card {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .social-card-icon {
    width: 32px;
    height: 32px;
  }

  .social-card-icon svg {
    width: 16px;
    height: 16px;
  }

  .social-card-name {
    font-size: 0.8rem;
  }

  .social-card-count {
    font-size: 0.65rem;
  }
}

/* Focus styles for accessibility */
.link-item:focus-visible,
.social-icon:focus-visible,
.social-card:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* DarkReader compatibility - ensure proper color scheme */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Prevent DarkReader from applying filters to specific decorative elements */
.avatar-glow,
.bg-gradient,
.bg-noise,
.particle {
  isolation: isolate;
}
