/* ==========================================================================
   垕洋 Photos — Apple Dual-Theme Glassmorphism & Nonlinear Motion
   兼容约束：原生 CSS / ES5 DOM 零破坏 / 锁定标志色区域 / 切换零卡顿
   ========================================================================== */

:root {
  /* ---------------- 默认深色模式（Apple Titanium Dark） ---------------- */
  --bg: #050507;
  --panel: rgba(20, 20, 24, 0.72);
  --card: #16161a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);

  /* 文字色阶 */
  --text: #f5f5f7;
  --text-strong: #ffffff;
  --muted: #98989f;
  --dim: #6e6e73;

  /* 主题交互色 */
  --accent: #2997ff;
  --accent-glow: rgba(41, 151, 255, 0.32);
  --danger: #ff453a;

  /* 组件级毛玻璃表面 Token */
  --topbar-bg: rgba(18, 18, 22, 0.68);
  --chipbar-bg: rgba(18, 18, 22, 0.55);
  --pcard-bg: linear-gradient(145deg, rgba(34, 34, 42, 0.65) 0%, rgba(22, 22, 27, 0.52) 100%);
  --pcard-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.42);
  --pcard-hover-shadow: 0 14px 32px -8px rgba(0, 0, 0, 0.6);
  --card-shimmer: linear-gradient(110deg, #18181d 25%, #222229 37%, #18181d 63%);
  --axis-bg: rgba(24, 24, 30, 0.52);
  --scrub-bg: rgba(36, 36, 44, 0.82);
  --lb-backdrop: rgba(6, 6, 9, 0.85);
  --lb-bar-bg: rgba(24, 24, 30, 0.68);
  --toast-bg: rgba(32, 32, 38, 0.84);

  /* 按钮与未选中胶囊毛玻璃 */
  --btn-bg: rgba(255, 255, 255, 0.07);
  --btn-bg-hover: rgba(255, 255, 255, 0.13);
  --btn-border: rgba(255, 255, 255, 0.1);
  --chip-all-active-bg: rgba(255, 255, 255, 0.22);
  --chip-all-active-text: #ffffff;
  --chip-all-active-border: rgba(255, 255, 255, 0.34);

  /* 入口页专属变量 */
  --entry-bg: radial-gradient(ellipse at 50% 38%, rgba(41, 151, 255, 0.14) 0%, rgba(20, 20, 24, 0.4) 48%, rgba(5, 5, 7, 0.95) 100%);
  --entry-title-grad: linear-gradient(180deg, #ffffff 0%, #f2f2f7 45%, #8e8e98 100%);
  --entry-title-shadow: drop-shadow(0 12px 36px rgba(0, 0, 0, 0.65));
  --entry-btn-bg: rgba(255, 255, 255, 0.08);
  --entry-btn-border: rgba(255, 255, 255, 0.18);
  --entry-btn-text: #ffffff;

  /* 玻璃高光与模糊滤镜 */
  --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.12);
  --app-desktop-shadow: 0 32px 80px -16px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(0, 0, 0, 0.6);
  --blur-md: saturate(180%) blur(20px);
  --blur-lg: saturate(190%) blur(32px);

  /* 非线性物理动画曲线 */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-apple: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------------- 浅色模式（Apple Ceramic Light） ---------------- */
html[data-theme="light"] {
  --bg: #f2f2f7;
  --panel: rgba(255, 255, 255, 0.78);
  --card: #e5e5ea;
  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.15);

  /* 文字色阶 */
  --text: #1d1d1f;
  --text-strong: #000000;
  --muted: #515154;
  --dim: #86868b;

  /* 主题交互色 */
  --accent: #0071e3;
  --accent-glow: rgba(0, 113, 227, 0.22);
  --danger: #ff3b30;

  /* 组件级毛玻璃表面 Token */
  --topbar-bg: rgba(255, 255, 255, 0.74);
  --chipbar-bg: rgba(249, 249, 253, 0.66);
  --pcard-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(246, 246, 250, 0.72) 100%);
  --pcard-shadow: 0 8px 22px -6px rgba(0, 0, 0, 0.07), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --pcard-hover-shadow: 0 14px 30px -8px rgba(0, 0, 0, 0.12);
  --card-shimmer: linear-gradient(110deg, #e5e5ea 25%, #f0f0f5 37%, #e5e5ea 63%);
  --axis-bg: rgba(255, 255, 255, 0.68);
  --scrub-bg: rgba(255, 255, 255, 0.88);
  --lb-backdrop: rgba(242, 242, 247, 0.88);
  --lb-bar-bg: rgba(255, 255, 255, 0.78);
  --toast-bg: rgba(255, 255, 255, 0.88);

  /* 按钮与未选中胶囊毛玻璃 */
  --btn-bg: rgba(0, 0, 0, 0.045);
  --btn-bg-hover: rgba(0, 0, 0, 0.09);
  --btn-border: rgba(0, 0, 0, 0.08);
  /* 浅色模式下「全部」选中态采用高对比深空黑胶囊白字，确保清晰醒目 */
  --chip-all-active-bg: #1d1d1f;
  --chip-all-active-text: #ffffff;
  --chip-all-active-border: rgba(0, 0, 0, 0.2);

  /* 入口页专属变量 */
  --entry-bg: radial-gradient(ellipse at 50% 38%, rgba(0, 113, 227, 0.1) 0%, rgba(242, 242, 247, 0.6) 52%, rgba(235, 235, 242, 0.98) 100%);
  --entry-title-grad: linear-gradient(180deg, #1d1d1f 0%, #3a3a3c 55%, #6e6e73 100%);
  --entry-title-shadow: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.12));
  --entry-btn-bg: rgba(255, 255, 255, 0.75);
  --entry-btn-border: rgba(0, 0, 0, 0.1);
  --entry-btn-text: #1d1d1f;

  /* 玻璃高光与桌面阴影 */
  --glass-highlight: inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  --app-desktop-shadow: 0 30px 70px -16px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   0. 零卡顿主题切换过渡控制（仅在点击切换的 440ms 内激活）
   ========================================================================== */
html.theme-switching body,
html.theme-switching .view-entry,
html.theme-switching .app,
html.theme-switching .topbar,
html.theme-switching .brand,
html.theme-switching .chip-bar,
html.theme-switching .chip,
html.theme-switching .icon-btn,
html.theme-switching .pcard,
html.theme-switching .pcard-head,
html.theme-switching .section-head,
html.theme-switching .axis-inner,
html.theme-switching .lightbox,
html.theme-switching .lb-foot,
html.theme-switching .sheet-close,
html.theme-switching .site-footer {
  transition:
    background-color 0.4s var(--ease-apple),
    color 0.4s var(--ease-apple),
    border-color 0.4s var(--ease-apple),
    box-shadow 0.4s var(--ease-apple) !important;
}

/* 全局重置与基础排版 */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* 桌面与全局环境光晕（利用 opacity 硬件加速切换深浅光效，不触发重绘） */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.45s var(--ease-apple);
}

/* 深色环境光晕 */
body::before {
  background:
    radial-gradient(circle at 20% 15%, rgba(41, 151, 255, 0.12) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(16, 85, 138, 0.14) 0%, transparent 50%);
  opacity: 1;
}

/* 浅色环境光晕 */
body::after {
  background:
    radial-gradient(circle at 20% 15%, rgba(0, 113, 227, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 80% 85%, rgba(52, 199, 89, 0.06) 0%, transparent 50%);
  opacity: 0;
}

html[data-theme="light"] body::before {
  opacity: 0;
}

html[data-theme="light"] body::after {
  opacity: 1;
}

/* ==========================================================================
   1. 视图容器与入口页（#view-entry）
   ========================================================================== */
.view {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
}

.view-entry {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 24px calc(env(safe-area-inset-bottom, 0px) + 20px);
  background: var(--entry-bg);
  overflow: hidden;
}

.view-entry::after {
  content: "";
  position: absolute;
  top: 36%;
  left: 50%;
  width: min(78vw, 360px);
  height: min(78vw, 360px);
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(15, 75, 53, 0.06) 45%, transparent 72%);
  filter: blur(40px);
  pointer-events: none;
  z-index: -1;
  animation: ambientPulse 7s var(--ease-apple) infinite alternate;
}

.entry-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 36px;
  width: 100%;
  text-align: center;
}

.entry-title {
  margin: 0;
  font-size: clamp(56px, 16vw, 96px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.08;
  background: var(--entry-title-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: var(--entry-title-shadow);
  animation: heroTitleReveal 1.1s var(--ease-out-expo) both;
}

.btn-enter {
  position: relative;
  appearance: none;
  border: 1px solid var(--entry-btn-border);
  background: var(--entry-btn-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  color: var(--entry-btn-text);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 13px 36px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    var(--glass-highlight),
    0 10px 30px -6px rgba(0, 0, 0, 0.25),
    0 0 24px -4px var(--accent-glow);
  overflow: hidden;
  transition:
    transform 0.45s var(--ease-spring),
    background-color 0.35s var(--ease-apple),
    border-color 0.35s var(--ease-apple),
    box-shadow 0.45s var(--ease-out-expo);
  animation: heroBtnReveal 1.1s var(--ease-out-expo) 0.14s both;
}

.btn-enter::before {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 70%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: skewX(-20deg);
  transition: left 0.75s var(--ease-out-expo);
}

.btn-enter:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    var(--glass-highlight),
    0 14px 36px -6px rgba(0, 0, 0, 0.32),
    0 0 32px -2px var(--accent-glow);
}

.btn-enter:hover::before {
  left: 140%;
}

.btn-enter:active {
  transform: scale(0.95);
  transition-duration: 0.12s;
}

/* ==========================================================================
   2. 相册主容器（.app）与毛玻璃顶栏（.topbar / 右上角主题切换按钮）
   ========================================================================== */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  overflow: hidden;
  animation: appViewReveal 0.65s var(--ease-out-expo) both;
}

/* 顶部导航：两行结构（第1行品牌居中无圆点，第2行左返回、右主题切换） */
.topbar {
  position: relative;
  z-index: 20;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 8px;
  background: var(--topbar-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--glass-highlight);
}

.brand {
  text-align: center;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-strong);
  line-height: 1.3;
  margin-bottom: 6px;
}

.brand::before,
.brand::after {
  content: none !important;
  display: none !important;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
}

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

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--glass-highlight);
  transition:
    transform 0.38s var(--ease-spring),
    background-color 0.25s var(--ease-apple),
    border-color 0.25s var(--ease-apple),
    color 0.25s var(--ease-apple);
}

.icon-btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.91);
}

/* 右上角深浅色切换按钮内部：日月非线性旋转弹性动画 */
.theme-toggle {
  padding: 5px 11px;
}

.theme-icon-wrap {
  position: relative;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.t-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  transition:
    transform 0.52s var(--ease-spring),
    opacity 0.32s var(--ease-apple);
}

/* 深色模式下显示太阳图标（提示点击切往浅色），浅色模式下显示月亮图标 */
.t-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
  color: #ffd60a;
}

.t-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
  color: #5e5ce6;
}

html[data-theme="light"] .t-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

html[data-theme="light"] .t-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ==========================================================================
   3. 胶囊标签栏（.chip-bar & .chip）— 严格保留标志色区域不随主题改变
   ========================================================================== */
.chip-bar {
  position: relative;
  z-index: 19;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  background: var(--chipbar-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.chip-bar::-webkit-scrollbar {
  display: none;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--muted);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  box-shadow: var(--glass-highlight);
  cursor: pointer;
  transition:
    transform 0.42s var(--ease-spring),
    background-color 0.28s var(--ease-apple),
    color 0.25s var(--ease-apple),
    border-color 0.28s var(--ease-apple),
    box-shadow 0.35s var(--ease-out-expo);
}

.chip:hover {
  color: var(--text-strong);
  background: var(--btn-bg-hover);
  border-color: var(--line-strong);
}

.chip:active {
  transform: scale(0.92);
}

/* ★ 标志色锁定区 1：分类标签左侧标志色圆点（始终读取 --dot，深浅模式通用） */
.chip.tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, #6B7280);
  box-shadow: 0 0 6px var(--dot, transparent);
  transition:
    background-color 0.3s var(--ease-apple),
    transform 0.4s var(--ease-spring),
    box-shadow 0.3s var(--ease-apple);
}

/* 「全部」标签选中态 */
.chip.all.active {
  background: var(--chip-all-active-bg);
  color: var(--chip-all-active-text);
  font-weight: 600;
  border-color: var(--chip-all-active-border);
  box-shadow:
    var(--glass-highlight),
    0 4px 14px -2px rgba(0, 0, 0, 0.16);
  transform: scale(1.03);
}

/* ★ 标志色锁定区 2：分类标签选中态＝标志色底（var(--dot)）+ 白色圆点（深浅模式完全一致） */
.chip.tag.active {
  background: var(--dot, #6B7280) !important;
  color: #ffffff !important;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.22),
    0 6px 18px -4px var(--dot, rgba(0, 0, 0, 0.38));
  transform: scale(1.03);
}

.chip.tag.active::before {
  background: #ffffff !important;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  transform: scale(1.12);
}

/* 亮色标志色自动切换深色文字（保持基线规则） */
.chip.tag.active.on-light,
.chip.on-light.active {
  color: #111114 !important;
  border-color: rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   4. 内容舞台（.stage）、滚动区（.scroll）与卡片（.pcard / .section / .card）
   ========================================================================== */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.scroll {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 44px calc(env(safe-area-inset-bottom, 0px) + 24px) 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.scroll::-webkit-scrollbar {
  width: 4px;
}

.scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

/* 球员概述卡（.pcard） */
.pcard {
  position: relative;
  background: var(--pcard-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 11px 12px;
  margin-bottom: 12px;
  box-shadow:
    var(--glass-highlight),
    var(--pcard-shadow);
  cursor: pointer;
  transition:
    transform 0.45s var(--ease-apple),
    border-color 0.3s var(--ease-apple),
    box-shadow 0.45s var(--ease-out-expo);
  animation: cardStaggerReveal 0.6s var(--ease-out-expo) both;
}

.pcard:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow:
    var(--glass-highlight),
    var(--pcard-hover-shadow);
}

.pcard:active {
  transform: scale(0.98);
  transition-duration: 0.15s;
}

.pcard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-strong);
}

.pcard-head small,
.pcard-head .count,
.pcard-head span:last-child {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--dim);
}

.pthumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pthumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
}

.pthumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-apple);
}

.pcard:hover .pthumb img {
  transform: scale(1.05);
}

/* 分组区块 */
.section {
  margin-bottom: 16px;
  animation: cardStaggerReveal 0.55s var(--ease-out-expo) both;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-strong);
}

.section-head small,
.section-head .count,
.section-head span:last-child {
  font-size: 11px;
  font-weight: 400;
  color: var(--dim);
}

/* 照片网格（.grid & .card） */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

#grid > .card {
  margin-bottom: 8px;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-shimmer);
  background-size: 200% 100%;
  border: 1px solid var(--line);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  /* 仅对 transform 做弹簧过渡，避免主题切换时上百张卡片重绘卡顿 */
  transition: transform 0.45s var(--ease-spring);
  animation: cardStaggerReveal 0.55s var(--ease-out-expo) both;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.65s var(--ease-apple);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: var(--line-strong);
    box-shadow: 0 10px 24px -4px rgba(0, 0, 0, 0.28);
    z-index: 2;
  }

  .card:hover img {
    transform: scale(1.08);
  }
}

.card:active {
  transform: scale(0.94);
  transition-duration: 0.12s;
}

/* ★ 标志色锁定区 3：卡片右下角多标签圆点（始终保持深色半透明毛玻璃底托 + --dot 标志色） */
.dots {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 999px;
  background: rgba(10, 10, 14, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.dots > * {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot, #ffffff);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

/* 非线性交错入场延迟 */
.pcard:nth-child(1), .grid > .card:nth-child(1) { animation-delay: 0.02s; }
.pcard:nth-child(2), .grid > .card:nth-child(2) { animation-delay: 0.05s; }
.pcard:nth-child(3), .grid > .card:nth-child(3) { animation-delay: 0.08s; }
.pcard:nth-child(4), .grid > .card:nth-child(4) { animation-delay: 0.11s; }
.pcard:nth-child(5), .grid > .card:nth-child(5) { animation-delay: 0.14s; }
.pcard:nth-child(6), .grid > .card:nth-child(6) { animation-delay: 0.17s; }
.pcard:nth-child(7), .grid > .card:nth-child(7) { animation-delay: 0.20s; }
.pcard:nth-child(8), .grid > .card:nth-child(8) { animation-delay: 0.23s; }
.pcard:nth-child(9), .grid > .card:nth-child(9) { animation-delay: 0.26s; }

/* 空状态提示 */
.empty-note {
  margin: 48px auto;
  padding: 28px 20px;
  max-width: 280px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  background: var(--topbar-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--glass-highlight);
}

/* ==========================================================================
   5. 右侧字母索引轴（.axis）与快速定位气泡（.scrub-bubble）
   ========================================================================== */
.axis {
  position: absolute;
  top: 0;
  right: 4px;
  bottom: 0;
  width: 34px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.axis-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 3px;
  border-radius: 999px;
  background: var(--axis-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--line);
  box-shadow: var(--glass-highlight);
}

/* 注意：height 与 font-size 由 app.js 的 layoutAxis() 内联写入，勿在 CSS 写死 */
.axis-letter {
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-weight: 600;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 0.2s var(--ease-apple),
    transform 0.3s var(--ease-spring),
    background-color 0.2s var(--ease-apple);
}

.axis-letter:hover,
.axis-letter.active {
  color: var(--text-strong);
  background: var(--accent-glow);
  transform: scale(1.15);
}

.scrub-bubble {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 52px;
  height: 52px;
  padding: 0 14px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-strong);
  background: var(--scrub-bg);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--line-strong);
  box-shadow:
    var(--glass-highlight),
    0 12px 32px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 25;
  animation: bubblePop 0.28s var(--ease-spring) both;
}

/* ==========================================================================
   6. 大图预览灯箱（.lightbox）— 保留左上角标志色标签高对比显示
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--lb-backdrop);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  padding:
    calc(env(safe-area-inset-top, 0px) + 12px)
    16px
    calc(env(safe-area-inset-bottom, 0px) + 12px);
  animation: lbBackdropIn 0.38s var(--ease-out-expo) both;
}

.lb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
  animation: lbBarSlideDown 0.45s var(--ease-out-expo) both;
}

.lb-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ★ 标志色锁定区 4：灯箱左上角标签整体 ×1.5（17.25px / 圆点 10.5px / 间距 9px）
   固定深色高对比毛玻璃底托 + var(--tag) 标志色圆点，深浅模式均保持原标志色醒目 */
.lb-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  padding: 6px 13.5px;
  font-size: 17.25px;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  background: rgba(24, 24, 30, 0.78);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 0 rgba(255, 255, 255, 0.14),
    0 6px 20px rgba(0, 0, 0, 0.3);
}

.lb-tag::before {
  content: "";
  width: 10.5px;
  height: 10.5px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--tag, #6B7280);
  box-shadow: 0 0 10px var(--tag, transparent);
}

.sheet-close {
  appearance: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--btn-border);
  background: var(--lb-bar-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  color: var(--text-strong);
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: var(--glass-highlight), 0 4px 14px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.4s var(--ease-spring),
    background-color 0.25s var(--ease-apple);
}

.sheet-close:hover {
  background: var(--btn-bg-hover);
  transform: scale(1.06);
}

.sheet-close:active {
  transform: scale(0.9);
}

.lb-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.lb-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.48);
  animation: lbImageSpringIn 0.52s var(--ease-out-expo) both;
}

.lb-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--lb-bar-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--line);
  box-shadow: var(--glass-highlight), 0 8px 24px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  color: var(--muted);
  animation: lbBarSlideUp 0.45s var(--ease-out-expo) 0.05s both;
}

#lbMeta {
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  appearance: none;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text-strong);
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.4s var(--ease-spring),
    background-color 0.25s var(--ease-apple),
    box-shadow 0.3s var(--ease-out-expo);
}

.btn.sm {
  font-size: 12.5px;
  padding: 6px 16px;
}

.btn.primary {
  color: #ffffff;
  background: linear-gradient(180deg, #3aa0ff 0%, #0071e3 100%);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 4px 14px rgba(0, 113, 227, 0.38);
}

.btn.primary:hover {
  background: linear-gradient(180deg, #4dadff 0%, #0077ed 100%);
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 20px rgba(0, 113, 227, 0.52);
}

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

.lb-copyright {
  margin-top: 8px;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--dim);
  animation: lbBarSlideUp 0.5s var(--ease-out-expo) 0.1s both;
}

/* ==========================================================================
   7. 页脚（.site-footer）与全局轻提示（#toast）
   ========================================================================== */
.site-footer {
  margin-top: 24px;
  padding: 12px 8px 4px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--dim);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.25s var(--ease-apple);
}

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

#toast,
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
  transform: translateX(-50%);
  z-index: 200;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  background: var(--toast-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border: 1px solid var(--line-strong);
  box-shadow:
    var(--glass-highlight),
    0 10px 30px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  animation: toastSlideUp 0.38s var(--ease-spring) both;
}

/* ==========================================================================
   8. 桌面端响应式断点（≥ 520px：居中悬浮毛玻璃容器）
   ========================================================================== */
@media (min-width: 520px) {
  .app {
    height: 94dvh;
    max-height: 900px;
    margin-top: 3dvh;
    border-radius: 28px;
    border: 1px solid var(--line-strong);
    box-shadow:
      var(--glass-highlight),
      var(--app-desktop-shadow);
  }
}

/* ==========================================================================
   9. 非线性关键帧动画库（Apple Spring & Expo Keyframes）
   ========================================================================== */
@keyframes ambientPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.92);
    opacity: 0.65;
  }
  100% {
    transform: translate(-50%, -46%) scale(1.12);
    opacity: 1;
  }
}

@keyframes heroTitleReveal {
  0% {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
    letter-spacing: 0.16em;
    filter: blur(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    letter-spacing: 0.06em;
    filter: blur(0);
  }
}

@keyframes heroBtnReveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes appViewReveal {
  0% {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes cardStaggerReveal {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bubblePop {
  0% {
    opacity: 0;
    transform: translateY(-50%) scale(0.6);
  }
  100% {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

@keyframes lbBackdropIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes lbImageSpringIn {
  0% {
    opacity: 0;
    transform: scale(0.88) translateY(12px);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes lbBarSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes lbBarSlideUp {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastSlideUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   10. 本项目兼容补丁（相对设计方案的修正，勿删）
   ========================================================================== */

/* P1. 旧设备不支持 dvh 时的 vh 回退（微信旧版 / iOS 14） */
.view { height: 100vh; height: 100dvh; }
.app  { height: 100vh; height: 100dvh; }
@media (min-width: 520px) { .app { height: 94vh; height: 94dvh; } }

/* P2. 气泡 top 由 JS 按 viewport clientY 写入，必须 fixed；absolute 会相对 .stage 错位 */
.scrub-bubble { position: fixed; }

/* P3. 保留基线：「进入相册」按钮整体下移（方案的 36px 会把按钮拉回中部） */
.entry-main { gap: clamp(88px, 19vh, 190px); }

/* P4. 「全部」胶囊保留圆点：未选中灰、选中白（JS 会生成 <i class="dot">，此处用伪元素呈现） */
.chip.all::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--muted);
  transition: background-color 0.3s var(--ease-apple);
}
.chip.all.active::before { background: #ffffff; }
/* JS 生成的 <i class="dot"> 由 ::before 替代呈现，隐藏空节点避免干扰 */
.chip .dot { display: none; }

/* P5. 分组标题：恢复「圆点+标题左对齐、计数靠右」，补上标志色圆点尺寸（方案漏了 .section-head .dot） */
.section-head { align-items: center; justify-content: flex-start; padding: 10px 2px 8px; }
.section-head .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.section-head .count { margin-left: auto; }

/* P6. 概述卡头部：恢复「圆点+名字左对齐、张数靠右」，补上标志色圆点尺寸（方案漏了 .pcard-head .dot） */
.pcard-head { justify-content: flex-start; padding: 1px 2px 0; }
.pcard-head .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pcard-head .nm { font-size: 14.5px; font-weight: 700; color: var(--text-strong); letter-spacing: .2px; }
.pcard-head .cnt { margin-left: auto; }

/* P7. 灯箱文件名在 flex 容器内需 min-width:0 才能正常省略 */
#lbMeta { min-width: 0; }

/* P8. 亮色标志色选中态：圆点改深色保证对比（白点在金黄等亮底上看不清） */
.chip.tag.active.on-light::before,
.chip.on-light.active::before {
  background: #111114 !important;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
}

/* P9. 灯箱标签间距保持基线 ×1.5 的 9px（方案注释写 9px 但代码误为 8px） */
.lb-tags { gap: 9px; }