:root {
  --bg: #0b1020;
  --text: #eaf2ff;
  --muted: #a4b1c2;
  --primary: #7C3AED; /* violet */
  --secondary: #22D3EE; /* cyan */
  --card: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.14);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}
:root.light {
  --bg: #f6f7fb;
  --text: #121722;
  --muted: #5b6575;
  --card: rgba(10,12,16,0.06);
  --border: rgba(10,12,16,0.12);
  --shadow: 0 10px 24px rgba(20,24,30,0.15);
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; border-radius: 12px; }

/* Animated gradient background */
.bg-animated {
  position: fixed; inset: -10% -10% -10% -10%;
  background: radial-gradient(1200px 800px at 10% 20%, rgba(124,58,237,0.28), transparent 60%),
              radial-gradient(1000px 900px at 80% 10%, rgba(34,211,238,0.26), transparent 60%),
              radial-gradient(900px 900px at 50% 90%, rgba(255,192,78,0.22), transparent 65%);
  filter: blur(40px) saturate(120%);
  z-index: -1;
  animation: float 20s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translate3d(0,0,0); }
  50% { transform: translate3d(0,-10px,0); }
}

.container {
  width: 100%;
  max-width: 1100px;
  padding: 0 20px;
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(150%) blur(10px);
  background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.1));
  border-bottom: 1px solid var(--border);
}
:root.light .site-header {
  background: rgba(255,255,255,0.7);
}
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  display: inline-flex; align-items: center;
  font-weight: 800; letter-spacing: 1px; font-size: 20px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo img { width: 32px; height: 32px; border-radius: 50%; box-shadow: var(--shadow); }
.nav { display: flex; gap: 18px; }
.nav a {
  padding: 10px 12px; border-radius: 10px; color: var(--muted);
}
.nav a:hover { color: var(--text); background: var(--card); }
.actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 12px; border-radius: 12px;
  box-shadow: var(--shadow);
  transition: all 200ms ease;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  border-color: rgba(124,58,237,0.4);
}

.icon-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.3);
}

/* 彻底移除所有默认焦点样式 */
button, a, .btn, .icon-btn, .badge, input, textarea, select {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
}

/* 移除移动端触摸高亮 */
* {
  -webkit-tap-highlight-color: transparent !important;
}

/* 为可聚焦元素添加自定义焦点样式（仅键盘导航时显示） */
button:focus-visible, a:focus-visible, .btn:focus-visible, 
.icon-btn:focus-visible, .badge:focus-visible, input:focus-visible, 
textarea:focus-visible, select:focus-visible {
  box-shadow: 0 0 0 2px rgba(124,58,237,0.3) !important;
  border-color: var(--primary) !important;
}

/* 移动端特殊处理 */
@media (max-width: 768px) {
  button, a, .btn, .icon-btn, .badge, input, textarea, select {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
  }
  
  /* 移除移动端默认焦点样式 */
  button:focus, a:focus, .btn:focus, .icon-btn:focus, 
  .badge:focus, input:focus, textarea:focus, select:focus {
    outline: none !important;
    box-shadow: none !important;
  }
}

/* 确保键盘导航时仍有视觉反馈 */
@media (prefers-reduced-motion: no-preference) {
  button:focus-visible, a:focus-visible, .btn:focus-visible, 
  .icon-btn:focus-visible, .badge:focus-visible {
    transform: translateY(-1px);
    transition: all 150ms ease;
  }
}

#langSelect {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  padding-right: 28px;
  min-width: 100px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 200ms ease;
}

#langSelect:hover {
  border-color: rgba(124,58,237,0.4);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#langSelect:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.3);
  border-color: var(--primary);
}

/* 下拉选项样式 */
#langSelect option {
  background: var(--bg);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  text-align: center;
  transition: background-color 150ms ease;
}

#langSelect option:hover {
  background: rgba(124,58,237,0.1);
  color: var(--primary);
}

#langSelect option:checked {
  background: rgba(124,58,237,0.2);
  color: var(--primary);
  font-weight: 600;
}

/* 移动端优化 */
@media (max-width: 768px) {
  #langSelect {
    min-width: 85px;
    padding-right: 24px;
    font-size: 13px;
    background-size: 10px;
    background-position: right 6px center;
  }
  
  #langSelect option {
    padding: 10px 12px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  #langSelect {
    min-width: 80px;
    padding-right: 22px;
    font-size: 12px;
  }
  
  #langSelect option {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* 确保下拉菜单在深色/浅色模式下都正常显示 */
:root #langSelect option {
  background: var(--bg);
  color: var(--text);
}

:root.light #langSelect option {
  background: var(--bg);
  color: var(--text);
}

:root #langSelect option:hover {
  background: rgba(124,58,237,0.1);
}

:root.light #langSelect option:hover {
  background: rgba(124,58,237,0.05);
}
.icon-btn.only-mobile { display: none; }
#themeToggle .icon { display: inline-block; transition: transform 200ms ease; }

/* Mobile menu */
.mobile-menu {
  display: none; flex-direction: column; gap: 6px; padding: 10px 20px; border-top: 1px solid var(--border);
}
.mobile-menu a { padding: 10px 8px; border-radius: 8px; color: var(--muted); }
.mobile-menu a:hover { background: var(--card); color: var(--text); }

/* Sections */
.section { padding: 80px 0; }
.section-title { font-size: 28px; font-weight: 800; margin-bottom: 24px; }
.hero {
  padding-top: 60px;
}
.hero-inner {
  display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 28px; align-items: center;
}
.hero h1 {
  font-size: 44px; line-height: 1.1; margin: 0 0 12px;
}
.subtitle { color: var(--muted); margin-bottom: 18px; }
.accent {
  color: var(--text);
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-cta { display: flex; gap: 12px; margin: 18px 0 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 18px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.btn.primary { background: linear-gradient(90deg, var(--primary), var(--secondary)); border: none; }
.btn.ghost { background: transparent; }
.btn.small { padding: 8px 12px; border-radius: 10px; }

.hero-stats { display: flex; gap: 22px; }
.stat .num { font-size: 28px; font-weight: 800; }
.stat .label { color: var(--muted); font-size: 14px; }
.hero-visual { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.avatar { width: 160px; height: 160px; border-radius: 22px; padding: 0; overflow: hidden; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tagline { color: var(--muted); text-align: center; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }

.card {
  border-radius: 18px; padding: 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.card.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  backdrop-filter: blur(10px) saturate(120%);
}
:root.light .card.glass {
  background: rgba(255,255,255,0.7);
}
.card.gradient {
  background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(34,211,238,0.2));
}

.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.chips li {
  list-style: none;
  border: 1px dashed var(--border);
  padding: 8px 10px; border-radius: 12px; color: var(--muted);
}

.list { padding-left: 18px; }
.list li { margin: 8px 0; color: var(--text); }

.projects-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
.project-card {
  border-radius: 18px; overflow: hidden; border: 1px solid var(--border);
  background: rgba(255,255,255,0.06); box-shadow: var(--shadow);
  display: grid; grid-template-rows: 140px auto;
}
.project-card .thumb {
  background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(34,211,238,0.25));
}
.shimmer {
  position: relative; overflow: hidden;
}
.shimmer::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%); 
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: shimmer 1.8s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  60% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.project-card .content { padding: 14px; }
.project-card h3 { margin: 2px 0 8px; }
.project-card p { color: var(--muted); margin: 0 0 10px; }
.project-card .actions { display: flex; gap: 8px; }

.skills-cloud {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.chip {
  padding: 8px 12px; border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card); color: var(--text);
}

.contact-list { display: grid; gap: 8px; margin-top: 8px; }
.contact-list a { color: var(--text); }
.socials { display: none; }

.muted { color: var(--muted); }

.social-badges {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); box-shadow: var(--shadow);
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
  position: relative;
}
.badge .icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: currentColor;
}
.badge .icon svg { width: 18px; height: 18px; display: block; }
.badge[data-type="email"] { color: #8aa0b6; }
.badge[data-type="qq"] { color: #3b8cff; }
.badge[data-type="wechat"] { color: #17c964; }
.badge .label { font-size: 14px; }
.badge:hover { transform: translateY(-1px); filter: brightness(1.05); }

.badge .copy-tip {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--muted);
  opacity: 0; transition: opacity 150ms ease;
}
.badge.copied .copy-tip { opacity: 1; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0; color: var(--muted); text-align: center;
  font-size: 14px;
}
.site-footer .beian {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.site-footer .beian .dot { opacity: 0.6; }
.site-footer a {
  color: var(--muted);
  border-bottom: 1px dashed transparent;
  transition: color 120ms ease, border-bottom-color 120ms ease;
}
.site-footer a:hover {
  color: var(--text);
  border-bottom-color: currentColor;
}

.site-footer .beian a[href*="beian.gov.cn"]::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  background-image: url("ga.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
  vertical-align: -3px;
}

@media (prefers-reduced-motion: no-preference) {
  .theme-transition,
  .theme-transition * {
    transition:
      background-color 220ms ease,
      color 220ms ease,
      border-color 220ms ease,
      box-shadow 220ms ease;
  }
}
/* Reveal animations */
.reveal {
  opacity: 0; transform: translateY(16px);
  will-change: opacity, transform;
}
.reveal.show {
  opacity: 1; transform: translateY(0);
  transition: opacity 500ms ease, transform 500ms ease;
}

/* Responsive */
@media (max-width: 1024px) {
  .container { padding: 0 16px; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-content { order: 2; text-align: center; }
  .hero-visual { order: 1; }
  .hero-stats { justify-content: center; }
  .grid-2 { grid-template-columns: 1fr; gap: 20px; }
  .section { padding: 60px 0; }
}

@media (max-width: 768px) {
  .container { padding: 0 12px; }
  .nav-wrap { height: 60px; }
  .nav { display: none; }
  .icon-btn.only-mobile { display: inline-flex; }
  .actions { gap: 8px; }
  
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 32px; line-height: 1.2; }
  .subtitle { font-size: 16px; margin-bottom: 16px; }
  .hero-cta { 
    flex-direction: column; 
    gap: 10px; 
    margin: 20px 0;
    align-items: center;
    justify-content: center;
  }
  .btn { 
    width: 100%; 
    max-width: 200px;
    text-align: center;
    justify-content: center;
  }
  .hero-stats { flex-direction: column; gap: 16px; margin-top: 24px; }
  .stat { text-align: center; }
  .avatar { width: 120px; height: 120px; border-radius: 20px; }
  .tagline { font-size: 14px; }
  
  .section { padding: 40px 0; }
  .section-title { font-size: 24px; margin-bottom: 20px; }
  .card { padding: 16px; border-radius: 16px; }
  .chips { gap: 8px; }
  .chips li { padding: 6px 8px; font-size: 14px; }
  .list li { font-size: 14px; }
  
  .skills-cloud { justify-content: center; gap: 8px; }
  .chip { padding: 6px 10px; font-size: 14px; border-radius: 12px; }
  
  .social-badges { flex-direction: column; gap: 8px; }
  .badge { padding: 8px 10px; }
  
  .site-footer { padding: 20px 0; font-size: 12px; }
  .site-footer .beian { flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  .container { padding: 0 10px; }
  .hero h1 { font-size: 28px; }
  .subtitle { font-size: 15px; }
  .hero-stats { gap: 12px; }
  .stat .num { font-size: 24px; }
  .stat .label { font-size: 13px; }
  .avatar { width: 100px; height: 100px; }
  
  .section-title { font-size: 22px; }
  .card { padding: 14px; border-radius: 14px; }
  
  #langSelect { min-width: 90px; padding-right: 24px; }
  .icon-btn { padding: 6px 10px; font-size: 13px; }
}

/* 移动端菜单样式 */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.mobile-menu a {
  padding: 10px 8px;
  border-radius: 8px;
  color: var(--muted);
}

.mobile-menu a:hover {
  background: var(--card);
  color: var(--text);
}

/* 确保移动端菜单显示 */
@media (max-width: 768px) {
  .mobile-menu.show {
    display: flex;
  }
}

/* 修复移动端按钮布局 */
@media (max-width: 768px) {
  .hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
  }
  
  .btn {
    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* 修复移动端导航栏 */
@media (max-width: 768px) {
  .nav-wrap {
    height: 56px;
  }
  
  .actions {
    gap: 6px;
  }
  
  .icon-btn {
    padding: 6px 10px;
    font-size: 13px;
  }
  
  #langSelect {
    min-width: 85px;
    padding-right: 22px;
  }
}

/* 修复移动端内容溢出 */
@media (max-width: 768px) {
  .hero-content {
    width: 100%;
    max-width: 100%;
  }
  
  .hero-visual {
    width: 100%;
    max-width: 100%;
  }
  
  .container {
    overflow-x: hidden;
  }
}