:root {
  --bg: #070b14;
  --panel: #101827;
  --text: #e6ecff;
  --muted: #9aa8c7;
  --primary: #6ea8ff;
  --primary-strong: #3f86ff;
  --border: #1e2a40;
  --shadow: 0 20px 60px rgba(5, 12, 28, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 20% -10%, #15233f 0%, var(--bg) 45%);
  color: var(--text);
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: 5.5rem 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(7, 11, 20, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.nav-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.menu-btn {
  display: none;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 42px;
  height: 42px;
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.5rem;
  align-items: center;
}

.hero-content h1 {
  font-size: clamp(2rem, 4.3vw, 3.7rem);
  margin: 0.5rem 0 1rem;
}

.hero-content h1 span {
  color: var(--primary);
}

.tag {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: 99px;
  font-size: 0.86rem;
  background: rgba(110, 168, 255, 0.16);
  color: #cfe2ff;
}

.hero-desc {
  color: var(--muted);
  line-height: 1.8;
  max-width: 62ch;
}

.hero-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 124px;
  border-radius: 12px;
  padding: 0.75rem 1.1rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 8px 30px rgba(63, 134, 255, 0.35);
}

.btn-ghost {
  border-color: var(--border);
  color: #ccd7f8;
}

.hero-card,
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

#skills .card,
#projects .card {
  position: relative;
  overflow: hidden;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease,
    background 0.28s ease;
}

#skills .grid-1 .card {
  min-height: 190px;
  padding: 1.4rem;
}

.skill-split-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: stretch;
  gap: 1.1rem;
}

.skill-title-box,
.skill-content-box {
  display: flex;
  align-items: center;
  min-height: 120px;
  padding: 1rem 1.1rem;
}

.skill-title-box h3 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.2;
}

.skill-tags {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  width: 100%;
}

.skill-tag {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 64px;
  border-radius: 12px;
  border: 1px solid rgba(110, 168, 255, 0.4);
  background: rgba(110, 168, 255, 0.08);
  color: #dce7ff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#skills .card::before,
#projects .card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
      rgba(110, 168, 255, 0.22),
      rgba(110, 168, 255, 0) 42%);
  opacity: 0;
  transition: opacity 0.24s ease;
  pointer-events: none;
}

#skills .card:hover,
#projects .card:hover {
  transform: translateY(-8px);
  border-color: rgba(110, 168, 255, 0.65);
  box-shadow: 0 20px 45px rgba(63, 134, 255, 0.25);
  background: linear-gradient(180deg, rgba(90, 132, 214, 0.12), rgba(255, 255, 255, 0.02));
}

#skills .card:hover::before,
#projects .card:hover::before {
  opacity: 1;
}

.hero-card h3,
.card h3 {
  margin-top: 0;
}

.hero-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  line-height: 1.9;
}

.profile-card {
  text-align: center;
}

.avatar-wrap {
  margin-bottom: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 128px;
  height: 128px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 50%;
  isolation: isolate;
}

.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(130, 190, 255, 0.58);
  opacity: 0.82;
  pointer-events: none;
  animation: ringBeat 1.05s ease-out infinite;
}

.avatar-wrap::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(130, 190, 255, 0.38);
  opacity: 0.66;
  pointer-events: none;
  animation: ringBeatOuter 1.05s ease-out infinite;
}

.avatar {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(138, 204, 255, 0.98);
  box-shadow:
    0 0 0 1px rgba(70, 130, 215, 0.45),
    0 0 12px rgba(118, 180, 255, 0.3);
  display: none;
  position: relative;
  z-index: 3;
}

.avatar-fallback {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  color: #dce7ff;
  border: 3px solid rgba(110, 168, 255, 0.45);
  background: radial-gradient(circle at 30% 20%, #35558a, #16233d);
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 2.2rem);
  margin-top: 0;
  margin-bottom: 0.8rem;
}

.section p {
  color: var(--muted);
  line-height: 1.9;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-1 {
  grid-template-columns: 1fr;
}

.project a {
  color: #bdd6ff;
  display: inline-block;
  margin-top: 0.4rem;
}

.contact {
  text-align: center;
}

.contact-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.contact-item {
  position: relative;
}

.qr-trigger {
  cursor: pointer;
}

#qrDebugToggle.debug-on {
  border-color: rgba(120, 188, 255, 0.68);
  color: #d7e9ff;
  box-shadow: 0 0 0 1px rgba(120, 188, 255, 0.28) inset;
}

.qr-hover-pop {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(10px) scale(0.95);
  width: 168px;
  padding: 0.45rem;
  border-radius: 12px;
  border: 1px solid rgba(120, 178, 255, 0.4);
  background: rgba(12, 22, 38, 0.96);
  box-shadow: 0 14px 30px rgba(6, 12, 26, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.22s ease;
  z-index: 30;
}

.qr-hover-pop::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: rgba(12, 22, 38, 0.96);
}

.contact-item:hover .qr-hover-pop {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.qr-hover-pop img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  padding: 1rem;
  pointer-events: none;
}

.qr-modal.open {
  display: block;
}

.qr-modal-backdrop {
  display: none;
}

.qr-modal-card {
  position: fixed;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  width: min(88vw, 460px);
  max-height: 88vh;
  overflow: auto;
  margin: 0;
  padding: 1rem 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(135, 191, 255, 0.44);
  background: linear-gradient(180deg, rgba(17, 28, 49, 0.97), rgba(10, 17, 30, 0.97));
  box-shadow: 0 22px 55px rgba(2, 7, 20, 0.55);
  z-index: 1;
  pointer-events: auto;
}

.qr-modal-card.debug-draggable {
  cursor: move;
  border-style: dashed;
}

.qr-modal-card h3 {
  margin: 0 0 0.8rem;
  text-align: center;
  font-size: 1.08rem;
}

.qr-modal-card img {
  display: block;
  width: min(100%, 420px);
  margin: 0 auto;
  border-radius: 10px;
}

.qr-modal-x {
  position: absolute;
  right: 0.55rem;
  top: 0.4rem;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  color: #e7efff;
  background: rgba(130, 180, 255, 0.16);
  cursor: pointer;
  font-size: 1.1rem;
}

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.6rem 1rem;
  text-align: center;
  color: var(--muted);
}

body.preload main,
body.preload .site-header,
body.preload .site-footer {
  opacity: 0;
  transform: translateY(12px);
}

main,
.site-header,
.site-footer {
  transition: opacity 0.65s ease, transform 0.65s ease;
}

body.loaded main,
body.loaded .site-header,
body.loaded .site-footer {
  opacity: 1;
  transform: translateY(0);
}

.page-enter {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: radial-gradient(circle at 30% 10%, #18315c, #050913 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.page-enter.hide {
  opacity: 0;
  visibility: hidden;
}

.enter-logo {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #dce8ff;
  text-shadow: 0 0 24px rgba(110, 168, 255, 0.5);
  animation: floatPulse 1.4s ease-in-out infinite alternate;
}

@keyframes floatPulse {
  from {
    transform: translateY(0) scale(1);
    opacity: 0.85;
  }

  to {
    transform: translateY(-6px) scale(1.03);
    opacity: 1;
  }
}

@keyframes bassPulse {
  0%,
  100% {
    opacity: 0.42;
    transform: translateY(0) scale(0.996);
    filter: drop-shadow(0 0 2px rgba(145, 198, 255, 0.2));
  }

  18% {
    opacity: 0.68;
    transform: translateY(-1.2px) scale(1.01);
    filter: drop-shadow(0 0 8px rgba(145, 198, 255, 0.38));
  }

  38% {
    opacity: 0.5;
    transform: translateY(0.6px) scale(1);
    filter: drop-shadow(0 0 4px rgba(145, 198, 255, 0.25));
  }

  62% {
    opacity: 0.74;
    transform: translateY(-1px) scale(1.012);
    filter: drop-shadow(0 0 10px rgba(145, 198, 255, 0.42));
  }

  82% {
    opacity: 0.52;
    transform: translateY(0.35px) scale(1.002);
    filter: drop-shadow(0 0 4px rgba(145, 198, 255, 0.28));
  }
}

@keyframes ringBeat {
  0% {
    transform: scale(0.98);
    opacity: 0.55;
  }

  35% {
    transform: scale(1.04);
    opacity: 0.88;
  }

  70% {
    transform: scale(1.08);
    opacity: 0.35;
  }

  100% {
    transform: scale(1.1);
    opacity: 0;
  }
}

@keyframes ringBeatOuter {
  0% {
    transform: scale(0.98);
    opacity: 0.42;
  }

  40% {
    transform: scale(1.06);
    opacity: 0.62;
  }

  100% {
    transform: scale(1.14);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 4rem;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .skill-split-card {
    grid-template-columns: 1fr;
  }

  .skill-tags {
    grid-template-columns: 1fr;
  }

  .menu-btn {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 72px;
    right: 1rem;
    left: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(8, 13, 24, 0.98);
    flex-direction: column;
    align-items: flex-start;
    display: none;
  }

  .nav-links.open {
    display: flex;
  }
}
