:root {
  --bg: #07080f;
  --bg-soft: #0c0e1a;
  --surface: rgba(18, 21, 38, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8eaf2;
  --text-dim: #9aa0b5;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --pink: #f472b6;
  --font-main: 'Inter', system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gradient: linear-gradient(120deg, var(--accent), var(--accent-2));
  --radius: 16px;
  --nav-h: 64px;
  --container: 1080px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(34, 211, 238, 0.35);
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

.mono {
  font-family: var(--font-mono);
}

/* ===== 背景 ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
}

.bg-glow-1 {
  width: 560px;
  height: 560px;
  top: -180px;
  left: 12%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.35), transparent 70%);
  animation: float 12s ease-in-out infinite;
}

.bg-glow-2 {
  width: 520px;
  height: 520px;
  top: 30%;
  right: -120px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.28), transparent 70%);
  animation: float 16s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, 30px); }
}

/* ===== 导航 ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background 0.3s, backdrop-filter 0.3s;
}

.nav.scrolled {
  background: rgba(7, 8, 15, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.logo-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-link {
  font-size: 14px;
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== 通用 section ===== */
.section {
  padding: 110px 24px;
  scroll-margin-top: var(--nav-h);
}

.section-inner {
  max-width: var(--container);
  margin: 0 auto;
}

.section-tag {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 8px;
}

.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  margin-bottom: 48px;
  letter-spacing: 0.5px;
}

/* ===== 英雄区 ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: calc(var(--nav-h) + 40px);
}

.hero-inner {
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 24px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  position: relative;
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.4);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

.hero-title {
  font-size: clamp(44px, 8vw, 76px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-typing {
  font-size: clamp(16px, 2.4vw, 22px);
  color: var(--accent);
  min-height: 1.6em;
  margin-bottom: 24px;
}

.typing-cursor {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-desc {
  max-width: 560px;
  color: var(--text-dim);
  font-size: 17px;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 28px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient);
  color: #071018;
  box-shadow: 0 8px 30px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(34, 211, 238, 0.4);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-lg {
  font-size: 16px;
  padding: 16px 36px;
}

.hero-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 30px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat-label {
  font-size: 13px;
  color: var(--text-dim);
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: bob 2s ease-in-out infinite;
}

.scroll-arrow {
  font-size: 16px;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* ===== 关于 ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.about-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.about-code {
  padding: 28px;
  font-size: 14px;
  line-height: 1.9;
  overflow-x: auto;
  white-space: pre;
}

.code-line {
  display: block;
}

.c-kw { color: var(--pink); }
.c-var { color: var(--accent); }
.c-key { color: var(--accent-2); }
.c-str { color: #86efac; }
.c-num { color: #fbbf24; }
.code-cursor { animation: blink 1s step-end infinite; }

.about-text h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.about-text p {
  color: var(--text-dim);
  margin-bottom: 14px;
}

.about-points {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-points li {
  color: var(--text);
  font-size: 15px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.point-icon {
  color: var(--accent);
  font-weight: 700;
}

/* ===== 技能 ===== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  transition: transform 0.3s, border-color 0.3s;
}

.skill-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.4);
}

.skill-cat {
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 22px;
  letter-spacing: 1px;
}

.skill-item {
  margin-bottom: 18px;
}

.skill-item:last-child {
  margin-bottom: 0;
}

.skill-head {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.skill-head .mono {
  color: var(--text);
  font-size: 12px;
}

.skill-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 100px;
  overflow: hidden;
}

.skill-fill {
  height: 100%;
  width: 0;
  background: var(--gradient);
  border-radius: 100px;
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== 项目 ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.project-folder {
  color: var(--accent-2);
  font-size: 15px;
}

.project-link {
  font-size: 22px;
  color: var(--text-dim);
  transition: color 0.2s, transform 0.2s;
}

.project-link:hover {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.project-title {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 10px;
}

.project-desc {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--accent);
}

.project-tags li {
  background: rgba(34, 211, 238, 0.08);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid rgba(34, 211, 238, 0.15);
}

/* ===== 联系 ===== */
.contact-box {
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  padding: 72px 40px;
  position: relative;
  overflow: hidden;
}

.contact-box::after {
  content: '';
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 70%);
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.contact-box .section-tag,
.contact-box .section-title {
  position: relative;
}

.contact-box .section-title {
  margin-bottom: 20px;
}

.contact-desc {
  color: var(--text-dim);
  max-width: 460px;
  margin: 0 auto 36px;
  position: relative;
}

.contact-socials {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 40px;
  position: relative;
}

.social {
  font-size: 14px;
  color: var(--text-dim);
  position: relative;
  padding-bottom: 4px;
  transition: color 0.2s;
}

.social::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s;
}

.social:hover {
  color: var(--text);
}

.social:hover::after {
  transform: scaleX(1);
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--container);
  margin: 0 auto;
  flex-wrap: wrap;
}

.footer p {
  font-size: 13px;
  color: var(--text-dim);
}

.footer-heart {
  color: var(--pink);
}

.back-top {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.back-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== 滚动动画 ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(7, 8, 15, 0.97);
    backdrop-filter: blur(14px);
    padding: 12px 24px 24px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .nav-link {
    padding: 12px 8px;
    font-size: 16px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    gap: 32px;
  }

  .contact-box {
    padding: 48px 24px;
  }

  .section {
    padding: 80px 20px;
  }
}
