:root {
  --primary: #6C63FF;
  --secondary: #4A44B5;
  --accent: #FF6584;
  --text: #2D2B55;
  --bg: #FAF7FF;
  --card-bg: rgba(255, 255, 255, 0.2);
  --card-border: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] {
  --text: #E2E1FF;
  --bg: #1A1A2E;
  --card-bg: rgba(26, 26, 46, 0.4);
  --card-border: rgba(106, 90, 205, 0.3);
}

* {
  margin: 0 0 0.5rem 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  position: relative;
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 1.5rem 5%;
  position: fixed;
  width: 100%;
  z-index: 100;
  backdrop-filter: blur(10px);
}

nav ul {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.typewriter {
  display: inline-block;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  padding-bottom: 5px;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

#themeToggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

main {
  padding-top: 100px;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  border: 1px solid var(--card-border);
  padding: 2.5rem;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  max-width: 800px;
  margin: 0 auto;
  transition: transform 0.5s ease;
}

.glass-card:hover {
  transform: translateY(-10px) rotate(1deg);
}

#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 5%;
}

#hero h2 {
  font-size: 3.5rem;
  margin-bottom: 1rem;
}

#hero h2 span {
  color: var(--accent);
  position: relative;
}

#hero h2 span::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

#hero p {
  font-size: 1.5rem;
  opacity: 0.8;
}

.typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: .15em solid var(--accent);
  letter-spacing: .15em;
  animation: typing 3.5s linear forwards, blink-caret .75s step-end infinite;
}

@keyframes typing {
  from { 
    width: 0;
  }
  to { 
    width: 8em; /* 匹配文本长度(一切皆有可能=8中文字符) */
  }
}

@keyframes blink-caret {
  from, to { border-color: transparent }
  50% { border-color: var(--accent) }
}

@media (max-width: 768px) {
  header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  #hero h2 {
    font-size: 2.5rem;
  }
  
  .glass-card {
    padding: 1.5rem;
  }
  
  .typewriter {
    min-width: unset;
    text-align: center;
  }
}

/* 新增作品网格样式 */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.link-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  border: 1px solid var(--card-border);
  transition: all 0.3s ease;
  text-decoration: none;
  padding: 1rem;
}

.link-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.25);
}

.link-card h2 {
  color: var(--text);
  font-size: 1.3rem;
  text-align: center;
  margin: 0;
}

/* 联系部分样式 */
#contact a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

#contact a:hover {
  text-decoration: underline;
}
