:root {
  --bg: rgba(246, 248, 252, 0.72);
  --bg-solid: #f6f8fc;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --bg-soft: #eef2ff;
  --text: #0f172a;
  --text-muted: #334155;
  --border: rgba(15, 23, 42, 0.12);
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --green: #10b981;
  --shadow: 0 12px 32px -12px rgba(15, 23, 42, 0.16);
  --radius: 18px;
  --nav-bg: rgba(246, 248, 252, 0.72);
  --overlay-bg: rgba(246, 248, 252, 0.45);
}

[data-theme="dark"] {
  --bg: rgba(11, 17, 32, 0.68);
  --bg-solid: #0b1120;
  --bg-elevated: rgba(17, 24, 39, 0.76);
  --bg-soft: #1e293b;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --border: rgba(148, 163, 184, 0.2);
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --green: #34d399;
  --shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.65);
  --nav-bg: rgba(11, 17, 32, 0.74);
  --overlay-bg: rgba(11, 17, 32, 0.62);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-solid);
  color: var(--text);
  line-height: 1.7;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

.bg-photo {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -3;
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  transition: background-image 0.45s ease, opacity 0.35s ease;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background: var(--overlay-bg);
  transition: background-color 0.25s ease;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 15%, var(--accent-soft), transparent 40%),
    radial-gradient(circle at 85% 25%, rgba(16, 185, 129, 0.08), transparent 35%);
}

.container {
  width: min(1080px, 92%);
  margin: 0 auto;
}

/* 顶部导航 */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--green));
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s, border-color 0.2s;
}

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

.menu-toggle {
  display: none;
}

/* Hero 首屏 */
.hero {
  padding: 72px 0 48px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 36px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.hero-role {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero-bio {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 56ch;
  margin-bottom: 28px;
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s, background-color 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

/* 右侧名片 */
.profile-card {
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.avatar-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.avatar {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  color: #ffffff;
  font-weight: 800;
  font-size: 1.35rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.profile-loc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.highlight-list {
  display: grid;
  gap: 12px;
}

.highlight-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.highlight-item span:first-child {
  color: var(--text-muted);
}

.highlight-item span:last-child {
  font-weight: 600;
  text-align: right;
}

/* 通用分区 */
.section {
  padding: 56px 0;
}

.section-header {
  margin-bottom: 28px;
}

.section-kicker {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

.section-title {
  font-size: 1.75rem;
  line-height: 1.3;
}

/* 关于与技能 */
.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 24px;
}

.card {
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.about-text p + p {
  margin-top: 14px;
}

.about-text p {
  color: var(--text-muted);
}

.skills-groups {
  display: grid;
  gap: 18px;
}

.skill-group-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 500;
  background: var(--accent-soft);
  color: var(--accent);
}

/* 项目列表 */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.project-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}

.project-title {
  font-size: 1.18rem;
  margin-bottom: 10px;
}

.project-desc {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin-bottom: 16px;
}

.project-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.mini-pill {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.project-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
}

/* 联系方式 */
.contact-box {
  display: block;
}

.contact-subtitle {
  color: var(--text-muted);
  margin: 10px 0 22px;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.email-pill {
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
}

.social-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.social-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s;
}

.social-item:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.social-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 页脚 */
.footer {
  padding: 36px 0 48px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
}

/* 提示气泡 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg-solid);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 响应式适配 */
@media (max-width: 900px) {
  .hero-grid,
  .bento-grid,
  .contact-box,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .social-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .social-list {
    grid-template-columns: 1fr;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 14px;
  }

  .nav-links.open {
    display: flex;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .btn-hide-xs {
    display: none;
  }

  .hero {
    padding-top: 44px;
  }
}

/* ---------- 随机二次元画廊 ---------- */
section[id] {
  scroll-margin-top: 96px;
}

.section-subtitle {
  margin-top: 10px;
  color: var(--text-muted);
  max-width: 620px;
}

.anime-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.anime-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.anime-card {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.anime-card.skeleton {
  cursor: default;
  overflow: hidden;
}

.anime-card.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(148, 163, 184, 0.28) 45%,
    transparent 70%
  );
  transform: translateX(-100%);
  animation: anime-shimmer 1.4s infinite;
}

@keyframes anime-shimmer {
  to {
    transform: translateX(100%);
  }
}

.anime-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: transform 0.55s ease, opacity 0.4s ease;
}

.anime-card.loaded .anime-img {
  opacity: 1;
}

.anime-card:hover .anime-img {
  transform: scale(1.045);
}

.anime-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.anime-actions {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 40px 12px 12px;
  background: linear-gradient(transparent, rgba(2, 6, 23, 0.66));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.anime-card:hover .anime-actions,
.anime-card:focus-within .anime-actions {
  opacity: 1;
  transform: translateY(0);
}

.anime-action {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.anime-action:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.anime-empty {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- 大图预览 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.8);
  backdrop-filter: blur(8px);
}

.lightbox-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(1100px, 100%);
  max-height: 100%;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 16px;
  background: #0b1120;
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.85);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: #e2e8f0;
}

.lightbox-meta {
  font-size: 0.85rem;
  opacity: 0.85;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lightbox-close {
  position: absolute;
  top: -42px;
  right: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .anime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .anime-grid {
    grid-template-columns: 1fr;
  }

  .anime-actions {
    opacity: 1;
    transform: none;
  }

  .lightbox {
    padding: 14px;
  }

  .lightbox-img {
    max-height: 64vh;
  }

  .lightbox-close {
    top: 6px;
    right: 6px;
    z-index: 2;
  }
}

/* ---------- 注册 / 登录 ---------- */
.auth-card {
  max-width: 560px;
  margin-top: 26px;
  padding: 24px;
}

.auth-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.auth-tab.is-active {
  background: var(--accent);
  color: #fff;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-field[hidden] {
  display: none;
}

.auth-field input {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.auth-session {
  font-size: 0.85rem;
  color: var(--green);
}

.auth-session:not(:empty) {
  cursor: pointer;
}

.auth-message {
  min-height: 1.2em;
  font-size: 0.88rem;
}

.auth-message.is-error {
  color: #e11d48;
}

.auth-message.is-success {
  color: var(--green);
}

[data-theme="dark"] .auth-message.is-error {
  color: #fb7185;
}

.auth-note {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------- 扫码名片 ---------- */
.qr-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.qr-item:hover {
  transform: translateY(-3px);
}

.qr-item img {
  width: 100%;
  max-width: 220px;
  border-radius: 14px;
  display: block;
  background: #fff;
}

.qr-item strong {
  font-size: 0.95rem;
}

.qr-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}
