/* =========================================================================
   Nya 的学习笔记 · style.css
   目录
   1. 设计变量 / 基础重置
   2. 背景与自定义光标
   3. 导航栏
   4. Bento 卡片骨架与网格
   5. 各卡片（Hero / 头像 / 时钟 / 运行时长 / 兴趣 / 统计 / 社交 / 随手记）
   6. Section 通用、关于、技术栈、项目、联系、页脚
   7. 浮动控件、Toast、动效
   8. 响应式与降级
   ========================================================================= */

/* ============================ 1. 变量 ============================ */
:root {
  color-scheme: dark;

  /* 字体：全站只保留两个族，避免中英混排各走一套 */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  /* 主题色 */
  --bg: #08080c;
  --bg-2: #0d0d14;
  --text: #f0f0f5;
  --text-dim: #b0b0c0;
  --text-muted: #8a8a9e;
  --accent: #7c6cff;
  --accent-2: #ff6cb8;
  --accent-3: #4ade80;
  --accent-soft: rgba(124, 108, 255, 0.12);
  --accent-line: rgba(124, 108, 255, 0.24);

  /* 表面 / 线条 / 阴影（亮色主题会整体覆盖，不再各写一份 rgba 白） */
  --glass: rgba(255, 255, 255, 0.045);
  --glass-border: rgba(255, 255, 255, 0.09);
  --fill-soft: rgba(255, 255, 255, 0.06);
  --fill-strong: rgba(255, 255, 255, 0.1);
  --fill-hover: rgba(255, 255, 255, 0.09);
  --sheen: rgba(255, 255, 255, 0.06);
  --nav-bg: rgba(13, 13, 20, 0.62);
  --float-bg: rgba(13, 13, 20, 0.72);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.26);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.38);

  /* 尺寸 / 节奏 */
  --radius: 24px;
  --radius-sm: 16px;
  --card-pad: 26px;
  --gutter: 24px;
  --section-gap: 112px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f5f9;
  --bg-2: #e9eaf1;
  --text: #16162a;
  --text-dim: #3d3d55;
  --text-muted: #6b6b82;
  --accent: #6c5ce7;
  --accent-2: #e84393;
  --accent-3: #00926a;
  --accent-soft: rgba(108, 92, 231, 0.1);
  --accent-line: rgba(108, 92, 231, 0.2);

  --glass: rgba(255, 255, 255, 0.66);
  --glass-border: rgba(22, 22, 42, 0.09);
  --fill-soft: rgba(22, 22, 42, 0.05);
  --fill-strong: rgba(22, 22, 42, 0.09);
  --fill-hover: rgba(22, 22, 42, 0.07);
  --sheen: rgba(108, 92, 231, 0.07);
  --nav-bg: rgba(255, 255, 255, 0.74);
  --float-bg: rgba(255, 255, 255, 0.86);
  --shadow-sm: 0 8px 24px rgba(30, 30, 60, 0.07);
  --shadow-lg: 0 24px 48px rgba(30, 30, 60, 0.13);
}

/* ============================================================
   基础重置
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 104px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* 滚动条 */
@supports selector(::-webkit-scrollbar) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-thumb {
    background: var(--fill-strong);
    border-radius: 100px;
    border: 2px solid transparent;
    background-clip: padding-box;
  }
  ::-webkit-scrollbar-track {
    background: transparent;
  }
}

/* ============================ 2. 背景 ============================ */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* WebGL 不可用时的兜底底色 */
  background:
    radial-gradient(58% 48% at 22% 18%, rgba(124, 108, 255, 0.16), transparent 70%),
    radial-gradient(52% 46% at 82% 78%, rgba(255, 108, 184, 0.12), transparent 72%);
}

[data-theme="light"] .aurora {
  background:
    radial-gradient(58% 48% at 22% 18%, rgba(108, 92, 231, 0.14), transparent 70%),
    radial-gradient(52% 46% at 82% 78%, rgba(232, 67, 147, 0.1), transparent 72%);
}

#shaderCanvas {
  width: 100%;
  height: 100%;
}

/* 自定义光标：只在有精确指针的设备上启用 */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 50%;
  opacity: 0;
  mix-blend-mode: difference;
  will-change: transform;
}

html.has-cursor .cursor-dot,
html.has-cursor .cursor-ring {
  opacity: 1;
}

html.has-cursor,
html.has-cursor * {
  cursor: none !important;
}

.cursor-dot {
  width: 8px;
  height: 8px;
  background: #fff;
}

.cursor-ring {
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  transition: width 0.3s, height 0.3s, border-color 0.3s;
}

.cursor-ring.hover {
  width: 60px;
  height: 60px;
  border-color: var(--accent);
}

/* ============================ 3. 导航栏 ============================ */
.navbar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 22px;
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  transition: top 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.navbar.scrolled {
  top: 12px;
  box-shadow: var(--shadow-sm);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  user-select: none;
}

.logo-mark {
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  animation: spin 8s linear infinite;
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(120deg, #ff6b6b, #feca57, #48dbfb, #a55eea, #ff6b6b);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientFlow 6s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 2px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 14px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.25s, background 0.25s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
  background: var(--fill-soft);
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  background: var(--fill-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.lang-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes gradientFlow {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ============================ 4. 容器 / 网格 ============================ */
.container {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px var(--gutter) 56px;
}

.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: var(--section-gap);
}

.card {
  position: relative;
  padding: var(--card-pad);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  color: var(--text);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
    border-color 0.4s var(--ease);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

.card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

/* 鼠标跟随光斑 */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    var(--sheen),
    transparent 42%
  );
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.card:hover::before {
  opacity: 1;
}

/* 桌面四列布局 */
.card-hero {
  grid-column: span 2;
  grid-row: span 2;
}
.card-avatar {
  grid-column: span 2;
}
.card-time,
.card-uptime {
  grid-column: span 1;
}
.card-interests {
  grid-column: span 2;
}
.card-stat {
  grid-column: span 1;
}
.card-social {
  grid-column: span 2;
}
.card-cave {
  grid-column: span 2;
}

/* ============================ 5. 卡片 ============================ */

/* --- 通用小标签 --- */
.card-label {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* --- Hero --- */
.card-hero {
  display: flex;
  flex-direction: column;
  min-height: 340px;
}

.card-tag {
  margin-bottom: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.hero-title {
  font-size: clamp(38px, 4.4vw, 56px);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.reveal-text {
  display: block;
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 0.8s var(--ease) forwards;
}

.reveal-text:nth-child(2) {
  animation-delay: 0.1s;
}

.hero-name {
  display: block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  animation: reveal 0.8s var(--ease) 0.2s forwards;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-desc {
  margin-top: 18px;
  max-width: 44ch;
  font-size: 15px;
  color: var(--text-dim);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 26px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 100px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.25s var(--ease), box-shadow 0.3s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 13px 26px;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.25s, border-color 0.25s;
}

.btn-ghost:hover {
  background: var(--fill-hover);
  border-color: var(--accent-line);
}

/* 技术栈一行：用真实空格分隔，允许换行（原来用 &nbsp; 无法折行导致溢出） */
.hero-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 10px;
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.hero-stack span + span::before {
  content: "/";
  margin-right: 10px;
  opacity: 0.5;
}

/* --- 头像 --- */
.card-avatar {
  display: flex;
  align-items: center;
  gap: 20px;
}

.avatar-ring {
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  padding: 3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.avatar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg-2);
}

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

.avatar-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.avatar-name {
  font-size: 18px;
  font-weight: 600;
}

.avatar-loc {
  font-size: 13px;
  color: var(--text-dim);
}

/* --- 时钟 --- */
.card-time {
  display: flex;
  flex-direction: column;
}

.clock {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.2vw, 26px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.clock-date {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.time-bar {
  height: 4px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 100px;
  background: var(--fill-soft);
}

.time-progress {
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s linear;
}

/* --- 运行时长（重排：大数字 + 小单位，不再挤成一行） --- */
.card-uptime {
  display: flex;
  flex-direction: column;
}

.uptime-value {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: auto;
}

.uptime-num {
  /* 大数字用无衬线（等宽字体的“0”带斜杠/圆点，放大后很抢眼） */
  font-family: var(--font-sans);
  font-size: clamp(38px, 4.8vw, 46px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.uptime-unit {
  font-size: 15px;
  color: var(--text-muted);
}

.uptime-hm {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* 底部那条细线让 “since” 成为卡片的落款，而不是浮在空白里 */
.uptime-since {
  width: 100%;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--glass-border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- 兴趣标签 --- */
.interest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interest-tag {
  padding: 7px 13px;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  background: var(--fill-soft);
  font-size: 13px;
  transition: background 0.25s, color 0.25s, border-color 0.25s,
    transform 0.25s;
  animation: tagIn 0.5s var(--d, 0s) backwards;
}

.interest-tag:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

@keyframes tagIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- 统计卡（GitHub / QQ 共用一套结构，解决排版不一致） --- */
.card-stat {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(19px, 1.8vw, 22px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.25s;
}

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

.stat-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.card-qq {
  align-items: flex-start;
}

/* --- 社交 --- */
.card-social {
  display: flex;
  flex-direction: column;
}

.social-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 4px;
}

.social-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  text-decoration: none;
  text-align: left;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}

.social-item:hover {
  background: var(--fill-hover);
  color: var(--text);
  transform: translateX(3px);
}

.social-icon {
  flex-shrink: 0;
  font-size: 15px;
}

.social-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-arrow {
  flex-shrink: 0;
  font-size: 13px;
  opacity: 0.45;
  transition: transform 0.25s, opacity 0.25s;
}

.social-item:hover .social-arrow {
  transform: translate(2px, -2px);
  opacity: 1;
}

.social-value {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* --- 随手记 --- */
.card-cave {
  display: flex;
  flex-direction: column;
  /* 卡片被同行的社交卡拉高时，把「— 随手记」压到底部，别留一坨空白 */
  justify-content: space-between;
  cursor: pointer;
}

.cave-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cave-title {
  font-size: 15px;
  font-weight: 600;
}

.cave-hint {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
  transition: opacity 0.3s, color 0.3s;
}

.card-cave:hover .cave-hint {
  opacity: 1;
  color: var(--accent);
}

.cave-text {
  min-height: 3.4em;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--accent);
  overflow-wrap: break-word;
}

.cave-text.flash {
  animation: caveFlash 0.24s steps(1, end) forwards;
}

@keyframes caveFlash {
  0%,
  33%,
  66% {
    opacity: 1;
  }
  16%,
  50%,
  100% {
    opacity: 0;
  }
}

.cave-from {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.45s ease 0.2s;
}

.cave-from.show {
  opacity: 1;
}

/* ============================ 6. Section ============================ */
.section {
  margin-bottom: var(--section-gap);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  font-size: clamp(28px, 3.4vw, 40px);
  letter-spacing: -0.03em;
}

.section-num {
  padding: 5px 11px;
  border: 1px solid var(--accent-line);
  border-radius: 100px;
  background: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--accent);
}

/* --- 关于 --- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.about-card {
  padding: 30px;
  border-radius: var(--radius);
}

.about-icon {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 30px;
  animation: iconBob 3s ease-in-out infinite;
}

@keyframes iconBob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.about-card h3 {
  margin-bottom: 6px;
  font-size: 19px;
}

.about-card p {
  font-size: 14px;
  color: var(--text-dim);
}

/* --- 技术栈 --- */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.stack-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  border-radius: var(--radius);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
    border-color 0.4s;
}

.stack-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.stack-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stack-emoji {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: var(--fill-soft);
  font-size: 24px;
}

.stack-name {
  font-size: 18px;
  font-weight: 600;
}

.stack-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.stack-desc {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-dim);
}

.stack-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 100px;
  background: var(--fill-soft);
}

.stack-fill {
  height: 100%;
  width: 0;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1.2s var(--ease) 0.15s;
}

.stack-card.in .stack-fill {
  width: var(--level, 0%);
}

.stack-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- 项目 --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease),
    border-color 0.4s;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-lg);
}

.project-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  overflow: hidden;
}

.project-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent, rgba(0, 0, 0, 0.18));
}

.project-emoji {
  position: relative;
  z-index: 1;
  font-size: 38px;
  transition: transform 0.4s var(--ease);
}

.project-card:hover .project-emoji {
  transform: scale(1.12) rotate(-5deg);
}

.project-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.project-tags span {
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--fill-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

.project-body h3 {
  margin-bottom: 6px;
  font-size: 17px;
}

.project-body p {
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

.project-link {
  margin-top: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: letter-spacing 0.3s;
}

.project-card:hover .project-link {
  letter-spacing: 0.06em;
}

.proj-star {
  color: var(--accent);
}

.project-card.more .project-visual {
  border-bottom: 1px dashed var(--glass-border);
}

/* --- 联系 --- */
.contact-card {
  position: relative;
  overflow: hidden;
  padding: 60px 44px;
  border-radius: var(--radius);
  text-align: center;
}

.contact-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.contact-headline {
  position: relative;
  font-size: clamp(34px, 4.6vw, 56px);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text), var(--text-dim));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.contact-sub {
  position: relative;
  margin-top: 14px;
  font-size: 15px;
  color: var(--text-dim);
}

.contact-email {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 90%;
  margin-top: 30px;
  padding: 12px 24px;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  font-size: clamp(16px, 3.6vw, 24px);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.3s;
}

.contact-email:hover {
  background: var(--fill-hover);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.contact-socials {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  margin-top: 26px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.contact-socials a,
.link-btn {
  font-size: 13.5px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s;
}

.contact-socials a:hover,
.link-btn:hover {
  color: var(--accent);
}

/* --- 友情链接（页面最下面） --- */
.section-friends {
  margin-bottom: 64px;
}

.friends-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.35s var(--ease), border-color 0.35s,
    box-shadow 0.35s;
}

.friend-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: var(--shadow-sm);
}

.friend-badge {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--g1, var(--accent)), var(--g2, var(--accent-2)));
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  text-transform: lowercase;
}

.friend-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.friend-name {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.friend-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.friend-arrow {
  margin-left: auto;
  padding-left: 8px;
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.3s, color 0.3s;
}

.friend-card:hover .friend-arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}

/* --- 页脚 --- */
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 36px 0;
  border-top: 1px solid var(--glass-border);
  font-size: 13px;
  color: var(--text-dim);
}

.footer-beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.footer-beian a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.25s;
}

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

.footer-powered {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.heart {
  display: inline-block;
  color: #ff5c8d;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* ============================ 7. 浮动控件 ============================ */
.back-to-top,
.theme-btn {
  position: fixed;
  right: 28px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--float-bg);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  color: var(--text);
  z-index: 90;
  transition: opacity 0.35s, transform 0.35s var(--ease), background 0.3s,
    color 0.3s, box-shadow 0.3s;
}

.back-to-top {
  bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.85);
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.theme-btn {
  bottom: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top:hover,
.theme-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.progress-ring-bg {
  stroke: var(--fill-strong);
}

.progress-ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 131.95;
  stroke-dashoffset: 131.95;
  transition: stroke-dashoffset 0.1s linear;
}

.arrow-up {
  position: absolute;
  color: var(--text);
  transition: transform 0.3s, color 0.3s;
}

.back-to-top:hover .arrow-up {
  transform: translateY(-2px);
  color: var(--accent);
}

.theme-btn svg {
  position: absolute;
  transition: opacity 0.3s, transform 0.4s var(--ease);
}

.theme-icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.theme-icon-moon {
  opacity: 1;
}

[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 10000;
  padding: 11px 22px;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  background: var(--bg-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  font-size: 13.5px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(70px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

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

/* --- 语言切换过渡 --- */
[data-i18n],
[data-i18n-alt] {
  transition: opacity 0.26s var(--ease), transform 0.26s var(--ease),
    filter 0.26s ease;
}

.lang-fade {
  opacity: 0 !important;
  transform: translateY(6px);
  filter: blur(3px);
}

/* --- 滚动揭示（仅在 JS 可用时隐藏，避免无脚本白屏） --- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.js [data-reveal].in {
  opacity: 1;
  transform: none;
}

/* ============================ 8. 响应式 ============================ */
@media (max-width: 1024px) {
  :root {
    --section-gap: 92px;
  }
  .nav-link {
    padding: 7px 10px;
    font-size: 13px;
  }
}

/* 两列：平板 */
@media (max-width: 900px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-hero {
    grid-row: span 1;
    min-height: 0;
  }
  .card-hero,
  .card-avatar,
  .card-interests,
  .card-social,
  .card-cave {
    grid-column: span 2;
  }
  .card-time,
  .card-uptime,
  .card-stat {
    grid-column: span 1;
  }
  /* 四张卡在平板宽度下 2×2，避免出现「3+1」的孤儿卡片 */
  .about-grid,
  .stack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 520px) {
  .about-grid,
  .stack-grid,
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 单列：手机（原来两列会把时钟 / QQ / 社交卡压到溢出） */
@media (max-width: 620px) {
  :root {
    --gutter: 16px;
    --card-pad: 20px;
    --section-gap: 72px;
    --radius: 20px;
  }

  .container {
    padding-top: 104px;
  }

  .bento {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-hero,
  .card-avatar,
  .card-time,
  .card-uptime,
  .card-interests,
  .card-stat,
  .card-social,
  .card-cave {
    grid-column: span 1;
  }

  .nav-links {
    display: none;
  }

  .navbar {
    gap: 10px;
    padding: 8px 8px 8px 16px;
  }

  .logo-text {
    font-size: 14px;
  }

  .hero-actions {
    padding-top: 20px;
  }

  .btn-primary,
  .btn-ghost {
    padding: 12px 20px;
  }

  .section-title {
    gap: 10px;
  }

  .contact-card {
    padding: 44px 22px;
  }

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

  .back-to-top,
  .theme-btn {
    right: 16px;
  }

  .toast {
    bottom: 20px;
    max-width: calc(100vw - 32px);
    text-align: center;
  }
}

/* ============================ 动效降级 ============================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .stack-card .stack-fill {
    width: var(--level, 0%);
  }
}
