:root {
  color-scheme: light;
  --bg-color: #f6f7fb;
  --bg-alt: #ebeef7;
  --shape-1: #ffe0c4;
  --shape-2: #e0e9ff;
  --shape-3: #ffe8f1;
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-glow: rgba(255, 255, 255, 0.7);
  --card-border: rgba(208, 214, 230, 0.8);
  --text-main: #201b1a;
  --text-muted: #786d66;
  --accent: #f08a43;
  --accent-2: #ba77ff;
  --accent-soft: rgba(240, 138, 67, 0.12);
  --neutral-line: rgba(132, 146, 185, 0.35);
  --shadow: 0 40px 80px rgba(68, 59, 55, 0.15);
  --blur: 28px;
}

@property --flip-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

[data-theme='dark'] {
  color-scheme: dark;
  --bg-color: #010208;
  --bg-alt: #060b1a;
  --shape-1: rgba(255, 150, 70, 0.22);
  --shape-2: rgba(70, 120, 255, 0.22);
  --shape-3: rgba(198, 110, 255, 0.2);
  --card-bg: rgba(12, 11, 22, 0.92);
  --card-glow: rgba(90, 96, 255, 0.08);
  --card-border: rgba(104, 119, 168, 0.45);
  --text-main: #f4f0ff;
  --text-muted: #b7c0de;
  --accent: #ffb347;
  --accent-2: #7c80ff;
  --accent-soft: rgba(124, 128, 255, 0.2);
  --neutral-line: rgba(109, 124, 170, 0.4);
  --shadow: 0 45px 120px rgba(1, 2, 8, 0.85);
  --blur: 32px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
  background: radial-gradient(circle at 20% 20%, var(--bg-alt), var(--bg-color) 55%);
  color: var(--text-main);
  position: relative;
  overflow: hidden;
  transition: background 0.6s ease, color 0.45s ease;
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.35),
    rgba(255, 255, 255, 0)
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  z-index: 5;
}

body.theme-switching::before {
  opacity: 1;
}

body::after {
  content: '';
  position: fixed;
  inset: -10%;
  background: radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.25), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(255, 196, 164, 0.25), transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(255, 255, 255, 0.18), transparent 55%);
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: screen;
  opacity: 0.8;
}

.animated-background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
  transition: opacity 0.6s ease;
}

body.theme-switching .animated-background {
  opacity: 0.8;
}

.spark-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 5;
}

.spark-overlay.active {
  opacity: 1;
}

.spark-overlay .spark {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: radial-gradient(circle, #fff, transparent 70%);
  animation: sparkPulse 1.4s ease-out forwards;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.7;
  animation: move 18s infinite alternate ease-in-out;
  transition: background-color 0.6s ease, opacity 0.6s ease;
}

.shape1 {
  width: clamp(220px, 28vw, 320px);
  height: clamp(220px, 28vw, 320px);
  top: -50px;
  left: -80px;
  background-color: var(--shape-1);
}

.shape2 {
  width: clamp(280px, 34vw, 420px);
  height: clamp(280px, 34vw, 420px);
  bottom: -120px;
  right: -140px;
  background-color: var(--shape-2);
  animation-duration: 22s;
  animation-delay: -5s;
}

.shape3 {
  width: clamp(200px, 25vw, 300px);
  height: clamp(200px, 25vw, 300px);
  bottom: 45%;
  right: 25%;
  background-color: var(--shape-3);
  animation-duration: 20s;
  animation-delay: -10s;
}

.gradient-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), transparent 60%),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.2), transparent 55%),
    radial-gradient(circle at 45% 80%, rgba(255, 255, 255, 0.15), transparent 60%);
  opacity: 0.35;
  animation: glowShift 18s ease-in-out infinite;
}

.light-trail {
  position: absolute;
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  opacity: 0.6;
  animation: trail 12s linear infinite;
}

.trail-1 {
  top: 25%;
  left: -40%;
}

.trail-2 {
  bottom: 15%;
  right: -40%;
  animation-delay: -4s;
}

@keyframes move {
  from {
    transform: translate(0, 0) rotate(0deg);
  }
  to {
    transform: translate(110px, 60px) rotate(180deg);
  }
}

@keyframes glowShift {
  0% {
    transform: scale(1) translate(0, 0);
  }
  50% {
    transform: scale(1.1) translate(-4%, 3%);
  }
  100% {
    transform: scale(1) translate(0, 0);
  }
}

@keyframes trail {
  from {
    transform: translateX(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  to {
    transform: translateX(140%);
    opacity: 0;
  }
}

@keyframes sparkPulse {
  0% {
    transform: scale(0.2) translate3d(0, 0, 0);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  100% {
    transform: scale(1.8)
      translate3d(var(--spark-dx, 0px), var(--spark-dy, -80px), 0);
    opacity: 0;
  }
}
.theme-toggle {
  position: fixed;
  top: clamp(1rem, 4vw, 1.75rem);
  right: clamp(1rem, 4vw, 1.75rem);
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  display: inline-flex;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(18px);
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.15);
  transition: transform 0.25s ease, border-color 0.35s ease, background 0.35s ease, color 0.35s ease;
  z-index: 10;
}

.theme-toggle:hover {
  transform: translateY(-3px);
}

.profile-card {
  width: min(620px, 92vw);
  padding: clamp(2.5rem, 5vw, 3.75rem);
  border-radius: 36px;
  border: 1px solid var(--card-border);
  background: linear-gradient(160deg, var(--card-bg), var(--card-glow));
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px);
  text-align: center;
  position: relative;
  overflow: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transform: perspective(1400px)
    rotateX(var(--tiltY, 0deg))
    rotateY(calc(var(--tiltX, 0deg) + var(--flip-angle, 0deg)));
  transition: transform 0.5s ease, box-shadow 0.5s ease, background 0.6s ease, border-color 0.6s ease, color 0.45s ease;
}

.profile-card.theme-flip {
  animation: flipTheme 0.85s ease;
  transition: box-shadow 0.5s ease, background 0.6s ease, border-color 0.6s ease, color 0.45s ease;
}

.profile-card::after {
  content: '';
  position: absolute;
  inset: 1.35rem;
  border-radius: 30px;
  border: 1px solid var(--neutral-line);
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0));
  opacity: 0.7;
  pointer-events: none;
  transition: border-color 0.6s ease, opacity 0.6s ease;
}

/* 移动端降低内边框的可见度 */
@media (max-width: 640px) {
  .profile-card::after {
    opacity: 0.4;
  }
}

.profile-card:hover {
  box-shadow: 0 45px 110px rgba(15, 23, 42, 0.32);
}

.avatar-stack {
  width: 148px;
  height: 148px;
  margin: 0 auto 1.25rem;
  position: relative;
}

.avatar-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 160deg, var(--accent), var(--accent-2), #ffd79e, var(--accent));
  padding: 6px;
  filter: drop-shadow(0 10px 30px rgba(241, 143, 58, 0.35));
  animation: pulse 6s ease-in-out infinite;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.9);
  position: relative;
  z-index: 1;
  --avatar-rotation: 0deg;
  transform: rotate(var(--avatar-rotation));
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.04);
  }
}

@keyframes flipTheme {
  0% {
    --flip-angle: 0deg;
  }
  50% {
    --flip-angle: 35deg;
  }
  100% {
    --flip-angle: 0deg;
  }
}


.micro {
  letter-spacing: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 3.1rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.tagline {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  min-height: 1.6em;
  margin-bottom: 1.75rem;
}

.social-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.social-link {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: grid;
  place-items: center;
  color: var(--text-main);
  font-size: 1.05rem;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.3);
  transition: transform 0.25s ease, border-color 0.35s ease, color 0.35s ease, background 0.35s ease;
  cursor: pointer;
  position: relative;
  outline: none;
}

.social-link:hover {
  transform: translateY(-3px) scale(1.05);
  border-color: var(--accent);
  color: var(--accent);
}

.social-link:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(241, 143, 58, 0.25);
}

.social-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.social-link::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(15, 15, 15, 0.8);
  color: #fff7ec;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme='dark'] .social-link::after {
  background: rgba(255, 255, 255, 0.15);
  color: #ffe9d0;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.social-link:hover::after,
.social-link:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.typed {
  border-right: 2px solid transparent;
}

.typed.active {
  border-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 20;
}

.modal[aria-hidden='false'] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 4, 0.55);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: min(420px, 90vw);
  padding: 2.5rem 2rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  color: #1b130a;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.7);
  z-index: 1;
  text-align: center;
}

[data-theme='dark'] .modal__panel {
  background: rgba(14, 9, 3, 0.95);
  color: #fef3e2;
  border-color: rgba(250, 182, 106, 0.4);
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

.modal__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.modal__btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 1.25rem;
  border-radius: 16px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.modal__btn.primary {
  background: linear-gradient(120deg, #f97316, #fb923c);
  color: #fff;
  box-shadow: 0 20px 45px rgba(249, 115, 22, 0.45);
}

.modal__btn.ghost {
  background: transparent;
  border-color: rgba(15, 15, 15, 0.2);
  color: inherit;
}

[data-theme='dark'] .modal__btn.ghost {
  border-color: rgba(255, 255, 255, 0.2);
}

.modal__btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  body {
    padding: 1.5rem;
  }

  .profile-card {
    padding: 2.25rem 1.75rem;
  }

  .light-trail {
    display: none;
  }

  /* 移动端隐藏主题切换按钮 */
  .theme-toggle {
    display: none;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
