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

html {
  -webkit-text-size-adjust: 100%;
}

/* ===== Body ===== */
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  transition: background 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Background glow layers ===== */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 15% 25%, var(--glow-1), transparent),
    radial-gradient(ellipse 50% 50% at 80% 15%, var(--glow-2), transparent),
    radial-gradient(ellipse 50% 40% at 50% 90%, var(--glow-3), transparent);
  transition: background 0.35s ease;
}

/* ===== Theme toggle ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.15rem;
  display: grid;
  place-items: center;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.theme-toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: scale(1.06);
}

.theme-toggle:active {
  transform: scale(0.95);
}

/* ===== Main container ===== */
.home-container {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 24px 0 44px;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

/* ===== Profile ===== */
.profile {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: fadeInUp 0.5s ease forwards;
}

.avatar-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 700;
  box-shadow:
    0 0 0 0 var(--accent-glow),
    0 8px 32px rgba(99, 102, 241, 0.25);
  animation: avatarPulse 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.profile h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.bio {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 340px;
}

/* ===== Link cards ===== */
.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background 0.28s ease;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: calc(var(--i, 0) * 0.12s);
}

.link-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(92, 95, 239, 0.25);
  background: var(--panel-hover);
}

.link-card:active {
  transform: translateY(-1px);
}

.link-card.featured {
  border-color: rgba(92, 95, 239, 0.25);
  border-left: 3px solid var(--accent);
  background: linear-gradient(135deg,
    rgba(92, 95, 239, 0.06),
    rgba(11, 158, 217, 0.04));
  padding-left: 17px;
}

[data-theme="light"] .link-card.featured {
  background: linear-gradient(135deg,
    rgba(92, 95, 239, 0.06),
    rgba(11, 158, 217, 0.03));
}

.link-card.featured:hover {
  border-color: rgba(92, 95, 239, 0.40);
}

.link-card.disabled {
  cursor: default;
  opacity: 0.45;
  pointer-events: none;
}

[data-theme="dark"] .link-card.disabled {
  opacity: 0.3;
}

/* Icon */
.link-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-sm);
  background: rgba(92, 95, 239, 0.12);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 600;
}

[data-theme="dark"] .link-icon {
  background: rgba(139, 143, 248, 0.18);
}

/* Body text */
.link-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.link-body strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.link-body small {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Arrow */
.link-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: transform 0.28s ease, color 0.28s ease;
}

.link-card:hover .link-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* Tag */
.link-tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(92, 95, 239, 0.12);
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .link-tag {
  background: rgba(139, 143, 248, 0.18);
}

/* ===== Socials ===== */
.socials {
  display: flex;
  gap: 10px;
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
  animation-delay: 0.35s;
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.social-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.social-link.muted {
  cursor: default;
  opacity: 0.35;
  pointer-events: none;
}

[data-theme="dark"] .social-link.muted {
  opacity: 0.25;
}

/* ===== Footer ===== */
.footer {
  margin-top: 2px;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
  animation-delay: 0.5s;
}

.footer p {
  color: var(--text-muted);
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.footer-donate {
  border-style:solid;
  cursor: pointer;
  font-weight: 700;
  text-decoration:;
  transition: color 0.2s;
}
.footer-donate:hover {
  color: var(--accent);
}

/* ===== Animations ===== */

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes avatarPulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 var(--accent-glow),
      0 8px 32px rgba(99, 102, 241, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 14px transparent,
      0 8px 40px rgba(99, 102, 241, 0.35);
  }
}

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

/* ===== 赞助弹窗 ===== */
.donate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.donate-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.donate-modal {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px 36px;
  max-width: 460px;
  width: calc(100% - 32px);
  text-align: center;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s ease;
}
.donate-overlay.show .donate-modal {
  transform: translateY(0) scale(1);
}

.donate-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, color 0.2s;
}
.donate-close:hover {
  background: var(--accent);
  color: #fff;
}

.donate-modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.donate-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 28px;
}

.donate-qr-row {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.donate-qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.donate-qr-item img {
  width: 275px;
  height: 275px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  object-fit: contain;
}

.donate-qr-item span {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
}

@media (max-width: 400px) {
  .donate-qr-row {
    flex-direction: column;
    align-items: center;
  }
  .donate-qr-item img {
    width: 140px;
    height: 140px;
  }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .home-container {
    gap: 24px;
    padding: 12px 0 32px;
  }

  .link-card {
    padding: 16px 16px;
    border-radius: var(--radius-md);
  }

  .avatar {
    width: 76px;
    height: 76px;
    font-size: 1.9rem;
  }

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

  .bio {
    font-size: 0.9rem;
    max-width: 280px;
  }

  .theme-toggle {
    top: 12px;
    right: 12px;
  }
}

/* ===== Server status (inside link-card) ===== */
.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  width: fit-content;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

[data-theme="dark"] .server-status {
  background: rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #888;
  flex-shrink: 0;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.status-dot.online {
  background: #4ec86e;
  box-shadow: 0 0 8px rgba(78, 200, 110, 0.6);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(78, 200, 110, 0.4); }
  50%       { box-shadow: 0 0 14px rgba(78, 200, 110, 0.8); }
}

.status-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.status-text.online {
  color: var(--text-secondary);
}

.status-latency {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.6;
  margin-left: auto;
}
