/* ====== Reset & Base ====== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #0a1929;
  color: #fff;
  overflow-x: hidden;
  line-height: 1.6;
}
.bg-layer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  background: url('1.png') no-repeat center center;
  background-size: cover;
}
::selection { background: rgba(8, 145, 178, 0.35); color: #fff; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(8, 145, 178, 0.6); border-radius: 3px; }

/* ====== Navigation ====== */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1rem 2rem;
  display: flex; justify-content: space-between; align-items: center;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}
nav.scrolled { padding: 0.6rem 2rem; background: transparent; box-shadow: none; }
.nav-logo {
  font-size: 1.5rem; font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #99f6e4, #a5f3fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  cursor: pointer; position: relative;
}
.nav-logo::after {
  content: '_'; animation: blink 1s step-end infinite;
  -webkit-text-fill-color: #22d3ee;
}
@keyframes blink { 50% { opacity: 0; } }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a {
  color: rgba(255, 255, 255, 0.85); text-decoration: none; font-size: 0.9rem;
  position: relative; padding: 0.2rem 0;
  transition: color 0.3s ease;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: linear-gradient(90deg, #22d3ee, #99f6e4);
  transition: width 0.3s ease;
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after { width: 100%; }

/* ====== Hero Section ====== */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  position: relative; z-index: 1;
  padding: 2rem;
}
@supports (min-height: 100dvh) {
  .hero { min-height: 100dvh; }
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 1rem; border-radius: 50px;
  background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 0.85rem; color: #67e8f9; margin-bottom: 2rem;
  opacity: 0; animation: fadeInUp 0.8s ease forwards 0.2s;
}
.hero-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); } 50% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } }
.hero h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800; text-align: center;
  opacity: 0; animation: fadeInUp 0.8s ease forwards 0.4s;
  color: #fff;
}
.hero h1 .gradient {
  background: linear-gradient(135deg, #22d3ee, #99f6e4, #a5f3fc, #67e8f9);
  background-size: 300% 300%;
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.hero .typing-container {
  font-size: clamp(1rem, 3vw, 1.5rem);
  color: rgba(255, 255, 255, 0.9); margin-top: 1rem; text-align: center;
  min-height: 2.5rem;
  opacity: 0; animation: fadeInUp 0.8s ease forwards 0.6s;
}
.typing-text::after {
  content: '|'; animation: blink 0.8s step-end infinite;
  color: #22d3ee;
}
.hero-cta {
  margin-top: 2.5rem; display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
  opacity: 0; animation: fadeInUp 0.8s ease forwards 0.8s;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.btn {
  padding: 0.8rem 2rem; border-radius: 50px; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: all 0.3s ease;
  text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem;
  position: relative; overflow: hidden;
}
.btn-primary {
  background: linear-gradient(135deg, #0891b2, #0ea5e9);
  color: #fff; border: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(8,145,178,0.5); }
.btn-outline {
  background: rgba(0, 0, 0, 0.25);
  color: #a5f3fc;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.btn-outline:hover { background: rgba(0, 0, 0, 0.4); transform: translateY(-2px); }
.btn .btn-shine {
  position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.5s ease;
}
.btn:hover .btn-shine { left: 100%; }

.scroll-indicator {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: rgba(255, 255, 255, 0.5); font-size: 0.8rem;
  animation: bounce 2s ease infinite;
}
.scroll-indicator .mouse {
  width: 24px; height: 38px; border: 2px solid rgba(255,255,255,0.4); border-radius: 12px;
  position: relative;
}
.scroll-indicator .mouse::after {
  content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 8px; background: #22d3ee; border-radius: 2px;
  animation: scrollDown 1.5s ease infinite;
}
@keyframes scrollDown { 0% { opacity: 1; top: 6px; } 100% { opacity: 0; top: 20px; } }
@keyframes bounce { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-10px); } }

/* ====== Section Common ====== */
section { position: relative; z-index: 1; padding: 6rem 2rem; }
.section-header { text-align: center; margin-bottom: 4rem; }
.section-header h2 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 800;
  margin-bottom: 0.5rem; color: #fff;
}
.section-header p { color: rgba(255, 255, 255, 0.85); font-size: 1.1rem; }
.section-header .line {
  width: 60px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, #22d3ee, #99f6e4);
  margin: 1rem auto 0;
}

/* ====== Reveal Animation ====== */
.reveal {
  opacity: 0; transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ====== Hero Quote ====== */
.hero-quote {
  margin-top: 3.5rem;
  text-align: center;
  min-height: 3rem;
}
.quote-text {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: rgba(255,255,255,0.8);
  font-weight: 500;
  letter-spacing: 2px;
  line-height: 1.6;
}
.quote-cursor {
  color: #22d3ee;
  font-weight: 300;
  animation: blinkCursor 0.8s step-end infinite;
}
@keyframes blinkCursor { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.quote-cursor.done { animation: none; opacity: 0; }
@media (max-width: 768px) {
  .hero-quote { margin-top: 2rem; min-height: 2.5rem; }
  .quote-text { font-size: 0.95rem; letter-spacing: 1px; }
}

/* ====== About Section ====== */
#about { max-width: 1100px; margin: 0 auto; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: center; }
.about-avatar {
  position: relative; width: 280px; height: 280px; margin: 0 auto;
}
.avatar-ring {
  position: absolute; inset: -10px; border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, #22d3ee, #99f6e4, #a5f3fc, #22d3ee) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 4s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-inner {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(135deg, rgba(8,145,178,0.2), rgba(14,165,233,0.15));
  display: flex; align-items: center; justify-content: center;
  font-size: 6rem; position: relative; overflow: hidden;
}
.avatar-inner::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(8,145,178,0.25), transparent 60%);
}
.about-text h3 { font-size: 1.5rem; margin-bottom: 1rem; color: #fff; }
.about-text p { color: rgba(255, 255, 255, 0.85); margin-bottom: 1rem; }
.about-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem;
  margin-top: 2rem;
}
.stat {
  text-align: center; padding: 1rem; border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.stat-number {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #99f6e4);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-label { font-size: 0.85rem; color: rgba(255, 255, 255, 0.75); margin-top: 0.2rem; }

/* ====== Skills Section ====== */
#skills { max-width: 1100px; margin: 0 auto; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.skill-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px; padding: 2rem;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative; overflow: hidden; cursor: pointer;
}
.skill-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent, #22d3ee), transparent);
  opacity: 0; transition: opacity 0.3s ease;
}
.skill-card:hover { transform: translateY(-8px); border-color: rgba(34,211,238,0.7);
  background: rgba(0, 0, 0, 0.35); }
.skill-card:hover::before { opacity: 1; }
.skill-icon {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin-bottom: 1rem;
  background: rgba(34, 211, 238, 0.15);
}
.skill-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: #fff; }
.skill-card p { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin-bottom: 1rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.skill-tag {
  padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem;
  background: rgba(34, 211, 238, 0.12); color: #99f6e4;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

/* ====== Projects Section ====== */
#projects { max-width: 1100px; margin: 0 auto; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 2rem; }
.project-card {
  border-radius: 16px; overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer; position: relative;
}
.project-card:hover { transform: translateY(-8px); border-color: rgba(34,211,238,0.7);
  background: rgba(0, 0, 0, 0.35); }
.project-preview {
  height: 200px; position: relative; overflow: hidden;
}
.project-preview-bg {
  width: 100%; height: 100%;
  transition: transform 0.6s ease;
}
.project-card:hover .project-preview-bg { transform: scale(1.1); }
.project-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  display: flex; align-items: flex-end; padding: 1.5rem;
  opacity: 0; transition: opacity 0.3s ease;
}
.project-card:hover .project-overlay { opacity: 1; }
.project-overlay a {
  padding: 0.5rem 1rem; border-radius: 8px;
  background: rgba(8,145,178,0.85); color: #fff;
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
  transition: background 0.3s ease;
}
.project-overlay a:hover { background: #0891b2; }
.project-info { padding: 1.5rem; }
.project-info h3 { font-size: 1.2rem; color: #fff; margin-bottom: 0.5rem; }
.project-info p { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin-bottom: 1rem; }
.project-tech { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.project-tech span {
  padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem;
  background: rgba(34, 197, 94, 0.12); color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* ====== Experience Timeline ====== */
#experience { max-width: 800px; margin: 0 auto; }
.timeline { position: relative; padding-left: 3rem; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, #22d3ee, #99f6e4, transparent);
}
.timeline-item {
  position: relative; margin-bottom: 3rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.5rem 2rem;
}
.timeline-dot {
  position: absolute; left: calc(-3rem + 8px); top: 1.8rem;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(10, 10, 35, 0.8); border: 3px solid #22d3ee;
  transition: all 0.3s ease; z-index: 1;
}
.timeline-item:hover .timeline-dot {
  background: #22d3ee;
  box-shadow: 0 0 20px rgba(34,211,238,0.5);
}
.timeline-date { font-size: 0.85rem; color: #67e8f9; margin-bottom: 0.3rem; font-weight: 600; }
.timeline-item h3 { font-size: 1.2rem; color: #fff; margin-bottom: 0.3rem; }
.timeline-item h4 { font-size: 0.95rem; color: #99f6e4; margin-bottom: 0.5rem; }
.timeline-item p { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; }

/* ====== Contact Section ====== */
#contact { max-width: 700px; margin: 0 auto; text-align: center; }
.contact-links { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 2rem; }
.contact-link {
  width: 60px; height: 60px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; text-decoration: none;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 0.3s ease; color: rgba(255, 255, 255, 0.9);
}
.contact-link:hover {
  transform: translateY(-4px); border-color: rgba(34,211,238,0.7);
  background: rgba(0, 0, 0, 0.35); color: #a5f3fc;
}
.contact-email {
  margin-top: 2rem; font-size: 1.2rem;
}
.contact-email a {
  color: #67e8f9; text-decoration: none;
  position: relative;
}
.contact-email a::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 2px; background: #67e8f9;
  transition: width 0.3s ease;
}
.contact-email a:hover::after { width: 100%; }

/* ====== Footer ====== */
footer {
  text-align: center; padding: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8); font-size: 0.85rem;
  position: relative; z-index: 1;
  background: rgba(0, 0, 0, 0.2);
}

/* ====== Cursor Glow ====== */
.cursor-glow {
  position: fixed; width: 400px; height: 400px;
  border-radius: 50%; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, rgba(8,145,178,0.1), transparent 60%);
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
}

/* ====== Footer Iframe ====== */
footer iframe {
  max-width: 100%;
  width: 330px;
  height: 86px;
  border: none;
}

/* ====== Magnetic Button Effect ====== */
.magnetic { transition: transform 0.3s ease; }

/* ====== Responsive ====== */
@media (max-width: 768px) {
  .hero { min-height: 90vh; min-height: 90dvh; padding: 0.5rem 1rem; justify-content: flex-start; padding-top: 3rem; }
  .hero h1 { font-size: clamp(2.4rem, 11vw, 4rem); }
  .hero .typing-container { font-size: 1rem; min-height: 2rem; }
  .hero-badge { margin-bottom: 1.5rem; }
  .hero-cta { flex-direction: row; width: 100%; justify-content: center; margin-top: 1.5rem; gap: 1rem; }
  .hero-cta .btn { width: 25%; max-width: none; justify-content: center; padding: 0.6rem 0.5rem; font-size: 0.85rem; }
  .about-grid { grid-template-columns: 1fr; text-align: center; gap: 2rem; }
  .about-avatar { width: 200px; height: 200px; }
  .about-stats { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .skills-grid { grid-template-columns: 1fr; gap: 1rem; }
  .projects-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .project-preview { height: 160px; }
  section { padding: 3rem 1rem; }
  .section-header { margin-bottom: 2.5rem; }
  .timeline { padding-left: 2.5rem; }
  .timeline-item { padding: 1.25rem 1rem 1.25rem 1.5rem; }
  .timeline-dot { left: calc(-2.5rem + 6px); width: 16px; height: 16px; }
  .contact-links { gap: 1rem; }
  .contact-link { width: 52px; height: 52px; font-size: 1.2rem; }
  .cursor-glow { display: none; }
  footer { padding: 1.5rem 1rem; }
  footer iframe { width: 100%; height: 80px; }
  .music-control {
    width: 44px; height: 44px; font-size: 1rem;
    bottom: 1rem; right: 1rem;
  }
}
@media (max-width: 480px) {
  .hero { min-height: 100svh; padding: 0.25rem 0.75rem; justify-content: flex-start; padding-top: 2.5rem; }
  .hero h1 { font-size: clamp(1.8rem, 8vw, 2.6rem); }
  .hero-badge { font-size: 0.7rem; padding: 0.25rem 0.7rem; margin-bottom: 1rem; }
  .hero .typing-container { font-size: 0.9rem; margin-top: 0.5rem; min-height: 1.8rem; }
  .hero-cta { flex-direction: row; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
  .hero-cta .btn { width: 25%; max-width: none; padding: 0.5rem 0.3rem; font-size: 0.75rem; }
  .about-stats { grid-template-columns: 1fr; }
  .stat { padding: 0.75rem; }
  .skill-card { padding: 1.5rem; }
  .project-info { padding: 1.25rem; }
  .timeline { padding-left: 2rem; }
  .timeline-item { padding: 1rem 0.875rem 1rem 1.25rem; margin-bottom: 2rem; }
  .timeline-dot { left: calc(-2rem + 4px); top: 1.2rem; width: 14px; height: 14px; border-width: 2px; }
  .timeline-item h3 { font-size: 1.05rem; }
  .timeline-item h4 { font-size: 0.85rem; }
  .timeline-item p { font-size: 0.85rem; }
  .contact-link { width: 48px; height: 48px; font-size: 0.85rem; border-radius: 12px; }
  .contact-email { font-size: 1rem; }
}

/* ====== Loading Screen ====== */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: #082f49;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  gap: 2rem;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; }
.loader-text {
  font-size: 2.2rem; font-weight: 800;
  background: linear-gradient(135deg, #22d3ee, #99f6e4, #a5f3fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}
.loader-bar {
  width: 220px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px;
  overflow: hidden;
}
.loader-bar::after {
  content: ''; display: block; width: 0; height: 100%;
  background: linear-gradient(90deg, #22d3ee, #99f6e4);
  animation: loading 0.6s linear forwards;
}
@keyframes loading { to { width: 100%; } }
.loader-hint {
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  letter-spacing: 1px;
  margin-top: -1rem;
}

/* ====== Tilt Card 3D ====== */
.tilt { transform-style: preserve-3d; perspective: 1000px; }
.tilt-inner { transition: transform 0.1s ease; }

/* ====== Music Control ====== */
.music-control {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: #fff;
  transition: all 0.3s ease;
}
.music-control:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.4);
  color: #99f6e4;
  transform: scale(1.1);
}
.music-control.playing {
  animation: musicPulse 2s ease infinite;
}
@keyframes musicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,211,238,0.3); }
  50% { box-shadow: 0 0 0 12px rgba(34,211,238,0); }
}
