/* ============================================================
   Nick Lee — Personal Homepage  V2.0
   学院风 · 苹果式简洁 · 浅色/深色双主题 · 液态玻璃视觉
   ============================================================ */

/* ---------- Theme Variables ---------- */
:root {
  --bg: #FAF9F6;
  --bg-elevated: rgba(255, 255, 255, 0.54);
  --text: #1A2332;
  --text-secondary: #5A6472;
  --accent: #2C4A8A;
  --accent-hover: #22396B;
  --accent-soft: rgba(44, 74, 138, 0.08);
  --divider: rgba(26, 35, 50, 0.09);
  --card-shadow: 0 4px 24px rgba(26, 35, 50, 0.06);
  --card-shadow-hover: 0 12px 40px rgba(26, 35, 50, 0.12);
  --nav-bg: rgba(250, 249, 246, 0.62);
  /* 液态玻璃（Liquid Glass）质感 */
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(26, 35, 50, 0.08);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(26, 35, 50, 0.04);
  --glass-shadow-strong: 0 14px 44px rgba(26, 35, 50, 0.18);
  --glow-1: rgba(44, 74, 138, 0.055);
  --glow-2: rgba(150, 130, 90, 0.045);
}

[data-theme="dark"] {
  --bg: #0F141B;
  --bg-elevated: rgba(27, 35, 48, 0.47);
  --text: #EDEAE2;
  --text-secondary: #9AA3AE;
  --accent: #7A9BD1;
  --accent-hover: #94B3DE;
  --accent-soft: rgba(122, 155, 209, 0.12);
  --divider: rgba(237, 234, 226, 0.09);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --card-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.4);
  --nav-bg: rgba(15, 20, 27, 0.62);
  --glass-bg: rgba(27, 35, 48, 0.4);
  --glass-border: rgba(237, 234, 226, 0.1);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --glass-highlight: inset 0 1px 0 rgba(237, 234, 226, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  --glass-shadow-strong: 0 14px 44px rgba(0, 0, 0, 0.55);
  --glow-1: rgba(122, 155, 209, 0.07);
  --glow-2: rgba(90, 110, 160, 0.05);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* 背景微光斑：为毛玻璃提供可折射的层次（克制、学院感） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 45% at 15% 8%, var(--glow-1), transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 90%, var(--glow-2), transparent 70%);
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
  text-decoration: none;
}

section {
  scroll-margin-top: 84px;
}

/* ---------- Reveal Animation (V1 克制版入场) ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.28, 0.11, 0.32, 1),
    transform 0.7s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Navigation ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* 滚动后整条导航栏毛玻璃化，与页面内容分层 */
.navbar.scrolled {
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--divider);
}

.nav-inner {
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 6px 2px;
}

/* 液态玻璃导航 pill：与页面拉开层级的玻璃容器 */
.nav-links {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 980px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.nav-links a {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 980px;
  transition: color 0.2s ease, background 0.2s ease;
}

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

.nav-links a.active {
  color: #FAF9F6;
  background: var(--accent);
}

[data-theme="dark"] .nav-links a.active {
  color: #0F141B;
}

/* 滚动后玻璃容器阴影加深，增强浮层感 */
.navbar.scrolled .nav-links,
.navbar.scrolled .control-btn {
  box-shadow: var(--glass-shadow-strong), var(--glass-highlight);
}

.nav-controls {
  display: flex;
  gap: 8px;
}

/* 移动端汉堡按钮（桌面隐藏，V2） */
.menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  border-radius: 15px;
  cursor: pointer;
  align-items: center;
}

.menu-btn-line {
  width: 15px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-btn.open .menu-btn-line:first-child {
  transform: translateY(3.5px) rotate(45deg);
}

.menu-btn.open .menu-btn-line:last-child {
  transform: translateY(-3.5px) rotate(-45deg);
}

/* 全屏毛玻璃移动菜单（V2） */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  display: none;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 26px;
  color: var(--text);
  padding: 12px 24px;
  border-radius: 16px;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-menu a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.control-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  height: 30px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

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

.control-btn--icon {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

/* 主题图标切换 */
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 120px 24px 88px;
  position: relative;
}

.hero-inner {
  width: 100%;
  max-width: 1120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr);
  align-items: center;
  gap: 64px;
}

.hero-content {
  max-width: 560px;
  text-align: left;
}

/* 顶部状态徽标：位置/可用性 + 当前探索 */
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 30px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.hero-pill--live {
  color: var(--text);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34C759;
  animation: status-pulse 2.4s ease-out infinite;
}

@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.hero-eyebrow {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.hero-name {
  font-size: clamp(48px, 7vw, 84px);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.hero-positioning {
  font-size: clamp(17px, 2.1vw, 21px);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-tagline {
  font-size: clamp(15px, 1.8vw, 17px);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 20px;
}

.hero-school {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  opacity: 0.8;
  margin-bottom: 34px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

/* 视觉锚点：线条头像画框（深色主题自动反相为白线黑底） */
.hero-figure {
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-portrait-frame {
  position: relative;
  width: min(100%, 400px);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-strong);
}

.hero-portrait {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

[data-theme="dark"] .hero-portrait-frame {
  background: #0B0F14;
  border-color: var(--divider);
}

[data-theme="dark"] .hero-portrait {
  filter: invert(1);
}

@media (prefers-reduced-motion: reduce) {
  .status-dot { animation: none; }
}

@media (max-width: 900px) {
  .hero {
    padding: 104px 20px 76px;
  }

  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    justify-items: center;
  }

  .hero-figure {
    order: -1;
  }

  .hero-portrait-frame {
    width: 200px;
    border-radius: 24px;
  }

  .hero-content {
    max-width: 620px;
    text-align: center;
  }

  .hero-pills,
  .hero-cta {
    justify-content: center;
  }

  .hero-tagline {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- Buttons (苹果式胶囊) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 500;
  padding: 14px 32px;
  border-radius: 980px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, transform 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

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

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

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

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

/* ---------- Scroll Hint ---------- */
.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

.scroll-hint:hover {
  opacity: 1;
}

.scroll-hint-text {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.scroll-hint-arrow {
  width: 10px;
  height: 10px;
  border-right: 1.5px solid var(--text-secondary);
  border-bottom: 1.5px solid var(--text-secondary);
  transform: rotate(45deg);
  animation: hint-bounce 2.2s cubic-bezier(0.28, 0.11, 0.32, 1) infinite;
}

@keyframes hint-bounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50% { transform: rotate(45deg) translate(4px, 4px); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint-arrow { animation: none; }
}

/* ---------- Sections ---------- */
.section {
  padding: 120px 24px;
  border-top: 1px solid var(--divider);
  transition: border-color 0.3s ease;
}

.container {
  max-width: 980px;
  margin: 0 auto;
}

.container-narrow {
  max-width: 720px;
}

.section-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(32px, 5vw, 48px);
  margin-bottom: 24px;
}

.section-lead {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-secondary);
  max-width: 680px;
  margin-bottom: 56px;
}

/* ---------- About: Feature Grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  /* 关键：卡片各自按内容定高，展开一张不会拉伸同排另两张（默认 stretch 会一起变高） */
  align-items: start;
}

.feature-card {
  /* 第二道保险：卡片自身不被拉伸（覆盖 grid 容器 align-items 的影响） */
  align-self: start;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  cursor: pointer;
  transition: box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.28, 0.11, 0.32, 1),
    background 0.3s ease, border-color 0.3s ease;
}

/* 展开动画：grid-template-rows 0fr→1fr，高度精确跟随内容、过渡连贯，
   且不像固定 max-height 那样会裁剪较长文案（如英文详情） */
.feature-card .feature-more {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  margin-top: 0;
  transition: grid-template-rows 0.42s cubic-bezier(0.25, 0.8, 0.25, 1),
    opacity 0.32s ease, margin-top 0.32s ease;
}

.feature-card .feature-more > * {
  overflow: hidden;
  min-height: 0;
}

.feature-card.expanded .feature-more {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 14px;
}

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

.feature-hint {
  display: inline-block;
  margin-top: 14px;
  font-size: 13px;
  color: var(--accent);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.feature-card:hover .feature-hint,
.feature-card.expanded .feature-hint {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .feature-hint { opacity: 1; transform: none; }
  .feature-card,
  .feature-card .feature-more { transition: none; }
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.feature-card h3 {
  font-size: 20px;
  margin-bottom: 10px;
}

.feature-card p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---------- Projects ---------- */
.project-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition: box-shadow 0.3s ease, transform 0.3s cubic-bezier(0.28, 0.11, 0.32, 1),
    background 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.project-card h3 {
  font-size: 22px;
  line-height: 1.35;
}

.project-card p {
  font-size: 15px;
  color: var(--text-secondary);
  flex-grow: 1;
  margin-bottom: 24px;
}

.badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 980px;
  white-space: nowrap;
}

.project-link {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}

.project-link .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.project-card:hover .project-link .arrow {
  transform: translateX(4px);
}

.project-tag {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 980px;
}

/* 卡片底部：链接 + 查看详情提示（V2） */
.project-card {
  cursor: pointer;
}

.project-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: auto;
}

.card-hint {
  font-size: 13px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}

.project-card:hover .card-hint {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .card-hint { opacity: 1; transform: none; }
}

/* ---------- Learning & Interests ---------- */
.interest-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.interest-card {
  border-top: 2px solid var(--accent);
  padding: 28px 4px 8px;
}

.interest-card h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.interest-card p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* ---------- Contact ---------- */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--divider);
  transition: padding 0.2s ease;
}

.contact-item:hover {
  padding-left: 12px;
}

.contact-label {
  font-size: 15px;
  font-weight: 600;
}

.contact-value {
  font-size: 15px;
  color: var(--accent);
  word-break: break-all;
  text-align: right;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--divider);
  padding: 40px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  transition: border-color 0.3s ease;
}

/* ---------- Responsive (V1 基础适配) ---------- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-btn { display: inline-flex; }
  .mobile-menu { display: flex; }

  .section { padding: 80px 20px; }

  .feature-grid,
  .project-list,
  .interest-grid {
    grid-template-columns: 1fr;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 320px;
  }

  .contact-item {
    flex-direction: column;
    gap: 4px;
  }

  .contact-value {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .nav-links { display: none; }
}

/* ============================================================
   V2 — Project Detail Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 20, 27, 0.38);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-panel {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 780px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.28);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.modal-overlay.open .modal-panel {
  transform: none;
}

.modal-close {
  position: sticky;
  top: 16px;
  align-self: flex-end;
  z-index: 2;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin: 16px 16px 0 0;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.modal-body {
  padding: 12px 44px 48px;
}

/* 模态内 eyebrow：与全站 section-eyebrow 同一字体体系（小号大写 accent） */
.modal-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.modal-title {
  font-size: clamp(24px, 4vw, 32px);
  margin-bottom: 16px;
}

.modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.stage-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  padding: 4px 12px;
  border-radius: 980px;
  white-space: nowrap;
}

.modal-github {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
}

.modal-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 980px;
  background: var(--accent-soft);
}

.stat b {
  color: var(--text);
  font-weight: 600;
}

.stat-note {
  font-size: 12px;
  color: var(--text-secondary);
  align-self: center;
}

.m-sec {
  margin-top: 34px;
}

.m-sec h3 {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.m-sec p,
.m-sec li {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.m-sec ol,
.m-sec ul {
  margin-left: 20px;
}

.m-sec li {
  margin-bottom: 6px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stack-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--divider);
  border-radius: 12px;
  background: var(--accent-soft);
}

.stack-mod {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.stack-tool {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: right;
}

.modal-note {
  font-size: 15px;
  color: var(--text-secondary);
  padding: 18px 20px;
  border: 1px dashed var(--divider);
  border-radius: 12px;
}

@media (max-width: 560px) {
  .modal-body { padding: 12px 24px 40px; }
  .stack-row { grid-template-columns: 1fr; text-align: left; }
  .stack-tool { text-align: left; }
}

/* ============================================================
   V2.1 — View Switch（Info / Chat）与 Chat 占位视图
   ============================================================ */
.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ChatGPT 风格 segmented 切换：与导航 pill 同一玻璃语言 */
.view-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 980px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.view-switch-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  padding: 5px 14px;
  border-radius: 980px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.view-switch-btn:hover {
  color: var(--text);
}

.view-switch-btn.active {
  background: var(--accent);
  color: #FAF9F6;
}

[data-theme="dark"] .view-switch-btn.active {
  color: #0F141B;
}

/* 视图切换：info 视图藏 chat 页；chat 视图藏信息页/页脚并禁用锚点导航 */
body[data-view="info"] #view-chat {
  display: none;
}

body[data-view="chat"] #view-info,
body[data-view="chat"] .footer {
  display: none;
}

body[data-view="chat"] .nav-links {
  opacity: 0.35;
  pointer-events: none;
}

/* V2.2 Chat 静态布局：全高单栏，消息流独立滚动，输入区固定底部 */
#view-chat {
  height: 100vh;
  padding-top: 64px;
  display: flex;
  flex-direction: column;
}

.chat-shell {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 36px 24px 28px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.chat-msg--user {
  justify-content: flex-end;
}

/* 切入 chat 视图时消息错峰渐现（prefers-reduced-motion 下 reveal 无过渡，delay 自动失效） */
.chat-thread > .reveal:nth-child(2) { transition-delay: 0.06s; }
.chat-thread > .reveal:nth-child(3) { transition-delay: 0.12s; }
.chat-thread > .reveal:nth-child(4) { transition-delay: 0.18s; }
.chat-thread > .reveal:nth-child(5) { transition-delay: 0.24s; }
.chat-thread > .reveal:nth-child(6) { transition-delay: 0.3s; }

/* AI 头像：复用线稿头像，暗色反相与 hero 一致 */
.chat-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: #FFFFFF;
  margin-top: 2px;
}

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

[data-theme="dark"] .chat-avatar {
  background: #0B0F14;
}

[data-theme="dark"] .chat-avatar img {
  filter: invert(1);
}

/* AI 消息：无气泡纯文本（ChatGPT / Claude 式排版） */
.chat-bubble-ai {
  max-width: 85%;
  padding-top: 2px;
}

.chat-bubble-ai p {
  font-size: 15.5px;
  line-height: 1.75;
}

/* 用户气泡：右侧柔和 accent 底色 */
.chat-bubble-user {
  max-width: 75%;
  background: var(--accent-soft);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 11px 18px;
}

.chat-bubble-user p {
  font-size: 15.5px;
  line-height: 1.65;
}

/* 建议追问 chips：静态预览期点击填充输入框 */
.chat-chips {
  margin-top: 4px;
}

.chat-chips-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.chat-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-chip {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 980px;
  padding: 9px 18px;
  cursor: pointer;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chat-chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
}

/* 底部输入区：玻璃胶囊 + 圆形发送钮（V3 前禁用） */
.chat-composer {
  padding: 10px 24px 18px;
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  padding: 7px 7px 7px 20px;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  transition: border-color 0.25s ease;
}

.chat-input-wrap:focus-within {
  border-color: var(--accent);
}

.chat-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  padding: 6px 0;
}

.chat-input::placeholder {
  color: var(--text-secondary);
}

.chat-send {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #FAF9F6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chat-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.chat-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

@media (max-width: 768px) {
  .chat-scroll { padding: 24px 18px 20px; }
  .chat-composer { padding: 8px 18px 14px; }
  .chat-bubble-ai { max-width: 92%; }
  .chat-bubble-user { max-width: 85%; }
}

/* 移动端：navbar 空间不足，切换控件收进移动端菜单 */
.mobile-view-switch {
  display: none;
}

@media (max-width: 768px) {
  .navbar .view-switch { display: none; }
  .mobile-view-switch { display: flex; margin-bottom: 30px; }
}

/* ============================================================
   V2.1 — Back to Top
   ============================================================ */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 85;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease,
    color 0.2s ease, border-color 0.2s ease;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

@media (max-width: 560px) {
  .back-to-top {
    right: 18px;
    bottom: 18px;
    width: 42px;
    height: 42px;
  }
}

/* ============================================================
   V3 R2 — Feedback 表单（玻璃质感，Supabase 直连）
   ============================================================ */
.feedback-form {
  width: 100%;
  margin-top: 36px;
}

.fb-field {
  margin-bottom: 18px;
}

.fb-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.fb-textarea,
.fb-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 12px 16px;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--glass-shadow), var(--glass-highlight);
  transition: border-color 0.25s ease;
}

.fb-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.65;
}

.fb-textarea:focus,
.fb-input:focus {
  outline: none;
  border-color: var(--accent);
}

.fb-textarea::placeholder,
.fb-input::placeholder {
  color: var(--text-secondary);
}

/* honeypot：视觉隐藏但保留 DOM（屏幕阅读器亦不读出） */
.fb-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.fb-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
}

.fb-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fb-status {
  font-size: 14px;
  margin: 0;
  transition: opacity 0.4s ease;
}

.fb-status.pending {
  color: var(--text-secondary);
}

.fb-status.success {
  color: #1F9D4D;
}

.fb-status.error {
  color: #C0392B;
}

[data-theme="dark"] .fb-status.success {
  color: #34D17B;
}

[data-theme="dark"] .fb-status.error {
  color: #FF7A72;
}


/* ---------- V3 R2.5: Feedback 关系 + 设备 字段 ---------- */
.fb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.fb-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A7A85' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
}

.fb-select:invalid {
  color: var(--text-secondary);
}

.fb-select option {
  color: var(--text);
  background: var(--bg-elevated);
}

[data-theme="dark"] .fb-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238E8E99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.fb-hint {
  margin: 6px 2px 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

@media (max-width: 640px) {
  .fb-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
