/**
 * 时光之易 - 样式表
 * 分栏布局：左侧搜索筛选，右侧砌体展示
 */

* {
  box-sizing: border-box;
}

:root {
  /* 时光之易特定变量 - 深色主题默认值 */
  --tp-bg-primary: #0b0d10;
  --tp-bg-secondary: #1a1a2e;
  --tp-bg-tertiary: #2d2d44;
  --tp-text-primary: #e5e9f0;
  --tp-text-secondary: #a0a8b8;
  --tp-border: #3a3a52;
  --tp-accent: #2dd4bf;
  --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --tp-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 根据主题系统变量动态更新时光之易变量 */
html[data-theme='dark'] {
  --tp-bg-primary: #0b0d10;
  --tp-bg-secondary: #1a1a2e;
  --tp-bg-tertiary: #2d2d44;
  --tp-text-primary: #e5e9f0;
  --tp-text-secondary: #a0a8b8;
  --tp-border: rgba(255, 255, 255, 0.06);
  --tp-accent: #2dd4bf;
  --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

html[data-theme='light'] {
  --tp-bg-primary: #f8fafc;
  --tp-bg-secondary: #ffffff;
  --tp-bg-tertiary: #f1f5f9;
  --tp-text-primary: #1e293b;
  --tp-text-secondary: #64748b;
  --tp-border: rgba(0, 0, 0, 0.08);
  --tp-accent: #0d9488;
  --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* 兼容旧的 [data-theme='light'] 选择器 */
[data-theme='light'] {
  --tp-bg-primary: #f8fafc;
  --tp-bg-secondary: #ffffff;
  --tp-bg-tertiary: #f1f5f9;
  --tp-text-primary: #1e293b;
  --tp-text-secondary: #64748b;
  --tp-border: rgba(0, 0, 0, 0.08);
  --tp-accent: #0d9488;
  --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* auto 主题（跟随系统） */
html[data-theme='auto'] {
  --tp-bg-primary: #0b0d10;
  --tp-bg-secondary: #1a1a2e;
  --tp-bg-tertiary: #2d2d44;
  --tp-text-primary: #e5e9f0;
  --tp-text-secondary: #a0a8b8;
  --tp-border: rgba(255, 255, 255, 0.06);
  --tp-accent: #2dd4bf;
  --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: light) {
  html[data-theme='auto'] {
    --tp-bg-primary: #f8fafc;
    --tp-bg-secondary: #ffffff;
    --tp-bg-tertiary: #f1f5f9;
    --tp-text-primary: #1e293b;
    --tp-text-secondary: #64748b;
    --tp-border: rgba(0, 0, 0, 0.08);
    --tp-accent: #0d9488;
    --tp-card-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  }
}

/* ============ 容器和布局 ============ */

#temporal-particles-container,
.temporal-particles-layout {
  width: 100%;
  height: 100vh;
  background-color: var(--tp-bg-primary);
  color: var(--tp-text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 主内容区 */
.temporal-particles-main {
  flex: 1;
  display: flex;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

/* 左侧面板 - TikTok 风格 */
.temporal-particles-left {
  width: 240px;
  background-color: var(--tp-bg-secondary);
  border-right: 1px solid var(--tp-border);
  overflow-y: auto;
  padding: 20px 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: width 0.2s ease;
}

/* 右侧面板 */
.temporal-particles-right {
  width: 50%;
  background-color: var(--tp-bg-primary);
  overflow: hidden;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
  position: relative;
  /* 为绝对定位的 masonry-grid 提供定位上下文 */
}

/* 右侧顶部分类筛选 */
.temporal-particles-filters-top {
  padding: 0;
  background-color: var(--tp-bg-secondary);
  border-bottom: 1px solid var(--tp-border);
  flex-shrink: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 当特效体验容器显示时，隐藏分类栏 */
.effect-experience-container[style*="display: flex"] ~ .temporal-particles-filters-top,
.effect-experience-container[style*="display: block"] ~ .temporal-particles-filters-top {
  display: none;
}

/* 更简单的方式：直接针对父容器状态 */
.temporal-particles-right:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-filters-top,
.temporal-particles-right:has(.effect-experience-container[style*="display: block"]) .temporal-particles-filters-top {
  display: none !important;
}

/* 当特效体验容器显示时，隐藏左侧栏（包括搜索栏） */
.temporal-particles-main:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-left,
.temporal-particles-main:has(.effect-experience-container[style*="display: block"]) .temporal-particles-left {
  display: none !important;
}

/* 当特效体验容器显示时，隐藏头部导航栏 */
#temporal-particles-container:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-header,
#temporal-particles-container:has(.effect-experience-container[style*="display: block"]) .temporal-particles-header {
  display: none !important;
}

/* 当特效体验容器显示时，主内容区占满全高 */
#temporal-particles-container:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-main,
#temporal-particles-container:has(.effect-experience-container[style*="display: block"]) .temporal-particles-main {
  height: 100vh !important;
}

/* 当特效体验容器显示时，右侧面板占满全宽 */
.temporal-particles-main:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-right,
.temporal-particles-main:has(.effect-experience-container[style*="display: block"]) .temporal-particles-right {
  width: 100% !important;
  max-width: 100% !important;
}

/* 砌体滚动容器 */
.masonry-scroll-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* ============ 特效体验页 ============ */

.effect-experience-container {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--tp-bg-primary);
  position: relative;
  overflow: hidden;
}

/* 全屏模式下的样式优化 */
.effect-experience-container:fullscreen,
.effect-experience-container:-webkit-full-screen,
.effect-experience-container:-moz-full-screen,
.effect-experience-container:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
}

/* 全屏模式下隐藏返回按钮 */
.effect-experience-container:fullscreen .experience-back-btn,
.effect-experience-container:-webkit-full-screen .experience-back-btn,
.effect-experience-container:-moz-full-screen .experience-back-btn,
.effect-experience-container:-ms-fullscreen .experience-back-btn {
  display: none;
}

/* 返回按钮 */
.experience-back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.experience-back-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--tp-accent);
  transform: translateX(-4px);
}

.experience-back-btn svg {
  stroke-width: 2.5;
}

/* Three.js 渲染容器 */
.effect-canvas-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* 加载提示 */
.effect-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  z-index: 1000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(45, 212, 191, 0.2);
  border-top-color: var(--tp-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: var(--tp-text-primary);
  font-size: 16px;
  font-weight: 500;
}

/* 控制面板 */
.experience-controls {
  position: absolute;
  right: 20px;
  top: 80px;
  z-index: 90;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-width: 280px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.experience-controls::-webkit-scrollbar {
  width: 4px;
}

.experience-controls::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

/* 底部操作栏 */
.experience-actions {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 48px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.experience-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.experience-action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.experience-action-btn svg {
  stroke-width: 2;
}

.temporal-particles-filters-top .temporal-particles-filter-label {
  display: none; /* 隐藏"分类"标签 */
}

.temporal-particles-filter-buttons-horizontal {
  display: flex;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.temporal-particles-filter-buttons-horizontal::-webkit-scrollbar {
  height: 0; /* 隐藏滚动条 */
}

.temporal-particles-filters-top .temporal-particles-filter-btn {
  padding: 14px 20px;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 500;
  background-color: transparent;
  border: none;
  border-radius: 0;
  color: var(--tp-text-secondary);
  transition: all 0.2s ease;
  position: relative;
  min-width: auto !important;
  width: auto !important;
  text-align: center;
}

.temporal-particles-filters-top .temporal-particles-filter-btn:hover {
  background-color: var(--tp-bg-tertiary);
  color: var(--tp-text-primary);
}

.temporal-particles-filters-top .temporal-particles-filter-btn.active {
  background-color: transparent;
  color: var(--tp-text-primary);
  font-weight: 600;
}

.temporal-particles-filters-top .temporal-particles-filter-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 3px;
  background-color: var(--tp-accent);
  border-radius: 2px 2px 0 0;
}

/* 分割线 */
.temporal-particles-divider {
  width: 8px;
  background-color: transparent;
  cursor: col-resize;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.temporal-particles-divider::after {
  content: '';
  width: 2px;
  height: 40px;
  background-color: var(--tp-border);
  border-radius: 1px;
  transition: background-color 0.2s ease;
}

.temporal-particles-divider:hover {
  background-color: rgba(45, 212, 191, 0.1);
}

.temporal-particles-divider:hover::after {
  background-color: var(--tp-accent);
}

#temporal-particles-container.hidden {
  display: none;
}

.temporal-particles-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--tp-border);
  background-color: var(--tp-bg-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.temporal-particles-header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.temporal-particles-header-content {
  flex: 1;
  min-width: 0;
}

.temporal-particles-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.temporal-particles-logo {
  width: 72px;
  height: auto;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  object-fit: contain;
}

.temporal-particles-title-text {
  flex: 1;
  min-width: 0;
}

.temporal-particles-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.temporal-particles-theme-btn {
  background: none;
  border: 1px solid var(--tp-border);
  color: var(--tp-text-primary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--tp-transition);
  border-radius: 8px;
}

.temporal-particles-theme-btn:hover {
  background-color: var(--tp-bg-tertiary);
  border-color: var(--tp-accent);
}

.temporal-particles-back-btn {
  background-color: var(--tp-bg-primary);
  border: 1px solid var(--tp-border);
  color: var(--tp-text-primary);
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--tp-transition);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.temporal-particles-back-btn:hover {
  background-color: var(--tp-bg-tertiary);
  border-color: var(--tp-accent);
  color: var(--tp-accent);
}

.temporal-particles-back-btn:active {
  transform: scale(0.95);
}

/* ============ 左侧面板内容 - TikTok 风格 ============ */

/* 搜索框 */
.temporal-particles-search {
  width: 100%;
  padding: 0 16px 20px 16px;
  position: relative;
}

.temporal-particles-search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--tp-text-secondary);
  stroke-width: 2;
  pointer-events: none;
}

.temporal-particles-search-input {
  width: 100%;
  padding: 10px 14px 10px 42px;
  background-color: var(--tp-bg-tertiary);
  border: none;
  border-radius: 24px;
  color: var(--tp-text-primary);
  font-size: 14px;
  transition: var(--tp-transition);
  font-family: inherit;
}

.temporal-particles-search-input:focus {
  outline: none;
  background-color: var(--tp-bg-primary);
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.15);
}

.temporal-particles-search-input::placeholder {
  color: var(--tp-text-secondary);
}

/* 导航菜单 */
.temporal-particles-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: auto;
}

.temporal-particles-nav-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: none;
  border: none;
  color: var(--tp-text-primary);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-align: left;
  font-family: inherit;
  position: relative;
}

.temporal-particles-nav-btn:hover {
  background-color: var(--tp-bg-tertiary);
}

.temporal-particles-nav-btn.active {
  color: var(--tp-accent);
  font-weight: 600;
}

.temporal-particles-nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 32px;
  background-color: var(--tp-accent);
  border-radius: 0 4px 4px 0;
}

.temporal-particles-nav-btn .nav-icon {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  flex-shrink: 0;
}

.temporal-particles-nav-btn.active .nav-icon {
  stroke: var(--tp-accent);
}

/* 登录按钮 */
.temporal-particles-login {
  padding: 20px 16px;
  border-top: 1px solid var(--tp-border);
  margin-top: auto;
}

.temporal-particles-login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.temporal-particles-login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(45, 212, 191, 0.3);
}

.temporal-particles-login-btn:active {
  transform: translateY(0);
}

.temporal-particles-login-btn .login-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.5;
}

/* 旧的左侧筛选样式 - 已废弃 */
.temporal-particles-filters,
.temporal-particles-filter-label,
.temporal-particles-filter-buttons,
.temporal-particles-sidebar-info {
  display: none !important;
}

.temporal-particles-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #2dd4bf, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.temporal-particles-subtitle {
  font-size: 12px;
  color: var(--tp-text-secondary);
  margin: 4px 0 0 0;
  line-height: 1.2;
}

/* ============ 分类筛选 ============ */

.category-filters {
  display: flex;
  gap: 12px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: var(--tp-bg-primary);
  border-bottom: 1px solid var(--tp-border);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.category-filters::-webkit-scrollbar {
  height: 4px;
}

.category-filters::-webkit-scrollbar-track {
  background: transparent;
}

.category-filters::-webkit-scrollbar-thumb {
  background: var(--tp-border);
  border-radius: 2px;
}

.category-filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--tp-border);
  border-radius: 20px;
  background-color: transparent;
  color: var(--tp-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--tp-transition);
}

.category-filter-btn:hover {
  border-color: var(--tp-accent);
  color: var(--tp-accent);
}

.category-filter-btn.active {
  background-color: var(--tp-accent);
  border-color: var(--tp-accent);
  color: var(--tp-bg-primary);
}

/* ============ 瀑布流 ============ */

.waterfall-container {
  padding: 20px;
  background-color: var(--tp-bg-primary);
}

.waterfall-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

.waterfall-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ============ 砌体布局 ============ */

.masonry-container {
  /* 右侧面板 */
  .temporal-particles-right {
    width: 50%;
    background-color: var(--tp-bg-primary);
    overflow: hidden; /* 必须隐藏溢出，由 JS 控制滚动 */
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    position: relative;
  }

  /* 瀑布流网格 */
  .masonry-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    /* 高度由 JS 动态计算 */
    /* 移除 CSS Grid */
    display: block; 
    padding: 0;
    /* 硬件加速优化 */
    will-change: transform;
    transform: translate3d(0, 0, 0);
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
  }
}

/* 瀑布流列 (JS 生成) */
.masonry-column {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  /* 不使用 gap，由 JS 通过 marginBottom 控制间距 */
  gap: 0; 
  /* 列间距的一半 (左右各一半) */
  padding: 0 8px; 
  box-sizing: border-box;
}

/* 卡片样式 */
.masonry-item {
  position: relative;
  width: 100%;
  max-height: 400px;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--tp-bg-tertiary);
  border: 1px solid var(--tp-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  /* 移除之前的 margin */
  margin: 0;
}

/* 移除特定的边距设置 */
.masonry-column:first-child .masonry-item,
.masonry-column:last-child .masonry-item,
.masonry-column .masonry-item:first-child {
  margin: 0;
}

.masonry-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(45, 212, 191, 0.25);
  border-color: var(--tp-accent);
}

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

.masonry-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.masonry-item:hover .masonry-item-info {
  opacity: 1;
}

/* ============ 卡片 ============ */

.waterfall-card {
  background-color: var(--tp-bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--tp-transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--tp-border);
  position: relative;
}

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

.waterfall-card.liked {
  animation: cardLike 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardLike {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.card-preview {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background-color: var(--tp-bg-tertiary);
}

.card-info {
  padding: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--tp-text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-emoji {
  font-size: 20px;
  display: inline-block;
}

.card-desc {
  font-size: 13px;
  color: var(--tp-text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
}

.card-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 12px;
}

.stat {
  color: var(--tp-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-date {
  font-size: 12px;
  color: var(--tp-text-secondary);
  opacity: 0.7;
}

/* ============ 响应式设计 ============ */

/* 平板端 (768px - 1023px) */
@media (max-width: 1023px) {
  .waterfall-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
  }

  .temporal-particles-title {
    font-size: 24px;
  }

  .card-preview {
    height: 180px;
  }

  .card-info {
    padding: 12px;
  }

  .card-title {
    font-size: 15px;
  }

  .card-desc {
    font-size: 12px;
  }
}

/* 移动端 (< 768px) */
@media (max-width: 767px) {
  .waterfall-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .temporal-particles-header {
    padding: 16px 12px;
  }

  .temporal-particles-title {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .temporal-particles-subtitle {
    font-size: 12px;
  }

  .category-filters {
    padding: 12px;
    gap: 8px;
  }

  .category-filter-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .card-preview {
    height: 240px;
  }

  .card-info {
    padding: 12px;
  }

  .card-title {
    font-size: 14px;
  }

  .card-desc {
    font-size: 12px;
  }

  .card-stats {
    font-size: 11px;
  }

  .card-date {
    font-size: 11px;
  }
}

/* ============ 加载状态 ============ */

.waterfall-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  color: var(--tp-text-secondary);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--tp-border);
  border-top-color: var(--tp-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ============ 空状态 ============ */

.waterfall-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--tp-text-secondary);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-hint {
  font-size: 13px;
  opacity: 0.7;
}

/* ============ 深色/浅色模式过渡 ============ */

#temporal-particles-container {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.waterfall-card {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.category-filter-btn {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* ============ 移动端响应式 ============ */

/* 平板端 (768px - 1024px) */
@media (max-width: 1024px) {
  .temporal-particles-main {
    flex-direction: column;
  }

  .temporal-particles-divider {
    display: none;
  }

  .temporal-particles-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--tp-border);
    height: auto;
    padding: 16px;
  }

  .temporal-particles-right {
    width: 100%;
    flex: 1;
  }
}

/* 移动端 (< 768px) */
@media (max-width: 768px) {
  /* 确保容器充满整个宽度 */
  #temporal-particles-container,
  .temporal-particles-layout {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* 防止横向滚动 */
  }

  .temporal-particles-main {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
  }

  /* 头部优化 - 更紧凑 */
  .temporal-particles-header {
    padding: 8px 16px;
  }

  .temporal-particles-logo {
    width: 56px;
    height: auto;
  }

  .temporal-particles-title {
    font-size: 16px;
    margin-bottom: 2px;
  }

  .temporal-particles-subtitle {
    font-size: 11px;
    opacity: 0.7;
  }

  /* 左侧栏改为顶部栏，只显示搜索 */
  .temporal-particles-left {
    padding: 6px 12px;  /* 进一步减小内边距 */
    height: auto;
    min-height: auto;  /* 确保高度自适应 */
    width: 100% !important;
    max-width: 100% !important;
    border-right: none;
    border-bottom: 1px solid var(--tp-border);
    flex-shrink: 0;  /* 防止被压缩 */
  }

  /* 隐藏左侧栏的其他元素（只保留搜索栏） */
  .temporal-particles-sidebar-header,
  .temporal-particles-filters,
  .temporal-particles-sidebar-info,
  .temporal-particles-nav,           /* 隐藏导航菜单（为您推荐、关注特效） */
  .temporal-particles-login {         /* 隐藏登录按钮 */
    display: none !important;
  }

  /* 搜索栏优化 - 更紧凑 */
  .temporal-particles-search {
    margin: 0;
    padding: 0;  /* 移除额外内边距 */
  }

  .temporal-particles-search-input {
    height: 34px; /* 进一步减小高度 */
    font-size: 14px;
    padding: 0 12px 0 34px;  /* 调整左侧padding适应图标 */
    border-radius: 17px; /* 匹配高度的圆角 */
  }

  .temporal-particles-search-icon {
    width: 16px;
    height: 16px;
    left: 10px;  /* 调整图标位置 */
    top: 50%;
    transform: translateY(-50%);  /* 垂直居中 */
  }

  /* 右侧面板 - 强制覆盖所有宽度设置，最大化空间 */
  .temporal-particles-right,
  .masonry-container .temporal-particles-right {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto;  /* 充分利用剩余空间 */
    min-height: 0;  /* 允许内容滚动 */
  }

  /* 确保滚动容器和网格充满宽度 */
  .masonry-scroll-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
  }

  .masonry-grid {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* 分类筛选优化为圆角标签 - 减小高度 */
  .temporal-particles-filters-top {
    padding: 6px 12px;  /* 减小内边距 */
    background-color: var(--tp-bg-primary);
    flex-shrink: 0;  /* 防止被压缩 */
  }

  .temporal-particles-filter-buttons-horizontal {
    gap: 6px;  /* 减小间距 */
    padding-bottom: 0;
    overflow-x: auto;  /* 允许横向滚动 */
    overflow-y: hidden;
    white-space: nowrap;  /* 防止换行 */
    -webkit-overflow-scrolling: touch;  /* iOS 平滑滚动 */
    scrollbar-width: none;  /* 隐藏滚动条 - Firefox */
  }

  .temporal-particles-filter-buttons-horizontal::-webkit-scrollbar {
    display: none;  /* 隐藏滚动条 - Chrome/Safari */
  }

  .temporal-particles-filters-top .temporal-particles-filter-btn {
    padding: 5px 12px;  /* 减小内边距 */
    font-size: 12px;
    font-weight: 400;
    border-radius: 14px; /* 更小的圆角 */
    background-color: var(--tp-bg-secondary);
    border: 1px solid var(--tp-border);
    color: var(--tp-text-primary);
    white-space: nowrap;  /* 防止文字换行 */
    flex-shrink: 0;  /* 防止按钮被压缩 */
  }

  .temporal-particles-filters-top .temporal-particles-filter-btn.active {
    background-color: var(--tp-accent);
    color: #fff;
    font-weight: 600;
    border-color: var(--tp-accent);
  }

  .temporal-particles-filters-top .temporal-particles-filter-btn.active::after {
    display: none;
  }

  /* 触摸反馈 */
  .temporal-particles-filters-top .temporal-particles-filter-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
  }

  /* 卡片优化 - 最大化显示空间 */
  .masonry-column {
    padding: 0 3px; /* 更小的列间距，给卡片更多空间 */
    box-sizing: border-box;
  }

  /* 强制两列布局，每列 50% */
  .masonry-column:nth-child(1) {
    left: 0 !important;
    width: 50% !important;
    padding-left: 6px !important; /* 左侧留小边距 */
    padding-right: 3px !important;
  }

  .masonry-column:nth-child(2) {
    left: 50% !important;
    width: 50% !important;
    padding-left: 3px !important;
    padding-right: 6px !important; /* 右侧留小边距 */
  }

  .masonry-item {
    border-radius: 12px; /* 更圆润的卡片 */
    width: 100%; /* 确保充满列宽 */
    /* 高度和间距由 JS 动态设置 */
  }

  /* 卡片内容优化 */
  .card-info {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100px;
  }

  .card-title {
    font-size: 13px;
    margin-bottom: 0;
    margin-top: 8px;
  }

  .card-emoji {
    font-size: 40px; /* 更大的图标 */
    line-height: 1;
  }

  /* 隐藏卡片的其他信息（移动端只显示图标和标题） */
  .card-desc,
  .card-stats,
  .card-date {
    display: none;
  }

  /* 卡片触摸反馈 */
  .masonry-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* 底部安全区域（适配刘海屏） */
  .masonry-scroll-container {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* 手机端：特效体验页面优化 */
  /* 当进入特效体验页面时，隐藏顶部导航栏和搜索栏，让特效充满屏幕 */
  #temporal-particles-container:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-header,
  #temporal-particles-container:has(.effect-experience-container[style*="display: block"]) .temporal-particles-header {
    display: none !important;
  }

  .temporal-particles-main:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-left,
  .temporal-particles-main:has(.effect-experience-container[style*="display: block"]) .temporal-particles-left {
    display: none !important;
  }

  /* 主内容区占满全高 */
  #temporal-particles-container:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-main,
  #temporal-particles-container:has(.effect-experience-container[style*="display: block"]) .temporal-particles-main {
    height: 100vh !important;
  }

  /* 特效体验页面：右侧面板占满全宽 */
  .temporal-particles-main:has(.effect-experience-container[style*="display: flex"]) .temporal-particles-right,
  .temporal-particles-main:has(.effect-experience-container[style*="display: block"]) .temporal-particles-right {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* 特效体验容器充满整个视口（手机端） */
  .effect-experience-container[style*="display: flex"],
  .effect-experience-container[style*="display: block"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
  }
}

/* ==================== 图库侧边栏样式 ==================== */
.christmas-gallery-sidebar {
  position: fixed;
  right: -420px;
  top: 0;
  width: 420px;
  height: 100vh;
  background: linear-gradient(135deg, rgba(18, 22, 27, 0.98) 0%, rgba(26, 18, 27, 0.98) 100%);
  box-shadow: -4px 0 32px rgba(0, 0, 0, 0.6);
  z-index: 10000;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}

.christmas-gallery-sidebar.open {
  right: 0;
}

/* 图库头部 */
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid rgba(45, 212, 191, 0.2);
  background: rgba(255, 255, 255, 0.03);
}

.gallery-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
}

.gallery-icon {
  font-size: 24px;
}

.gallery-count {
  color: var(--tp-accent);
  font-size: 16px;
}

.gallery-close-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-close-btn:hover {
  background: rgba(255, 59, 48, 0.8);
  transform: rotate(90deg);
}

/* 工具栏 */
.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-actions {
  display: flex;
  gap: 8px;
}

.gallery-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-action-btn:hover:not(:disabled) {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--tp-accent);
}

.gallery-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery-sort-select {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #ffffff;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-sort-select:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* 图库内容区域 */
.gallery-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  align-content: start;
}

.gallery-content::-webkit-scrollbar {
  width: 6px;
}

.gallery-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.gallery-content::-webkit-scrollbar-thumb {
  background: rgba(45, 212, 191, 0.3);
  border-radius: 3px;
}

.gallery-content::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 212, 191, 0.5);
}

/* 空状态 */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #8A92A5;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #ffffff;
}

.empty-hint {
  font-size: 13px;
  opacity: 0.6;
}

/* 图库项目 */
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(45, 212, 191, 0.3);
}

.gallery-item.selected {
  border-color: var(--tp-accent);
}

.gallery-item.on-tree::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(45, 212, 191, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

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

.gallery-item-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border: 2px solid white;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-item.selected .gallery-item-checkbox {
  background: var(--tp-accent);
  border-color: var(--tp-accent);
}

.gallery-item.selected .gallery-item-checkbox::after {
  content: '✓';
  color: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* 图库底部 */
.gallery-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  gap: 12px;
}

.gallery-footer-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gallery-footer-btn-primary {
  background: linear-gradient(135deg, #2dd4bf 0%, #14b8a6 100%);
  color: white;
}

.gallery-footer-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 212, 191, 0.4);
}

.gallery-footer-btn-danger {
  background: rgba(255, 59, 48, 0.1);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

.gallery-footer-btn-danger:hover {
  background: rgba(255, 59, 48, 0.2);
}

/* 照片预览模态框 */
.photo-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview-modal.hidden {
  display: none;
}

.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
}

.preview-container {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.preview-close {
  position: absolute;
  top: -50px;
  right: -50px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 28px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-close:hover {
  background: rgba(255, 59, 48, 0.8);
  transform: rotate(90deg);
}

.preview-prev,
.preview-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-prev {
  left: -70px;
}

.preview-next {
  right: -70px;
}

.preview-prev:hover,
.preview-next:hover {
  background: rgba(45, 212, 191, 0.8);
}

.preview-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.preview-info {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 20px;
  min-width: 400px;
}

.preview-filename {
  color: white;
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 16px;
  text-align: center;
}

.preview-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.preview-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-action-btn:hover {
  background: rgba(45, 212, 191, 0.2);
  border-color: var(--tp-accent);
}

.preview-action-btn-danger {
  border-color: rgba(255, 59, 48, 0.3);
}

.preview-action-btn-danger:hover {
  background: rgba(255, 59, 48, 0.2);
  border-color: #ff3b30;
}

/* 手机端适配 */
@media (max-width: 768px) {
  .christmas-gallery-sidebar {
    width: 100%;
    right: -100%;
  }
  
  .christmas-gallery-sidebar.open {
    right: 0;
  }
  
  .gallery-content {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
  }
  
  .preview-info {
    min-width: 90vw;
  }
  
  .preview-close {
    top: 20px;
    right: 20px;
  }
  
  .preview-prev {
    left: 20px;
  }
  
  .preview-next {
    right: 20px;
  }
}

