:root {
  --bg: #070b12;
  --bg-alt: #0c1220;
  --surface: rgba(16, 24, 40, 0.72);
  --border: rgba(56, 189, 248, 0.18);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #22d3ee;
  --accent-dim: #0891b2;
  --accent-glow: rgba(34, 211, 238, 0.35);
  --mono: "JetBrains Mono", "Consolas", monospace;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(7, 11, 18, 0.75);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.35rem;
}

.logo-mark {
  color: var(--accent);
}

.logo-text {
  color: var(--text);
}

.nav {
  display: flex;
  gap: 1.75rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--accent);
}

main {
  position: relative;
  z-index: 2;
}

.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem 2rem 4rem;
  max-width: 960px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 1.5rem;
  background: rgba(34, 211, 238, 0.06);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero h1 {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.hero-cn {
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-en {
  font-family: var(--mono);
  font-size: clamp(0.85rem, 2.5vw, 1.1rem);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  margin-bottom: 2rem;
}

.hero-desc strong {
  color: var(--accent);
  font-weight: 500;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 3rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  color: #041016;
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 32px var(--accent-glow);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-alt {
  max-width: none;
  background: linear-gradient(180deg, transparent, rgba(12, 18, 32, 0.6) 20%, rgba(12, 18, 32, 0.6) 80%, transparent);
}

.section-alt > .section-head,
.section-alt > .repo-list,
.section-alt > .contact-grid {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

.section-head {
  margin-bottom: 2.5rem;
}

.section-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-dim);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 0.5rem;
}

.section-head h2 {
  font-size: 1.75rem;
  font-weight: 700;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgba(34, 211, 238, 0.4);
  transform: translateY(-2px);
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.repo-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.repo-item {
  display: block;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.repo-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.08);
}

.repo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.repo-name {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
}

.repo-stars {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.repo-item p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.repo-more {
  text-align: center;
  border-style: dashed;
}

.repo-more .repo-name {
  color: var(--text-muted);
}

.repo-more:hover .repo-name {
  color: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: rgba(34, 211, 238, 0.04);
  transition: all 0.2s;
}

.tag:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.terminal {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0f18;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border);
}

.terminal-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
}

.terminal-bar span:nth-child(1) { background: #ef4444; }
.terminal-bar span:nth-child(2) { background: #eab308; }
.terminal-bar span:nth-child(3) { background: #22c55e; }

.terminal-bar code {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-body {
  padding: 1.25rem 1.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.8;
  overflow-x: auto;
}

.t-comment { color: #64748b; }
.t-key { color: #38bdf8; }
.t-str { color: #86efac; }
.t-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.contact-card h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.contact-highlight {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.contact-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.contact-card a {
  color: var(--accent);
  text-decoration: none;
}

.contact-card a:hover {
  text-decoration: underline;
}

.mono {
  font-family: var(--mono);
}

.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2.5rem 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer p + p {
  margin-top: 0.35rem;
}

@media (max-width: 640px) {
  .site-header {
    padding: 0.85rem 1.25rem;
  }

  .nav {
    gap: 1rem;
  }

  .nav a {
    font-size: 0.8rem;
  }

  .hero {
    padding: 6rem 1.25rem 3rem;
  }

  .section {
    padding: 3.5rem 1.25rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulse, .t-cursor {
    animation: none;
  }

  html {
    scroll-behavior: auto;
  }
}
