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

:root {
  --bg: #0a0b12;
  --bg-elevated: rgba(16, 18, 28, 0.92);
  --text: #f4f0ea;
  --text-soft: #d0c8bc;
  --muted: #8f8a96;
  --rose: #f0a0b8;
  --coral: #f0b090;
  --gold: #e8c988;
  --mint: #7ed9b0;
  --sky: #7ec8e8;
  --lilac: #b8a0e8;
  --card-bg: rgba(255, 255, 255, 0.035);
  --font-serif: "Cormorant Garamond", "Times New Roman", "Songti SC", serif;
  --font: "LXGW WenKai", "PingFang SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-ui: "Inter", "PingFang SC", "Helvetica Neue", system-ui, sans-serif;
}

html, body {
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 200;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(184, 160, 232, 0.35);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 2px solid rgba(184, 160, 232, 0.7);
  outline-offset: 3px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 20% 15%, rgba(184, 160, 232, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 45% at 85% 25%, rgba(126, 200, 232, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 50% at 50% 85%, rgba(240, 160, 184, 0.1), transparent 55%),
    radial-gradient(ellipse 40% 35% at 70% 70%, rgba(126, 217, 176, 0.08), transparent 50%),
    radial-gradient(ellipse 35% 30% at 15% 75%, rgba(232, 201, 136, 0.07), transparent 50%);
}

#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

.page {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.page a,
.page button {
  pointer-events: auto;
}

.hero-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem 2.5rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.hero {
  text-align: center;
  margin-bottom: 2.75rem;
}

.avatar-ring {
  width: 100px;
  height: 100px;
  margin: 0 auto 1.75rem;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(145deg, rgba(244, 240, 234, 0.45), rgba(244, 240, 234, 0.08) 50%, rgba(200, 190, 220, 0.22));
  box-shadow: 0 0 32px rgba(244, 240, 234, 0.06);
  transition: box-shadow 0.5s ease, transform 0.5s ease;
}

.avatar-ring:hover {
  box-shadow: 0 0 40px rgba(244, 240, 234, 0.12);
  transform: scale(1.02);
}

.avatar-wrap {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg);
  border: 2px solid var(--bg);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.name {
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 7vw, 3.4rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  margin-bottom: 0.45rem;
  color: var(--text);
  text-shadow: 0 0 40px rgba(244, 240, 234, 0.08);
}

.interests {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.25rem auto 1.25rem;
  padding: 0;
}

.interest {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: saturate(1.05);
}

.interest:hover {
  transform: translateY(-2px) scale(1.08);
  filter: saturate(1.2) brightness(1.05);
}

.interest-emoji {
  font-size: 1.25rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
  user-select: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.divider {
  width: 36px;
  height: 1px;
  margin: 0 auto 1.35rem;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(244, 240, 234, 0.35), transparent);
}

.motto {
  font-size: 1.02rem;
  color: var(--text-soft);
  line-height: 1.6;
  letter-spacing: 0.14em;
  max-width: 100%;
  margin: 0 auto;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .motto {
    white-space: normal;
    letter-spacing: 0.08em;
    font-size: 0.92rem;
  }
}

.links {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 520px;
}

.links-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  width: 100%;
}

.link-card {
  --link-color: var(--gold);
  --link-glow: rgba(232, 201, 136, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
  padding: 0.85rem 0.75rem;
  background: var(--card-bg);
  border: 1px solid color-mix(in srgb, var(--link-color) 28%, transparent);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.4s ease, background 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.link-card:hover {
  border-color: color-mix(in srgb, var(--link-color) 55%, transparent);
  background: color-mix(in srgb, var(--link-color) 12%, transparent);
  box-shadow: 0 8px 32px var(--link-glow);
  transform: translateY(-2px);
}

.link-card .icon {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
  background-color: var(--link-color);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--link-color) 45%, transparent));
}

.link-github { --link-color: #a8b4f0; --link-glow: rgba(168, 180, 240, 0.28); }
.link-bilibili { --link-color: #fb8fb0; --link-glow: rgba(251, 143, 176, 0.28); }
.link-hackthebox { --link-color: #9fef00; --link-glow: rgba(159, 239, 0, 0.22); }
.link-blog { --link-color: var(--mint); --link-glow: rgba(126, 217, 176, 0.28); }
.link-mail { --link-color: var(--coral); --link-glow: rgba(240, 176, 144, 0.28); }
.link-coffee { --link-color: #e0b070; --link-glow: rgba(224, 176, 112, 0.28); }
.link-default { --link-color: var(--gold); --link-glow: rgba(232, 201, 136, 0.25); }

.icon-github { -webkit-mask-image: url("../assets/icons/github.svg"); mask-image: url("../assets/icons/github.svg"); }
.icon-bilibili { -webkit-mask-image: url("../assets/icons/bilibili.svg"); mask-image: url("../assets/icons/bilibili.svg"); }
.icon-hackthebox { -webkit-mask-image: url("../assets/icons/hackthebox.svg"); mask-image: url("../assets/icons/hackthebox.svg"); }
.icon-blog { -webkit-mask-image: url("../assets/icons/blog.svg"); mask-image: url("../assets/icons/blog.svg"); }
.icon-mail { -webkit-mask-image: url("../assets/icons/email.svg"); mask-image: url("../assets/icons/email.svg"); }
.icon-coffee { -webkit-mask-image: url("../assets/icons/coffee.svg"); mask-image: url("../assets/icons/coffee.svg"); }

.link-card .label {
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--link-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.about-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 2rem;
  border-radius: 999px;
  border: 1px solid rgba(244, 240, 234, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-family: var(--font);
  font-size: 0.9rem;
  letter-spacing: 0.18em;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.35s ease, background 0.35s ease, color 0.35s ease, transform 0.35s ease;
}

.about-btn:hover {
  color: var(--text);
  border-color: rgba(244, 240, 234, 0.32);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.about-btn:active {
  transform: translateY(0);
}

.friends-layer {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.friend-card {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem;
  min-width: 72px;
  border: none;
  background: transparent;
  text-decoration: none;
  color: var(--text);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  opacity: 0;
}

.friend-card.is-ready {
  opacity: 1;
  transition: opacity 0.6s ease;
}

.friend-card.is-hover,
.friend-card:hover {
  z-index: 5;
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  transition: transform 0.35s ease, filter 0.35s ease;
}

.friend-card.is-hover .friend-avatar,
.friend-card:hover .friend-avatar {
  transform: scale(1.06);
  filter: brightness(1.06);
}

.friend-name {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
  transition: color 0.3s ease;
}

.friend-card.is-hover .friend-name,
.friend-card:hover .friend-name {
  color: var(--text-soft);
}

footer {
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  opacity: 0.55;
  padding: 1.25rem 2rem 2.75rem;
  letter-spacing: 0.12em;
}

.footer-mark {
  opacity: 0.5;
  margin: 0 0.35rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 6, 10, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay.open[hidden] {
  display: flex;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: min(76vh, 600px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 2.5rem 2.15rem 2.15rem;
  background: var(--bg-elevated);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  transform: translateY(14px);
  transition: transform 0.4s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-align: center;
  margin-bottom: 0.85rem;
  color: var(--text);
}

.modal-rule {
  width: 28px;
  height: 1px;
  margin: 0 auto 1.6rem;
  border-radius: 999px;
  background: rgba(244, 240, 234, 0.28);
}

.modal-body {
  min-height: 7rem;
}

.typewriter {
  font-size: 0.98rem;
  line-height: 2;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.02em;
}

.cursor {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--lilac);
  box-shadow: 0 0 8px rgba(184, 160, 232, 0.5);
  animation: blink 1s step-end infinite;
  opacity: 0;
}

.cursor.visible {
  opacity: 0.7;
}

.cursor.done {
  animation: none;
  opacity: 0;
  transition: opacity 0.8s ease 0.6s;
}

@keyframes blink {
  50% { opacity: 0; }
}

.music-player {
  position: fixed;
  left: 1.35rem;
  bottom: 1.35rem;
  z-index: 40;
  width: min(300px, calc(100vw - 2.2rem));
  pointer-events: auto;
  animation: fadeInUp 1.1s ease both;
  animation-delay: 0.55s;
}

.music-player[hidden] {
  display: none;
}

.mp-shell {
  padding: 1rem 1.05rem 0.9rem;
  border-radius: 20px;
  border: 1px solid transparent;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background-image:
    linear-gradient(rgba(12, 12, 18, 0.82), rgba(12, 12, 18, 0.82)),
    linear-gradient(145deg, rgba(240, 160, 184, 0.4), rgba(126, 200, 232, 0.28), rgba(184, 160, 232, 0.38));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42), 0 0 32px rgba(184, 160, 232, 0.08);
}

.mp-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mp-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  color: #1a1420;
  cursor: pointer;
  background: linear-gradient(135deg, var(--rose), var(--gold) 48%, var(--sky));
  transition: transform 0.25s ease, box-shadow 0.35s ease;
}

.mp-play:hover {
  transform: scale(1.05);
  box-shadow: 0 0 22px rgba(240, 160, 184, 0.35);
}

.mp-play .icon-pause {
  display: none;
}

.music-player.is-playing .mp-play .icon-play {
  display: none;
}

.music-player.is-playing .mp-play .icon-pause {
  display: block;
}

.music-player.is-playing .mp-play {
  animation: mpPulse 2.8s ease-in-out infinite;
}

.music-player.is-needs-gesture .mp-play {
  animation: mpNeedClick 1.6s ease-in-out infinite;
}

@keyframes mpPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 160, 232, 0.2); }
  50% { box-shadow: 0 0 0 8px rgba(184, 160, 232, 0); }
}

@keyframes mpNeedClick {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 160, 184, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(240, 160, 184, 0); transform: scale(1.06); }
}

.mp-hint {
  margin-top: 0.55rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.16em;
  color: var(--rose);
  opacity: 0.85;
}

.mp-hint[hidden] {
  display: none;
}

.mp-lyrics-toggle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.25s ease, background 0.25s ease;
}

.mp-lyrics-toggle:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.05);
}

.mp-lyrics-toggle-icon {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.3s ease;
}

.music-player.is-lyrics-collapsed .mp-lyrics-toggle-icon {
  transform: rotate(-90deg);
}

.music-player.is-lyrics-collapsed .mp-lyrics {
  display: none;
}

.mp-meta {
  flex: 1;
  min-width: 0;
}

.mp-title {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.12em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-artist {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--muted);
  margin-top: 0.2rem;
  letter-spacing: 0.14em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-progress {
  margin-top: 0.85rem;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.mp-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--gold), var(--sky), var(--lilac));
  transition: width 0.2s linear;
}

.mp-lyrics {
  margin-top: 0.85rem;
  min-height: 5.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  overflow: hidden;
}

.mp-line {
  width: 100%;
  margin: 0;
  padding: 0.12rem 0.4rem;
  font-size: 0.82rem;
  line-height: 1.55;
  letter-spacing: 0.1em;
  color: var(--muted);
  opacity: 0.35;
  min-height: 1.4em;
  transition: opacity 0.35s ease, color 0.35s ease, transform 0.35s ease;
  user-select: none;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-line.is-prev,
.mp-line.is-next {
  cursor: pointer;
  font-size: 0.78rem;
}

.mp-line.is-prev:hover,
.mp-line.is-next:hover {
  opacity: 0.55;
}

.mp-line.is-active {
  opacity: 1;
  color: var(--text);
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  transform: none;
  white-space: normal;
  line-height: 1.65;
}

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

.anim-1 { animation: fadeInUp 1s ease both; animation-delay: 0.1s; }
.anim-2 { animation: fadeInUp 1s ease both; animation-delay: 0.28s; }
.anim-3 { animation: fadeInUp 1s ease both; animation-delay: 0.44s; }

@media (max-width: 640px) {
  .music-player {
    left: 0.65rem;
    bottom: 0.65rem;
    width: min(280px, calc(100vw - 1.3rem));
  }

  .mp-shell {
    padding: 0.8rem 0.85rem 0.75rem;
  }

  .mp-lyrics {
    min-height: 4.8rem;
  }

  .mp-line.is-active {
    font-size: 0.86rem;
  }

  .friend-avatar {
    width: 40px;
    height: 40px;
  }

  .friend-name {
    font-size: 0.62rem;
  }
}

/* image lightbox */
.image-modal-overlay {
  z-index: 110;
}

.image-modal {
  position: relative;
  max-width: min(420px, 92vw);
  max-height: min(80vh, 640px);
  padding: 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 14, 20, 0.94);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
  transform: translateY(14px);
  transition: transform 0.4s ease;
}

.image-modal-overlay.open .image-modal {
  transform: translateY(0);
}

.image-modal img {
  display: block;
  width: 100%;
  max-height: min(70vh, 560px);
  object-fit: contain;
  border-radius: 12px;
}

.image-modal .modal-close {
  top: 0.55rem;
  right: 0.65rem;
}

@media (max-width: 520px) {
  .links-row {
    gap: 0.5rem;
  }

  .link-card {
    padding: 0.75rem 0.4rem;
    gap: 0.35rem;
    border-radius: 14px;
  }

  .link-card .label {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
  }

  .link-card .icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .modal {
    padding: 2rem 1.4rem 1.6rem;
  }

  .hero-section {
    padding-top: 3rem;
    padding-bottom: 7rem;
  }

  footer {
    padding-bottom: 6.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .anim-1, .anim-2, .anim-3,
  .music-player.is-playing .mp-play,
  .music-player.is-needs-gesture .mp-play,
  .cursor {
    animation: none !important;
  }

  .modal-overlay,
  .modal {
    transition: none;
  }
}
